Esempio n. 1
0
    /// <summary>
    /// 设置启动
    /// </summary>
    private void StartUp()
    {
        if (!Application.isMobilePlatform)
        {
            return;
        }
        if (GlobalData.isStartUp)
        {
            if (GlobalData.sdkPlatform == SDKPlatform.ANDROID)
            {
                GlobalData.StartUpParam = AndroidSdkInterface.GetStartParam();
            }
            GlobalData.isStartUp = false;
        }
        Dictionary <string, string> paramDic = StringUtil.ParseParam(GlobalData.StartUpParam);

        if (paramDic.ContainsKey(StartUpParam.ROOMID))
        {
            HallProxy hallProxy = ApplicationFacade.Instance.RetrieveProxy(Proxys.HALL_PROXY) as HallProxy;
            hallProxy.HallInfo.roomCode = paramDic [StartUpParam.ROOMID];
            JoinInRoomC2S package = new JoinInRoomC2S();
            package.roomCode = hallProxy.HallInfo.roomCode;
            package.seat     = 0;
            NetMgr.Instance.SendBuff <JoinInRoomC2S> (SocketType.HALL, MsgNoC2S.C2S_Hall_JOIN_IN_ROOM.GetHashCode(), 0, package);
        }
        GlobalData.StartUpParam = null;
    }
Esempio n. 2
0
    public override void OnRegister()
    {
        base.OnRegister();
        hallProxy       = ApplicationFacade.Instance.RetrieveProxy(Proxys.HALL_PROXY) as HallProxy;
        loginProxy      = ApplicationFacade.Instance.RetrieveProxy(Proxys.LOGIN_PROXY) as LoginProxy;
        View.HallView   = (HallView)UIManager.Instance.ShowUI(UIViewID.HALL_VIEW);
        View.TopView    = (TopMenuView)UIManager.Instance.ShowUI(UIViewID.TOPMENU_VIEW);
        View.MiddleView = (MiddleMenuView)UIManager.Instance.ShowUI(UIViewID.MIDDLEMENU_VIEW);
        TopMenuAddEvent();
        MiddleMenuAddEvent();
        View.TopView.ViewRoot.SetActive(false);
        View.MiddleView.ViewRoot.SetActive(false);
        AudioSystem.Instance.PlayBgm(Resources.Load <AudioClip>("Voices/Bgm/HallBgm"));
        if (GlobalData.LoginServer != "127.0.0.1")
        {
            NetMgr.Instance.StopTcpConnection(SocketType.BATTLE);
            if (!NetMgr.Instance.ConnentionDic.ContainsKey(SocketType.HALL))
            {
                NetMgr.Instance.CreateConnect(SocketType.HALL, loginProxy.hallServerIP, loginProxy.hallServerPort);
            }
        }
        var startUpParam = AndroidSdkInterface.GetStartParam();

        if (startUpParam != null)
        {
            Dictionary <string, string> paramDic = StringUtil.ParseParam(startUpParam);
            if (paramDic.ContainsKey(StartUpParam.TYPE) && paramDic[StartUpParam.TYPE] == StartUpType.JOINROOM)
            {
                hallProxy.HallInfo.RoomCode = paramDic[StartUpParam.ROOMID];
                JoinInRoomC2S package = new JoinInRoomC2S();
                package.roomCode = hallProxy.HallInfo.RoomCode;
                package.seat     = 0;
                NetMgr.Instance.SendBuff <JoinInRoomC2S>(SocketType.HALL, MsgNoC2S.REQUEST_JOINROOM_C2S.GetHashCode(), 0, package);
            }
        }
    }