/// <summary> /// 设置基本数据 /// </summary> private void SetBaseData() { m_NameInput.transform.Find("Text Area/Placeholder").GetComponent <TMP_Text>().text = TableUtil.GetLanguageString("login_title_1001"); //帐户名称 m_PassInput.transform.Find("Text Area/Placeholder").GetComponent <TMP_Text>().text = TableUtil.GetLanguageString("login_title_1002"); //输入密码 m_BtnLogin.transform.Find("Label").GetComponent <TMP_Text>().text = TableUtil.GetLanguageString("login_btn_1003"); //登录 m_NameInput.text = PlayerPrefs.GetString(LAST_LOGIN_USER); if (SettingINI.Setting.GetBoolValue(SettingINI.Setting.CombineKey(SettingINI.Constants.GROUP_LOGIN , SettingINI.Constants.KEY_ENABLE_DEFAULT_USERNAME) , false) && SettingINI.Setting.TryGetValue(SettingINI.Setting.CombineKey(SettingINI.Constants.GROUP_LOGIN , SettingINI.Constants.KEY_DEFAULT_USERNAME) , out string defaultUsername)) { m_NameInput.text = defaultUsername; } if (SettingINI.Setting.GetBoolValue(SettingINI.Setting.CombineKey(SettingINI.Constants.GROUP_LOGIN , SettingINI.Constants.KEY_RANDOM_USERNAME) , false)) { m_NameInput.text = Guid.NewGuid().ToString().Substring(4, 16); } EventSystemUtils.SetFocus(m_NameInput); m_NameInput.caretPosition = m_NameInput.text.Length; }
/// <summary> /// 刷新数据 /// </summary> /// <param name="msg"></param> public void OnRefresh() { m_CanvasGroup.interactable = true; if (m_CurrentShip == null) { return; } SendViewerChange(); SetData(); RefreshHotKey(); if (m_BeforeToggle && m_BeforeToggle.gameObject) { OnToggleValueChange(m_BeforeToggle.gameObject); EventSystemUtils.SetFocus(m_BeforeToggle); } else { OnToggleValueChange(m_WeaponCellList[0].gameObject); EventSystemUtils.SetFocus(m_WeaponCellList[0].GetComponent <Toggle>()); } MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>(); msg.State = WarshipPanelState.Main; GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg); }
/// <summary> /// 点击登陆按钮 /// </summary> private void OnClickBtnLogin() { NetworkManager.Instance.GetLoginController().Account = m_NameInput.text; NetworkManager.Instance.GetLoginController().Password = m_PassInput.text; m_LoginProxy.Login(); PlayerPrefs.SetString(LAST_LOGIN_USER, m_NameInput.text); EventSystemUtils.SetFocus(null); m_CanvasGroup.interactable = false; UIManager.Instance.StartCoroutine(Excute(0.5f, () => { m_LoadingObj.SetActive(true); })); }
/// <summary> /// 关闭起名面板 /// </summary> public void CloseNamePanel() { EventSystemUtils.SetFocus(null); m_NamePanelInput.onValueChanged.RemoveListener(NameInputOnChange); m_IsOpenName = false; m_WarningNameText.text = ""; //m_NamePanelInput.text = ""; DeleteHotKey("input_x"); DeleteHotKey("input_esc");//注销起名面板上的enter键和esc键 DeleteHotKey("tab"); m_NameTransform.gameObject.SetActive(false); OnGotFocus(); GameFacade.Instance.SendNotification(NotificationName.MSG_CHARACTER_MODEL_ROTATE, true); //起名声音 WwiseUtil.PlaySound((int)WwiseMusic.Music_Panel_PopupPanel_Close, false, null); }
/// <summary> /// 创角失败提示 /// </summary> /// <param name="values">参数</param> public void OnCharacterCreateFail(params object[] values) { int id = (int)values[0]; string errTex = ""; m_WarningNameText.gameObject.SetActive(true); if ((KCreateRoleRespondCode)id != KCreateRoleRespondCode.eCreateRoleSucceed) { m_NamePanelInput.interactable = true; EventSystemUtils.SetFocus(m_NamePanelInput); SetHotKeyEnabled("tab", true); SetHotKeyEnabled("input_x", true); SetHotKeyEnabled("input_esc", true); } switch ((KCreateRoleRespondCode)id) { case KCreateRoleRespondCode.eCreateRoleSucceed: m_WarningNameText.gameObject.SetActive(false); break; case KCreateRoleRespondCode.eCreateRoleNameAlreadyExist: errTex = TableUtil.GetLanguageString("character_text_1011"); break; case KCreateRoleRespondCode.eCreateRoleInvalidRoleName: errTex = TableUtil.GetLanguageString("character_text_1012"); break; case KCreateRoleRespondCode.eCreateRoleNameTooLong: errTex = TableUtil.GetLanguageString("character_text_1013"); break; case KCreateRoleRespondCode.eCreateRoleNameTooShort: errTex = TableUtil.GetLanguageString("character_text_1014"); break; default: errTex = TableUtil.GetLanguageString("character_text_1015"); break; } m_WarningNameText.text = errTex; }
private void OnSwichTab(HotkeyCallback callback) { if (callback.started) { if (InputManager.Instance.CurrentInputDevice == InputManager.GameInputDevice.KeyboardAndMouse) { m_IndexFocus++; m_IndexFocus %= 2; if (m_IndexFocus == 0) { EventSystemUtils.SetFocus(m_NameInput); m_NameInput.caretPosition = m_NameInput.text.Length; } else if (m_IndexFocus == 1) { EventSystemUtils.SetFocus(m_PassInput); m_PassInput.selectionFocusPosition = m_PassInput.text.Length; } } } }
/// <summary> /// 点击起名文本 /// </summary> /// <param name="go">点击物体</param> /// <param name="args">参数</param> private void NameInputOnClick(HotkeyCallback callbackContext) { if (callbackContext.performed) { m_IsOpenName = true; OnLostFocus(); AddHotKey("tab", HotKeyID.FuncLT, RandomOnClick, m_HotKeyRootName, TableUtil.GetLanguageString("character_hotkey_1004")); AddHotKey("input_x", HotKeyID.FuncX, HotKeyXOnClick, m_HotKeyRootName, TableUtil.GetLanguageString("common_hotkey_id_1001")); AddHotKey("input_esc", HotKeyID.FuncB, BackOnClick, m_HotKeyRootName, TableUtil.GetLanguageString("common_hotkey_id_1002")); m_NameTransform.gameObject.SetActive(true); SetHotKeyEnabled("tab", true); SetHotKeyEnabled("input_x", true); SetHotKeyEnabled("input_esc", true); EventSystemUtils.SetFocus(m_NamePanelInput); m_NamePanelInput.interactable = true; m_NamePanelInput.text = ""; m_NamePanelInput.onValueChanged.AddListener(NameInputOnChange); GameFacade.Instance.SendNotification(NotificationName.MSG_CHARACTER_MODEL_ROTATE, false); //起名声音 WwiseUtil.PlaySound((int)WwiseMusic.Music_Panel_PopupPanel_Open, false, null); } }
public override void HandleNotification(INotification notification) { switch (notification.Name) { case NotificationName.MSG_CHARACTER_ROLLNAME_SUCC: m_NamePanelInput.text = notification.Body as string; EventSystemUtils.SetFocus(m_NamePanelInput); m_NamePanelInput.stringPosition = m_NamePanelInput.text.Length; break; case NotificationName.MSG_CHARACTER_ROLLNAME_FAIL: if (--m_RandomRetryCount > 0) { m_ServerListProxy.RandomName(); } break; case NotificationName.MSG_CHARACTER_CREATE_FAIL: OnCharacterCreateFail(notification.Body); break; } }
/// <summary> /// 服务器列表点击时 /// </summary> private void OnClickBtnServerList() { UIManager.Instance.OpenPanel(UIPanel.ServerListPanel); EventSystemUtils.SetFocus(null); }