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();
                }
            }
        }
Exemple #2
0
        public static void UpdateConfirmBox(GameObject root, ulong confirmPlayerUid)
        {
            RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            DebugHelper.Assert(roomInfo != null, "Room Info is NULL!!!");
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "RoleInfo is NULL!!!");
            int currentMapPlayerNum = Singleton <CMatchingSystem> .GetInstance().currentMapPlayerNum;

            int confirmPlayerNum = Singleton <CMatchingSystem> .GetInstance().confirmPlayerNum;

            Transform transform = root.transform.Find("Panel/Panel/stateGroup");

            if (transform)
            {
                if ((roomInfo.roomAttrib.bMapType == 3 && masterRoleInfo != null && (int)CLadderSystem.GetGradeDataByShowGrade((int)masterRoleInfo.m_rankGrade).bLogicGrade >= CMatchingView.ShowDefaultHeadImgStartLogicLadderLevel && !roomInfo.roomAttrib.bWarmBattle) || roomInfo.roomAttrib.bMapType == 5)
                {
                    if (masterRoleInfo.playerUllUID == confirmPlayerUid)
                    {
                        CUICommonSystem.SetObjActive(transform.Find(string.Format("icon{0}/ready", confirmPlayerNum)), true);
                        CUICommonSystem.SetObjActive(transform.Find(string.Format("icon{0}/unready", confirmPlayerNum)), false);
                    }
                    else
                    {
                        CUITimerScript uITimerScript = CUICommonSystem.GetUITimerScript(transform.Find(string.Format("icon{0}", confirmPlayerNum)));
                        if (uITimerScript != null)
                        {
                            uITimerScript.SetTotalTime((float)Random.Range(1, 4));
                            uITimerScript.SetTimerEventId(enTimerEventType.TimeUp, enUIEventID.Matchingt_ShowConfirmHead);
                            uITimerScript.enabled = true;
                            uITimerScript.StartTimer();
                        }
                    }
                }
                else
                {
                    int num = 1;
                    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.ullUid == confirmPlayerUid)
                            {
                                Transform transform2 = transform.Find(string.Format("icon{0}/ready", num));
                                if (transform2)
                                {
                                    transform2.gameObject.CustomSetActive(true);
                                }
                                Transform transform3 = transform.Find(string.Format("icon{0}/unready", num));
                                if (transform3)
                                {
                                    transform3.gameObject.CustomSetActive(false);
                                }
                                break;
                            }
                            num++;
                        }
                    }
                }
            }
            bool      flag       = roomInfo.roomAttrib.bPkAI == 2;
            int       num2       = (!roomInfo.roomAttrib.bWarmBattle && flag) ? (currentMapPlayerNum / 2) : currentMapPlayerNum;
            Transform transform4 = root.transform.Find("Panel/Panel/TxtReadyNum");

            if (transform4)
            {
                Text component = transform4.GetComponent <Text>();
                if (component)
                {
                    component.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Matching_Confirm_PlayerNum"), confirmPlayerNum, num2));
                }
            }
            if (confirmPlayerUid == roomInfo.selfInfo.ullUid)
            {
                Transform transform5 = root.transform.Find("Panel/Panel/btnGroup/Button_Confirm");
                if (transform5 != null)
                {
                    Button component2 = transform5.GetComponent <Button>();
                    if (component2)
                    {
                        component2.set_interactable(false);
                    }
                }
            }
        }
        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();
                }
            }
        }
Exemple #4
0
        public static void InitConfirmBox(GameObject root, int PlayerNum, ref RoomInfo roomInfo, CUIFormScript form)
        {
            if (root.transform.Find("Panel/Timer") != null)
            {
                CUITimerScript component = root.transform.Find("Panel/Timer").GetComponent <CUITimerScript>();
                if (component != null)
                {
                    component.EndTimer();
                    component.StartTimer();
                }
            }
            if (root.transform.Find("Panel/Panel/Timer") != null)
            {
                CUITimerScript component2 = root.transform.Find("Panel/Panel/Timer").GetComponent <CUITimerScript>();
                if (component2 != null)
                {
                    component2.EndTimer();
                    component2.StartTimer();
                }
            }
            Transform       transform  = root.transform.Find("Panel/Panel/stateGroup");
            GridLayoutGroup component3 = transform.GetComponent <GridLayoutGroup>();

            if (component3)
            {
                component3.set_constraintCount((PlayerNum == 6) ? 3 : 5);
            }
            bool flag = roomInfo.roomAttrib.bPkAI == 2;
            int  num  = (!roomInfo.roomAttrib.bWarmBattle && flag) ? (PlayerNum / 2) : PlayerNum;

            for (int i = 1; i <= 10; i++)
            {
                GameObject gameObject = transform.Find(string.Format("icon{0}", i)).gameObject;
                gameObject.CustomSetActive(num >= i);
            }
            int num2 = 1;

            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 j = 0; j < listView.Count; j++)
                {
                    MemberInfo memberInfo     = listView[j];
                    Transform  transform2     = transform.Find(string.Format("icon{0}", num2));
                    CRoleInfo  masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if (!CSysDynamicBlock.bSocialBlocked)
                    {
                        if ((roomInfo.roomAttrib.bMapType == 3 && masterRoleInfo != null && (int)CLadderSystem.GetGradeDataByShowGrade((int)masterRoleInfo.m_rankGrade).bLogicGrade >= CMatchingView.ShowDefaultHeadImgStartLogicLadderLevel) || roomInfo.roomAttrib.bMapType == 5)
                        {
                            Image component4 = transform2.Find("HttpImage").GetComponent <Image>();
                            if (component4)
                            {
                                component4.SetSprite(CUIUtility.s_Sprite_Dynamic_BustPlayer_Dir + "Common_PlayerImg", form, true, false, false, false);
                            }
                        }
                        else
                        {
                            CUIHttpImageScript component5 = transform2.Find("HttpImage").GetComponent <CUIHttpImageScript>();
                            if (component5)
                            {
                                component5.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(memberInfo.MemberHeadUrl));
                            }
                        }
                    }
                    Transform transform3 = transform.Find(string.Format("icon{0}/ready", num2));
                    if (transform3)
                    {
                        transform3.gameObject.CustomSetActive(false);
                    }
                    Transform transform4 = transform.Find(string.Format("icon{0}/unready", num2));
                    if (transform4)
                    {
                        transform4.gameObject.CustomSetActive(true);
                    }
                    num2++;
                }
            }
            Transform transform5 = root.transform.Find("Panel/Panel/TxtReadyNum");

            if (transform5)
            {
                Text component6 = transform5.GetComponent <Text>();
                if (component6)
                {
                    component6.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Matching_Confirm_PlayerNum"), 0, num));
                }
            }
            Transform transform6 = root.transform.Find("Panel/Panel/btnGroup/Button_Confirm");

            if (transform6)
            {
                Button component7 = transform6.GetComponent <Button>();
                component7.set_interactable(true);
            }
        }
Exemple #5
0
        public static void UpdateConfirmBox(GameObject root, ulong confirmPlayerUid)
        {
            RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            DebugHelper.Assert(roomInfo != null, "Room Info is NULL!!!");
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "RoleInfo is NULL!!!");
            int currentMapPlayerNum = Singleton <CMatchingSystem> .GetInstance().currentMapPlayerNum;

            int confirmPlayerNum = Singleton <CMatchingSystem> .GetInstance().confirmPlayerNum;

            Transform transform = root.transform.Find("Panel/Panel/stateGroup");

            if (transform)
            {
                if ((roomInfo.roomAttrib.bMapType == 3 && masterRoleInfo != null && masterRoleInfo.m_rankGrade >= 7 && !roomInfo.roomAttrib.bWarmBattle) || roomInfo.roomAttrib.bMapType == 5)
                {
                    CUICommonSystem.SetObjActive(transform.Find(string.Format("icon{0}/ready", confirmPlayerNum)), true);
                    CUICommonSystem.SetObjActive(transform.Find(string.Format("icon{0}/unready", confirmPlayerNum)), false);
                }
                else
                {
                    int num = 1;
                    for (COM_PLAYERCAMP cOM_PLAYERCAMP = 1; cOM_PLAYERCAMP < 3; cOM_PLAYERCAMP++)
                    {
                        ListView <MemberInfo> listView = roomInfo[cOM_PLAYERCAMP];
                        for (int i = 0; i < listView.get_Count(); i++)
                        {
                            MemberInfo memberInfo = listView.get_Item(i);
                            if (memberInfo.ullUid == confirmPlayerUid)
                            {
                                Transform transform2 = transform.Find(string.Format("icon{0}/ready", num));
                                if (transform2)
                                {
                                    transform2.gameObject.CustomSetActive(true);
                                }
                                Transform transform3 = transform.Find(string.Format("icon{0}/unready", num));
                                if (transform3)
                                {
                                    transform3.gameObject.CustomSetActive(false);
                                }
                                break;
                            }
                            num++;
                        }
                    }
                }
            }
            bool flag = roomInfo.roomAttrib.bPkAI == 2;

            flag = (!roomInfo.roomAttrib.bWarmBattle && flag);
            int       num2       = (!flag) ? currentMapPlayerNum : (currentMapPlayerNum / 2);
            Transform transform4 = root.transform.Find("Panel/Panel/TxtReadyNum");

            if (transform4)
            {
                Text component = transform4.GetComponent <Text>();
                if (component)
                {
                    component.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Matching_Confirm_PlayerNum"), confirmPlayerNum, num2);
                }
            }
        }
Exemple #6
0
        public static void InitConfirmBox(GameObject root, int PlayerNum, ref RoomInfo roomInfo, CUIFormScript form)
        {
            if (root.transform.Find("Panel/Timer") != null)
            {
                CUITimerScript script = root.transform.Find("Panel/Timer").GetComponent <CUITimerScript>();
                if (script != null)
                {
                    script.EndTimer();
                    script.StartTimer();
                }
            }
            if (root.transform.Find("Panel/Panel/Timer") != null)
            {
                CUITimerScript script2 = root.transform.Find("Panel/Panel/Timer").GetComponent <CUITimerScript>();
                if (script2 != null)
                {
                    script2.EndTimer();
                    script2.StartTimer();
                }
            }
            Transform       transform = root.transform.Find("Panel/Panel/stateGroup");
            GridLayoutGroup component = transform.GetComponent <GridLayoutGroup>();

            if (component != null)
            {
                component.constraintCount = (PlayerNum != 6) ? 5 : 3;
            }
            bool flag = roomInfo.roomAttrib.bPkAI == 2;
            int  num  = !(!roomInfo.roomAttrib.bWarmBattle ? flag : false) ? PlayerNum : (PlayerNum / 2);

            for (int i = 1; i <= 10; i++)
            {
                transform.Find(string.Format("icon{0}", i)).gameObject.CustomSetActive(num >= i);
            }
            int num3 = 1;

            for (COM_PLAYERCAMP com_playercamp = COM_PLAYERCAMP.COM_PLAYERCAMP_1; com_playercamp < COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT; com_playercamp += 1)
            {
                ListView <MemberInfo> view = roomInfo[com_playercamp];
                for (int j = 0; j < view.Count; j++)
                {
                    MemberInfo info           = view[j];
                    Transform  transform2     = transform.Find(string.Format("icon{0}", num3));
                    CRoleInfo  masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if (!CSysDynamicBlock.bSocialBlocked)
                    {
                        if ((((roomInfo.roomAttrib.bMapType == 3) && (masterRoleInfo != null)) && (masterRoleInfo.m_rankGrade >= 7)) || (roomInfo.roomAttrib.bMapType == 5))
                        {
                            Image image = transform2.Find("HttpImage").GetComponent <Image>();
                            if (image != null)
                            {
                                image.SetSprite(CUIUtility.s_Sprite_Dynamic_BustPlayer_Dir + "Common_PlayerImg", form, true, false, false);
                            }
                        }
                        else
                        {
                            CUIHttpImageScript script3 = transform2.Find("HttpImage").GetComponent <CUIHttpImageScript>();
                            if (script3 != null)
                            {
                                script3.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(info.MemberHeadUrl));
                            }
                        }
                    }
                    Transform transform3 = transform.Find(string.Format("icon{0}/ready", num3));
                    if (transform3 != null)
                    {
                        transform3.gameObject.CustomSetActive(false);
                    }
                    Transform transform4 = transform.Find(string.Format("icon{0}/unready", num3));
                    if (transform4 != null)
                    {
                        transform4.gameObject.CustomSetActive(true);
                    }
                    num3++;
                }
            }
            Transform transform5 = root.transform.Find("Panel/Panel/TxtReadyNum");

            if (transform5 != null)
            {
                Text text = transform5.GetComponent <Text>();
                if (text != null)
                {
                    text.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Matching_Confirm_PlayerNum"), 0, num);
                }
            }
            Transform transform6 = root.transform.Find("Panel/Panel/btnGroup/Button_Confirm");

            if (transform6 != null)
            {
                transform6.GetComponent <Button>().interactable = true;
            }
        }
Exemple #7
0
        private static void ReqStartSingleWarmBattle()
        {
            bInFakeSelect = false;
            Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout));

            RemoveAllFakeTimer();
            CSPkg    msg      = NetworkModule.CreateDefaultCSPKG(0x41a);
            RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            if (roomInfo == null)
            {
                DebugHelper.Assert(roomInfo != null, "RoomInfo Should not be NULL!!!");
            }
            else if (roomInfo != null)
            {
                msg.stPkgData.stStartSingleGameReq.stBattleParam.bGameType = 1;
                msg.stPkgData.stStartSingleGameReq.stBattleParam.stGameDetail.stGameOfCombat = Singleton <CHeroSelectBaseSystem> .instance.m_stGameOfCombat;
                msg.stPkgData.stStartSingleGameReq.stBattleList.stBattleList.wHeroCnt        = 1;
                if (msg.stPkgData.stStartSingleGameReq.stBattleParam.stGameDetail.stGameOfCombat != null)
                {
                    MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo();
                    if (masterMemberInfo != null)
                    {
                        msg.stPkgData.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 camp     = COM_PLAYERCAMP.COM_PLAYERCAMP_1;
                            int            dwHeroID = 0;
                            for (COM_PLAYERCAMP com_playercamp2 = COM_PLAYERCAMP.COM_PLAYERCAMP_1; com_playercamp2 < COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT; com_playercamp2 += 1)
                            {
                                ListView <MemberInfo> view = roomInfo[com_playercamp2];
                                for (int i = 0; i < view.Count; i++)
                                {
                                    if (view[i].ullUid == roomInfo.selfInfo.ullUid)
                                    {
                                        camp     = view[i].camp;
                                        dwHeroID = (int)view[i].ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID;
                                        break;
                                    }
                                }
                            }
                            CSDT_BATTLE_PLAYER_BRIEF stBattlePlayer = msg.stPkgData.stStartSingleGameReq.stBattlePlayer;
                            int index = 0;
                            for (COM_PLAYERCAMP com_playercamp3 = COM_PLAYERCAMP.COM_PLAYERCAMP_1; com_playercamp3 < COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT; com_playercamp3 += 1)
                            {
                                ListView <MemberInfo> view2 = roomInfo[com_playercamp3];
                                for (int j = 0; j < view2.Count; j++)
                                {
                                    MemberInfo info4 = view2[j];
                                    if (info4 != null)
                                    {
                                        if (info4.RoomMemberType == 2)
                                        {
                                            stBattlePlayer.astFighter[index].bObjType   = 2;
                                            stBattlePlayer.astFighter[index].bPosOfCamp = (byte)j;
                                            stBattlePlayer.astFighter[index].bObjCamp   = (byte)com_playercamp3;
                                            stBattlePlayer.astFighter[index].dwLevel    = info4.dwMemberPvpLevel;
                                            FakeHeroSelect fakeHeroSelect = GetFakeHeroSelect(info4.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 = info4.WarmNpc.szUserName;
                                                stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc                    = new COMDT_PLAYERINFO_OF_NPC();
                                                stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.ullFakeUid         = info4.WarmNpc.ullUid;
                                                stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakePvpLevel     = info4.WarmNpc.dwAcntPvpLevel;
                                                stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakeLogicWorldID = info4.WarmNpc.dwLogicWorldId;
                                            }
                                        }
                                        else if (info4.RoomMemberType == 1)
                                        {
                                            stBattlePlayer.astFighter[index].bObjType   = 1;
                                            stBattlePlayer.astFighter[index].bPosOfCamp = (byte)j;
                                            stBattlePlayer.astFighter[index].bObjCamp   = (byte)camp;
                                            for (int k = 0; k < pvpMapCommonInfo.bHeroNum; k++)
                                            {
                                                stBattlePlayer.astFighter[index].astChoiceHero[k].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);
                        }
                    }
                    else
                    {
                        DebugHelper.Assert(roomInfo != null, "selfInfo Should not be NULL!!!");
                    }
                }
            }
        }
Exemple #8
0
        private static void DoSelectAction(ref FakeHeroSelect fakeSelect)
        {
            if (IsInSelectHero())
            {
                if (fakeSelect.changeHeroCount < fakeSelect.maxChangeHeroCount)
                {
                    int             id          = 0;
                    uint            dwHeroID    = 0;
                    ResFakeAcntHero dataByIndex = null;
                    if (fakeSelect.FakePlayer.dwAcntPvpLevel <= 6)
                    {
                        id          = UnityEngine.Random.Range(0, GameDataMgr.robotRookieHeroSkinDatabin.Count());
                        dataByIndex = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByIndex(id);
                        if (dataByIndex == null)
                        {
                            return;
                        }
                        for (dwHeroID = dataByIndex.dwHeroID; ChosenHeroes.ContainsValue(dataByIndex.dwHeroID); dwHeroID = dataByIndex.dwHeroID)
                        {
                            id          = UnityEngine.Random.Range(0, GameDataMgr.robotRookieHeroSkinDatabin.Count());
                            dataByIndex = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByIndex(id);
                            if (dataByIndex == null)
                            {
                                return;
                            }
                        }
                    }
                    else
                    {
                        CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                        int num3 = GameDataMgr.robotVeteranHeroSkinDatabin.Count();
                        int max  = num3 + ((masterRoleInfo == null) ? 0 : masterRoleInfo.freeHeroList.Count);
                        id = UnityEngine.Random.Range(0, max);
                        if (id < num3)
                        {
                            dataByIndex = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByIndex(id);
                            if (dataByIndex == null)
                            {
                                return;
                            }
                            dwHeroID = dataByIndex.dwHeroID;
                        }
                        else
                        {
                            dwHeroID = masterRoleInfo.freeHeroList[id - num3].dwFreeHeroID;
                        }
                        while (ChosenHeroes.ContainsValue(dwHeroID))
                        {
                            id = UnityEngine.Random.Range(0, max);
                            if (id < num3)
                            {
                                dataByIndex = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByIndex(id);
                                if (dataByIndex == null)
                                {
                                    return;
                                }
                                dwHeroID = dataByIndex.dwHeroID;
                            }
                            else
                            {
                                dwHeroID = masterRoleInfo.freeHeroList[id - num3].dwFreeHeroID;
                            }
                        }
                    }
                    ChosenHeroes[fakeSelect.FakePlayer.ullUid] = dwHeroID;
                    fakeSelect.selectedHero = dwHeroID;
                    fakeSelect.changeHeroCount++;
                    RoomInfo roomInfo = Singleton <CHeroSelectBaseSystem> .instance.roomInfo;
                    if (roomInfo != null)
                    {
                        MemberInfo memberInfo = roomInfo.GetMemberInfo(fakeSelect.FakePlayer.ullUid);
                        if ((memberInfo != null) && (memberInfo.ChoiceHero[0] != null))
                        {
                            memberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = dwHeroID;
                            Singleton <CHeroSelectNormalSystem> .GetInstance().RefreshHeroPanel(false, true);
                        }
                    }
                }
                else
                {
                    if (fakeSelect.FakePlayer.dwAcntPvpLevel <= 6)
                    {
                        ResFakeAcntHero hero2 = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByKey(fakeSelect.selectedHero);
                        if (((hero2 != null) && (hero2.dwSkinID != 0)) && (UnityEngine.Random.Range(0, 0x2710) < hero2.dwSkinRate))
                        {
                            fakeSelect.selectedSkin = (int)hero2.dwSkinID;
                        }
                    }
                    else
                    {
                        ResFakeAcntHero hero3 = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByKey(fakeSelect.selectedHero);
                        if (((hero3 != null) && (hero3.dwSkinID != 0)) && (UnityEngine.Random.Range(0, 0x2710) < hero3.dwSkinRate))
                        {
                            fakeSelect.selectedSkin = (int)hero3.dwSkinID;
                        }
                    }
                    ResFakeAcntSkill dataByKey = GameDataMgr.robotPlayerSkillDatabin.GetDataByKey(fakeSelect.FakePlayer.dwAcntPvpLevel);
                    if (dataByKey != null)
                    {
                        int index = UnityEngine.Random.Range(0, dataByKey.SkillId.Length);
                        while (dataByKey.SkillId[index] == 0)
                        {
                            index = UnityEngine.Random.Range(0, dataByKey.SkillId.Length);
                        }
                        uint num8 = dataByKey.SkillId[index];
                        fakeSelect.selectedPlayerSkill = num8;
                    }
                    fakeSelect.bConfirmed = true;
                    HeroConfirmedPlayerNum++;
                    MemberInfo info5 = Singleton <CRoomSystem> .GetInstance().roomInfo.GetMemberInfo(fakeSelect.FakePlayer.ullUid);

                    if ((info5 != null) && (info5.ChoiceHero[0] != null))
                    {
                        info5.ChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeSelect.selectedPlayerSkill;
                        info5.isPrepare = true;
                        Singleton <CHeroSelectNormalSystem> .GetInstance().RefreshHeroPanel(false, true);
                    }
                    if (HeroConfirmedPlayerNum == (FakeHeroSelectList.Count + 1))
                    {
                        ReqStartSingleWarmBattle();
                    }
                }
            }
        }