Ejemplo n.º 1
0
        public override void OnRecv()
        {
            if (eno == 0)
            {
                Debug.Log("无角色,跳转创建界面");
                LoginModule login = (LoginModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelLogin);
                login.SetVisible(false);
                CreateRoleModule cRole = (CreateRoleModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelCreate);
                cRole.SetVisible(true);
            }
            else if (eno == 1)
            {
                LoginModule login = (LoginModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelLogin);
                login.SetVisible(false);
                Debug.Log("有角色,直接进入大厅");
                SC_PlayerPublicData data = GetData <SC_PlayerPublicData>(structBytes);
                Debug.Log(data.name);
                Debug.Log(data.occ);
                Debug.Log(data.x);
                Debug.Log(data.y);
                Debug.Log(data.dir);

                EnterMainUI(data);
            }
            else if (eno == -1)
            {
                Debug.Log("服务器数据异常");
            }
        }
Ejemplo n.º 2
0
        public override void Update(float fTime, float fDTime)
        {
            if (m_netState == NetState.Connecting || m_netState == NetState.ConnSucc)
            {
                _UpdateCheckHeartBeat();
            }
            if (m_netState == NetState.ConnSucc)
            {
                if (m_connectedCb != null)
                {
                    m_connectedCb();
                    m_connectedCb = null;
                }
                _UpdateReceive();
                _UpdateSend();
                _SendHeartBeat();
                _UpdateOffline();
            }
            if (m_netState == NetState.ConnFail)
            {
                Stop();
                //连接失败弹出对话框
                LoginModule login = (LoginModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelLogin);

                login.OpenReConnDialog();
            }
        }
Ejemplo n.º 3
0
        private void OnLoadingEnd()
        {
            isFirstLoading = false;
            Client.Inst().m_uiResInit.OpenPanel(false);
            LayoutMgr.Inst.InitLayout();
            //LayoutMgr.Inst.OpenUIBgm(LayoutMgr.UIBgmType.Main);
            LoginModule login = (LoginModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelLogin);

            login.SetVisible(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 服务器收到所有人准备后,开始游戏
        /// </summary>
        public void Start(SC_BattleInfo battleInfo)
        {
            m_fspMgr = new FspManager();
            m_fspMgr.Init();

            Debug.Log("开始加载场景,开始汇报场景进度");

            LoginModule loginHero = (LoginModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelLogin);

            loginHero.SetVisible(false);

            SelectHeroModule selectHero = (SelectHeroModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelSelectHero);

            selectHero.SetVisible(false);

            MainModule mainModule = (MainModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelMain);

            mainModule.SetVisible(false);

            JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick);

            js.SetVisible(true);
            HeadModule head = (HeadModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelHead);

            head.SetVisible(true);


            SetRandSeed(10);
            CMap map = CMapMgr.Create(1);

            map.Create();


            for (int i = 0; i < battleInfo.playerInfo.Count; i++)
            {
                PlayerInfo playerInfo = battleInfo.playerInfo[i];
                int        uid        = (int)playerInfo.uid;
                if (EGame.m_openid.Equals(uid.ToString()))
                {
                    EGame.m_uid = uid;
                }
                CCreature master = CCreatureMgr.Create(EThingType.Player, uid);
                master.Create(playerInfo.heroIndex, uid.ToString(), new Vector2d(60, 60 + i * 4), FPCollide.GetVector(60));

                master.m_ai     = new CCreatureAI(master, eAILevel.HARD);
                master.m_aiType = eAIType.Player;
                master.StartAi(false);
            }

            for (int i = 0; i < 1; i++)
            {
                CCreature test1 = CCreatureMgr.Create(EThingType.Player, 3000 + i);
                test1.Create(3, "测试" + i, new Vector2d(50 + i * 2, 60), FPCollide.GetVector(-220));
                test1.m_ai = new CCreatureAI(test1, eAILevel.EASY);
                test1.StartAi(true);
            }

            for (int i = 0; i < 1; i++)
            {
                CCreature test1 = CCreatureMgr.Create(EThingType.Player, 2000 + i);
                test1.Create(2, "测试" + i, new Vector2d(50 + i * 2, 60), FPCollide.GetVector(-220));
                test1.m_ai = new CCreatureAI(test1, eAILevel.EASY);
                test1.StartAi(true);
            }

            for (int i = 0; i < 1; i++)
            {
                CCreature test1 = CCreatureMgr.Create(EThingType.Player, 1000 + i);
                test1.Create(1, "测试" + i, new Vector2d(50 + i * 2, 60), FPCollide.GetVector(-220));
                test1.m_ai = new CCreatureAI(test1, eAILevel.EASY);
                test1.StartAi(true);
            }

            m_bRunning = true;
        }