コード例 #1
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.get_Count() > CFakePvPHelper.ChosenHeroes.get_Count(), "May have not enough Candidate Heroes!!!");
                    int       num      = Random.Range(0, pvPHeroList.get_Count());
                    IHeroData heroData = pvPHeroList.get_Item(num);
                    while (CFakePvPHelper.ChosenHeroes.ContainsValue(heroData.cfgID))
                    {
                        num      = Random.Range(0, pvPHeroList.get_Count());
                        heroData = pvPHeroList.get_Item(num);
                    }
                    MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo();
                    masterMemberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = heroData.cfgID;
                    CFakePvPHelper.ReqStartSingleWarmBattle();
                }
            }
        }
コード例 #2
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();
            }
        }
コード例 #3
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();
                }
            }
        }