Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
7f280745
E
et
项目概览
guo450212436
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7f280745
编写于
10月 17, 2016
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加服务器命令行配置工具,放在unity tool菜单下面
上级
98d57911
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
260 addition
and
42 deletion
+260
-42
Server/Controller/Server.Controller.csproj
Server/Controller/Server.Controller.csproj
+1
-1
Server/Model/Component/OptionsComponent.cs
Server/Model/Component/OptionsComponent.cs
+0
-38
Server/Model/Server.Model.csproj
Server/Model/Server.Model.csproj
+4
-1
Unity/Assets/Editor/ServerCommandLineEditor.meta
Unity/Assets/Editor/ServerCommandLineEditor.meta
+9
-0
Unity/Assets/Editor/ServerCommandLineEditor/Component.meta
Unity/Assets/Editor/ServerCommandLineEditor/Component.meta
+9
-0
Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs
...s/Editor/ServerCommandLineEditor/Component/CommandLine.cs
+23
-0
Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs.meta
...tor/ServerCommandLineEditor/Component/CommandLine.cs.meta
+12
-0
Unity/Assets/Editor/ServerCommandLineEditor/UI.meta
Unity/Assets/Editor/ServerCommandLineEditor/UI.meta
+9
-0
Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs
...tor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs
+98
-0
Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs.meta
...erverCommandLineEditor/UI/ServerCommandLineEditor.cs.meta
+12
-0
Unity/Assets/Scripts/Other/Options.cs
Unity/Assets/Scripts/Other/Options.cs
+63
-0
Unity/Assets/Scripts/Other/Options.cs.meta
Unity/Assets/Scripts/Other/Options.cs.meta
+12
-0
Unity/Unity.CSharp.Editor.csproj
Unity/Unity.CSharp.Editor.csproj
+7
-2
Unity/Unity.CSharp.csproj
Unity/Unity.CSharp.csproj
+1
-0
未找到文件。
Server/Controller/Server.Controller.csproj
浏览文件 @
7f280745
...
...
@@ -17,7 +17,7 @@
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
..\Bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<DefineConstants>
TRACE;DEBUG;SERVER
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
...
...
Server/Model/Component/OptionsComponent.cs
浏览文件 @
7f280745
using
System
;
using
System.Text
;
using
Base
;
using
CommandLine
;
namespace
Model
{
public
class
Options
{
[
Option
(
"appType"
,
Required
=
true
,
HelpText
=
"AppType: realm gate"
)]
public
string
AppType
{
get
;
set
;
}
[
Option
(
"name"
,
Required
=
true
,
HelpText
=
"Name."
)]
public
string
Name
{
get
;
set
;
}
[
Option
(
"protocol"
,
Required
=
false
,
HelpText
=
"Protocol, tcp or udp."
,
DefaultValue
=
NetworkProtocol
.
UDP
)]
public
NetworkProtocol
Protocol
{
get
;
set
;
}
[
Option
(
"host"
,
Required
=
true
,
HelpText
=
"Host."
)]
public
string
Host
{
get
;
set
;
}
[
Option
(
"port"
,
Required
=
true
,
HelpText
=
"Port."
)]
public
int
Port
{
get
;
set
;
}
[
Option
(
"gateHost"
,
Required
=
false
,
HelpText
=
"GateHost."
)]
public
string
GateHost
{
get
;
set
;
}
[
Option
(
"gatePort"
,
Required
=
false
,
HelpText
=
"GatePort."
)]
public
int
GatePort
{
get
;
set
;
}
[
Option
(
'v'
,
HelpText
=
"Print details during execution."
)]
public
bool
Verbose
{
get
;
set
;
}
[
HelpOption
]
public
string
GetUsage
()
{
// this without using CommandLine.Text
StringBuilder
usage
=
new
StringBuilder
();
usage
.
AppendLine
(
"Quickstart Application 1.0"
);
usage
.
AppendLine
(
"Read user manual for usage instructions..."
);
return
usage
.
ToString
();
}
}
[
ObjectEvent
]
public
class
OptionsComponentEvent
:
ObjectEvent
<
OptionsComponent
>,
IAwake
<
string
[
]>
{
...
...
Server/Model/Server.Model.csproj
浏览文件 @
7f280745
...
...
@@ -17,7 +17,7 @@
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
..\Bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<DefineConstants>
TRACE;DEBUG;SERVER
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
...
...
@@ -71,6 +71,9 @@
<Compile
Include=
"..\..\Unity\Assets\Scripts\Message\OpcodeHelper.cs"
>
<Link>
Message\OpcodeHelper.cs
</Link>
</Compile>
<Compile
Include=
"..\..\Unity\Assets\Scripts\Other\Options.cs"
>
<Link>
Other\Options.cs
</Link>
</Compile>
<Compile
Include=
"Component\OptionsComponent.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
...
...
Unity/Assets/Editor/ServerCommandLineEditor.meta
0 → 100644
浏览文件 @
7f280745
fileFormatVersion: 2
guid: 7b8e880bdba621545827eea82adf63cc
folderAsset: yes
timeCreated: 1476672464
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Editor/ServerCommandLineEditor/Component.meta
0 → 100644
浏览文件 @
7f280745
fileFormatVersion: 2
guid: 24f0b40b39c2f954d9e5e63bbb17f3d6
folderAsset: yes
timeCreated: 1476673759
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs
0 → 100644
浏览文件 @
7f280745
using
System
;
using
System.Collections.Generic
;
using
Base
;
using
Model
;
namespace
MyEditor
{
public
class
CommandLine
:
ICloneable
{
public
string
IP
=
""
;
public
Options
Options
=
new
Options
();
public
object
Clone
()
{
return
MongoHelper
.
FromBson
<
CommandLine
>(
MongoHelper
.
ToBson
(
this
));
}
}
public
class
CommandLines
{
public
List
<
CommandLine
>
Commands
=
new
List
<
CommandLine
>();
}
}
Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs.meta
0 → 100644
浏览文件 @
7f280745
fileFormatVersion: 2
guid: 4f4981289b5c3cc4ca1604a6ba39f3a8
timeCreated: 1476674012
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Editor/ServerCommandLineEditor/UI.meta
0 → 100644
浏览文件 @
7f280745
fileFormatVersion: 2
guid: 04d12359a9fbea443904bae2c7dcf115
folderAsset: yes
timeCreated: 1476673684
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs
0 → 100644
浏览文件 @
7f280745
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.IO
;
using
Base
;
using
UnityEditor
;
using
UnityEngine
;
namespace
MyEditor
{
public
class
ServerCommandLineEditor
:
EditorWindow
{
private
const
string
Path
=
@"..\Server\Bin\Debug\CommandLineConfig.txt"
;
private
CommandLines
commandLines
;
[
MenuItem
(
"Tools/服务端命令行配置"
)]
static
void
ShowWindow
()
{
GetWindow
(
typeof
(
ServerCommandLineEditor
));
}
void
OnEnable
()
{
if
(!
File
.
Exists
(
Path
))
{
this
.
commandLines
=
new
CommandLines
();
return
;
}
string
s
=
File
.
ReadAllText
(
Path
);
this
.
commandLines
=
MongoHelper
.
FromJson
<
CommandLines
>(
s
);
}
void
OnGUI
()
{
for
(
int
i
=
0
;
i
<
this
.
commandLines
.
Commands
.
Count
;
++
i
)
{
CommandLine
commandLine
=
this
.
commandLines
.
Commands
[
i
];
GUILayout
.
BeginHorizontal
();
GUILayout
.
Label
(
$"IP:"
);
commandLine
.
IP
=
EditorGUILayout
.
TextField
(
commandLine
.
IP
);
GUILayout
.
Label
(
$"AppType:"
);
commandLine
.
Options
.
AppType
=
EditorGUILayout
.
TextField
(
commandLine
.
Options
.
AppType
);
GUILayout
.
Label
(
$"Name:"
);
commandLine
.
Options
.
Name
=
EditorGUILayout
.
TextField
(
commandLine
.
Options
.
Name
);
GUILayout
.
Label
(
$"Host:"
);
commandLine
.
Options
.
Host
=
EditorGUILayout
.
TextField
(
commandLine
.
Options
.
Host
);
GUILayout
.
Label
(
$"Port:"
);
commandLine
.
Options
.
Port
=
EditorGUILayout
.
IntField
(
commandLine
.
Options
.
Port
);
if
(
GUILayout
.
Button
(
"删除"
))
{
this
.
commandLines
.
Commands
.
Remove
(
commandLine
);
break
;
}
if
(
GUILayout
.
Button
(
"复制"
))
{
CommandLine
newCommandLine
=
(
CommandLine
)
commandLine
.
Clone
();
this
.
commandLines
.
Commands
.
Add
(
newCommandLine
);
break
;
}
GUILayout
.
EndHorizontal
();
}
if
(
GUILayout
.
Button
(
"添加"
))
{
CommandLine
commandLine
=
new
CommandLine
();
this
.
commandLines
.
Commands
.
Add
(
commandLine
);
}
if
(
GUILayout
.
Button
(
"保存"
))
{
File
.
WriteAllText
(
Path
,
MongoHelper
.
ToJson
(
this
.
commandLines
));
}
if
(
GUILayout
.
Button
(
"启动"
))
{
foreach
(
CommandLine
commandLine
in
this
.
commandLines
.
Commands
)
{
string
arguments
=
$"--appType=
{
commandLine
.
Options
.
AppType
}
--name=
{
commandLine
.
Options
.
Name
}
--Host=
{
commandLine
.
Options
.
Host
}
--Port=
{
commandLine
.
Options
.
Port
}
"
;
ProcessStartInfo
info
=
new
ProcessStartInfo
(
@"App.exe"
,
arguments
)
{
UseShellExecute
=
true
,
WorkingDirectory
=
@"..\Server\Bin\Debug"
};
Process
.
Start
(
info
);
}
}
}
void
OnDisable
()
{
}
void
OnDestroy
()
{
}
}
}
\ No newline at end of file
Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs.meta
0 → 100644
浏览文件 @
7f280745
fileFormatVersion: 2
guid: f87d124589b266d41a4281a2a6ba3f63
timeCreated: 1476673528
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Scripts/Other/Options.cs
0 → 100644
浏览文件 @
7f280745
using
System.Text
;
using
Base
;
#if SERVER
using
CommandLine
;
#endif
namespace
Model
{
public
class
Options
{
#if SERVER
[
Option
(
"appType"
,
Required
=
true
,
HelpText
=
"AppType: realm gate"
)]
#endif
public
string
AppType
{
get
;
set
;
}
#if SERVER
[
Option
(
"name"
,
Required
=
true
,
HelpText
=
"Name."
)]
#endif
public
string
Name
{
get
;
set
;
}
#if SERVER
[
Option
(
"protocol"
,
Required
=
false
,
HelpText
=
"Protocol, tcp or udp."
,
DefaultValue
=
NetworkProtocol
.
UDP
)]
#endif
public
NetworkProtocol
Protocol
{
get
;
set
;
}
#if SERVER
[
Option
(
"host"
,
Required
=
true
,
HelpText
=
"Host."
)]
#endif
public
string
Host
{
get
;
set
;
}
#if SERVER
[
Option
(
"port"
,
Required
=
true
,
HelpText
=
"Port."
)]
#endif
public
int
Port
{
get
;
set
;
}
#if SERVER
[
Option
(
"gateHost"
,
Required
=
false
,
HelpText
=
"GateHost."
)]
#endif
public
string
GateHost
{
get
;
set
;
}
#if SERVER
[
Option
(
"gatePort"
,
Required
=
false
,
HelpText
=
"GatePort."
)]
#endif
public
int
GatePort
{
get
;
set
;
}
#if SERVER
[
Option
(
'v'
,
HelpText
=
"Print details during execution."
)]
#endif
public
bool
Verbose
{
get
;
set
;
}
#if SERVER
[
HelpOption
]
#endif
public
string
GetUsage
()
{
// this without using CommandLine.Text
StringBuilder
usage
=
new
StringBuilder
();
usage
.
AppendLine
(
"Quickstart Application 1.0"
);
usage
.
AppendLine
(
"Read user manual for usage instructions..."
);
return
usage
.
ToString
();
}
}
}
\ No newline at end of file
Unity/Assets/Scripts/Other/Options.cs.meta
0 → 100644
浏览文件 @
7f280745
fileFormatVersion: 2
guid: 7ba4eddc4124ae740bd2d0c3208e5541
timeCreated: 1476674408
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Unity/Unity.CSharp.Editor.csproj
浏览文件 @
7f280745
...
...
@@ -13,11 +13,13 @@
<TargetFrameworkIdentifier>
.NETFramework
</TargetFrameworkIdentifier>
<TargetFrameworkVersion>
v3.5
</TargetFrameworkVersion>
<TargetFrameworkProfile>
Unity Full v3.5
</TargetFrameworkProfile>
<CompilerResponseFile></CompilerResponseFile>
<CompilerResponseFile>
</CompilerResponseFile>
<UnityProjectType>
Editor:5
</UnityProjectType>
<UnityBuildTarget>
StandaloneWindows:5
</UnityBuildTarget>
<UnityVersion>
5.4.2f1
</UnityVersion>
<RootNamespace></RootNamespace>
<RootNamespace>
</RootNamespace>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
...
...
@@ -112,10 +114,13 @@
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Assets\Editor\ReferenceCollectorEditor\ReferenceCollectorEditor.cs"
/>
<Compile
Include=
"Assets\Editor\ServerCommandLineEditor\Component\CommandLine.cs"
/>
<Compile
Include=
"Assets\Editor\ServerCommandLineEditor\UI\ServerCommandLineEditor.cs"
/>
</ItemGroup>
<ItemGroup>
<None
Include=
"Assets\CSharp 6.0 Support\AsyncTools\Plugins\AsyncBridge.Net35.xml"
/>
<None
Include=
"Assets\CSharp 6.0 Support\AsyncTools\Plugins\System.Threading.xml"
/>
</ItemGroup>
<ItemGroup
/>
<Import
Project=
"$(MSBuildExtensionsPath)\SyntaxTree\UnityVS\2015\UnityVS.CSharp.targets"
/>
</Project>
Unity/Unity.CSharp.csproj
浏览文件 @
7f280745
...
...
@@ -103,6 +103,7 @@
<Compile
Include=
"Assets\Scripts\Message\OpcodeHelper.cs"
/>
<Compile
Include=
"Assets\Scripts\Other\EntityType.cs"
/>
<Compile
Include=
"Assets\Scripts\Other\GameException.cs"
/>
<Compile
Include=
"Assets\Scripts\Other\Options.cs"
/>
<Compile
Include=
"Assets\Scripts\Other\UIType.cs"
/>
<Compile
Include=
"Assets\Scripts\ReferenceCollector.cs"
/>
</ItemGroup>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录