private void Init() { if (GameUtil.isVIP()) { VipTimeTxt.text = $"过期时间:{CommonUtil.splitStr_Start_str(PlayerInfoComponent.Instance.GetPlayerInfo().VipTime, ' ')}"; } else { VipTimeTxt.text = ""; } if (OtherData.getIsShiedBindPhone()) { bindPhoneBtn.transform.localScale = Vector3.zero; } if (OtherData.getIsShiedRealName()) { realNameBtn.transform.localScale = Vector3.zero; } bindPhoneBtn.gameObject.SetActive(string.IsNullOrEmpty(PlayerInfoComponent.Instance.GetPlayerInfo().Phone) && !OtherData.getIsShiedBindPhone()); bindPhoneBtn.transform.parent.gameObject.SetActive(string.IsNullOrEmpty(PlayerInfoComponent.Instance.GetPlayerInfo().Phone) && !OtherData.getIsShiedBindPhone()); changeNameBtn.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0); changeNameBtn.transform.parent.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0); realNameBtn.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName()); realNameBtn.transform.parent.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName()); realNameTxt.gameObject.SetActive(!OtherData.getIsShiedRealName()); noBindPhoneTxt.gameObject.SetActive(!OtherData.getIsShiedBindPhone()); GoldNumTxt.text = PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum.ToString(); WingNumTxt.text = PlayerInfoComponent.Instance.GetPlayerInfo().WingNum.ToString(); HuafeiNumTxt.text = (PlayerInfoComponent.Instance.GetPlayerInfo().HuaFeiNum / 100.0f).ToString(); if (GameUtil.isVIP()) { PlayerFrame.transform.Find("HeadKuang").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "touxiangkuang_vip"); } }
public void Update() { HeadManager.setHeadSprite(playerIcon.GetComponent <Image>(), PlayerInfoComponent.Instance.GetPlayerInfo().Icon); nameTxt.text = PlayerInfoComponent.Instance.GetPlayerInfo().Name; if (PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount <= 0) { changeNameBtn.gameObject.SetActive(false); changeNameBtn.transform.parent.gameObject.SetActive(false); } if (GameUtil.isVIP()) { VipTimeTxt.text = $"过期时间:{CommonUtil.splitStr_Start_str(PlayerInfoComponent.Instance.GetPlayerInfo().VipTime, ' ')}"; } else { VipTimeTxt.text = ""; } changeNameBtn.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0); changeNameBtn.transform.parent.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0); realNameBtn.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName()); realNameBtn.transform.parent.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName()); realNameTxt.gameObject.SetActive(!OtherData.getIsShiedRealName()); noBindPhoneTxt.gameObject.SetActive(!OtherData.getIsShiedBindPhone()); if (PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName) { realNameTxt.text = "已实名"; realNameBtn.gameObject.SetActive(false); realNameBtn.transform.parent.gameObject.SetActive(false); } if (!string.IsNullOrEmpty(PlayerInfoComponent.Instance.GetPlayerInfo().Phone)) { noBindPhoneTxt.text = "已绑定"; bindPhoneBtn.gameObject.SetActive(false); bindPhoneBtn.transform.parent.gameObject.SetActive(false); } GoldNumTxt.text = PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum.ToString(); }
public async void Start() { ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); playerNameTxt = rc.Get <GameObject>("PlayerNameTxt").GetComponent <Text>(); goldNumTxt = rc.Get <GameObject>("GoldNumTxt").GetComponent <Text>(); wingNumTxt = rc.Get <GameObject>("WingNumTxt").GetComponent <Text>(); HuaFeiNumTxt = rc.Get <GameObject>("HuaFeiNumTxt").GetComponent <Text>(); playerIcon = rc.Get <GameObject>("PlayerIcon").GetComponent <Image>(); LaBa = rc.Get <GameObject>("LaBa"); PlayerInfoBg = rc.Get <GameObject>("PlayerInfoBg"); BtnList_Down = rc.Get <GameObject>("BtnList_Down"); BtnList_Up = rc.Get <GameObject>("BtnList_Up"); Rank = rc.Get <GameObject>("Rank"); ChoiceRoomType = rc.Get <GameObject>("ChoiceRoomType"); Relax = rc.Get <GameObject>("Relax"); Btn_GoldSelect = rc.Get <GameObject>("Btn_GoldSelect"); Btn_GameSelect = rc.Get <GameObject>("Btn_GameSelect"); Grid = rc.Get <GameObject>("Grid"); WealthGrid = rc.Get <GameObject>("WealthGrid"); GoldTxt = rc.Get <GameObject>("GoldTxt").GetComponent <Text>(); NameTxt = rc.Get <GameObject>("NameTxt").GetComponent <Text>(); RankTxt = rc.Get <GameObject>("RankTxt").GetComponent <Text>(); Icon = rc.Get <GameObject>("Icon").GetComponent <Image>(); RankImg = rc.Get <GameObject>("RankImg"); RewardBtn = rc.Get <GameObject>("RewardBtn").GetComponent <Button>(); DetailBtn = rc.Get <GameObject>("DetailBtn").GetComponent <Button>(); Img = rc.Get <GameObject>("Img").GetComponent <Image>(); // 休闲场和好友房两个按钮动画 { FrameAnimation.Start(ChoiceRoomType.transform.Find("Btn_relax1").GetComponent <Image>(), "image_frameanimation", "xiuxian00", 70, null, true, true); FrameAnimation.Start(ChoiceRoomType.transform.Find("Btn_pvp1").GetComponent <Image>(), "image_frameanimation", "haoyou00", 70, null, true, true); } #region 好友房 FriendGrid = rc.Get <GameObject>("FriendGrid"); FriendRoom = rc.Get <GameObject>("FriendRoom"); NoRoomTipTxt = rc.Get <GameObject>("NoRoomTipTxt"); JoinRoomBtn = rc.Get <GameObject>("JoinRoomBtn").GetComponent <Button>(); CreateRoomBtn = rc.Get <GameObject>("CreateRoomBtn").GetComponent <Button>(); CloseFrRoomBtn = rc.Get <GameObject>("CloseFrRoomBtn").GetComponent <Button>(); ScoreTxt = rc.Get <GameObject>("ScoreTxt").GetComponent <Text>(); GameBtn = rc.Get <GameObject>("GameBtn").GetComponent <Button>(); roomItem = CommonUtil.getGameObjByBundle(UIType.UIFriendRoomItem); #endregion CommonUtil.SetTextFont(FriendRoom); CommonUtil.SetTextFont(this.GetParent <UI>().GameObject); #region 加入房间 //打开加入房间 JoinRoomBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIJoinRoom); }); //我的战绩 GameBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIFriendRoomRank); }); //关闭好友房界面 CloseFrRoomBtn.onClick.Add(() => { SetUIShow(true); isFriendReqStop = true; }); ////打开创建房间UI CreateRoomBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UICreateFriendRoom); }); #endregion //周排行规则以及奖励明细 DetailBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIWeekRank); }); // 转盘 BtnList_Down.transform.Find("Btn_JianTou").GetComponent <Button>().onClick.Add(() => { // 向左 if (BtnList_Down.transform.localPosition.x > 400) { BtnList_Down.GetComponent <RectTransform>().DOAnchorPos(new Vector2(-392.0f, 73.6f), 0.5f, false).OnComplete(() => { PlayerInfoBg.transform.Find("GoldBg").transform.localScale = Vector3.zero; }); BtnList_Down.transform.Find("Btn_JianTou").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "btn_you"); } // 向右 else { BtnList_Down.GetComponent <RectTransform>().DOAnchorPos(new Vector2(-127.4f, 73.6f), 0.5f, false).OnComplete(() => { PlayerInfoBg.transform.Find("GoldBg").transform.localScale = new Vector3(1, 1, 1); }); BtnList_Down.transform.Find("Btn_JianTou").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "btn_zuo"); } }); // 喇叭 { LaBa.transform.Find("Btn_laba").GetComponent <Button>().onClick .Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIUseLaBa); }); LaBa.transform.Find("Text_content").GetComponent <Text>().text = GameUtil.getTips(); } // 商城 BtnList_Down.transform.Find("Grid/Btn_Shop").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIShop); }); // 活动 BtnList_Down.transform.Find("Grid/Btn_Activity").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIActivity); }); // 任务 BtnList_Down.transform.Find("Grid/Btn_Task").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UITask); }); // 成就 BtnList_Down.transform.Find("Grid/Btn_ChengJiu").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIChengjiu); }); // 背包 BtnList_Down.transform.Find("Grid/Btn_Bag").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIBag); }); // 转盘 BtnList_Down.transform.Find("Grid/Btn_ZhuanPan").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIZhuanPan); }); // 每日必做 BtnList_Up.transform.Find("Btn_Daily").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIDaily); }); // 邮箱 BtnList_Up.transform.Find("Btn_Mail").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIEmail); }); // 帮助 BtnList_Up.transform.Find("Btn_Help").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIHelp); }); // 休闲场 ChoiceRoomType.transform.Find("Btn_relax").GetComponent <Button>().onClick.Add(() => { ChoiceRoomType.transform.Find("Btn_relax1").transform.localScale = Vector3.zero; ChoiceRoomType.transform.Find("Btn_pvp1").transform.localScale = Vector3.zero; ChoiceRoomType.transform.Find("Btn_relax").transform.localScale = Vector3.zero; ChoiceRoomType.transform.Find("Btn_pvp").transform.localScale = Vector3.zero; ChoiceRoomType.transform.Find("Relax").transform.localScale = new Vector3(1, 1, 1); }); // 好友房 ChoiceRoomType.transform.Find("Btn_pvp").GetComponent <Button>().onClick.Add(() => { //ToastScript.createToast("暂未开放:比赛场"); //return ShowFriendRoom(); }); // 休闲场返回按钮 ChoiceRoomType.transform.Find("Relax/Btn_back").GetComponent <Button>().onClick.Add(() => { ChoiceRoomType.transform.Find("Btn_relax").transform.localScale = new Vector3(1, 1, 1); ChoiceRoomType.transform.Find("Btn_pvp").transform.localScale = new Vector3(1, 1, 1); ChoiceRoomType.transform.Find("Btn_relax1").transform.localScale = new Vector3(1, 1, 1); ChoiceRoomType.transform.Find("Btn_pvp1").transform.localScale = new Vector3(1, 1, 1); ChoiceRoomType.transform.Find("Relax").transform.localScale = Vector3.zero; }); // 休闲场-新手场 ChoiceRoomType.transform.Find("Relax/Btn_xinshou").GetComponent <Button>().onClick.Add(() => { OnEnterRoom(1); }); // 休闲场-精英场 ChoiceRoomType.transform.Find("Relax/Btn_jingying").GetComponent <Button>().onClick.Add(() => { OnEnterRoom(2); }); PlayerInfoBg.transform.Find("HuaFeiBg/Btn_DuiHuan").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIUseHuaFei); }); PlayerInfoBg.transform.Find("Btn_set").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIPlayerInfo); }); playerIcon.GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIPlayerInfo); }); PlayerInfoBg.transform.Find("HeadKuang").GetComponent <Button>().onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIPlayerInfo); }); RankItem = CommonUtil.getGameObjByBundle(UIType.UIRankItem); curType = 2; Rank.transform.Find("Btn_gold").GetComponent <Button>().onClick.Add(() => { if (curType == 1) { return; } curType = 1; ShowGoldRank(); SetMyRank(); RewardBtn.gameObject.SetActive(g2cWeek.IsGetGoldRank); }); Rank.transform.Find("Btn_game").GetComponent <Button>().onClick.Add(() => { if (curType == 2) { return; } curType = 2; ShowGameRank(); SetMyGameRank(); RewardBtn.gameObject.SetActive(g2cWeek.IsGetGameRank); }); //可以领取周排行榜奖励 RewardBtn.onClick.Add(() => { GetWeekReward(); }); //PlayerPrefs.DeleteAll(); ShowNotice(); WeekRankReq(); //向服务器发送消息请求玩家信息,然后设置玩家基本信息 await SetPlayerInfo(); GetRankInfo(); if (!PlayerInfoComponent.Instance.GetPlayerInfo().IsSign) { CommonUtil.ShowUI(UIType.UIDaily); } SetRedTip(); HeartBeat.getInstance().startHeartBeat(); // 实名认证提示 try { RealNameTip = PlayerInfoBg.transform.Find("RealNameTip").gameObject; RealNameTip.transform.Find("Button_close").GetComponent <Button>().onClick.Add(() => { RealNameTip.transform.localScale = Vector3.zero; }); if (OtherData.getIsShiedRealName()) { RealNameTip.transform.localScale = Vector3.zero; } else { if (PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName) { RealNameTip.transform.localScale = Vector3.zero; } else { DOTween.Sequence().Append(RealNameTip.GetComponent <RectTransform>().DOAnchorPos(new Vector2(117.3f, 114.38f), 0.8f, false)) .Append(RealNameTip.GetComponent <RectTransform>().DOAnchorPos(new Vector2(117.3f, 97.1f), 0.8f, false)).SetLoops(-1).Play(); } } } catch (Exception ex) { Log.Debug(ex.ToString()); } }
public void Awake() { rc = GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); icon = rc.Get <GameObject>("Icon").GetComponent <Image>(); nameTxt = rc.Get <GameObject>("NameTxt").GetComponent <Text>(); priceTxt = rc.Get <GameObject>("PriceTxt").GetComponent <Text>(); buyBtn = rc.Get <GameObject>("BuyBtn").GetComponent <Button>(); CommonUtil.SetTextFont(this.GetParent <UI>().GameObject); buyBtn.onClick.Add(async() => { if (shopInfo.CurrencyType == 2) { //用元宝购买 long yuan = PlayerInfoComponent.Instance.GetPlayerInfo().WingNum; if (GameUtil.isVIP()) { ShowBuy(yuan, shopInfo.VipPrice, "元宝"); } else { ShowBuy(yuan, shopInfo.Price, "元宝"); } } else if (shopInfo.CurrencyType == 1) { //用元宝购买 long gold = PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum; if (GameUtil.isVIP()) { ShowBuy(gold, shopInfo.VipPrice, "金币"); } else { ShowBuy(gold, shopInfo.Price, "金币"); } } else { if (!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName()) { ToastScript.createToast("请先完成实名认证!"); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIShop); Game.Scene.GetComponent <UIComponent>().Create(UIType.UIRealName); return; } { UINetLoadingComponent.showNetLoading(); G2C_IsCanRecharge g2cIsCanRecharge = (G2C_IsCanRecharge)await SessionComponent.Instance.Session.Call(new C2G_IsCanRecharge { UId = PlayerInfoComponent.Instance.uid }); UINetLoadingComponent.closeNetLoading(); if (g2cIsCanRecharge.Error != ErrorCode.ERR_Success) { ToastScript.createToast(g2cIsCanRecharge.Message); return; } else { //ToastScript.createToast("可以充值"); } } //接购买SDK //ToastScript.createToast("暂时未开放人民币购买"); //可以购买 if (!ChannelHelper.IsThirdChannel()) { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIShop).GetComponent <UIShopComponent>().Pay(shopInfo); } else { PlatformHelper.pay(PlatformHelper.GetChannelName(), "AndroidCallBack", "GetPayResult", SetRequest(shopInfo).ToJson()); } } }); }