Beispiel #1
0
        public void OnStartLogin()
        {
            if (Client.Inst().isSingleTest)
            {
                //int[] info = new int[1];
                //info[0] = 5;

                EGame.m_uid = 2;

                SC_BattleInfo s = new SC_BattleInfo();
                s.roomId = 1;
                PlayerInfo p = new PlayerInfo();
                p.uid       = 2;
                p.heroIndex = 2;
                s.playerInfo.Add(p);

                GameManager.Inst.Start(s);
                GameManager.Inst.GetFspManager().m_bStartCtl = true;
                return;
            }

            NetRunTime.Inst.Conn(GlobleConfig.s_gameServerIP, GlobleConfig.s_gameServerPort, () =>
            {
                OnSendLoginMsg();
            });
            m_bStartConn  = true;
            m_connCurTime = 0;
        }
Beispiel #2
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;
        }