Ejemplo n.º 1
0
        private static void OnSelectHeroTimeout(int seq)
        {
            if (Singleton <CUIManager> .GetInstance().GetForm(CHeroSelectSystem.s_heroSelectFormPath) != null)
            {
                Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

                if ((roomInfo != null) && (roomInfo.GetMasterMemberInfo() != null))
                {
                    ListView <IHeroData> pvPHeroList = CHeroDataFactory.GetPvPHeroList();
                    DebugHelper.Assert(pvPHeroList.Count > ChosenHeroes.Count, "May have not enough Candidate Heroes!!!");
                    int       num  = UnityEngine.Random.Range(0, pvPHeroList.Count);
                    IHeroData data = pvPHeroList[num];
                    while (ChosenHeroes.ContainsValue(data.cfgID))
                    {
                        num  = UnityEngine.Random.Range(0, pvPHeroList.Count);
                        data = pvPHeroList[num];
                    }
                    roomInfo.GetMasterMemberInfo().ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = data.cfgID;
                    ReqStartSingleWarmBattle();
                }
            }
        }
Ejemplo n.º 2
0
        private static void ReqStartSingleWarmBattle()
        {
            bInFakeSelect = false;
            Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout));

            CSPkg msg = NetworkModule.CreateDefaultCSPKG(0x41a);

            Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            DebugHelper.Assert(roomInfo != null, "RoomInfo Should not be NULL!!!");
            if (roomInfo != null)
            {
                msg.stPkgData.stStartSingleGameReq.stBattleParam.bGameType = 1;
                msg.stPkgData.stStartSingleGameReq.stBattleParam.stGameDetail.stGameOfCombat = Singleton <CHeroSelectSystem> .GetInstance().m_stGameOfCombat;

                msg.stPkgData.stStartSingleGameReq.stBattleList.stBattleList.wHeroCnt = 1;
                MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo();
                DebugHelper.Assert(masterMemberInfo != null, "self Info Should not be NULL!!!");
                if (masterMemberInfo != null)
                {
                    msg.stPkgData.stStartSingleGameReq.stBattleList.stBattleList.BattleHeroList[0] = masterMemberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID;
                }
                ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(roomInfo.roomAttrib.dwMapId);
                DebugHelper.Assert(dataByKey != null);
                if (dataByKey != null)
                {
                    ResDT_LevelCommonInfo stLevelCommonInfo = dataByKey.stLevelCommonInfo;
                    COM_PLAYERCAMP        camp = COM_PLAYERCAMP.COM_PLAYERCAMP_1;
                    int dwHeroID = 0;
                    for (int i = 0; i < roomInfo.CampMemberList.Length; i++)
                    {
                        ListView <MemberInfo> view = roomInfo.CampMemberList[i];
                        for (int k = 0; k < view.Count; k++)
                        {
                            if (view[k].ullUid == roomInfo.selfInfo.ullUid)
                            {
                                camp     = view[k].camp;
                                dwHeroID = (int)view[k].ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID;
                                break;
                            }
                        }
                    }
                    CSDT_BATTLE_PLAYER_BRIEF stBattlePlayer = msg.stPkgData.stStartSingleGameReq.stBattlePlayer;
                    int index = 0;
                    for (int j = 0; j < 2; j++)
                    {
                        for (int m = 0; m < roomInfo.CampMemberList[j].Count; m++)
                        {
                            MemberInfo info5 = roomInfo.CampMemberList[j][m];
                            if (info5 != null)
                            {
                                if (info5.RoomMemberType == 2)
                                {
                                    stBattlePlayer.astFighter[index].bObjType   = 2;
                                    stBattlePlayer.astFighter[index].bPosOfCamp = (byte)m;
                                    stBattlePlayer.astFighter[index].bObjCamp   = (byte)(j + 1);
                                    stBattlePlayer.astFighter[index].dwLevel    = info5.dwMemberPvpLevel;
                                    FakeHeroSelect fakeHeroSelect = GetFakeHeroSelect(info5.ullUid);
                                    if (fakeHeroSelect != null)
                                    {
                                        stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID             = fakeHeroSelect.selectedHero;
                                        stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeHeroSelect.selectedPlayerSkill;
                                        stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.wSkinID = (ushort)fakeHeroSelect.selectedSkin;
                                        stBattlePlayer.astFighter[index].szName = fakeHeroSelect.FakePlayer.szUserName;
                                        stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc                    = new COMDT_PLAYERINFO_OF_NPC();
                                        stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.ullFakeUid         = fakeHeroSelect.FakePlayer.ullUid;
                                        stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakePvpLevel     = fakeHeroSelect.FakePlayer.dwAcntPvpLevel;
                                        stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakeLogicWorldID = fakeHeroSelect.FakePlayer.dwLogicWorldId;
                                    }
                                    else
                                    {
                                        SelectHeroForEnemyPlayer(ref stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo, stBattlePlayer.astFighter[index].dwLevel);
                                        stBattlePlayer.astFighter[index].szName = info5.WarmNpc.szUserName;
                                        stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc                    = new COMDT_PLAYERINFO_OF_NPC();
                                        stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.ullFakeUid         = info5.WarmNpc.ullUid;
                                        stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakePvpLevel     = info5.WarmNpc.dwAcntPvpLevel;
                                        stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakeLogicWorldID = info5.WarmNpc.dwLogicWorldId;
                                    }
                                }
                                else if (info5.RoomMemberType == 1)
                                {
                                    stBattlePlayer.astFighter[index].bObjType   = 1;
                                    stBattlePlayer.astFighter[index].bPosOfCamp = (byte)m;
                                    stBattlePlayer.astFighter[index].bObjCamp   = (byte)camp;
                                    for (int n = 0; n < stLevelCommonInfo.bHeroNum; n++)
                                    {
                                        stBattlePlayer.astFighter[index].astChoiceHero[n].stBaseInfo.stCommonInfo.dwHeroID = (uint)dwHeroID;
                                    }
                                }
                                index++;
                            }
                        }
                    }
                    stBattlePlayer.bNum             = (byte)index;
                    roomInfo.roomAttrib.bWarmBattle = false;
                    roomInfo.roomAttrib.npcAILevel  = 2;
                    Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref msg, true);
                }
            }
        }