Exemplo n.º 1
0
        public static void OnSelfLoadProcess(float progress)
        {
            SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext();

            if (curLvelContext != null)
            {
                if (curLvelContext.IsMobaModeWithOutGuide())
                {
                    Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                    if (hostPlayer != null)
                    {
                        GameObject memberItem = GetMemberItem(hostPlayer.PlayerId);
                        if (memberItem != null)
                        {
                            Transform transform = memberItem.transform.Find("Txt_LoadingPct");
                            if (transform != null)
                            {
                                transform.GetComponent <Text>().text = string.Format("{0}%", Convert.ToUInt16((float)(progress * 100f)));
                            }
                        }
                    }
                    if (curLvelContext.m_isWarmBattle)
                    {
                        CFakePvPHelper.FakeLoadProcess(progress);
                    }
                }
                else if (_singlePlayerLoading != null)
                {
                    _singlePlayerLoading.m_formWidgets[2].GetComponent <Text>().text = string.Format("{0}%", (int)(Mathf.Clamp(progress, 0f, 1f) * 100f));
                    _singlePlayerLoading.m_formWidgets[3].GetComponent <Image>().CustomFillAmount(Mathf.Clamp(progress, 0f, 1f));
                }
            }
        }
Exemplo n.º 2
0
        private static void OnSelectHeroTimeout(int seq)
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CHeroSelectNormalSystem.s_heroSelectFormPath);

            if (form != null)
            {
                RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

                if (roomInfo != null && roomInfo.GetMasterMemberInfo() != null)
                {
                    ListView <IHeroData> pvPHeroList = CHeroDataFactory.GetPvPHeroList(CMallSortHelper.HeroViewSortType.Name);
                    DebugHelper.Assert(pvPHeroList.Count > CFakePvPHelper.ChosenHeroes.get_Count(), "May have not enough Candidate Heroes!!!");
                    int       index    = Random.Range(0, pvPHeroList.Count);
                    IHeroData heroData = pvPHeroList[index];
                    while (CFakePvPHelper.ChosenHeroes.ContainsValue(heroData.cfgID))
                    {
                        index    = Random.Range(0, pvPHeroList.Count);
                        heroData = pvPHeroList[index];
                    }
                    MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo();
                    masterMemberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = heroData.cfgID;
                    CFakePvPHelper.ReqStartSingleWarmBattle();
                }
            }
        }
Exemplo n.º 3
0
        private static void UpdateFakeSelectHero(int seq)
        {
            int num = 0;

            for (int i = 0; i < CFakePvPHelper.FakeHeroSelectList.Count; i++)
            {
                CFakePvPHelper.FakeHeroSelect fakeHeroSelect = CFakePvPHelper.FakeHeroSelectList[i];
                if (fakeHeroSelect.bConfirmed)
                {
                    num++;
                }
                else if (fakeHeroSelect.idleSec == fakeHeroSelect.nextActionSec)
                {
                    CFakePvPHelper.DoSelectAction(ref fakeHeroSelect);
                    fakeHeroSelect.idleSec       = 0;
                    fakeHeroSelect.nextActionSec = Random.Range(3, 6);
                }
                else
                {
                    fakeHeroSelect.idleSec++;
                }
            }
            if (num == CFakePvPHelper.FakeHeroSelectList.Count)
            {
                Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.UpdateFakeSelectHero));
            }
        }
Exemplo n.º 4
0
        private static void UpdateFakeConfirm(int seq)
        {
            List <CFakePvPHelper.FakePlayerConfirm> list = CFakePvPHelper.SelectConfirmPlayer(CFakePvPHelper.CurrentSelectTime++);
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CMatchingSystem.PATH_MATCHING_CONFIRMBOX);

            if (form != null)
            {
                for (int i = 0; i < list.get_Count(); i++)
                {
                    CFakePvPHelper.FakePlayerConfirm fakePlayerConfirm = list.get_Item(i);
                    fakePlayerConfirm.bConfirmed = true;
                    CFakePvPHelper.ConfirmedFakePlayerNum++;
                    Singleton <CMatchingSystem> .GetInstance().confirmPlayerNum++;

                    CMatchingView.UpdateConfirmBox(form.gameObject, fakePlayerConfirm.FakePlayer.ullUid);
                    if (CFakePvPHelper.ConfirmedFakePlayerNum == CFakePvPHelper.FakePlayerList.Count)
                    {
                        Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.UpdateFakeConfirm));
                    }
                    if (Singleton <CMatchingSystem> .GetInstance().confirmPlayerNum == Singleton <CMatchingSystem> .GetInstance().currentMapPlayerNum)
                    {
                        CFakePvPHelper.GotoHeroSelectPage();
                    }
                }
            }
        }
Exemplo n.º 5
0
        public static void SetConfirmFakeData()
        {
            CFakePvPHelper.RemoveAllFakeTimer();
            CFakePvPHelper.DatabinCheck();
            CFakePvPHelper.RealPlayerConfirmNum = 0;
            CFakePvPHelper.FakePlayerConfirmNum = 0;
            CFakePvPHelper.FakePlayerList.Clear();
            RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            DebugHelper.Assert(roomInfo != null);
            DebugHelper.Assert(roomInfo.roomAttrib.bWarmBattle);
            for (COM_PLAYERCAMP cOM_PLAYERCAMP = COM_PLAYERCAMP.COM_PLAYERCAMP_1; cOM_PLAYERCAMP < COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT; cOM_PLAYERCAMP++)
            {
                ListView <MemberInfo> listView = roomInfo[cOM_PLAYERCAMP];
                for (int i = 0; i < listView.Count; i++)
                {
                    MemberInfo memberInfo = listView[i];
                    if (memberInfo.RoomMemberType == 2u)
                    {
                        CFakePvPHelper.FakePlayerConfirm fakePlayerConfirm = new CFakePvPHelper.FakePlayerConfirm();
                        fakePlayerConfirm.FakePlayer      = memberInfo.WarmNpc;
                        fakePlayerConfirm.confirmWaitTime = Random.Range(2, 11);
                        CFakePvPHelper.FakePlayerList.Add(fakePlayerConfirm);
                    }
                }
            }
        }
Exemplo n.º 6
0
        public static void OnSelfHeroConfirmed()
        {
            CFakePvPHelper.HeroConfirmedPlayerNum++;
            RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            MemberInfo memberInfo = roomInfo.GetMemberInfo(roomInfo.selfInfo.ullUid);

            memberInfo.isPrepare = true;
            if (CFakePvPHelper.HeroConfirmedPlayerNum == CFakePvPHelper.FakeHeroSelectList.get_Count() + 1)
            {
                CFakePvPHelper.ReqStartSingleWarmBattle();
            }
        }
        public static void OnSelfLoadProcess(float progress)
        {
            SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext();

            if (curLvelContext == null)
            {
                return;
            }
            if (curLvelContext.IsMobaModeWithOutGuide())
            {
                uint num = 0u;
                if (Singleton <WatchController> .GetInstance().IsWatching)
                {
                    Player playerByUid = Singleton <GamePlayerCenter> .GetInstance().GetPlayerByUid(Singleton <WatchController> .GetInstance().TargetUID);

                    num = ((playerByUid != null) ? playerByUid.PlayerId : 0u);
                }
                if (num == 0u)
                {
                    Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                    num = ((hostPlayer != null) ? hostPlayer.PlayerId : 0u);
                }
                GameObject memberItem = CUILoadingSystem.GetMemberItem(num);
                if (memberItem != null)
                {
                    Transform transform = memberItem.transform.Find("Txt_LoadingPct");
                    if (transform)
                    {
                        Text component = transform.GetComponent <Text>();
                        component.set_text(string.Format("{0}%", Convert.ToUInt16(progress * 100f)));
                    }
                }
                if (curLvelContext.m_isWarmBattle)
                {
                    CFakePvPHelper.FakeLoadProcess(progress);
                }
            }
            else
            {
                if (CUILoadingSystem._singlePlayerLoading == null)
                {
                    return;
                }
                CUILoadingSystem._singlePlayerLoading.m_formWidgets[2].GetComponent <Text>().set_text(string.Format("{0}%", (int)(Mathf.Clamp(progress, 0f, 1f) * 100f)));
                CUILoadingSystem._singlePlayerLoading.m_formWidgets[3].GetComponent <Image>().CustomFillAmount(Mathf.Clamp(progress, 0f, 1f));
            }
        }
Exemplo n.º 8
0
        public static void OnSelfConfirmed(GameObject root, int PlayerNum)
        {
            Singleton <CMatchingSystem> .GetInstance().confirmPlayerNum++;

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

            DebugHelper.Assert(roomInfo != null);
            if (roomInfo != null)
            {
                CMatchingView.UpdateConfirmBox(root, roomInfo.selfInfo.ullUid);
                if (Singleton <CMatchingSystem> .GetInstance().confirmPlayerNum == Singleton <CMatchingSystem> .GetInstance().currentMapPlayerNum)
                {
                    CFakePvPHelper.GotoHeroSelectPage();
                }
            }
        }
Exemplo n.º 9
0
        public static void BeginFakeSelectHero()
        {
            CFakePvPHelper.HeroConfirmedPlayerNum = 0;
            CFakePvPHelper.FakeHeroSelectList.Clear();
            CFakePvPHelper.ChosenHeroes.Clear();
            CFakePvPHelper.EnemyChosenHeroes.Clear();
            RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            DebugHelper.Assert(roomInfo != null);
            DebugHelper.Assert(roomInfo.roomAttrib.bWarmBattle);
            COM_PLAYERCAMP        selfCamp = roomInfo.GetSelfCamp();
            ListView <MemberInfo> listView = roomInfo[selfCamp];

            for (int i = 0; i < listView.get_Count(); i++)
            {
                MemberInfo memberInfo = listView.get_Item(i);
                if (memberInfo.RoomMemberType == 2u)
                {
                    CFakePvPHelper.FakeHeroSelect fakeHeroSelect = new CFakePvPHelper.FakeHeroSelect();
                    fakeHeroSelect.FakePlayer = memberInfo.WarmNpc;
                    if (Singleton <CHeroSelectBaseSystem> .get_instance().selectType == enSelectType.enRandom)
                    {
                        fakeHeroSelect.maxChangeHeroCount = Random.Range(0, 2);
                        CFakePvPHelper.DoSelectAction(ref fakeHeroSelect);
                    }
                    else
                    {
                        fakeHeroSelect.maxChangeHeroCount = Random.Range(1, 4);
                    }
                    fakeHeroSelect.nextActionSec = Random.Range(3, 6);
                    CFakePvPHelper.FakeHeroSelectList.Add(fakeHeroSelect);
                }
            }
            if (CFakePvPHelper.FakeHeroSelectList.get_Count() > 0)
            {
                Singleton <CTimerManager> .GetInstance().AddTimer(1000, 60, new CTimer.OnTimeUpHandler(CFakePvPHelper.UpdateFakeSelectHero));

                CFakePvPHelper.bInFakeSelect = true;
            }
            Singleton <CTimerManager> .GetInstance().AddTimer(60000, 1, new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout));
        }
Exemplo n.º 10
0
 public static void FakeSendChatTemplate(int index)
 {
     CFakePvPHelper.FakeSendChat(Singleton <CChatController> .get_instance().model.Get_HeroSelect_ChatTemplate(index).GetTemplateString());
 }
Exemplo n.º 11
0
        private static void ReqStartSingleWarmBattle()
        {
            CFakePvPHelper.bInFakeSelect = false;
            Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout));

            CFakePvPHelper.RemoveAllFakeTimer();
            CSPkg    cSPkg    = NetworkModule.CreateDefaultCSPKG(1050u);
            RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            if (roomInfo == null)
            {
                DebugHelper.Assert(roomInfo != null, "RoomInfo Should not be NULL!!!");
                return;
            }
            if (roomInfo != null)
            {
                cSPkg.stPkgData.get_stStartSingleGameReq().stBattleParam.bGameType = 1;
                cSPkg.stPkgData.get_stStartSingleGameReq().stBattleParam.stGameDetail.set_stGameOfCombat(Singleton <CHeroSelectBaseSystem> .get_instance().m_stGameOfCombat);
                cSPkg.stPkgData.get_stStartSingleGameReq().stBattleList.stBattleList.wHeroCnt = 1;
                if (cSPkg.stPkgData.get_stStartSingleGameReq().stBattleParam.stGameDetail.get_stGameOfCombat() == null)
                {
                    return;
                }
                MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo();
                if (masterMemberInfo == null)
                {
                    DebugHelper.Assert(roomInfo != null, "selfInfo Should not be NULL!!!");
                    return;
                }
                cSPkg.stPkgData.get_stStartSingleGameReq().stBattleList.stBattleList.BattleHeroList[0] = masterMemberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID;
                ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(roomInfo.roomAttrib.bMapType, roomInfo.roomAttrib.dwMapId);
                if (pvpMapCommonInfo != null)
                {
                    COM_PLAYERCAMP cOM_PLAYERCAMP = 1;
                    int            dwHeroID       = 0;
                    for (COM_PLAYERCAMP cOM_PLAYERCAMP2 = 1; cOM_PLAYERCAMP2 < 3; cOM_PLAYERCAMP2++)
                    {
                        ListView <MemberInfo> listView = roomInfo[cOM_PLAYERCAMP2];
                        for (int i = 0; i < listView.get_Count(); i++)
                        {
                            if (listView.get_Item(i).ullUid == roomInfo.selfInfo.ullUid)
                            {
                                cOM_PLAYERCAMP = listView.get_Item(i).camp;
                                dwHeroID       = (int)listView.get_Item(i).ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID;
                                break;
                            }
                        }
                    }
                    CSDT_BATTLE_PLAYER_BRIEF stBattlePlayer = cSPkg.stPkgData.get_stStartSingleGameReq().stBattlePlayer;
                    int num = 0;
                    for (COM_PLAYERCAMP cOM_PLAYERCAMP3 = 1; cOM_PLAYERCAMP3 < 3; cOM_PLAYERCAMP3++)
                    {
                        ListView <MemberInfo> listView2 = roomInfo[cOM_PLAYERCAMP3];
                        for (int j = 0; j < listView2.get_Count(); j++)
                        {
                            MemberInfo memberInfo = listView2.get_Item(j);
                            if (memberInfo != null)
                            {
                                if (memberInfo.RoomMemberType == 2u)
                                {
                                    stBattlePlayer.astFighter[num].bObjType   = 2;
                                    stBattlePlayer.astFighter[num].bPosOfCamp = (byte)j;
                                    stBattlePlayer.astFighter[num].bObjCamp   = cOM_PLAYERCAMP3;
                                    stBattlePlayer.astFighter[num].dwLevel    = memberInfo.dwMemberPvpLevel;
                                    CFakePvPHelper.FakeHeroSelect fakeHeroSelect = CFakePvPHelper.GetFakeHeroSelect(memberInfo.ullUid);
                                    if (fakeHeroSelect != null)
                                    {
                                        stBattlePlayer.astFighter[num].astChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID             = fakeHeroSelect.selectedHero;
                                        stBattlePlayer.astFighter[num].astChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeHeroSelect.selectedPlayerSkill;
                                        stBattlePlayer.astFighter[num].astChoiceHero[0].stBaseInfo.stCommonInfo.wSkinID = (ushort)fakeHeroSelect.selectedSkin;
                                        stBattlePlayer.astFighter[num].szName = fakeHeroSelect.FakePlayer.szUserName;
                                        stBattlePlayer.astFighter[num].stDetail.set_stPlayerOfNpc(new COMDT_PLAYERINFO_OF_NPC());
                                        stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().ullFakeUid         = fakeHeroSelect.FakePlayer.ullUid;
                                        stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().dwFakePvpLevel     = fakeHeroSelect.FakePlayer.dwAcntPvpLevel;
                                        stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().dwFakeLogicWorldID = fakeHeroSelect.FakePlayer.dwLogicWorldId;
                                    }
                                    else
                                    {
                                        CFakePvPHelper.SelectHeroForEnemyPlayer(ref stBattlePlayer.astFighter[num].astChoiceHero[0].stBaseInfo, stBattlePlayer.astFighter[num].dwLevel);
                                        stBattlePlayer.astFighter[num].szName = memberInfo.WarmNpc.szUserName;
                                        stBattlePlayer.astFighter[num].stDetail.set_stPlayerOfNpc(new COMDT_PLAYERINFO_OF_NPC());
                                        stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().ullFakeUid         = memberInfo.WarmNpc.ullUid;
                                        stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().dwFakePvpLevel     = memberInfo.WarmNpc.dwAcntPvpLevel;
                                        stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().dwFakeLogicWorldID = memberInfo.WarmNpc.dwLogicWorldId;
                                    }
                                }
                                else if (memberInfo.RoomMemberType == 1u)
                                {
                                    stBattlePlayer.astFighter[num].bObjType   = 1;
                                    stBattlePlayer.astFighter[num].bPosOfCamp = (byte)j;
                                    stBattlePlayer.astFighter[num].bObjCamp   = cOM_PLAYERCAMP;
                                    for (int k = 0; k < (int)pvpMapCommonInfo.bHeroNum; k++)
                                    {
                                        stBattlePlayer.astFighter[num].astChoiceHero[k].stBaseInfo.stCommonInfo.dwHeroID = (uint)dwHeroID;
                                    }
                                }
                                num++;
                            }
                        }
                    }
                    stBattlePlayer.bNum             = (byte)num;
                    roomInfo.roomAttrib.bWarmBattle = false;
                    roomInfo.roomAttrib.npcAILevel  = 2;
                    Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref cSPkg, true);

                    Singleton <WatchController> .GetInstance().Stop();
                }
            }
        }
Exemplo n.º 12
0
        private static void DoSelectAction(ref CFakePvPHelper.FakeHeroSelect fakeSelect)
        {
            if (!CFakePvPHelper.IsInSelectHero())
            {
                return;
            }
            if (fakeSelect.changeHeroCount < fakeSelect.maxChangeHeroCount)
            {
                uint num2;
                if (fakeSelect.FakePlayer.dwAcntPvpLevel <= 6u)
                {
                    int             num         = Random.Range(0, GameDataMgr.robotRookieHeroSkinDatabin.Count());
                    ResFakeAcntHero dataByIndex = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByIndex(num);
                    if (dataByIndex == null)
                    {
                        return;
                    }
                    num2 = dataByIndex.dwHeroID;
                    while (CFakePvPHelper.ChosenHeroes.ContainsValue(dataByIndex.dwHeroID))
                    {
                        num         = Random.Range(0, GameDataMgr.robotRookieHeroSkinDatabin.Count());
                        dataByIndex = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByIndex(num);
                        if (dataByIndex == null)
                        {
                            return;
                        }
                        num2 = dataByIndex.dwHeroID;
                    }
                }
                else
                {
                    CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    int num3 = GameDataMgr.robotVeteranHeroSkinDatabin.Count();
                    int max  = num3 + ((masterRoleInfo == null) ? 0 : masterRoleInfo.freeHeroList.get_Count());
                    int num  = Random.Range(0, max);
                    if (num < num3)
                    {
                        ResFakeAcntHero dataByIndex = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByIndex(num);
                        if (dataByIndex == null)
                        {
                            return;
                        }
                        num2 = dataByIndex.dwHeroID;
                    }
                    else
                    {
                        num2 = masterRoleInfo.freeHeroList.get_Item(num - num3).dwFreeHeroID;
                    }
                    while (CFakePvPHelper.ChosenHeroes.ContainsValue(num2))
                    {
                        num = Random.Range(0, max);
                        if (num < num3)
                        {
                            ResFakeAcntHero dataByIndex = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByIndex(num);
                            if (dataByIndex == null)
                            {
                                return;
                            }
                            num2 = dataByIndex.dwHeroID;
                        }
                        else
                        {
                            num2 = masterRoleInfo.freeHeroList.get_Item(num - num3).dwFreeHeroID;
                        }
                    }
                }
                CFakePvPHelper.ChosenHeroes.set_Item(fakeSelect.FakePlayer.ullUid, num2);
                fakeSelect.selectedHero = num2;
                fakeSelect.changeHeroCount++;
                RoomInfo roomInfo = Singleton <CHeroSelectBaseSystem> .get_instance().roomInfo;

                if (roomInfo == null)
                {
                    return;
                }
                MemberInfo memberInfo = roomInfo.GetMemberInfo(fakeSelect.FakePlayer.ullUid);
                if (memberInfo != null && memberInfo.ChoiceHero[0] != null)
                {
                    memberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = num2;
                    Singleton <CHeroSelectNormalSystem> .GetInstance().RefreshHeroPanel(false, true);
                }
            }
            else
            {
                if (fakeSelect.FakePlayer.dwAcntPvpLevel <= 6u)
                {
                    ResFakeAcntHero dataByKey = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByKey(fakeSelect.selectedHero);
                    if (dataByKey != null && dataByKey.dwSkinID != 0u)
                    {
                        int num4 = Random.Range(0, 10000);
                        if ((long)num4 < (long)((ulong)dataByKey.dwSkinRate))
                        {
                            fakeSelect.selectedSkin = (int)dataByKey.dwSkinID;
                        }
                    }
                }
                else
                {
                    ResFakeAcntHero dataByKey2 = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByKey(fakeSelect.selectedHero);
                    if (dataByKey2 != null && dataByKey2.dwSkinID != 0u)
                    {
                        int num5 = Random.Range(0, 10000);
                        if ((long)num5 < (long)((ulong)dataByKey2.dwSkinRate))
                        {
                            fakeSelect.selectedSkin = (int)dataByKey2.dwSkinID;
                        }
                    }
                }
                ResFakeAcntSkill dataByKey3 = GameDataMgr.robotPlayerSkillDatabin.GetDataByKey(fakeSelect.FakePlayer.dwAcntPvpLevel);
                if (dataByKey3 != null)
                {
                    int num6 = Random.Range(0, dataByKey3.SkillId.Length);
                    while (dataByKey3.SkillId[num6] == 0u)
                    {
                        num6 = Random.Range(0, dataByKey3.SkillId.Length);
                    }
                    uint selectedPlayerSkill = dataByKey3.SkillId[num6];
                    fakeSelect.selectedPlayerSkill = selectedPlayerSkill;
                }
                fakeSelect.bConfirmed = true;
                CFakePvPHelper.HeroConfirmedPlayerNum++;
                RoomInfo roomInfo2 = Singleton <CRoomSystem> .GetInstance().roomInfo;

                MemberInfo memberInfo2 = roomInfo2.GetMemberInfo(fakeSelect.FakePlayer.ullUid);
                if (memberInfo2 != null && memberInfo2.ChoiceHero[0] != null)
                {
                    memberInfo2.ChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeSelect.selectedPlayerSkill;
                    memberInfo2.isPrepare = true;
                    Singleton <CHeroSelectNormalSystem> .GetInstance().RefreshHeroPanel(false, true);
                }
                if (CFakePvPHelper.HeroConfirmedPlayerNum == CFakePvPHelper.FakeHeroSelectList.get_Count() + 1)
                {
                    CFakePvPHelper.ReqStartSingleWarmBattle();
                }
            }
        }
Exemplo n.º 13
0
        public static void OnRoomChange(CSPkg msg)
        {
            COMDT_ROOMCHG_CHGMEMBERPOS stChgMemberPos;
            MemberInfo info3;

            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

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

            if (roomInfo == null)
            {
                DebugHelper.Assert(false, "Room Info is NULL!!!");
                return;
            }
            bool flag = false;

            if (msg.stPkgData.stRoomChgNtf.stRoomChgInfo.iChgType == 0)
            {
                int        index = msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stPlayerAdd.iCamp - 1;
                MemberInfo item  = Singleton <CRoomSystem> .GetInstance().CreateMemInfo(ref msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stPlayerAdd.stMemInfo, (COM_PLAYERCAMP)msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stPlayerAdd.iCamp, roomInfo.roomAttrib.bWarmBattle);

                roomInfo.CampMemberList[index].Add(item);
                flag = true;
                goto Label_05C2;
            }
            if (msg.stPkgData.stRoomChgNtf.stRoomChgInfo.iChgType != 1)
            {
                if (msg.stPkgData.stRoomChgNtf.stRoomChgInfo.iChgType == 2)
                {
                    Singleton <CRoomSystem> .GetInstance().bInRoom = false;

                    Singleton <CUIManager> .GetInstance().CloseForm(PATH_CREATE_ROOM);

                    Singleton <CUIManager> .GetInstance().CloseForm(PATH_ROOM);

                    Singleton <CTopLobbyEntry> .GetInstance().CloseForm();

                    Singleton <CInviteSystem> .GetInstance().CloseInviteForm();

                    Singleton <CChatController> .instance.model.channelMgr.Clear(EChatChannel.Room, 0L, 0);

                    Singleton <CChatController> .instance.model.channelMgr.SetChatTab(CChatChannelMgr.EChatTab.Normal);

                    Singleton <CChatController> .instance.view.UpView(false);

                    Singleton <CChatController> .instance.model.sysData.ClearEntryText();

                    Singleton <CUIManager> .GetInstance().OpenTips("PVP_Room_Kick_Tip", true, 1f, null, new object[0]);

                    goto Label_05C2;
                }
                if (msg.stPkgData.stRoomChgNtf.stRoomChgInfo.iChgType == 4)
                {
                    roomInfo.roomOwner.ullUid      = msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stMasterChg.stNewMaster.ullMasterUid;
                    roomInfo.roomOwner.iGameEntity = msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stMasterChg.stNewMaster.iMasterGameEntity;
                    flag = true;
                    goto Label_05C2;
                }
                if (msg.stPkgData.stRoomChgNtf.stRoomChgInfo.iChgType != 5)
                {
                    if (msg.stPkgData.stRoomChgNtf.stRoomChgInfo.iChgType == 3)
                    {
                        enRoomState bOldState = (enRoomState)msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stStateChg.bOldState;
                        enRoomState bNewState = (enRoomState)msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stStateChg.bNewState;
                        if ((bOldState == enRoomState.E_ROOM_PREPARE) && (bNewState == enRoomState.E_ROOM_WAIT))
                        {
                            Singleton <LobbyLogic> .GetInstance().inMultiRoom = false;

                            Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.HeroSelect_CloseForm);

                            Singleton <CUIManager> .GetInstance().OpenForm(PATH_ROOM, false, true);

                            Singleton <CChatController> .instance.model.channelMgr.Clear(EChatChannel.Room, 0L, 0);

                            Singleton <CChatController> .instance.model.channelMgr.SetChatTab(CChatChannelMgr.EChatTab.Room);

                            Singleton <CChatController> .instance.ShowPanel(true, false);

                            Singleton <CChatController> .instance.view.UpView(true);

                            Singleton <CChatController> .instance.model.sysData.ClearEntryText();
                        }
                        if ((bOldState == enRoomState.E_ROOM_WAIT) && (bNewState == enRoomState.E_ROOM_CONFIRM))
                        {
                            CUIEvent uiEvent = new CUIEvent {
                                m_eventID = enUIEventID.Matching_OpenConfirmBox
                            };
                            uiEvent.m_eventParams.tag = roomInfo.roomAttrib.bPkAI;
                            Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(uiEvent);

                            if (roomInfo.roomAttrib.bWarmBattle)
                            {
                                CFakePvPHelper.SetConfirmFakeData();
                            }
                        }
                    }
                    goto Label_05C2;
                }
                stChgMemberPos = msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stChgMemberPos;
                if (stChgMemberPos.bNewCamp == stChgMemberPos.bOldCamp)
                {
                    for (int j = 0; j < roomInfo.CampMemberList[stChgMemberPos.bOldCamp - 1].Count; j++)
                    {
                        if (roomInfo.CampMemberList[stChgMemberPos.bOldCamp - 1][j].ullUid == stChgMemberPos.ullMemberUid)
                        {
                            roomInfo.CampMemberList[stChgMemberPos.bOldCamp - 1][j].dwPosOfCamp = stChgMemberPos.bNewPosOfCamp;
                            break;
                        }
                    }
                    goto Label_046C;
                }
                info3 = null;
                for (int i = 0; i < roomInfo.CampMemberList[stChgMemberPos.bOldCamp - 1].Count; i++)
                {
                    if (roomInfo.CampMemberList[stChgMemberPos.bOldCamp - 1][i].ullUid == stChgMemberPos.ullMemberUid)
                    {
                        info3 = roomInfo.CampMemberList[stChgMemberPos.bOldCamp - 1][i];
                        roomInfo.CampMemberList[stChgMemberPos.bOldCamp - 1].RemoveAt(i);
                        break;
                    }
                }
            }
            else
            {
                int num2 = msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stPlayerLeave.iCamp - 1;
                int bPos = msg.stPkgData.stRoomChgNtf.stRoomChgInfo.stChgInfo.stPlayerLeave.bPos;
                for (int k = 0; k < roomInfo.CampMemberList[num2].Count; k++)
                {
                    if (roomInfo.CampMemberList[num2][k].dwPosOfCamp == bPos)
                    {
                        roomInfo.CampMemberList[num2].RemoveAt(k);
                        break;
                    }
                }
                flag = true;
                goto Label_05C2;
            }
            DebugHelper.Assert(info3 != null, "oldMemberInfo is NULL!!");
            info3.camp        = (COM_PLAYERCAMP)stChgMemberPos.bNewCamp;
            info3.dwPosOfCamp = stChgMemberPos.bNewPosOfCamp;
            roomInfo.CampMemberList[stChgMemberPos.bNewCamp - 1].Add(info3);
Label_046C:
            flag = true;
Label_05C2:
            if (flag)
            {
                CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(PATH_ROOM);

                if (form != null)
                {
                    CRoomView.SetRoomData(form.gameObject, roomInfo);
                }
            }
        }