diff --git a/Server/Controller/Server.Controller.csproj b/Server/Controller/Server.Controller.csproj
index 80eb47dbf31e917f36f1f4ebc79c6f681a2aa475..43dca12dbcb38559972c0b32f9838047472519f7 100644
--- a/Server/Controller/Server.Controller.csproj
+++ b/Server/Controller/Server.Controller.csproj
@@ -17,7 +17,7 @@
full
false
..\Bin\Debug\
- DEBUG;TRACE
+ TRACE;DEBUG;SERVER
prompt
4
diff --git a/Server/Model/Component/OptionsComponent.cs b/Server/Model/Component/OptionsComponent.cs
index 54f3ba1a046a141ed356f5d209f6562bd6322b32..f6b473f6cb3cf5668f79a3654c41decf942b6e77 100644
--- a/Server/Model/Component/OptionsComponent.cs
+++ b/Server/Model/Component/OptionsComponent.cs
@@ -1,47 +1,9 @@
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, IAwake
{
diff --git a/Server/Model/Server.Model.csproj b/Server/Model/Server.Model.csproj
index e2ede9980de8cfba41871e3e59ad13212dcadedf..5cbe633997d018ed24e8a9f37e0b57e4203f1f17 100644
--- a/Server/Model/Server.Model.csproj
+++ b/Server/Model/Server.Model.csproj
@@ -17,7 +17,7 @@
full
false
..\Bin\Debug\
- DEBUG;TRACE
+ TRACE;DEBUG;SERVER
prompt
4
@@ -71,6 +71,9 @@
Message\OpcodeHelper.cs
+
+ Other\Options.cs
+
diff --git a/Unity/Assets/Editor/ServerCommandLineEditor.meta b/Unity/Assets/Editor/ServerCommandLineEditor.meta
new file mode 100644
index 0000000000000000000000000000000000000000..8b811764f2558872e079962844feb76dc886f50b
--- /dev/null
+++ b/Unity/Assets/Editor/ServerCommandLineEditor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7b8e880bdba621545827eea82adf63cc
+folderAsset: yes
+timeCreated: 1476672464
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity/Assets/Editor/ServerCommandLineEditor/Component.meta b/Unity/Assets/Editor/ServerCommandLineEditor/Component.meta
new file mode 100644
index 0000000000000000000000000000000000000000..b83ff012e21f84ade42f331332286e5b984f9487
--- /dev/null
+++ b/Unity/Assets/Editor/ServerCommandLineEditor/Component.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 24f0b40b39c2f954d9e5e63bbb17f3d6
+folderAsset: yes
+timeCreated: 1476673759
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs b/Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs
new file mode 100644
index 0000000000000000000000000000000000000000..8f6d5a4f12607a304c6a7370bf3554f032bd7c22
--- /dev/null
+++ b/Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs
@@ -0,0 +1,23 @@
+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(MongoHelper.ToBson(this));
+ }
+ }
+
+ public class CommandLines
+ {
+ public List Commands = new List();
+ }
+}
diff --git a/Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs.meta b/Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs.meta
new file mode 100644
index 0000000000000000000000000000000000000000..c2188700b09c306697e080dcf973283b740b8095
--- /dev/null
+++ b/Unity/Assets/Editor/ServerCommandLineEditor/Component/CommandLine.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4f4981289b5c3cc4ca1604a6ba39f3a8
+timeCreated: 1476674012
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity/Assets/Editor/ServerCommandLineEditor/UI.meta b/Unity/Assets/Editor/ServerCommandLineEditor/UI.meta
new file mode 100644
index 0000000000000000000000000000000000000000..eae94b7729b15697fad7c9c6b871e6e2e6a1526b
--- /dev/null
+++ b/Unity/Assets/Editor/ServerCommandLineEditor/UI.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 04d12359a9fbea443904bae2c7dcf115
+folderAsset: yes
+timeCreated: 1476673684
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs b/Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs
new file mode 100644
index 0000000000000000000000000000000000000000..16b1e14afce9ef731c44b1144d11f9ada041b752
--- /dev/null
+++ b/Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs
@@ -0,0 +1,98 @@
+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(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
diff --git a/Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs.meta b/Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs.meta
new file mode 100644
index 0000000000000000000000000000000000000000..20a33185152be8e729ab1bc35c8f8581cf5bd046
--- /dev/null
+++ b/Unity/Assets/Editor/ServerCommandLineEditor/UI/ServerCommandLineEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f87d124589b266d41a4281a2a6ba3f63
+timeCreated: 1476673528
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity/Assets/Scripts/Other/Options.cs b/Unity/Assets/Scripts/Other/Options.cs
new file mode 100644
index 0000000000000000000000000000000000000000..2a568c43e06a472f566fb594055fa1855829733c
--- /dev/null
+++ b/Unity/Assets/Scripts/Other/Options.cs
@@ -0,0 +1,63 @@
+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
diff --git a/Unity/Assets/Scripts/Other/Options.cs.meta b/Unity/Assets/Scripts/Other/Options.cs.meta
new file mode 100644
index 0000000000000000000000000000000000000000..c4f703a6a6e2fffbb10029f0f3868d030af32452
--- /dev/null
+++ b/Unity/Assets/Scripts/Other/Options.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7ba4eddc4124ae740bd2d0c3208e5541
+timeCreated: 1476674408
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity/Unity.CSharp.Editor.csproj b/Unity/Unity.CSharp.Editor.csproj
index f7c105fd9dd67748fdeed1a33c208078770a930c..a51e3b49b9e8bb96b4f600929ec7ecf87d070ff3 100644
--- a/Unity/Unity.CSharp.Editor.csproj
+++ b/Unity/Unity.CSharp.Editor.csproj
@@ -13,11 +13,13 @@
.NETFramework
v3.5
Unity Full v3.5
-
+
+
Editor:5
StandaloneWindows:5
5.4.2f1
-
+
+
pdbonly
@@ -112,10 +114,13 @@
+
+
+
diff --git a/Unity/Unity.CSharp.csproj b/Unity/Unity.CSharp.csproj
index 8d50beb0fd932d6428dab0e8b967abb63cc8c1dd..7a5c6a5a56351e3aa607329472c7c6ef0f468b61 100644
--- a/Unity/Unity.CSharp.csproj
+++ b/Unity/Unity.CSharp.csproj
@@ -103,6 +103,7 @@
+