当前位置: 首页>>代码示例>>C#>>正文


C# Main.SetWorld方法代码示例

本文整理汇总了C#中Main.SetWorld方法的典型用法代码示例。如果您正苦于以下问题:C# Main.SetWorld方法的具体用法?C# Main.SetWorld怎么用?C# Main.SetWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Main的用法示例。


在下文中一共展示了Main.SetWorld方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadServerParameters

		private static void LoadServerParameters(Main game)
		{
			try
			{
				string s;
				if ((s = LaunchInitializer.TryParameter(new string[]
				{
					"-forcepriority"
				})) != null)
				{
					Process currentProcess = Process.GetCurrentProcess();
					int num;
					if (int.TryParse(s, out num))
					{
						switch (num)
						{
						case 0:
							currentProcess.PriorityClass = ProcessPriorityClass.RealTime;
							break;
						case 1:
							currentProcess.PriorityClass = ProcessPriorityClass.High;
							break;
						case 2:
							currentProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
							break;
						case 3:
							currentProcess.PriorityClass = ProcessPriorityClass.Normal;
							break;
						case 4:
							currentProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
							break;
						case 5:
							currentProcess.PriorityClass = ProcessPriorityClass.Idle;
							break;
						default:
							currentProcess.PriorityClass = ProcessPriorityClass.High;
							break;
						}
					}
					else
					{
						currentProcess.PriorityClass = ProcessPriorityClass.High;
					}
				}
				else
				{
					Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
				}
			}
			catch
			{
			}
			string s2;
			int netPlayers;
			if ((s2 = LaunchInitializer.TryParameter(new string[]
			{
				"-maxplayers",
				"-players"
			})) != null && int.TryParse(s2, out netPlayers))
			{
				game.SetNetPlayers(netPlayers);
			}
			string serverPassword;
			if ((serverPassword = LaunchInitializer.TryParameter(new string[]
			{
				"-pass",
				"-password"
			})) != null)
			{
				Netplay.ServerPassword = serverPassword;
			}
			string s3;
			int lang;
			if ((s3 = LaunchInitializer.TryParameter(new string[]
			{
				"-lang"
			})) != null && int.TryParse(s3, out lang))
			{
				Lang.lang = lang;
			}
			string worldName;
			if ((worldName = LaunchInitializer.TryParameter(new string[]
			{
				"-worldname"
			})) != null)
			{
				game.SetWorldName(worldName);
			}
			string newMOTD;
			if ((newMOTD = LaunchInitializer.TryParameter(new string[]
			{
				"-motd"
			})) != null)
			{
				game.NewMOTD(newMOTD);
			}
			string banFilePath;
			if ((banFilePath = LaunchInitializer.TryParameter(new string[]
			{
				"-banlist"
//.........这里部分代码省略.........
开发者ID:thegamingboffin,项目名称:Ulterraria_Reborn_GitHub,代码行数:101,代码来源:LaunchInitializer.cs


注:本文中的Main.SetWorld方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。