private void SelfCheckingProcess(object[] parameters) { switch (checkedEvent) { case CheckedEvent.Eve_Start: { checkedEvent = CheckedEvent.Eve_GameResolution; TimerCall(SelfCheckingProcess, 1, false); } break; case CheckedEvent.Eve_GameResolution: { if (UniGameOptionsDefine.gameResolution != UniGameOptionsFile.GameResolution.Resolution_Default) { UnityEngine.Resolution resolution = UniGameOptionsDefine.gameResolutionUnity; Screen.SetResolution(resolution.width, resolution.height, true); } checkedEvent = CheckedEvent.Eve_IntoGameOk; TimerCall(SelfCheckingProcess, 1, false); } break; case CheckedEvent.Eve_IntoGameOk: { //在这里预载入声音资源 MusicPlayer.LoadAllUnloadAudioClip(); //进入公司LOGO过程 ConsoleCenter.CurrentSceneWorkMode = SceneWorkMode.SCENEWORKMODE_Release; processControl.ActivateProcess(typeof(StandbyProcess)); } break; } }
private void Mouse_LeftClicked(object sender, EventArgs e) { if (shape.GetGlobalBounds().Intersects(Game.Input.Mouse.Position)) { Game.AudioPlayer.PlaySound("GUI_CLICK"); if (boxChecked) { boxChecked = false; UnCheckedEvent?.Invoke(this, null); } else { boxChecked = true; CheckedEvent?.Invoke(this, null); } } }
//初始化函数 public override void Initialization() { //首先在启动过程中先查看是否出现了错误,如果出现了错误需要显示错误信息 //然后就不进行下面的过程了 if (ErrMessageBox.IsShowErrMessageBox) { ErrMessageBox.ShowErrMessage("游戏启动发生错误,停止自检过程!"); return; } //进入游戏待机画面 base.Initialization(); guiModule = GameRoot.gameResource.LoadResource_Prefabs("SelfCheckingWindows.prefab").GetComponent <GuiModule>(); //创建出来自检画面 guiModule.mainGroup.AutoWidth = new GuiVector2(1.0f, 0.0f); guiModule.mainGroup.AutoHeight = new GuiVector2(1.0f, 0.0f); guiModule.mainGroup.BackgroupSeting = new GuiBackgroup(guiModule.skin.box); textdoc = guiModule.RegisterGuiLableTextDoc("", "", 0.1f, 0.1f, guiModule.skin.label, Color.white, int.MaxValue); textdoc.AutoWidth = new GuiVector2(1.0f, 0.0f); textdoc.AutoHeight = new GuiVector2(1.0f, 0.0f); //再次加载游戏配置信息,因为从控制台退出后也是会重新开始这个过程的 UniGameOptionsDefine.LoadGameOptionsDefine(); //显示非致命错误 if (GameRoot.non_fatal_error_list != null) { ShowMessage("发生非致命错误:"); for (int i = 0; i < GameRoot.non_fatal_error_list.Count; i++) { ShowMessage(GameRoot.non_fatal_error_list[i]); } GameRoot.non_fatal_error_list = null; ShowMessage(""); ShowMessage(""); } checkedEvent = CheckedEvent.Eve_Start; SelfCheckingProcess(null); }
remove => RemoveHandler(CheckedEvent, value);
add => AddHandler(CheckedEvent, value);
void SelfCheckingProcess(object[] parameters) { switch (checkedEvent) { case CheckedEvent.Eve_Start: { ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str1")); //开始系统自检... checkedEvent = CheckedEvent.Eve_ProduceActivateInfo; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_ProduceActivateInfo: { ShowMessage(PartingLine); ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str2")); //产品激活成功! ShowMessage(string.Format(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str3"), GameRoot.produceActivateId.activateId, GameRoot.produceActivateId.activateDate)); //产品编码:{0} 激活日期:{1} checkedEvent = CheckedEvent.Eve_ProduceVersion; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_ProduceVersion: { FTLibrary.Produce.ProduceVersionInformation.VersionInfo version = GameRoot.gameResource.produceVersion.mainVersion; ShowMessage(string.Format(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str4"), version.version, version.compiledate, version.issuedate)); //产品版本:{0} 生产日期:{1} 发布日期:{2} checkedEvent = CheckedEvent.Eve_InputDeviceResponse; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_InputDeviceResponse: { ShowMessage(PartingLine); ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str5")); //输入设备自检... checkedEvent = CheckedEvent.Eve_InputDeviceResponseOver; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_InputDeviceResponseOver: { ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str6")); //输入设备自检完成 checkedEvent = CheckedEvent.Eve_InputDeviceOut; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_InputDeviceOut: { ShowMessage(PartingLine); ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str7")); //输出设备自检... checkedEvent = CheckedEvent.Eve_InputDeviceOutOver; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_InputDeviceOutOver: { ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str8")); //输出设备自检完成! checkedEvent = CheckedEvent.Eve_GameResolution; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_GameResolution: { ShowMessage(PartingLine); ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str9")); //调整游戏最佳分辨率 if (UniGameOptionsDefine.gameResolution != UniGameOptionsFile.GameResolution.Resolution_Default) { UnityEngine.Resolution resolution = UniGameOptionsDefine.gameResolutionUnity; Screen.SetResolution(resolution.width, resolution.height, true); } //Resolution now = Screen.currentResolution; //Debug.Log(string.Format("{0},{1},{2}", now.width, now.height, now.refreshRate)); //Resolution[] resolutions = Screen.GetResolution; //for (int i = 0; i < resolutions.Length;i++ ) //{ // Debug.Log(string.Format("{0},{1},{2}", resolutions[i].width, resolutions[i].height, resolutions[i].refreshRate)); //} checkedEvent = CheckedEvent.Eve_GameResolution1; TimerCall(SelfCheckingProcess, 3000, false); } break; case CheckedEvent.Eve_GameResolution1: { Resolution current = Screen.currentResolution; ShowMessage(string.Format(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str9_1"), current.width, current.height, current.refreshRate)); ShowMessage(string.Format(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str9_2"), Screen.width, Screen.height)); checkedEvent = CheckedEvent.Eve_IntoControlPanel; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_IntoControlPanel: { ShowMessage(PartingLine); ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str10")); checkedEvent = CheckedEvent.Eve_IntoGame; TimerCall(SelfCheckingProcess, 10000, false); } break; case CheckedEvent.Eve_IntoGame: { ShowMessage(GameRoot.gameResource.LoadLanguageResource_Text("Check_Str11")); checkedEvent = CheckedEvent.Eve_IntoGameOk; TimerCall(SelfCheckingProcess, EveDelayTime, false); } break; case CheckedEvent.Eve_IntoGameOk: { //在这里预载入声音资源 MusicPlayer.LoadAllUnloadAudioClip(); //进入公司LOGO过程 processControl.ActivateProcess(typeof(CompanyLogoProcess)); } break; } }