/// <summary> /// 确认切换头像 /// </summary> private async void OnConfirmChangeHead() { ETModel.Game.Scene.GetComponent <SoundComponent>().PlayClip(DataCenterComponent.Instance.soundInfo.click); if (ChangeHeadIndex == UserDataHelper.UserInfo.HeadId) { ChangeHeadView.SetActive(false); NormalInfoView.SetActive(true); return; } if (_isRequest) { Game.PopupComponent.ShowTips(DataCenterComponent.Instance.tipInfo.NotRepeatModifyTip); return; } _isRequest = true; try { G2C_ChangerUserInfo_Res chagerHead = (G2C_ChangerUserInfo_Res)await SessionComponent.Instance.Session. Call(new C2G_ChangerUserInfo_Req() { UserId = GamePrefs.GetUserId(), Type = 0, HeadId = ChangeHeadIndex }); if (chagerHead.Error != 0) { Debug.Log(chagerHead.Message); // GameHelper.ShowMessageBox(chagerHead.Message); Game.PopupComponent.ShowMessageBox(chagerHead.Message); _isRequest = false; return; } ChangeHeadView.SetActive(false); NormalInfoView.SetActive(true); _isRequest = false; } catch (Exception e) { Log.Debug("修改头像错误:" + e.Message); Game.PopupComponent.ShowMessageBox(DataCenterComponent.Instance.tipInfo.ModifyHeadIdFailTip); _isRequest = false; } // GameHelper.ShowMessageBox("修改头像成功!"); Game.PopupComponent.ShowMessageBox(DataCenterComponent.Instance.tipInfo.ModifyHeadIdSuccTip); // 刷新显示 await UserDataHelper.GetUserInfo(true); }
/// <summary> /// 打开修改头像页面 /// </summary> private async void OnChangeHead() { ETModel.Game.Scene.GetComponent <SoundComponent>().PlayClip(DataCenterComponent.Instance.soundInfo.click); NormalInfoView.SetActive(false); ChangeHeadView.SetActive(true); // 选择默认的头像 var userInfo = await UserDataHelper.GetUserInfo(); if (ChangeHeadIndex != 0 && ChangeHeadIndex == userInfo.HeadId) { return; } LastSelectHead?.SetActive(false); ChangeHeadIndex = userInfo.HeadId; LastSelectHead = ChangeHeadObjs.GetChild(userInfo.HeadId - 0).GetChild(2).gameObject; LastSelectHead.SetActive(true); //修改 changeHeadIcon.sprite = LastSelectHead.transform.parent.Find("icon").GetComponent <Image>().sprite; }
protected override async void Run(ETModel.Session session, Actor_UpdateUserInfo_Ntt message) { await UserDataHelper.GetUserInfo(true); Log.Debug("后台推送用户信息,在充值或者提现审核后!!"); }
/// <summary> /// 确认修改用户名 /// </summary> private async void OnConfirmChangeName() { ETModel.Game.Scene.GetComponent <SoundComponent>().PlayClip(DataCenterComponent.Instance.soundInfo.click); var changeName = NameInputField.text.Trim(); if (string.IsNullOrEmpty(changeName) || changeName.Equals(PlayerName.text)) { Game.PopupComponent.ShowMessageBox("昵称不可为空"); OnCancelChangeName(); return; } var isMatch = Regex.IsMatch(NameInputField.text, _nameRegexStr); // if (!isMatch) // { // var matchA = Regex.IsMatch(_changeNameInput.text, _nameRegexStrGroupA); // if (matchA) // { // // 找到了汉字和字母数字的混合 // isMatch = Regex.IsMatch(_changeNameInput.text, _nameRegexStrGroupB); // } // } if (!isMatch) { Game.PopupComponent.ShowMessageBox(DataCenterComponent.Instance.tipInfo.NickNameNotMatchTip); return; } if (_isRequest) { Game.PopupComponent.ShowTips(DataCenterComponent.Instance.tipInfo.NotRepeatModifyTip); return; } _isRequest = true; try { Game.PopupComponent.ShowLoadingLockUI(); G2C_ChangerUserInfo_Res chagerHead = (G2C_ChangerUserInfo_Res)await SessionComponent.Instance.Session. Call(new C2G_ChangerUserInfo_Req() { UserId = GamePrefs.GetUserId(), Type = 1, NickName = changeName }); if (chagerHead.Error != 0) { Debug.Log(chagerHead.Message); // GameHelper.ShowMessageBox(chagerHead.Message); Game.PopupComponent.ShowMessageBox(chagerHead.Message); _isRequest = false; Game.PopupComponent.CloseLoadingLockUI(); return; } _isRequest = false; await UserDataHelper.GetUserInfo(true); Game.PopupComponent.ShowMessageBox(DataCenterComponent.Instance.tipInfo.ModifyNickNameSuccTip); PlayerName.gameObject.SetActive(true); _changePlayerName.SetActive(true); _changeNameInput.text = ""; _changeNameInput.gameObject.SetActive(false); _confirmChangeName.SetActive(false); _cancelChangeName.SetActive(false); ChangeNameView.SetActive(false); Game.PopupComponent.CloseLoadingLockUI(); } catch (Exception e) { Log.Debug($"修改昵称错误:{e.Message}"); Game.PopupComponent.ShowMessageBox(DataCenterComponent.Instance.tipInfo.ModifyNickNameFailTip); _isRequest = false; Game.PopupComponent.CloseLoadingLockUI(); } }