private async void GetFriendActInfo() { UINetLoadingComponent.showNetLoading(); G2C_FriendActInfo g2cFrd = (G2C_FriendActInfo)await SessionComponent.Instance.Session.Call(new C2G_FriendActInfo() { UId = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); notGetcount = 0; GetNoGetCount(g2cFrd); if (notGetcount != 0) { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().SetRedTip(3, true, notGetcount); } else { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().SetRedTip(3, false); } ShowText.text = g2cFrd.ConsumCount.ToString() + "/" + count; LeftTxt.text = "次数" + "<Color=#F5E724FF>" + (g2cFrd.GetCount) + "/" + count + "</Color>"; if (g2cFrd.GetCount >= 5) { GetBtn.enabled = false; GetBtn.GetComponent <Image>().color = Color.grey; } else { GetBtn.enabled = true; GetBtn.GetComponent <Image>().color = Color.white; } }
public async Task getAllData() { UINetLoadingComponent.showNetLoading(); try { await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/tips.json", TipsConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/prop.json", PropConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/zhuanpan.json", ZhuanPanConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/notice.json", NoticeConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/friendRoomConfig.json", FriendRoomConfig.getInstance().init); //await SensitiveWordUtil.Req("http://fwdown.hy51v.com/online/file/stopwords.txt"); string data = CommonUtil.getTextFileByBundle("config", "stopwords"); SensitiveWordUtil.WordsDatas = data.Split(','); } catch (Exception ex) { Log.Error(ex); } UINetLoadingComponent.closeNetLoading(); }
private async void GetReward() { UINetLoadingComponent.showNetLoading(); G2C_GetTaskReward g2cGet = (G2C_GetTaskReward)await SessionComponent.Instance.Session.Call(new C2G_GetTaskReward { UId = PlayerInfoComponent.Instance.uid, TaskInfo = info, GetType = 2 }); UINetLoadingComponent.closeNetLoading(); if (g2cGet.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cGet.Message); } else { GameUtil.changeData(1, info.Reward); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain) .GetComponent <UIMainComponent>().refreshUI(); string str = "1:" + info.Reward; ShowRewardUtil.Show(str); string icon = new StringBuilder().Append("chengjiu_") .Append(info.Id).ToString(); Debug.Log("已经领取成就奖励"); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIChengjiu).GetComponent <UIChengjiuComponent>().DeCount(); Complete.SetActive(false); ChengjiuItemBtn.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("uichengjiuicon", icon); } }
private async void GetBagInfoList() { long uid = PlayerInfoComponent.Instance.uid; UINetLoadingComponent.showNetLoading(); G2C_BagOperation g2cBag = (G2C_BagOperation)await SessionComponent.Instance.Session.Call(new C2G_BagOperation() { UId = uid }); UINetLoadingComponent.closeNetLoading(); bagList = g2cBag.ItemList; PlayerInfoComponent.Instance.SetBagInfoList(bagList); if (item != null && item.ItemId == 105 && !IsCurPropUseUp()) { useBg.SetActive(false); } if (g2cBag.ItemList.Count <= 0) { BagBgR.SetActive(false); } else { BagBgR.SetActive(true); } CreateItemList(g2cBag.ItemList); }
private async void RequestRealName() { UINetLoadingComponent.showNetLoading(); G2C_RealName g2cRealName = (G2C_RealName)await SessionComponent.Instance.Session.Call(new C2G_RealName { Uid = PlayerInfoComponent.Instance.uid, Name = InputField_name.text, IDNumber = InputField_idNumber.text }); UINetLoadingComponent.closeNetLoading(); if (g2cRealName.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cRealName.Message); return; } PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName = true; GameUtil.changeData(1, 3000); ShowRewardUtil.Show("1:3000"); ToastScript.createToast("认证成功"); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIPlayerInfo).GetComponent <UIPlayerInfoComponent>().Update(); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIRealName); }
private async void RequestDailySign() { UINetLoadingComponent.showNetLoading(); G2C_DailySign g2cDailySign = (G2C_DailySign)await SessionComponent.Instance.Session.Call(new C2G_DailySign { Uid = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); if (g2cDailySign.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cDailySign.Message); return; } string reward = g2cDailySign.Reward; GameUtil.changeDataWithStr(reward); ShowRewardUtil.Show(reward); PlayerInfoComponent.Instance.GetPlayerInfo().IsSign = true; { Button btn = Item2.transform.Find("Button").GetComponent <Button>(); btn.interactable = false; btn.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "DayDo_tomorrow"); string TomorrowReward = g2cDailySign.TomorrowReward; int prop_id = CommonUtil.splitStr_Start(TomorrowReward, ':'); int prop_num = CommonUtil.splitStr_End(TomorrowReward, ':'); Item2.transform.Find("Text").GetComponent <Text>().text = ("奖励 <color=#FF8604FF>" + prop_num + "</color>金币"); } }
public async void OnBindPhone(string phone, string code) { try { UINetLoadingComponent.showNetLoading(); G2C_BindPhone g2cBindPhone = (G2C_BindPhone)await SessionComponent.Instance.Session.Call(new C2G_BindPhone { Uid = PlayerInfoComponent.Instance.uid, Phone = phone, Code = code }); UINetLoadingComponent.closeNetLoading(); if (g2cBindPhone.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cBindPhone.Message); return; } ToastScript.createToast("绑定手机号成功"); PlayerInfoComponent.Instance.GetPlayerInfo().Phone = phone; if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIPlayerInfo) != null) { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIPlayerInfo).GetComponent <UIPlayerInfoComponent>().Update(); } isSuccess = true; Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIBindPhone); } catch (Exception e) { Log.Error(e); } }
private async void CreateRoom() { FriendRoomInfo info = new FriendRoomInfo(); info.Hua = curHua; info.Ju = curJu; info.IsPublic = curType; info.KeyCount = curKey; UINetLoadingComponent.showNetLoading(); G2C_CreateFriendRoom c2gCreate = (G2C_CreateFriendRoom)await SessionComponent.Instance.Session.Call(new C2G_CreateFriendRoom { FriendRoomInfo = info, UserId = PlayerInfoComponent.Instance.uid }); if (c2gCreate.Error != ErrorCode.ERR_Success) { UICommonPanelComponent panel = UICommonPanelComponent.showCommonPanel("提示", c2gCreate.Message); if (c2gCreate.Error != ErrorCode.ERR_RoomNoExist) { panel.setOnClickOkEvent(OpenShop); } UINetLoadingComponent.closeNetLoading(); return; } await UIJoinRoomComponent.EnterFriendRoom(c2gCreate.RoomId.ToString()); }
private async void RequestDailySignState() { UINetLoadingComponent.showNetLoading(); G2C_DailySignState g2cDailySignState = (G2C_DailySignState)await SessionComponent.Instance.Session.Call(new C2G_DailySignState { Uid = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); bool TodayIsSign = g2cDailySignState.TodayIsSign; if (TodayIsSign) { Button btn = Item2.transform.Find("Button").GetComponent <Button>(); btn.interactable = false; btn.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "DayDo_tomorrow"); string TomorrowReward = g2cDailySignState.TomorrowReward; int prop_id = CommonUtil.splitStr_Start(TomorrowReward, ':'); int prop_num = CommonUtil.splitStr_End(TomorrowReward, ':'); Item2.transform.Find("Text").GetComponent <Text>().text = ("奖励 <color=#FF8604FF>" + prop_num + "</color>金币"); } else { string TodayReward = g2cDailySignState.TodayReward; int prop_id = CommonUtil.splitStr_Start(TodayReward, ':'); int prop_num = CommonUtil.splitStr_End(TodayReward, ':'); Item2.transform.Find("Text").GetComponent <Text>().text = ("奖励 <color=#FF8604FF>" + prop_num + "</color>金币"); } }
private async void GetWeekReward() { UINetLoadingComponent.showNetLoading(); G2C_GetWeekReward g2cWR = (G2C_GetWeekReward)await Game.Scene.GetComponent <SessionComponent>() .Session.Call(new C2G_GetWeekReward { UId = PlayerInfoComponent.Instance.uid, type = curType }); UINetLoadingComponent.closeNetLoading(); if (g2cWR.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cWR.Message); return; } RewardBtn.gameObject.SetActive(false); g2cWeek.IsGetGameRank = g2cWR.IsGetGameRank; g2cWeek.IsGetGoldRank = g2cWR.IsGetGoldRank; string str = ""; if (curType == 1) { str = "2:" + g2cWR.GoldReward; //ToastScript.createToast($"领取成功,获得元宝{g2cWR.GoldReward}"); } else if (curType == 2) { str = "111:" + g2cWR.GameReward; /* ToastScript.createToast($"领取成功,获得话费礼包{g2cWR.GameReward}");*/ } ShowRewardUtil.Show(str); }
private async void RequestUseHuaFei(int huafei, int type) { UINetLoadingComponent.showNetLoading(); G2C_UseHuaFei g2cUseHuaFei = (G2C_UseHuaFei)await SessionComponent.Instance.Session.Call(new C2G_UseHuaFei { Uid = PlayerInfoComponent.Instance.uid, HuaFei = huafei, Phone = PlayerInfoComponent.Instance.GetPlayerInfo().Phone, Type = type }); UINetLoadingComponent.closeNetLoading(); if (g2cUseHuaFei.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cUseHuaFei.Message); return; } GameUtil.changeData(3, -huafei); // 兑换话费 if (type == 1) { ++HuaFei_5_RestCount; ToastScript.createToast((huafei / 100.0f).ToString() + "元话费兑换成功"); } // 兑换元宝 else if (type == 2) { ++YuanBao_RestCount; GameUtil.changeDataWithStr(g2cUseHuaFei.Reward); ShowRewardUtil.Show(g2cUseHuaFei.Reward); } Button_HuaFei.transform.Find("Text").GetComponent <Text>().text = "兑换 " + HuaFei_5_RestCount + "/1"; Button_Key.transform.Find("Text").GetComponent <Text>().text = "兑换 " + YuanBao_RestCount + "/10"; }
private async void GetItem() { List <GetItemInfo> itemList = new List <GetItemInfo>(); for (int i = 0; i < rewardList.Count; ++i) { GetItemInfo itemInfo = new GetItemInfo(); itemInfo.ItemID = rewardList[i].itemId; itemInfo.Count = rewardList[i].rewardNum; itemList.Add(itemInfo); } UINetLoadingComponent.showNetLoading(); G2C_EmailOperate g2cGetItem = (G2C_EmailOperate)await SessionComponent.Instance .Session.Call(new C2G_EmailOperate { Uid = PlayerInfoComponent.Instance.uid, EmailId = (int)email.EId, state = 1 }); UINetLoadingComponent.closeNetLoading(); get.gameObject.SetActive(false); GameUtil.changeDataWithStr(email.RewardItem); ShowRewardUtil.Show(email.RewardItem); flag.SetActive(false); Delete.gameObject.SetActive(true); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIEmail).GetComponent <UIEmailComponent>().RefreshMailUI(); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIEmail).GetComponent <UIEmailComponent>().DeCount(); }
/// <summary> /// 购买物品 /// </summary> private async void BuyItem() { GetItemInfo info = new GetItemInfo(); int shopId = CommonUtil.splitStr_Start(shopInfo.Items.ToString(), ':'); int count = CommonUtil.splitStr_End(shopInfo.Items.ToString(), ':'); UINetLoadingComponent.showNetLoading(); G2C_BuyItem g2cBuyItem = (G2C_BuyItem)await SessionComponent.Instance. Session.Call(new C2G_BuyItem { UId = PlayerInfoComponent.Instance.uid, ShopId = shopInfo.Id }); UINetLoadingComponent.closeNetLoading(); ToastScript.createToast("购买成功"); GameUtil.changeData(shopId, (int)g2cBuyItem.Count); if (g2cBuyItem.ShopType == 2) { PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum = g2cBuyItem.Wealth; } if (g2cBuyItem.ShopType == 1) { PlayerInfoComponent.Instance.GetPlayerInfo().WingNum = g2cBuyItem.Wealth; } Log.Debug("==" + g2cBuyItem.Wealth); Log.Debug("--" + PlayerInfoComponent.Instance.GetPlayerInfo().WingNum); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent> ().refreshUI(); buyTip.SetActive(false); }
private async void OnEnterRoom(int i) { try { UINetLoadingComponent.showNetLoading(); RoomConfig roomConfig = ConfigHelp.Get <RoomConfig>(i); if (PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum < roomConfig.MinThreshold) { ToastScript.createToast("金币不足:" + roomConfig.MinThreshold); UINetLoadingComponent.closeNetLoading(); return; } G2C_EnterRoom enterRoom = (G2C_EnterRoom)await Game.Scene.GetComponent <SessionComponent>().Session.Call(new C2G_EnterRoom() { RoomType = i }); PlayerInfoComponent.Instance.RoomType = i; } catch (Exception e) { Log.Error(e); } }
public static async Task EnterFriendRoom(string curEnterValue) { if (curEnterValue.Length >= 6) { //向服务器发送消息 // ToastScript.createToast(curEnterValue); //如果curRoomId不为0,则是点击私密房间 if (curRoomId != 0) { if (curRoomId != Convert.ToInt64(curEnterValue)) { UICommonPanelComponent.showCommonPanel("提示", "房间号输入错误,请重新输入!"); return; } } UINetLoadingComponent.showNetLoading(); G2C_EnterRoom g2CEnterRoom = (G2C_EnterRoom)await SessionComponent.Instance.Session.Call(new C2G_EnterRoom() { RoomType = 3, RoomId = Convert.ToInt32(curEnterValue) }); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIJoinRoom); UINetLoadingComponent.closeNetLoading(); if (g2CEnterRoom.Error != ErrorCode.ERR_Success) { UICommonPanelComponent.showCommonPanel("提示", g2CEnterRoom.Message); return; } } }
private async void RequestUseLaBa() { UINetLoadingComponent.showNetLoading(); G2C_UseLaBa g2cUseLaBa = (G2C_UseLaBa)await SessionComponent.Instance.Session.Call(new C2G_UseLaBa { Uid = PlayerInfoComponent.Instance.uid, Content = InputField_content.text }); UINetLoadingComponent.closeNetLoading(); if (g2cUseLaBa.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cUseLaBa.Message); return; } ToastScript.createToast("发送成功"); GameUtil.changeData(105, -1); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIUseLaBa); if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIBag) != null) { if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIBag).GetComponent <UIBagComponent>() != null) { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIBag).GetComponent <UIBagComponent>().RefreshUI(); } } }
private async void WeekRankReq() { UINetLoadingComponent.showNetLoading(); g2cWeek = (G2C_WeekRank)await Game.Scene.GetComponent <SessionComponent>() .Session.Call(new C2G_WeekRank { UId = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); }
public async void RequestShare() { ToastScript.createToast("分享成功"); UINetLoadingComponent.showNetLoading(); G2C_Share g2cShare = (G2C_Share)await SessionComponent.Instance.Session.Call(new C2G_Share { Uid = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); RequestGetZhuanPanState(); }
private async void UpdatePlayerInfoData() { UINetLoadingComponent.showNetLoading(); G2C_UpdatePlayerInfo g2c = (G2C_UpdatePlayerInfo)await SessionComponent.Instance.Session .Call(new C2G_UpdatePlayerInfo { Uid = PlayerInfoComponent.Instance.uid, playerInfo = PlayerInfoComponent.Instance.GetPlayerInfo() }); UINetLoadingComponent.closeNetLoading(); }
private async void GetRoomInfoReq() { #region 向服务器请求信息 UINetLoadingComponent.showNetLoading(); G2C_FriendRoomInfo m2cFriend = (G2C_FriendRoomInfo)await SessionComponent.Instance.Session.Call(new C2G_FriendRoomInfo { UId = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); PlayerInfoComponent.Instance.GetPlayerInfo().FriendKeyCount = m2cFriend.KeyCount; CreateUI(m2cFriend); }
private async void RequestUseHuaFeiState() { UINetLoadingComponent.showNetLoading(); G2C_UseHuaFeiState g2cUseHuaFeiState = (G2C_UseHuaFeiState)await SessionComponent.Instance.Session.Call(new C2G_UseHuaFeiState { Uid = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); HuaFei_5_RestCount = g2cUseHuaFeiState.HuaFei_5_Count; YuanBao_RestCount = g2cUseHuaFeiState.YuanBao_Count; Button_HuaFei.transform.Find("Text").GetComponent <Text>().text = "兑换 " + HuaFei_5_RestCount + "/1"; Button_Key.transform.Find("Text").GetComponent <Text>().text = "兑换 " + YuanBao_RestCount + "/10"; }
public async void onClickGetPhoneCode() { if (inputField_Phone.text.CompareTo("") == 0) { ToastScript.createToast("请输入手机号"); return; } if (!VerifyRuleUtil.CheckPhone(inputField_Phone.text)) { ToastScript.createToast("请输入正确的手机号"); return; } btn_yanzhengma.transform.localScale = Vector3.zero; text_yanzhengmadaojishi.transform.localScale = new Vector3(1, 1, 1); UINetLoadingComponent.showNetLoading(); Session sessionWrap = null; try { //IPEndPoint connetEndPoint = NetworkHelper.ToIPEndPoint(GlobalConfigComponent.Instance.GlobalProto.Address); IPEndPoint connetEndPoint = ToIPEndPointWithYuMing(NetConfig.getInstance().getServerPort()); ETModel.Session session = ETModel.Game.Scene.GetComponent <NetOuterComponent>().Create(connetEndPoint); sessionWrap = ComponentFactory.Create <Session, ETModel.Session>(session); R2C_SendSms r2CData = (R2C_SendSms)await sessionWrap.Call(new C2R_SendSms() { Phone = inputField_Phone.text }); UINetLoadingComponent.closeNetLoading(); if (r2CData.Error != ErrorCode.ERR_Success) { ToastScript.createToast(r2CData.Message); } sessionWrap.Dispose(); startPhoneCodeTimer(); } catch (Exception e) { sessionWrap?.Dispose(); Log.Error(e); } }
/// <summary> /// 获得邮件信息 /// </summary> public async void GetEmail() { long uid = PlayerInfoComponent.Instance.uid; UINetLoadingComponent.showNetLoading(); G2C_Email g2cEmail = (G2C_Email)await SessionComponent.Instance.Session.Call(new C2G_Email() { Uid = uid }); UINetLoadingComponent.closeNetLoading(); emailList = g2cEmail.EmailInfoList; Email temp; //临时变量,保存最大值 int i, j; //循环变量 for (i = 0; i < emailList.Count - 1; i++) { for (j = 0; j < emailList.Count - 1 - i; j++) { if (emailList[j].EId > emailList[j + 1].EId) { temp = emailList[j]; emailList[j] = emailList[j + 1]; emailList[j + 1] = temp; } } } if (emailList.Count <= 0) { NoEmailTip.gameObject.SetActive(true); NoEmailTip.text = "暂无邮件!"; } else { NoEmailTip.gameObject.SetActive(false); } CreateEmailItemList(); notGetcount = 0; GetNoGetCount(); if (notGetcount != 0) { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().SetRedTip(5, true, notGetcount); } else { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().SetRedTip(5, false); } }
/// <summary> /// 像服务器请求成就列表 /// </summary> private async void RequestChengjiuList() { UINetLoadingComponent.showNetLoading(); G2C_Chengjiu g2cChengjiu = (G2C_Chengjiu)await SessionComponent.Instance.Session.Call(new C2G_Chengjiu { Uid = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); CreateItems(g2cChengjiu.ChengjiuList); notGetcount = 0; GetNoGetCount(g2cChengjiu.ChengjiuList); CurProgress.text = new StringBuilder().Append("<color=#E8DBAAFF>").Append("已获勋章:").Append("</color>") .Append(GetCompleteChengjiu(g2cChengjiu.ChengjiuList)).Append("/").Append(g2cChengjiu.ChengjiuList.Count).ToString(); }
private async void GetTaskInfoList() { UINetLoadingComponent.showNetLoading(); G2C_Task g2cTask = (G2C_Task)await SessionComponent.Instance.Session.Call(new C2G_Task { uid = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); taskProgressList = g2cTask.TaskProgressList; progressTxt.text = new StringBuilder().Append("<color=#E8DBAAFF>完成数量:</color>") .Append(GetProgress()) .Append("/") .Append(taskProgressList.Count) .ToString(); CreateTaskItem(g2cTask.TaskProgressList); GetNoGetCount(g2cTask.TaskProgressList); }
private async void DeleteMail() { UINetLoadingComponent.showNetLoading(); G2C_EmailOperate g2cGetItem = (G2C_EmailOperate)await SessionComponent.Instance .Session.Call(new C2G_EmailOperate { Uid = PlayerInfoComponent.Instance.uid, EmailId = (int)email.EId, state = 2 }); UINetLoadingComponent.closeNetLoading(); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIEmail).GetComponent <UIEmailComponent>().RefreshMailUI(); ToastScript.createToast("删除邮件成功!"); }
private async void UpdateIcon() { Game.Scene.GetComponent <PlayerInfoComponent>().GetPlayerInfo().Icon = curIcon.sprite.name.ToString(); UINetLoadingComponent.showNetLoading(); G2C_UpdatePlayerInfo g2CPlayerInfo = (G2C_UpdatePlayerInfo)await SessionComponent.Instance.Session.Call(new C2G_UpdatePlayerInfo() { Uid = PlayerInfoComponent.Instance.uid, playerInfo = PlayerInfoComponent.Instance.GetPlayerInfo() }); UINetLoadingComponent.closeNetLoading(); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().refreshUI(); Game.Scene.GetComponent <UIComponent>().Get(UIType.UIPlayerInfo).GetComponent <UIPlayerInfoComponent>().Update(); }
private async void RequestSetPlayerSound(int PlayerSound) { UINetLoadingComponent.showNetLoading(); G2C_SetPlayerSound g2cSetPlayerSound = (G2C_SetPlayerSound)await SessionComponent.Instance.Session.Call(new C2G_SetPlayerSound { Uid = PlayerInfoComponent.Instance.uid, PlayerSound = PlayerSound }); UINetLoadingComponent.closeNetLoading(); if (g2cSetPlayerSound.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cSetPlayerSound.Message); return; } PlayerInfoComponent.Instance.GetPlayerInfo().PlayerSound = PlayerSound; ToastScript.createToast("设置成功"); }
private async void RequestGetZhuanPanState() { UINetLoadingComponent.showNetLoading(); G2C_GetZhuanPanState g2cGetZhuanPanState = (G2C_GetZhuanPanState)await SessionComponent.Instance.Session.Call(new C2G_GetZhuanPanState { Uid = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); if (g2cGetZhuanPanState.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cGetZhuanPanState.Message); return; } ZhuanPanCount = g2cGetZhuanPanState.ZhuanPanCount; LuckyValue = g2cGetZhuanPanState.LuckyValue; xingyunzhi.transform.Find("Text_MyLuckyValue").GetComponent <Text>().text = LuckyValue.ToString(); Button_ChouJiang.transform.Find("Text_restCount").GetComponent <Text>().text = ZhuanPanCount.ToString(); }
private async void RequestUseZhuanPan() { UINetLoadingComponent.showNetLoading(); G2C_UseZhuanPan g2cUseZhuanPan = (G2C_UseZhuanPan)await SessionComponent.Instance.Session.Call(new C2G_UseZhuanPan { Uid = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); if (g2cUseZhuanPan.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cUseZhuanPan.Message); return; } m_canClick = false; m_curReward = g2cUseZhuanPan.reward; GameUtil.changeDataWithStr(g2cUseZhuanPan.reward); { --ZhuanPanCount; ++LuckyValue; if (ZhuanPanCount <= 0) { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().SetRedTip(4, false); } else { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().SetRedTip(4, true, ZhuanPanCount); } if (LuckyValue == 99) { LuckyValue = 0; } xingyunzhi.transform.Find("Text_MyLuckyValue").GetComponent <Text>().text = LuckyValue.ToString(); Button_ChouJiang.transform.Find("Text_restCount").GetComponent <Text>().text = ZhuanPanCount.ToString(); } startXuanZhuan(g2cUseZhuanPan.itemId); }