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);
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        public void Update()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Log.Info("第三方返回:" + PlatformHelper.isThirdSDKQuit());

                if (PlatformHelper.isThirdSDKQuit())
                {
                    PlatformHelper.thirdSDKQuit("AnroidCallBack", "", "");
                }
                else
                {
                    // 不在游戏内,退出整个游戏
                    if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom) == null)
                    {
                        UICommonPanelComponent script = UICommonPanelComponent.showCommonPanel("通知", "是否退出游戏?");
                        script.setOnClickOkEvent(() =>
                        {
                            Application.Quit();
                        });

                        script.setOnClickCloseEvent(() =>
                        {
                            Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICommonPanel);
                        });

                        script.getTextObj().alignment = TextAnchor.MiddleCenter;
                    }
                    // 在游戏内,退回到主界面
                    else
                    {
                        UIRoomComponent.OnExit();
                    }
                }
            }
        }