public static void OnExit() { try { if (!IsFriendRoom) { UICommonPanelComponent script = UICommonPanelComponent.showCommonPanel("通知", "是否退出房间?"); script.setOnClickOkEvent(() => { SessionComponent.Instance.Session.Send(new Actor_GamerExitRoom() { IsFromClient = true }); if (ISGaming) { CommonUtil.ShowUI(UIType.UIMain); GameUtil.Back2Main(); } }); script.setOnClickCloseEvent(() => { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICommonPanel); }); script.getTextObj().alignment = TextAnchor.MiddleCenter; } //好友房硬件返回屏蔽 else { if (!ISGaming && CurrentJuCount == 0) { UICommonPanelComponent script = UICommonPanelComponent.showCommonPanel("通知", "是否退出房间?"); script.setOnClickOkEvent(() => { SessionComponent.Instance.Session.Send(new Actor_GamerExitRoom() { IsFromClient = true }); if (ISGaming) { CommonUtil.ShowUI(UIType.UIMain); GameUtil.Back2Main(); } }); script.setOnClickCloseEvent(() => { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICommonPanel); }); script.getTextObj().alignment = TextAnchor.MiddleCenter; } } } catch (Exception e) { Log.Error(e); } }
protected override async void Run(ETModel.Session session, Actor_GamerReadyTimeOut message) { try { Log.Info($"收到准备超时:{message.Message}"); CommonUtil.ShowUI(UIType.UIMain); GameUtil.Back2Main(); { UICommonPanelComponent script = UICommonPanelComponent.showCommonPanel("通知", message.Message); script.setOnClickOkEvent(() => { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICommonPanel); }); script.setOnClickCloseEvent(() => { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICommonPanel); }); script.getTextObj().alignment = TextAnchor.MiddleCenter; } } catch (Exception e) { Log.Error(e); } }
protected override async void Run(ETModel.Session session, Actor_GamerExitRoom message) { try { Log.Info($"收到退出"); UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom); if (uiRoom == null) { return; } // UI uiReady = Game.Scene.GetComponent<UIComponent>().Get(UIType.UIReady); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>(); // UIReadyComponent uiReadyComponent = uiReady.GetComponent<UIReadyComponent>(); if (gamerComponent.LocalGamer.UserID == message.Uid) { CommonUtil.ShowUI(UIType.UIMain); GameUtil.Back2Main(); } else { Gamer gamer = gamerComponent.Get(message.Uid); gamer?.GetComponent <GamerUIComponent>()?.ResetReadyPanel(); uiRoomComponent.RemoveGamer(message.Uid); } SoundsHelp.Instance.playSound_LiKai(); } catch (Exception e) { Log.Error(e); } }
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 override void Run() { UI ui = CommonUtil.ShowUI(UIType.UILogin); }
public void onClick_jiazhangjianhu() { CommonUtil.ShowUI(UIType.UIJiaZhangJianHu); }
public async void Awake() { ReferenceCollector rc = GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); nameTxt = rc.Get <GameObject>("NameTxt").GetComponent <Text>(); uIDTxt = rc.Get <GameObject>("UIDTxt").GetComponent <Text>(); realNameTxt = rc.Get <GameObject>("RealNameTxt").GetComponent <Text>(); noBindPhoneTxt = rc.Get <GameObject>("NoBindPhoneTxt").GetComponent <Text>(); HuafeiNumTxt = rc.Get <GameObject>("HuafeiNumTxt").GetComponent <Text>(); AlPlayTxt = rc.Get <GameObject>("AlPlayTxt").GetComponent <Text>(); WinGameTxt = rc.Get <GameObject>("WinGameTxt").GetComponent <Text>(); SuccessRateTxt = rc.Get <GameObject>("SuccessRateTxt").GetComponent <Text>(); MaxSuccessTxt = rc.Get <GameObject>("MaxSuccessTxt").GetComponent <Text>(); VipTimeTxt = rc.Get <GameObject>("VipTimeTxt").GetComponent <Text>(); returnBtn = rc.Get <GameObject>("ReturnBtn").GetComponent <Button>(); playerIcon = rc.Get <GameObject>("PlayerIcon").GetComponent <Button>(); changeNameBtn = rc.Get <GameObject>("ChangeNameBtn").GetComponent <Button>(); realNameBtn = rc.Get <GameObject>("RealNameBtn").GetComponent <Button>(); bindPhoneBtn = rc.Get <GameObject>("BindPhoneBtn").GetComponent <Button>(); ChangeAccountBtn = rc.Get <GameObject>("ChangeAccountBtn").GetComponent <Button>(); DuihuanBtn = rc.Get <GameObject>("DuihuanBtn").GetComponent <Button>(); De = rc.Get <GameObject>("De").GetComponent <Button>(); GoldNumTxt = rc.Get <GameObject>("GoldNumTxt").GetComponent <Text>(); WingNumTxt = rc.Get <GameObject>("WingNumTxt").GetComponent <Text>(); AddBtn = rc.Get <GameObject>("AddBtn").GetComponent <Button>(); DuihuanBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIUseHuaFei); }); AddBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIPlayerInfo); Game.Scene.GetComponent <UIComponent>().Create(UIType.UIShop); }); PlayerFrame = rc.Get <GameObject>("PlayerFrame"); bindPhoneBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIBindPhone); }); realNameBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIRealName); }); returnBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().SetUIHideOrOpen(true); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIPlayerInfo); if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIVIP) != null) { if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIVIP).GameObject.activeInHierarchy) { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIVIP); } } }); changeNameBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIChangeName); }); ChangeAccountBtn.onClick.Add(() => { onClickChangeAccount(); }); De.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIVIP); }); PlayerInfoComponent pc = Game.Scene.GetComponent <PlayerInfoComponent>(); PlayerInfo playerInfo = pc.GetPlayerInfo(); nameTxt.text = playerInfo.Name; uIDTxt.text = pc.uid.ToString(); AlPlayTxt.text = $"已玩牌局:{ playerInfo.TotalGameCount}"; string winRate = GameUtil.GetWinRate(playerInfo.TotalGameCount, playerInfo.WinGameCount).ToString(); if (winRate.Equals(0)) { SuccessRateTxt.text = $"胜 率:{0}%"; } else { SuccessRateTxt.text = $"胜 率:{winRate}%"; } MaxSuccessTxt.text = $"最大赢取:{playerInfo.MaxHua}"; WinGameTxt.text = $"获胜局数:{ playerInfo.WinGameCount}"; if (playerInfo.IsRealName) { realNameTxt.text = "已实名"; } if (!string.IsNullOrEmpty(playerInfo.Phone)) { noBindPhoneTxt.text = "已绑定"; } // 设置头像 { HeadManager.setHeadSprite(playerIcon.GetComponent <Image>(), PlayerInfoComponent.Instance.GetPlayerInfo().Icon); } playerIcon.onClick.Add(() => { CommonUtil.ShowUI(UIType.UIIcon); }); Init(); }
public static async Task GamerEnterRoom(Actor_GamerEnterRoom message) { try { //玩家还在结算画面 if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIGameResult) != null || UIRoomComponent.ISGaming) { return; } Log.Info($"收到玩家进入"); //第一次进入创建UIRoom if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom) == null) { CommonUtil.ShowUI(UIType.UIRoom); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIMain); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICreateFriendRoom); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIJoinRoom); } if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady) == null) { CommonUtil.ShowUI(UIType.UIReady); } UINetLoadingComponent.closeNetLoading(); UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom); UI uiReady = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); UIRoomComponent roomComponent = uiRoom.GetComponent <UIRoomComponent>(); roomComponent.ContinueGamer(); roomComponent.enterRoomMsg = message; roomComponent.SetRoomType(message.RoomType, message.Multiples); Gamer[] gamers = gamerComponent.GetAll(); //清空座位 for (int i = 0; i < gamers.Length; i++) { if (gamers[i] == null) { continue; } if (gamers[i].UserID != 0) { Log.Debug("删除gamer"); roomComponent.RemoveGamer(gamers[i].UserID); } } GamerInfo localGamer = null; for (int i = 0; i < message.Gamers.Count; i++) { if (message.Gamers[i].UserID == PlayerInfoComponent.Instance.uid) { localGamer = message.Gamers[i]; gamerComponent.LocalGamer = GamerFactory.Create(localGamer.UserID, localGamer.IsReady, localGamer.playerInfo); break; } } if (localGamer == null) { return; } roomComponent.localGamer = localGamer; //好友房处理 if (message.RoomType == 3) { UIRoomComponent.IsFriendRoom = true; roomComponent.JuCount = message.JuCount; uiReady?.GetComponent <UIReadyComponent>()?.ClosePropt(); uiReady?.GetComponent <UIReadyComponent>()?.SetFriendRoom(true); uiReady?.GetComponent <UIReadyComponent>()?.ShowWeChat(message.RoomId.ToString()); roomComponent.RoomConfig.Multiples = message.Multiples; roomComponent.SetFriendSetting(message.MasterUserId); if (message.CurrentJuCount > 0) { uiReady?.GetComponent <UIReadyComponent>()?.CloseBtn(); roomComponent.exitBtn.interactable = false; } } else { uiReady?.GetComponent <UIReadyComponent>()?.SetFriendRoom(false); UIRoomComponent.IsFriendRoom = false; } for (int i = 0; i < message.Gamers.Count; i++) { GamerInfo gamerInfo = message.Gamers[i]; Gamer gamer; if (gamerInfo.UserID == localGamer.UserID) { gamer = gamerComponent.LocalGamer; } else { gamer = GamerFactory.Create(gamerInfo.UserID, gamerInfo.IsReady, gamerInfo.playerInfo); } UIReadyComponent uiReadyComponent = uiReady.GetComponent <UIReadyComponent>(); GamerUIComponent gamerUiComponent = gamer.GetComponent <GamerUIComponent>(); //排序 int index = gamerInfo.SeatIndex - localGamer.SeatIndex; if (index < 0) { index += 4; } //设置准备 if (uiReadyComponent != null) { if (gamer?.PlayerInfo != null) { gamerUiComponent?.SetHeadPanel(uiReadyComponent.HeadPanel[index], index); gamerUiComponent?.SetFace(roomComponent.FacePanel[index]); uiReady?.GetComponent <UIReadyComponent>()?.SetPanel(gamer, index); //根据座位的indax添加玩家 roomComponent?.AddGamer(gamer, index); } } } SoundsHelp.Instance.playSound_JinRu(); } catch (Exception e) { Log.Error(e); } }