void Init() { clickPanel = Control("ClickPanel"); LevelTalkRoot = Control("LevelTalk", WndObject).transform; ctrl = LevelTalkRoot.GetComponent <AutoMsgCtrl>(); ctrl.SetConfig(2.0f, 1.5f); Control("BattleInfo").GetComponent <RectTransform>().anchoredPosition = new Vector2(Main.Ins.GameStateMgr.gameStatus.ShowSysMenu2 ? 145 : -20, -175); NodeHelper.Find("SceneName", WndObject).GetComponent <Button>().onClick.AddListener(() => { OpenMiniMap(); }); NodeHelper.Find("SceneName", WndObject).GetComponentInChildren <Text>().text = Main.Ins.CombatData.GLevelItem.Name; NodeHelper.Find("System", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenSystemWnd(); }); timeLabel = NodeHelper.Find("GameTime", WndObject).GetComponent <Text>(); hpBar = Control("HPBar", WndObject).gameObject.GetComponent <Image>(); angryBar = Control("AngryBar", WndObject).gameObject.GetComponent <Image>(); hpLabel = Control("HPLabel", WndObject).gameObject.GetComponent <Text>(); NodeHelper.Find("Status", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnStatusPress); NodeHelper.Find("Status", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnStatusRelease); NodeHelper.Find("SysMenu2", WndObject).SetActive(true); if (Main.Ins.LocalPlayer != null) { angryBar.fillAmount = 0.0f; UpdatePlayerInfo(); } TargetBlood = Control("TargetBlood"); TargetBlood.SetActive(false); TargetHp = Control("HPBar", TargetBlood).GetComponent <Image>(); TargetHPLabel = Control("TargetHPLabel", TargetBlood).GetComponent <Text>(); TargetName = Control("TargetName", TargetBlood).GetComponent <Text>(); UpdateUIButton(); CanvasGroup[] c = WndObject.GetComponentsInChildren <CanvasGroup>(); for (int i = 0; i < c.Length; i++) { c[i].alpha = Main.Ins.GameStateMgr.gameStatus.UIAlpha; } }
void RefreshUI() { GameButton[] buttons = WndObject.GetComponentsInChildren <GameButton>(); for (int i = 1; i < buttons.Length; i++) { if (GameStateMgr.Ins.gameStatus.HasUIAnchor[i - 1]) { buttons[i].GetComponent <RectTransform>().anchoredPosition = GameStateMgr.Ins.gameStatus.UIAnchor[i - 1]; } float scale = GameStateMgr.Ins.gameStatus.UIScale[i - 1]; buttons[i].GetComponent <RectTransform>().localScale = new Vector3(scale, scale, 1); } float joyScale = GameStateMgr.Ins.gameStatus.JoyScale; Control("JoyArrow").GetComponent <RectTransform>().localScale = new Vector3(joyScale, joyScale, 1); Control("JoyArrow").GetComponent <RectTransform>().anchoredPosition = GameStateMgr.Ins.gameStatus.JoyAnchor; //透明度设定 Control("AlphaSliderBar").GetComponent <Slider>().value = GameStateMgr.Ins.gameStatus.UIAlpha; //方向键缩放 Control("JoyScale").GetComponent <Slider>().value = GameStateMgr.Ins.gameStatus.JoyScale; //功能键缩放,需要先选择按键后 Control("ButtonScale").GetComponent <Slider>().value = 1; Control("ButtonScale").GetComponent <Slider>().onValueChanged.AddListener(OnButtonScaleChange); Control("ButtonScale").GetComponent <Slider>().enabled = false; SelectButton = null; SelectIndex = -1; }
int SelectIndex = -1; //选中按钮序号 void Init() { Control("Close").GetComponent <Button>().onClick.AddListener(() => { if (Main.Ins.GameBattleEx != null) { Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.EscDialogState); } else { Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.SettingDialogState); } }); Control("Reset").GetComponent <Button>().onClick.AddListener(() => { OnReset(); }); Control("AlphaSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnUIAlphaChange); Control("JoyScale").GetComponent <Slider>().onValueChanged.AddListener(OnJoyScaleChange); Control("ButtonScale").GetComponent <Slider>().onValueChanged.AddListener(OnButtonScaleChange); Control("ButtonScale").GetComponent <Slider>().enabled = false; //for (int i = 0; i < GameStateMgr.Ins.gameStatus.UIScale.Count; i++) { // Debug.Log(GameStateMgr.Ins.gameStatus.UIScale[i]); //} UIAdjust adjust = Control("LeftJoystick").GetComponent <UIAdjust>(); GameButton[] buttons = WndObject.GetComponentsInChildren <GameButton>(); for (int i = 0; i < buttons.Length; i++) { int k = i; if (i > 0) { original[i - 1] = new MyVector2(buttons[i].GetComponent <RectTransform>().anchoredPosition.x, buttons[i].GetComponent <RectTransform>().anchoredPosition.y); } buttons[i].OnPress.AddListener(() => { adjust.OnChangeTarget(k, buttons[k]); if (k == 0) { //设置方向键时,无需同步 SelectButton = null; SelectIndex = -1; //禁用功能键缩放 Control("ButtonScale").GetComponent <Slider>().enabled = false; } else { SelectButton = buttons[k]; SelectIndex = k; //设置功能键,缩放要同步到缩放滑块上 Control("ButtonScale").GetComponent <Slider>().enabled = true; Control("ButtonScale").GetComponent <Slider>().value = GameStateMgr.Ins.gameStatus.UIScale[k - 1]; } }); buttons[i].OnRelease.AddListener(() => { adjust.OnChangeTarget(-1, null); }); } RefreshUI(); }
void OnUIAlphaChange(float v) { GameStateMgr.Ins.gameStatus.UIAlpha = v; CanvasGroup[] c = WndObject.GetComponentsInChildren <CanvasGroup>(); for (int i = 0; i < c.Length; i++) { c[i].alpha = GameStateMgr.Ins.gameStatus.UIAlpha; } }
void Init() { GameObject chapterTab = Control("ChapterTab", WndObject); GameObject modelTab = Control("ModelTab", WndObject); Control("Return").GetComponent <Button>().onClick.AddListener(() => { Close(); }); Control("PluginPrev").GetComponent <Button>().onClick.AddListener(OnPrevPagePlugin); Control("PluginNext").GetComponent <Button>().onClick.AddListener(OnNextPagePlugin); Control("ResetModel").GetComponent <Button>().onClick.AddListener(() => { GameStateMgr.Ins.gameStatus.UseModel = -1; U3D.PopupTip("已设置使用默认角色"); }); ChapterRoot = Control("Content", chapterTab); ModelRoot = Control("Content", modelTab); //模组分页内的功能设定 Control("DeletePlugin").GetComponent <Button>().onClick.AddListener(() => { U3D.DeletePlugins(filter); int f = filter; Close(); Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.DlcManagerDialogState, f); }); Toggle togShowInstallPlugin = Control("ShowInstallToggle").GetComponent <Toggle>(); togShowInstallPlugin.onValueChanged.AddListener((bool value) => { this.showInstallPlugin = value; DlcMng.Ins.CollectAll(this.showInstallPlugin, filter); this.PluginPageRefreshEx(); }); togShowInstallPlugin.isOn = true; Control("InstallAll").GetComponent <Button>().onClick.AddListener(OnInstallAll); UITab select = null; UITab[] tabs = WndObject.GetComponentsInChildren <UITab>(); for (int i = 0; i < tabs.Length; i++) { tabs[i].onValueChanged.AddListener(OnTabShow); if (filter == i) { select = tabs[i]; } } if (select != null) { if (!select.isOn) { select.Select(); return; } } OnTabShow(true); }
void Init() { Fill = Control("Fill", WndObject).GetComponent <Image>(); ProgressText = Control("ProgressText", WndObject).GetComponent <Text>(); clickPanel = Control("ClickPanel"); LevelTalkRoot = Control("LevelTalk", WndObject).transform; ctrl = LevelTalkRoot.GetComponent <AutoMsgCtrl>(); ctrl.SetConfig(2.0f, 1.5f); Control("FreeCamera", WndObject).GetComponent <Button>().onClick.AddListener(UseFreeCamera); Control("FollowCamera", WndObject).GetComponent <Button>().onClick.AddListener(UseFollowCamera); Control("PrevTarget", WndObject).GetComponent <Button>().onClick.AddListener(OnPrevTarget); Control("NextTarget", WndObject).GetComponent <Button>().onClick.AddListener(OnNextTarget); Control("BattleInfo").GetComponent <RectTransform>().anchoredPosition = new Vector2(145, -175); NodeHelper.Find("SceneName", WndObject).GetComponent <Button>().onClick.AddListener(() => { OpenMiniMap(); }); NodeHelper.Find("SceneName", WndObject).GetComponentInChildren <Text>().text = CombatData.Ins.GLevelItem.Name; NodeHelper.Find("System", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.EscConfirmDialogState); }); timeLabel = NodeHelper.Find("GameTime", WndObject).GetComponent <Text>(); hpBar = Control("HPBar", WndObject).gameObject.GetComponent <Image>(); angryBar = Control("AngryBar", WndObject).gameObject.GetComponent <Image>(); hpLabel = Control("HPLabel", WndObject).gameObject.GetComponent <Text>(); NodeHelper.Find("Status", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnStatusPress); NodeHelper.Find("Status", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnStatusRelease); Control("HideBtn", WndObject).GetComponent <Button>().onClick.AddListener(SysMenu2Hide); Control("Menu2HotArea", WndObject).GetComponent <Button>().onClick.AddListener(ShowSysMenu2); Control("Menu2HotArea", WndObject).SetActive(false); NodeHelper.Find("SysMenu2", WndObject).SetActive(true); if (Main.Ins.LocalPlayer != null) { angryBar.fillAmount = 0.0f; UpdatePlayerInfo(); } TargetBlood = Control("TargetBlood"); TargetBlood.SetActive(false); TargetHp = Control("HPBar", TargetBlood).GetComponent <Image>(); TargetHPLabel = Control("TargetHPLabel", TargetBlood).GetComponent <Text>(); TargetName = Control("TargetName", TargetBlood).GetComponent <Text>(); NodeHelper.Find("MiniMap", gameObject).SetActive(true); CanvasGroup[] c = WndObject.GetComponentsInChildren <CanvasGroup>(); for (int i = 0; i < c.Length; i++) { c[i].alpha = GameStateMgr.Ins.gameStatus.UIAlpha; } }
void Init() { Control("Return").GetComponent <Button>().onClick.AddListener(() => { Main.Ins.GameStateMgr.SaveState(); Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.MainMenuState); }); Control("DeleteState").GetComponent <Button>().onClick.AddListener(() => { Main.Ins.GameStateMgr.ResetState(); Init(); }); Control("ChangeLog").GetComponent <Text>().text = ResMng.LoadTextAsset("ChangeLog").text; Control("AppVerText").GetComponent <Text>().text = Main.Ins.AppInfo.AppVersion(); Control("MeteorVerText").GetComponent <Text>().text = Main.Ins.AppInfo.MeteorVersion; Control("Nick").GetComponentInChildren <Text>().text = Main.Ins.CombatData.Logined ? Main.Ins.GameStateMgr.gameStatus.NickName:"未登录"; Control("Nick").GetComponent <Button>().onClick.AddListener( () => { if (Main.Ins.CombatData.Logined) { Main.Ins.EnterState(Main.Ins.NickNameDialogState); } else { } } ); Toggle highPerfor = Control("HighPerformance").GetComponent <Toggle>(); highPerfor.isOn = Main.Ins.GameStateMgr.gameStatus.TargetFrame == 60; highPerfor.onValueChanged.AddListener(OnChangePerformance); Toggle High = Control("High").GetComponent <Toggle>(); Toggle Medium = Control("Medium").GetComponent <Toggle>(); Toggle Low = Control("Low").GetComponent <Toggle>(); High.isOn = Main.Ins.GameStateMgr.gameStatus.Quality == 0; Medium.isOn = Main.Ins.GameStateMgr.gameStatus.Quality == 1; Low.isOn = Main.Ins.GameStateMgr.gameStatus.Quality == 2; High.onValueChanged.AddListener((bool selected) => { if (selected) { Main.Ins.GameStateMgr.gameStatus.Quality = 0; } }); Medium.onValueChanged.AddListener((bool selected) => { if (selected) { Main.Ins.GameStateMgr.gameStatus.Quality = 1; } }); Low.onValueChanged.AddListener((bool selected) => { if (selected) { Main.Ins.GameStateMgr.gameStatus.Quality = 2; } }); Toggle ShowTargetBlood = Control("ShowTargetBlood").GetComponent <Toggle>(); ShowTargetBlood.isOn = Main.Ins.GameStateMgr.gameStatus.ShowBlood; ShowTargetBlood.onValueChanged.AddListener((bool selected) => { Main.Ins.GameStateMgr.gameStatus.ShowBlood = selected; }); Toggle ShowFPS = Control("ShowFPS").GetComponent <Toggle>(); ShowFPS.isOn = Main.Ins.GameStateMgr.gameStatus.ShowFPS; ShowFPS.onValueChanged.AddListener((bool selected) => { Main.Ins.GameStateMgr.gameStatus.ShowFPS = selected; Main.Ins.ShowFps(selected); }); Toggle ShowSysMenu2 = Control("ShowSysMenu2").GetComponent <Toggle>(); ShowSysMenu2.isOn = Main.Ins.GameStateMgr.gameStatus.ShowSysMenu2; ShowSysMenu2.onValueChanged.AddListener((bool selected) => { Main.Ins.GameStateMgr.gameStatus.ShowSysMenu2 = selected; }); if (Main.Ins != null) { Control("BGMSlider").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.MusicVolume; Control("EffectSlider").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.SoundVolume; Control("HSliderBar").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.AxisSensitivity.x; Control("VSliderBar").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.AxisSensitivity.y; } Control("BGMSlider").GetComponent <Slider>().onValueChanged.AddListener(OnMusicVolumeChange); Control("EffectSlider").GetComponent <Slider>().onValueChanged.AddListener(OnEffectVolumeChange); Control("HSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnXSensitivityChange); Control("VSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnYSensitivityChange); Control("SetJoyPosition").GetComponent <Button>().onClick.AddListener(OnSetUIPosition); //显示战斗界面的调试按钮 Toggle toggleDebug = Control("EnableSFX").GetComponent <Toggle>(); toggleDebug.isOn = Main.Ins.GameStateMgr.gameStatus.EnableDebugSFX; toggleDebug.onValueChanged.AddListener(OnEnableDebugSFX); //显示战斗界面的调试按钮 Toggle toggleRobot = Control("EnableRobot").GetComponent <Toggle>(); toggleRobot.isOn = Main.Ins.GameStateMgr.gameStatus.EnableDebugRobot; toggleRobot.onValueChanged.AddListener(OnEnableDebugRobot); //显示武器挑选按钮 Toggle toggleEnableFunc = Control("EnableWeaponChoose").GetComponent <Toggle>(); toggleEnableFunc.isOn = Main.Ins.GameStateMgr.gameStatus.EnableWeaponChoose; toggleEnableFunc.onValueChanged.AddListener(OnEnableWeaponChoose); //无限气 Toggle toggleEnableInfiniteAngry = Control("EnableInfiniteAngry").GetComponent <Toggle>(); toggleEnableInfiniteAngry.isOn = Main.Ins.GameStateMgr.gameStatus.EnableInfiniteAngry; toggleEnableInfiniteAngry.onValueChanged.AddListener(OnEnableInfiniteAngry); //无锁定 Toggle toggleDisableLock = Control("CameraLock").GetComponent <Toggle>(); toggleDisableLock.isOn = Main.Ins.GameStateMgr.gameStatus.AutoLock; toggleDisableLock.onValueChanged.AddListener(OnDisableLock); Toggle toggleEnableGodMode = Control("EnableGodMode").GetComponent <Toggle>(); toggleEnableGodMode.isOn = Main.Ins.GameStateMgr.gameStatus.EnableGodMode; toggleEnableGodMode.onValueChanged.AddListener(OnEnableGodMode); Toggle toggleEnableUndead = Control("EnableUnDead").GetComponent <Toggle>(); toggleEnableUndead.isOn = Main.Ins.GameStateMgr.gameStatus.Undead; toggleEnableUndead.onValueChanged.AddListener(OnEnableUndead); Toggle toggleShowWayPoint = Control("ShowWayPoint").GetComponent <Toggle>(); toggleShowWayPoint.isOn = Main.Ins.GameStateMgr.gameStatus.ShowWayPoint; #if !STRIP_DBG_SETTING toggleShowWayPoint.onValueChanged.AddListener(OnShowWayPoint); if (Main.Ins.GameStateMgr.gameStatus.ShowWayPoint) { OnShowWayPoint(true); } #else Destroy(toggleShowWayPoint.gameObject); #endif Control("ChangeV107").GetComponent <Button>().onClick.AddListener(() => { OnChangeVer("1.07"); }); Control("ChangeV907").GetComponent <Button>().onClick.AddListener(() => { OnChangeVer("9.07"); }); Control("UnlockAll").GetComponent <Button>().onClick.AddListener(() => { U3D.UnlockLevel(); }); //粒子特效 Toggle toggleDisableParticle = Control("Particle").GetComponent <Toggle>(); toggleDisableParticle.isOn = Main.Ins.GameStateMgr.gameStatus.DisableParticle; toggleDisableParticle.onValueChanged.AddListener(OnDisableParticle); OnDisableParticle(toggleDisableParticle.isOn); //关闭摇杆 Toggle toggleDisableJoyStick = Control("Joystick").GetComponent <Toggle>(); toggleDisableJoyStick.isOn = Main.Ins.GameStateMgr.gameStatus.DisableJoystick; toggleDisableJoyStick.onValueChanged.AddListener(OnDisableJoyStick); OnDisableJoyStick(toggleDisableJoyStick.isOn); Toggle toggleSkipVideo = Control("SkipVideo").GetComponent <Toggle>(); toggleSkipVideo.isOn = Main.Ins.GameStateMgr.gameStatus.SkipVideo; toggleSkipVideo.onValueChanged.AddListener(OnSkipVideo); Toggle toggleOnlyWifi = Control("OnlyWifi").GetComponent <Toggle>(); toggleOnlyWifi.isOn = Main.Ins.GameStateMgr.gameStatus.OnlyWifi; toggleOnlyWifi.onValueChanged.AddListener(OnOnlyWifi); GameObject pluginTab = Control("PluginTab", WndObject); GameObject debugTab = Control("DebugTab", WndObject); Control("PluginPrev").GetComponent <Button>().onClick.AddListener(OnPrevPagePlugin); Control("PluginNext").GetComponent <Button>().onClick.AddListener(OnNextPagePlugin); Control("AnimationDebug").GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); UnityEngine.SceneManagement.SceneManager.LoadScene("DebugScene0"); }); Control("SfxDebug").GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); UnityEngine.SceneManagement.SceneManager.LoadScene("DebugScene1"); }); PluginRoot = Control("Content", pluginTab); DebugRoot = Control("Content", debugTab); //模组分页内的功能设定 Control("DeletePlugin").GetComponent <Button>().onClick.AddListener(() => { U3D.DeletePlugins(); SettingDialogState.Instance.ShowTab(4); }); Toggle togShowInstallPlugin = Control("ShowInstallToggle").GetComponent <Toggle>(); togShowInstallPlugin.onValueChanged.AddListener((bool value) => { this.showInstallPlugin = value; Main.Ins.DlcMng.CollectAll(this.showInstallPlugin); this.PluginPageRefreshEx(); }); togShowInstallPlugin.isOn = true; //透明度设定 Control("AlphaSliderBar").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.UIAlpha; Control("AlphaSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnUIAlphaChange); Control("InstallAll").GetComponent <Button>().onClick.AddListener(OnInstallAll); if (Main.Ins.AppInfo.AppVersionIsSmallThan(Main.Ins.GameNotice.newVersion)) { //需要更新,设置好服务器版本号,设置好下载链接 Control("NewVersionSep", WndObject).SetActive(true); Control("NewVersion", WndObject).GetComponent <Text>().text = string.Format("最新版本号:{0}", Main.Ins.GameNotice.newVersion); Control("NewVersion", WndObject).SetActive(true); Control("GetNewVersion", WndObject).GetComponent <LinkLabel>().URL = Main.Ins.GameNotice.apkUrl; Control("GetNewVersion", WndObject).SetActive(true); Control("Flag", WndObject).SetActive(true); } UITab[] tabs = WndObject.GetComponentsInChildren <UITab>(); for (int i = 0; i < tabs.Length; i++) { tabs[i].onValueChanged.AddListener(OnTabShow); } }
void Init() { Control("Return").GetComponent <Button>().onClick.AddListener(() => { GameStateMgr.Ins.SaveState(); Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.MainMenuState); }); Control("DeleteState").GetComponent <Button>().onClick.AddListener(() => { GameStateMgr.Ins.ResetState(); Init(); }); Control("ChangeLog").GetComponent <Text>().text = Resources.Load <TextAsset>("ChangeLog").text; Control("AuthorText").GetComponent <Text>().text = Resources.Load <TextAsset>("Author").text; Text cheat = Control("CheatCodeList").GetComponent <Text>(); cheat.text = Resources.Load <TextAsset>("CheatCodeList").text; cheat.fontSize = 33; Control("AppVerText").GetComponent <Text>().text = Main.Ins.AppInfo.AppVersion(); Control("MeteorVerText").GetComponent <Text>().text = Main.Ins.AppInfo.MeteorVersion; Control("DoScript").GetComponent <Button>().onClick.AddListener(() => { U3D.DoScript(); }); Control("Nick").GetComponentInChildren <Text>().text = GameStateMgr.Ins.gameStatus.NickName; Control("Nick").GetComponent <Button>().onClick.AddListener( () => { NickNameDialogState.State.Open(); } ); lowPerfor = Control("LowPerformance").GetComponent <Toggle>(); lowPerfor.isOn = GameStateMgr.Ins.gameStatus.TargetFrame == 30; lowPerfor.onValueChanged.AddListener(OnChangePerformance); LowMiddle = Control("LowMiddle").GetComponent <Toggle>(); LowMiddle.isOn = GameStateMgr.Ins.gameStatus.TargetFrame == 60; LowMiddle.onValueChanged.AddListener(OnChangePerformance); highPerfor = Control("HighPerformance").GetComponent <Toggle>(); highPerfor.isOn = GameStateMgr.Ins.gameStatus.TargetFrame == 90; highPerfor.onValueChanged.AddListener(OnChangePerformance); superHighPerfor = Control("SuperHighPerformance").GetComponent <Toggle>(); superHighPerfor.isOn = GameStateMgr.Ins.gameStatus.TargetFrame == 120; superHighPerfor.onValueChanged.AddListener(OnChangePerformance); Toggle High = Control("High").GetComponent <Toggle>(); Toggle Medium = Control("Medium").GetComponent <Toggle>(); Toggle Low = Control("Low").GetComponent <Toggle>(); High.isOn = GameStateMgr.Ins.gameStatus.Quality == 0; Medium.isOn = GameStateMgr.Ins.gameStatus.Quality == 1; Low.isOn = GameStateMgr.Ins.gameStatus.Quality == 2; High.onValueChanged.AddListener((bool selected) => { if (selected) { GameStateMgr.Ins.gameStatus.Quality = 0; } }); Medium.onValueChanged.AddListener((bool selected) => { if (selected) { GameStateMgr.Ins.gameStatus.Quality = 1; } }); Low.onValueChanged.AddListener((bool selected) => { if (selected) { GameStateMgr.Ins.gameStatus.Quality = 2; } }); Toggle ShowTargetBlood = Control("ShowTargetBlood").GetComponent <Toggle>(); ShowTargetBlood.isOn = GameStateMgr.Ins.gameStatus.ShowBlood; ShowTargetBlood.onValueChanged.AddListener((bool selected) => { GameStateMgr.Ins.gameStatus.ShowBlood = selected; }); Toggle ShowFPS = Control("ShowFPS").GetComponent <Toggle>(); ShowFPS.isOn = GameStateMgr.Ins.gameStatus.ShowFPS; ShowFPS.onValueChanged.AddListener((bool selected) => { GameStateMgr.Ins.gameStatus.ShowFPS = selected; Main.Ins.ShowFps(selected); }); if (Main.Ins != null) { Control("BGMSlider").GetComponent <Slider>().value = GameStateMgr.Ins.gameStatus.MusicVolume; Control("EffectSlider").GetComponent <Slider>().value = GameStateMgr.Ins.gameStatus.SoundVolume; } Control("BGMSlider").GetComponent <Slider>().onValueChanged.AddListener(OnMusicVolumeChange); Control("EffectSlider").GetComponent <Slider>().onValueChanged.AddListener(OnEffectVolumeChange); Control("SetJoyPosition").GetComponent <Button>().onClick.AddListener(OnSetUIPosition); Toggle EnableGamePad = Control("EnableGamePad").GetComponent <Toggle>(); EnableGamePad.isOn = GameStateMgr.Ins.gameStatus.UseGamePad; EnableGamePad.onValueChanged.AddListener((bool selected) => { GameStateMgr.Ins.gameStatus.UseGamePad = selected; Main.Ins.JoyStick.enabled = selected; }); Toggle EnableMouse = Control("EnableMouse").GetComponent <Toggle>(); EnableMouse.isOn = GameStateMgr.Ins.gameStatus.UseMouse; EnableMouse.onValueChanged.AddListener((bool selected) => { GameStateMgr.Ins.gameStatus.UseMouse = selected; }); //显示战斗界面的调试按钮 Toggle toggleDebug = Control("EnableSFX").GetComponent <Toggle>(); toggleDebug.isOn = GameStateMgr.Ins.gameStatus.EnableDebugSFX; toggleDebug.onValueChanged.AddListener(OnEnableDebugSFX); //显示战斗界面的调试按钮 Toggle toggleRobot = Control("EnableRobot").GetComponent <Toggle>(); toggleRobot.isOn = GameStateMgr.Ins.gameStatus.EnableDebugRobot; toggleRobot.onValueChanged.AddListener(OnEnableDebugRobot); //显示武器挑选按钮 Toggle toggleEnableFunc = Control("EnableWeaponChoose").GetComponent <Toggle>(); toggleEnableFunc.isOn = GameStateMgr.Ins.gameStatus.EnableWeaponChoose; toggleEnableFunc.onValueChanged.AddListener(OnEnableWeaponChoose); //无限气 Toggle toggleEnableInfiniteAngry = Control("EnableInfiniteAngry").GetComponent <Toggle>(); toggleEnableInfiniteAngry.isOn = GameStateMgr.Ins.gameStatus.EnableInfiniteAngry; toggleEnableInfiniteAngry.onValueChanged.AddListener(OnEnableInfiniteAngry); //无锁定 Toggle toggleDisableLock = Control("CameraLock").GetComponent <Toggle>(); toggleDisableLock.isOn = GameStateMgr.Ins.gameStatus.AutoLock; toggleDisableLock.onValueChanged.AddListener(OnDisableLock); Toggle toggleEnableGodMode = Control("EnableGodMode").GetComponent <Toggle>(); toggleEnableGodMode.isOn = GameStateMgr.Ins.gameStatus.EnableGodMode; toggleEnableGodMode.onValueChanged.AddListener(OnEnableGodMode); Toggle toggleHidePlayer = Control("HidePlayer").GetComponent <Toggle>(); toggleHidePlayer.isOn = GameStateMgr.Ins.gameStatus.HidePlayer; toggleHidePlayer.onValueChanged.AddListener(OnHidePlayer); Toggle toggleEnableUndead = Control("EnableUnDead").GetComponent <Toggle>(); toggleEnableUndead.isOn = GameStateMgr.Ins.gameStatus.Undead; toggleEnableUndead.onValueChanged.AddListener(OnEnableUndead); Toggle toggleShowWayPoint = Control("ShowWayPoint").GetComponent <Toggle>(); toggleShowWayPoint.isOn = GameStateMgr.Ins.gameStatus.ShowWayPoint; toggleShowWayPoint.onValueChanged.AddListener(OnShowWayPoint); Control("ChangeV107").GetComponent <Button>().onClick.AddListener(() => { OnChangeVer("1.07"); }); Control("ChangeV907").GetComponent <Button>().onClick.AddListener(() => { OnChangeVer("9.07"); }); Control("UnlockAll").GetComponent <Button>().onClick.AddListener(() => { U3D.UnlockLevel(); }); //粒子特效 Toggle toggleDisableParticle = Control("Particle").GetComponent <Toggle>(); toggleDisableParticle.isOn = GameStateMgr.Ins.gameStatus.DisableParticle; toggleDisableParticle.onValueChanged.AddListener(OnDisableParticle); OnDisableParticle(toggleDisableParticle.isOn); Toggle toggleJoyEnable = Control("EnableJoy").GetComponent <Toggle>(); toggleJoyEnable.isOn = GameStateMgr.Ins.gameStatus.JoyEnable; toggleJoyEnable.onValueChanged.AddListener(OnJoyEnable); Toggle toggleJoyOnlyRotate = Control("JoyOnlyRotate").GetComponent <Toggle>(); toggleJoyOnlyRotate.isOn = GameStateMgr.Ins.gameStatus.JoyRotateOnly; toggleJoyOnlyRotate.onValueChanged.AddListener(OnJoyRotateOnly); GameObject debugTab = Control("DebugTab", WndObject); Toggle debugToggle = Control("Debug", WndObject).GetComponent <Toggle>(); Toggle cheatToggle = Control("Cheat", WndObject).GetComponent <Toggle>(); DebugRoot = Control("Content", debugTab); if (Main.Ins.AppInfo.AppVersionIsSmallThan(Main.Ins.GameNotice.newVersion)) { //需要更新,设置好服务器版本号,设置好下载链接 Control("NewVersionSep", WndObject).SetActive(true); Control("NewVersion", WndObject).GetComponent <Text>().text = string.Format("最新版本号:{0}", Main.Ins.GameNotice.newVersion); Control("NewVersion", WndObject).SetActive(true); Control("GetNewVersion", WndObject).GetComponent <LinkLabel>().URL = Main.Ins.GameNotice.apkUrl; Control("GetNewVersion", WndObject).SetActive(true); Control("Flag", WndObject).SetActive(true); } UITab[] tabs = WndObject.GetComponentsInChildren <UITab>(); for (int i = 0; i < tabs.Length; i++) { tabs[i].onValueChanged.AddListener(OnTabShow); } //把一些模式禁用,例如作弊之类的. if (GameStateMgr.Ins.gameStatus.CheatEnable) { debugToggle.gameObject.SetActive(true); cheatToggle.gameObject.SetActive(true); } else { Control("EnableRobot").SetActive(false);//屏蔽可添加电脑 Control("EnableWeaponChoose").SetActive(false); Control("ShowWayPoint").SetActive(false); Control("EnableUnDead").SetActive(false); Control("EnableGodMode").SetActive(false); Control("EnableInfiniteAngry").SetActive(false); Control("EnableSFX").SetActive(false); } LoadDebugLevel(); //起始页显示 OnTabShow(true); Button JoyW = Control("JoyW").GetComponent <Button>(); JoyW.onClick.AddListener(() => { FlashButton(JoyW, EKeyList.KL_KeyW, "上:[{0}]"); }); Button JoyS = Control("JoyS").GetComponent <Button>(); JoyS.onClick.AddListener(() => { FlashButton(JoyS, EKeyList.KL_KeyS, "下:[{0}]"); }); Button JoyA = Control("JoyA").GetComponent <Button>(); JoyA.onClick.AddListener(() => { FlashButton(JoyA, EKeyList.KL_KeyA, "左:[{0}]"); }); Button JoyD = Control("JoyD").GetComponent <Button>(); JoyD.onClick.AddListener(() => { FlashButton(JoyD, EKeyList.KL_KeyD, "右:[{0}]"); }); Button JoyCW = Control("JoyCW").GetComponent <Button>(); JoyCW.onClick.AddListener(() => { FlashButton(JoyCW, EKeyList.KL_CameraAxisYU, "视角上:[{0}]"); }); Button JoyCS = Control("JoyCS").GetComponent <Button>(); JoyCS.onClick.AddListener(() => { FlashButton(JoyCS, EKeyList.KL_CameraAxisYD, "视角下:[{0}]"); }); Button JoyCA = Control("JoyCA").GetComponent <Button>(); JoyCA.onClick.AddListener(() => { FlashButton(JoyCA, EKeyList.KL_CameraAxisXL, "视角左:[{0}]"); }); Button JoyCD = Control("JoyCD").GetComponent <Button>(); JoyCD.onClick.AddListener(() => { FlashButton(JoyCD, EKeyList.KL_CameraAxisXR, "视角右:[{0}]"); }); Button JoyAttack = Control("JoyAttack").GetComponent <Button>(); JoyAttack.onClick.AddListener(() => { FlashButton(JoyAttack, EKeyList.KL_Attack, "攻击:[{0}]"); }); Button JoyDefence = Control("JoyDefence").GetComponent <Button>(); JoyDefence.onClick.AddListener(() => { FlashButton(JoyDefence, EKeyList.KL_Defence, "防守:[{0}]"); }); Button JoyJump = Control("JoyJump").GetComponent <Button>(); JoyJump.onClick.AddListener(() => { FlashButton(JoyJump, EKeyList.KL_Jump, "跳跃:[{0}]"); }); Button JoyBurst = Control("JoyBurst").GetComponent <Button>(); JoyBurst.onClick.AddListener(() => { FlashButton(JoyBurst, EKeyList.KL_BreakOut, "爆气:[{0}]"); }); Button JoyChangeWeapon = Control("JoyChangeWeapon").GetComponent <Button>(); JoyChangeWeapon.onClick.AddListener(() => { FlashButton(JoyChangeWeapon, EKeyList.KL_ChangeWeapon, "切换武器:[{0}]"); }); Button JoyDrop = Control("JoyDrop").GetComponent <Button>(); JoyDrop.onClick.AddListener(() => { FlashButton(JoyDrop, EKeyList.KL_DropWeapon, "丢弃武器:[{0}]"); }); Button JoyCrouch = Control("JoyCrouch").GetComponent <Button>(); JoyCrouch.onClick.AddListener(() => { FlashButton(JoyCrouch, EKeyList.KL_Crouch, "蹲下:[{0}]"); }); Button JoyUnlock = Control("JoyUnlock").GetComponent <Button>(); JoyUnlock.onClick.AddListener(() => { FlashButton(JoyUnlock, EKeyList.KL_KeyQ, "锁定:[{0}]"); }); Button JoyHelp = Control("JoyHelp").GetComponent <Button>(); JoyHelp.onClick.AddListener(() => { FlashButton(JoyHelp, EKeyList.KL_Help, "救助:[{0}]"); }); }
void Init() { Prev = Control("Prev"); Next = Control("Next"); Button PrevBtn = Control("PrevPanel").GetComponent <Button>(); Button NextBtn = Control("NextPanel").GetComponent <Button>(); PrevBtn.onClick.AddListener(U3D.WatchPrevRobot); NextBtn.onClick.AddListener(U3D.WatchNextRobot); Position = Control("Position").GetComponent <Text>(); clickPanel = Control("ClickPanel"); LevelTalkRoot = Control("LevelTalk", WndObject).transform; ctrl = LevelTalkRoot.GetComponent <AutoMsgCtrl>(); ctrl.SetConfig(2.0f, 1.5f); //联机不需要剧情对白面板,而使用房间聊天面板单独代替. if (U3D.IsMultiplyPlayer()) { GameObject.Destroy(Control("BattleInfo").gameObject); } else { Control("BattleInfo").GetComponent <RectTransform>().anchoredPosition = new Vector2(145, -175); } NodeHelper.Find("Attack", WndObject).GetComponent <GameButton>().OnPress.AddListener(OnAttackPress); NodeHelper.Find("Attack", WndObject).GetComponent <GameButton>().OnRelease.AddListener(OnAttackRelease); NodeHelper.Find("Defence", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnDefencePress); NodeHelper.Find("Defence", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnDefenceRelease); NodeHelper.Find("Jump", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnJumpPress); NodeHelper.Find("Jump", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnJumpRelease); NodeHelper.Find("ChangeWeapon", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnChangeWeaponPress); NodeHelper.Find("ChangeWeapon", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnChangeWeaponRelease); NodeHelper.Find("BreakOut", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnBreakOut); NodeHelper.Find("WeaponSelect", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenWeaponWnd(); }); NodeHelper.Find("SceneName", WndObject).GetComponent <Button>().onClick.AddListener(() => { OpenMiniMap(); }); NodeHelper.Find("SceneName", WndObject).GetComponentInChildren <Text>().text = CombatData.Ins.GLevelItem.Name; NodeHelper.Find("System", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenSystemWnd(); }); NodeHelper.Find("Crouch", WndObject).GetComponent <GameButton>().OnPress.AddListener(OnCrouchPress); NodeHelper.Find("Crouch", WndObject).GetComponent <GameButton>().OnRelease.AddListener(OnCrouchRelease); NodeHelper.Find("Drop", WndObject).GetComponent <Button>().onClick.AddListener(OnClickDrop); Unlock = NodeHelper.Find("Unlock", WndObject); Unlock.GetComponentInChildren <Button>().onClick.AddListener(OnClickChangeLock); LockSprite = NodeHelper.Find("LockSprite", Unlock).GetComponent <Image>(); NodeHelper.Find("SfxMenu", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenSfxWnd(); }); NodeHelper.Find("Robot", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenRobotWnd(); }); timeLabel = NodeHelper.Find("GameTime", WndObject).GetComponent <Text>(); hpBar = Control("HPBar", WndObject).gameObject.GetComponent <Image>(); angryBar = Control("AngryBar", WndObject).gameObject.GetComponent <Image>(); hpLabel = Control("HPLabel", WndObject).gameObject.GetComponent <Text>(); NodeHelper.Find("Status", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnStatusPress); NodeHelper.Find("Status", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnStatusRelease); NodeHelper.Find("Chat", WndObject).GetComponentInChildren <Button>().onClick.AddListener(OnChatClick); Control("SkillHotArea").GetComponent <Button>().onClick.AddListener(ShowSkillBar); NodeHelper.Find("Reborn", WndObject).GetComponentInChildren <Button>().onClick.AddListener(OnRebornClick); NodeHelper.Find("SysMenu2", WndObject).SetActive(true); //单机-金华城-只有这一关能复活冷燕 if (CombatData.Ins.GLevelMode == LevelMode.SinglePlayerTask && CombatData.Ins.GLevelItem.Id == 4) { NodeHelper.Find("Reborn", WndObject).SetActive(true); } else { //创建关卡,非暗杀,都不允许复活 if (CombatData.Ins.GGameMode != GameMode.ANSHA) { NodeHelper.Find("Reborn", WndObject).SetActive(false); } } //联机屏蔽按键-多人游戏 if (U3D.IsMultiplyPlayer()) { //联机还无法复活队友. NodeHelper.Find("Reborn", WndObject).SetActive(false); } else { //非联机屏蔽按键-单人游戏 NodeHelper.Find("Chat", WndObject).SetActive(false); } if (Main.Ins.LocalPlayer != null) { angryBar.fillAmount = 0.0f; UpdatePlayerInfo(); } TargetBlood = Control("TargetBlood"); TargetBlood.SetActive(false); TargetHp = Control("HPBar", TargetBlood).GetComponent <Image>(); TargetHPLabel = Control("TargetHPLabel", TargetBlood).GetComponent <Text>(); TargetName = Control("TargetName", TargetBlood).GetComponent <Text>(); UpdateUIButton(); CanvasGroup[] c = WndObject.GetComponentsInChildren <CanvasGroup>(); for (int i = 0; i < c.Length; i++) { c[i].alpha = GameStateMgr.Ins.gameStatus.UIAlpha; } //使用手柄时,不再显示右下侧按键和方向盘. if (GameStateMgr.Ins.gameStatus.UseGamePad) { Control("ClickPanel").SetActive(false); Control("JoyArrow").SetActive(false); } OnBattleStart(); Menu2HotArea = Control("Menu2HotArea", WndObject); Menu2HotArea.GetComponent <Button>().onClick.AddListener(ShowSysMenu2); Menu2HotArea.SetActive(false); Control("HideBtn", WndObject).GetComponent <Button>().onClick.AddListener(SysMenu2Hide); }
void Init() { clickPanel = Control("ClickPanel"); LevelTalkRoot = Control("LevelTalk", WndObject).transform; ctrl = LevelTalkRoot.GetComponent <AutoMsgCtrl>(); ctrl.SetConfig(2.0f, 1.5f); //联机不需要剧情对白面板,而使用房间聊天面板单独代替. if (Main.Ins.CombatData.GLevelMode == LevelMode.MultiplyPlayer) { GameObject.Destroy(Control("BattleInfo").gameObject); } else { Control("BattleInfo").GetComponent <RectTransform>().anchoredPosition = new Vector2(Main.Ins.GameStateMgr.gameStatus.ShowSysMenu2 ? 145 : -20, -175); } NodeHelper.Find("Attack", WndObject).GetComponent <GameButton>().OnPress.AddListener(OnAttackPress); NodeHelper.Find("Attack", WndObject).GetComponent <GameButton>().OnRelease.AddListener(OnAttackRelease); NodeHelper.Find("Defence", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnDefencePress); NodeHelper.Find("Defence", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnDefenceRelease); NodeHelper.Find("Jump", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnJumpPress); NodeHelper.Find("Jump", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnJumpRelease); NodeHelper.Find("ChangeWeapon", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnChangeWeaponPress); NodeHelper.Find("ChangeWeapon", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnChangeWeaponRelease); NodeHelper.Find("BreakOut", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnBreakOut); NodeHelper.Find("WeaponSelect", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenWeaponWnd(); }); NodeHelper.Find("SceneName", WndObject).GetComponent <Button>().onClick.AddListener(() => { OpenMiniMap(); }); NodeHelper.Find("SceneName", WndObject).GetComponentInChildren <Text>().text = Main.Ins.CombatData.GLevelItem.Name; NodeHelper.Find("System", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenSystemWnd(); }); NodeHelper.Find("Crouch", WndObject).GetComponent <GameButton>().OnPress.AddListener(OnCrouchPress); NodeHelper.Find("Crouch", WndObject).GetComponent <GameButton>().OnRelease.AddListener(OnCrouchRelease); NodeHelper.Find("Drop", WndObject).GetComponent <Button>().onClick.AddListener(OnClickDrop); Unlock = NodeHelper.Find("Unlock", WndObject); Unlock.GetComponentInChildren <Button>().onClick.AddListener(OnClickChangeLock); LockSprite = NodeHelper.Find("LockSprite", Unlock).GetComponent <Image>(); NodeHelper.Find("SfxMenu", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenSfxWnd(); }); NodeHelper.Find("Robot", WndObject).GetComponentInChildren <Button>().onClick.AddListener(() => { U3D.OpenRobotWnd(); }); timeLabel = NodeHelper.Find("GameTime", WndObject).GetComponent <Text>(); hpBar = Control("HPBar", WndObject).gameObject.GetComponent <Image>(); angryBar = Control("AngryBar", WndObject).gameObject.GetComponent <Image>(); hpLabel = Control("HPLabel", WndObject).gameObject.GetComponent <Text>(); NodeHelper.Find("Status", WndObject).GetComponentInChildren <GameButton>().OnPress.AddListener(OnStatusPress); NodeHelper.Find("Status", WndObject).GetComponentInChildren <GameButton>().OnRelease.AddListener(OnStatusRelease); NodeHelper.Find("Chat", WndObject).GetComponentInChildren <Button>().onClick.AddListener(OnChatClick); NodeHelper.Find("SysMenu2", WndObject).SetActive( (Main.Ins.CombatData.GLevelMode == LevelMode.CreateWorld && Main.Ins.GameStateMgr.gameStatus.ShowSysMenu2) || (Main.Ins.CombatData.GLevelMode == LevelMode.SinglePlayerTask && Main.Ins.GameStateMgr.gameStatus.ShowSysMenu2) || (Main.Ins.CombatData.GLevelMode == LevelMode.MultiplyPlayer)); NodeHelper.Find("Reborn", WndObject).GetComponentInChildren <Button>().onClick.AddListener(OnRebornClick); //单机-金华城 if (Main.Ins.CombatData.GLevelMode == LevelMode.SinglePlayerTask && Main.Ins.CombatData.GLevelItem.ID == 4) { NodeHelper.Find("Reborn", WndObject).SetActive(true); } else { //创建关卡,非暗杀,都不允许复活 if (Main.Ins.CombatData.GGameMode != GameMode.ANSHA) { NodeHelper.Find("Reborn", WndObject).SetActive(false); } } //联机屏蔽按键-多人游戏 if (Main.Ins.CombatData.GLevelMode == LevelMode.MultiplyPlayer) { //联机还无法复活队友. NodeHelper.Find("Reborn", WndObject).SetActive(false); } else { //非联机屏蔽按键-单人游戏 NodeHelper.Find("Chat", WndObject).SetActive(false); } #if !STRIP_DBG_SETTING NodeHelper.Find("DBG", WndObject).GetComponent <Button>().onClick.AddListener(OnDebugCanvas); #else NodeHelper.Find("DBG", WndObject).SetActive(false); #endif if (Main.Ins.LocalPlayer != null) { angryBar.fillAmount = 0.0f; UpdatePlayerInfo(); } TargetBlood = Control("TargetBlood"); TargetBlood.SetActive(false); TargetHp = Control("HPBar", TargetBlood).GetComponent <Image>(); TargetHPLabel = Control("TargetHPLabel", TargetBlood).GetComponent <Text>(); TargetName = Control("TargetName", TargetBlood).GetComponent <Text>(); UpdateUIButton(); CanvasGroup[] c = WndObject.GetComponentsInChildren <CanvasGroup>(); for (int i = 0; i < c.Length; i++) { c[i].alpha = Main.Ins.GameStateMgr.gameStatus.UIAlpha; } #if (UNITY_EDITOR || UNITY_STANDALONE_WIN) && !STRIP_KEYBOARD Control("ClickPanel").SetActive(false); Control("JoyArrow").SetActive(false); #endif }