/// <summary> /// 初始化服务器 /// </summary> /// <param name="whenCreateWorld">是否为创建新世界时调用</param> public void InitServer(bool whenCreateWorld = false) { // 设置游戏平台 CommonPath.SetGamePlatform(); // 设置游戏平台SelectBox选择 GamePlatformSelectBox.TextIndex = CommonPath.GetGamePlatform(); // 设置SaveSlot面板按钮 SetSaveSlotRadioButton(); // 汉化 _Hanization = JsonHelper.ReadHanization(); // 控制台 CreateConsoleClassificationButton(); #region 仅创建世界时 // [创建世界]设定文件路径 if (whenCreateWorld) { _dediFilePath = new DediFilePath(SaveSlot); } // [创建世界]从modoverrides.lua读取mod设置 if (!string.IsNullOrEmpty(CommonPath.ServerModsDirPath) && whenCreateWorld) { SetModSet(); } #endregion }
/// <summary> /// 设置"路径" /// </summary> private void SetCommonPath() { // 读取游戏平台 CommonPath.SetGamePlatform(); #region 读取客户端路径、服务器路径和ClusterToken // 客户端路径 GameDirSelectTextBox.Text = ""; CommonPath.ClientFilePath = CommonPath.ReadClientPath(CommonPath.GamePlatform); if (!string.IsNullOrEmpty(CommonPath.ClientFilePath) && File.Exists(CommonPath.ClientFilePath)) { GameDirSelectTextBox.Text = CommonPath.ClientFilePath; } else { CommonPath.ClientFilePath = ""; } // 服务器路径 DediDirSelectTextBox.Text = ""; CommonPath.ServerFilePath = CommonPath.ReadServerPath(CommonPath.GamePlatform); if (!string.IsNullOrEmpty(CommonPath.ServerFilePath) && File.Exists(CommonPath.ServerFilePath)) { DediDirSelectTextBox.Text = CommonPath.ServerFilePath; } else { CommonPath.ServerFilePath = ""; } // ClusterToken DediSettingClusterTokenTextBox.Text = ""; CommonPath.ClusterToken = CommonPath.ReadClusterTokenPath(CommonPath.GamePlatform); if (!string.IsNullOrEmpty(CommonPath.ClusterToken)) { DediSettingClusterTokenTextBox.Text = CommonPath.ClusterToken; } else { CommonPath.ClusterToken = ""; } #endregion }