Exemplo n.º 1
0
        // ===================== 按钮回调 =================
        // 1: 登陆按钮
        private void OnClickLoginBtn()
        {
            // 第一次登陆没有选择过登陆服务器,强制让用户选择一个
            if (isEmptyServer)
            {
                OnClickServerBtn();
                return;
            }

            string ServerID = ConfigsManager.Inst.GetClientConfig(ClientConfigs.ServerID);

            if (ServerID != string.Empty)
            {
                ServerListConfig serverconfig = ConfigsManager.Inst.GetServerList(ServerID);
                if (serverconfig != null)
                {
                    curServerName = serverconfig.ServerName;

                    IOControler.Connect(serverconfig.ServerIP, (ushort)serverconfig.ServerPort);

                    GameUtils.SetBtnSpriteGrayState(LoginBtn, true);
                    LoginBtn.interactable = false;
                }
                else
                {
                    // 加代码
                    UI_LoginControler.Inst.AddUI(UI_ServerList.UI_ResPath);
                }
            }
            else
            {
                GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("error #100052"));//serverid 错误
            }
        }
Exemplo n.º 2
0
        // ===================== 按钮回调 =================
        private void OnClickYesBtn()
        {
            if (type == TipsType.GameTips)
            {
                if (!SceneManager.Inst.CurScene.Equals(SceneEntry.Login.ToString()))
                {
                    GameObject.Destroy(MainGameControler.Inst.gameObject.GetComponent <ObjectSelf>());
                    SceneManager.Inst.StartChangeScene(SceneEntry.Login.ToString());
                }
                else
                {
                    HideUI();
                    GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_ReActive);
                }

                SocketManager.GetInstance().Uninit();

                return;
            }

            if (type == TipsType.SocketTips)
            {
                string ServerID = ConfigsManager.Inst.GetClientConfig(ClientConfigs.ServerID);
                if (ServerID != string.Empty)
                {
                    ServerListConfig serverconfig = ConfigsManager.Inst.GetServerList(ServerID);
                    if (serverconfig != null)
                    {
                        IOControler.Connect(serverconfig.ServerIP, (ushort)serverconfig.ServerPort);
                    }
                }
                else
                {
                    GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("error #100053"));//serverid 错误
                }
            }

            if (type == TipsType.Recruit)
            {
                //招募界面
                UI_HomeControler.Inst.AddUI(UI_Recruit.UI_ResPath);
            }

            if (type == TipsType.GoPlatform || type == TipsType.CancelOrGoPlatform)
            {
                //Debug.Log("GoPlatform");
                Application.OpenURL("www.baidu.com");
            }

            if (type == TipsType.StartLoadUpdataAsset)
            {
                AssetManager.Inst.StartLoadAsset();
                GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_OpenUI, UI_AssetsLoading.UI_ResPath);
            }

            if (type == TipsType.ResourceDownloadUnOk)
            {
                Debug.Log("Quit");
                Application.Quit();
            }

            if (UI_HomeControler.Inst != null)
            {
                UI_HomeControler.Inst.ReMoveUI(gameObject);
            }
            else if (UI_LoginControler.Inst != null)
            {
                UI_LoginControler.Inst.ReMoveUI(gameObject);
            }
            else if (UI_FightControler.Inst != null)
            {
                UI_FightControler.Inst.ReMoveUI(gameObject);
            }
            else if (UI_LodingControler.Inst != null)
            {
                UI_LodingControler.Inst.ReMoveUI(gameObject);
            }
            else
            {
                Debug.LogError("destory game tips error");
            }
        }