Przeglądaj źródła

加上默认参数,以后命令行可以少输入几个参数

tanghai 8 lat temu
rodzic
commit
e96aa6c2a4

+ 1 - 1
Server/App/Program.cs

@@ -21,7 +21,7 @@ namespace App
 				Options options = Game.Scene.AddComponent<OptionComponent, string[]>(args).Options;
 				StartConfig startConfig = Game.Scene.AddComponent<StartConfigComponent, string, int>(options.Config, options.AppId).StartConfig;
 
-				if (options.AppType != startConfig.AppType)
+				if (!options.AppType.Is(startConfig.AppType))
 				{
 					Log.Error("命令行参数apptype与配置不一致");
 					return;

+ 0 - 1
Server/App/Properties/launchSettings.json

@@ -2,7 +2,6 @@
   "profiles": {
     "Server.App": {
       "commandName": "Project",
-      "commandLineArgs": "--appId=1 --appType=AllServer --config=../Config/StartConfig/LocalAllServer.txt",
       "workingDirectory": "D:\\Source\\Egametang\\netcoreapp2.0"
     }
   }

+ 3 - 3
Server/Model/Other/Options.cs

@@ -6,14 +6,14 @@ namespace Model
 {
 	public class Options
 	{
-		[Option("appId", Required = true)]
+		[Option("appId", Required = false, Default = 1)]
 		public int AppId { get; set; }
 		
 		// 没啥用,主要是在查看进程信息能区分每个app.exe的类型
-		[Option("appType", Required = true)]
+		[Option("appType", Required = false, Default = AppType.Manager)]
 		public AppType AppType { get; set; }
 
-		[Option("config", Required = false)]
+		[Option("config", Required = false, Default = "../Config/StartConfig/LocalAllServer.txt")]
 		public string Config { get; set; }
 	}
 }

+ 1 - 6
Unity/Unity.sln

@@ -1,8 +1,6 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26730.15
-MinimumVisualStudioVersion = 10.0.40219.1
+# Visual Studio 2017
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity.Plugins.csproj", "{D1FDB199-0FB7-099D-3771-C6A942E4E326}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"
@@ -43,7 +41,4 @@ Global
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {ED6F29BC-3CD2-4A7E-938F-1F85FFE60CB1}
-	EndGlobalSection
 EndGlobal