Example #1
0
        public void BuildRoomInfo(COMDT_MATCH_SUCC_DETAIL roomData)
        {
            this.roomInfo                        = new Assets.Scripts.GameSystem.RoomInfo();
            this.roomInfo.iRoomEntity            = roomData.iRoomEntity;
            this.roomInfo.dwRoomID               = roomData.dwRoomID;
            this.roomInfo.dwRoomSeq              = roomData.dwRoomSeq;
            this.roomInfo.roomAttrib.bGameMode   = roomData.stRoomInfo.bGameMode;
            this.roomInfo.roomAttrib.bPkAI       = roomData.stRoomInfo.bPkAI;
            this.roomInfo.roomAttrib.bMapType    = roomData.stRoomInfo.bMapType;
            this.roomInfo.roomAttrib.dwMapId     = roomData.stRoomInfo.dwMapId;
            this.roomInfo.roomAttrib.bWarmBattle = Convert.ToBoolean(roomData.stRoomInfo.bIsWarmBattle);
            this.roomInfo.roomAttrib.npcAILevel  = roomData.stRoomInfo.bAILevel;
            this.roomInfo.selfInfo.ullUid        = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo().playerUllUID;

            for (int i = 0; i < 2; i++)
            {
                COM_PLAYERCAMP camp = (COM_PLAYERCAMP)(i + 1);
                this.roomInfo.CampMemberList[i].Clear();
                for (int j = 0; j < roomData.stMemInfo.astCampMem[i].dwMemNum; j++)
                {
                    COMDT_ROOMMEMBER_DT memberDT = roomData.stMemInfo.astCampMem[i].astMemInfo[j];
                    MemberInfo          item     = this.CreateMemInfo(ref memberDT, camp, this.roomInfo.roomAttrib.bWarmBattle);
                    this.roomInfo.CampMemberList[i].Add(item);
                }
                this.SortCampMemList(ref this.roomInfo.CampMemberList[i]);
            }
        }
Example #2
0
        public static void BeginFakeSelectHero()
        {
            HeroConfirmedPlayerNum = 0;
            FakeHeroSelectList.Clear();
            ChosenHeroes.Clear();
            EnemyChosenHeroes.Clear();
            Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            DebugHelper.Assert(roomInfo != null);
            DebugHelper.Assert(roomInfo.roomAttrib.bWarmBattle);
            COM_PLAYERCAMP selfCamp = roomInfo.GetSelfCamp();

            for (int i = 0; i < roomInfo.CampMemberList[((int)selfCamp) - 1].Count; i++)
            {
                MemberInfo info2 = roomInfo.CampMemberList[((int)selfCamp) - 1][i];
                if (info2.RoomMemberType == 2)
                {
                    FakeHeroSelect item = new FakeHeroSelect {
                        FakePlayer         = info2.WarmNpc,
                        maxChangeHeroCount = UnityEngine.Random.Range(1, 4),
                        nextActionSec      = UnityEngine.Random.Range(3, 6)
                    };
                    FakeHeroSelectList.Add(item);
                }
            }
            if (FakeHeroSelectList.Count > 0)
            {
                Singleton <CTimerManager> .GetInstance().AddTimer(0x3e8, 60, new CTimer.OnTimeUpHandler(CFakePvPHelper.UpdateFakeSelectHero));

                bInFakeSelect = true;
            }
            Singleton <CTimerManager> .GetInstance().AddTimer(0xea60, 1, new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout));
        }
Example #3
0
        public override void UnInit()
        {
            this.roomInfo = null;
            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_OpenCreateForm, new CUIEventManager.OnUIEventHandler(this.OnRoom_OpenCreateForm));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_CreateRoom, new CUIEventManager.OnUIEventHandler(this.OnRoom_CreateRoom));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_CloseForm, new CUIEventManager.OnUIEventHandler(this.OnRoom_CloseForm));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_SelectMap, new CUIEventManager.OnUIEventHandler(this.OnRoom_SelectMap));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_OpenInvite, new CUIEventManager.OnUIEventHandler(this.OnRoom_OpenInvite));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_StartGame, new CUIEventManager.OnUIEventHandler(this.OnRoom_StartGame));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_AddRobot, new CUIEventManager.OnUIEventHandler(this.OnRoom_AddRobot));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_ChangePos, new CUIEventManager.OnUIEventHandler(this.OnRoom_ChangePos));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_KickPlayer, new CUIEventManager.OnUIEventHandler(this.OnRoom_KickPlayer));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_LeaveRoom, new CUIEventManager.OnUIEventHandler(this.OnRoom_LeaveRoom));

            Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Room_AddFriend, new CUIEventManager.OnUIEventHandler(this.OnRoom_AddFriend));

            base.UnInit();
        }
Example #4
0
        public static void SetStartBtnStatus(GameObject root, Assets.Scripts.GameSystem.RoomInfo data)
        {
            GameObject gameObject      = root.transform.Find("Panel_Main/Btn_Start").gameObject;
            bool       isSelfRoomOwner = Singleton <CRoomSystem> .GetInstance().IsSelfRoomOwner;

            gameObject.CustomSetActive(isSelfRoomOwner);
            if (isSelfRoomOwner)
            {
                Button component = gameObject.GetComponent <Button>();
                bool   flag2     = (data.CampMemberList[0].Count > 0) && (data.CampMemberList[1].Count > 0);
                component.interactable = flag2;
            }
        }
Example #5
0
        private static MemberInfo GetMemberInfo(Assets.Scripts.GameSystem.RoomInfo roomInfo, COM_PLAYERCAMP Camp, int Pos)
        {
            ListView <MemberInfo> view = roomInfo.CampMemberList[(Camp != COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? 1 : 0];

            for (int i = 0; i < view.Count; i++)
            {
                if (view[i].dwPosOfCamp == (Pos - 1))
                {
                    return(view[i]);
                }
            }
            return(null);
        }
Example #6
0
        public static void UpdateConfirmBox(GameObject root, ulong confirmPlayerUid)
        {
            Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

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

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

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

            if (transform != null)
            {
                int num3 = 1;
                for (int i = 0; i < roomInfo.CampMemberList.Length; i++)
                {
                    for (int j = 0; j < roomInfo.CampMemberList[i].Count; j++)
                    {
                        MemberInfo info2 = roomInfo.CampMemberList[i][j];
                        if (info2.ullUid == confirmPlayerUid)
                        {
                            Transform transform2 = transform.Find(string.Format("icon{0}/ready", num3));
                            if (transform2 != null)
                            {
                                transform2.gameObject.CustomSetActive(true);
                            }
                            Transform transform3 = transform.Find(string.Format("icon{0}/unready", num3));
                            if (transform3 != null)
                            {
                                transform3.gameObject.CustomSetActive(false);
                            }
                            break;
                        }
                        num3++;
                    }
                }
            }
            bool      flag       = roomInfo.roomAttrib.bPkAI == 2;
            int       num6       = !(!roomInfo.roomAttrib.bWarmBattle ? flag : false) ? currentMapPlayerNum : (currentMapPlayerNum / 2);
            Transform transform4 = root.transform.Find("Panel/Panel/TxtReadyNum");

            if (transform4 != null)
            {
                Text component = transform4.GetComponent <Text>();
                if (component != null)
                {
                    component.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Matching_Confirm_PlayerNum"), confirmPlayerNum, num6);
                }
            }
        }
Example #7
0
 public void UpdateRoomInfoReconnectPick(COMDT_DESKINFO inDeskInfo, CSDT_RECONN_CAMPPICKINFO[] inCampInfo)
 {
     this.roomInfo = new Assets.Scripts.GameSystem.RoomInfo();
     this.roomInfo.roomAttrib.bGameMode   = inDeskInfo.bGameMode;
     this.roomInfo.roomAttrib.bPkAI       = 0;
     this.roomInfo.roomAttrib.bMapType    = inDeskInfo.bMapType;
     this.roomInfo.roomAttrib.dwMapId     = inDeskInfo.dwMapId;
     this.roomInfo.roomAttrib.bWarmBattle = Convert.ToBoolean(inDeskInfo.bIsWarmBattle);
     this.roomInfo.roomAttrib.npcAILevel  = inDeskInfo.bAILevel;
     for (int i = 0; i < inCampInfo.Length; i++)
     {
         COM_PLAYERCAMP           com_playercamp           = (COM_PLAYERCAMP)(i + 1);
         CSDT_RECONN_CAMPPICKINFO csdt_reconn_camppickinfo = inCampInfo[i];
         this.roomInfo.CampMemberList[i].Clear();
         for (int j = 0; j < csdt_reconn_camppickinfo.dwPlayerNum; j++)
         {
             MemberInfo       item         = new MemberInfo();
             COMDT_PLAYERINFO stPlayerInfo = csdt_reconn_camppickinfo.astPlayerInfo[j].stPickHeroInfo.stPlayerInfo;
             item.isPrepare      = csdt_reconn_camppickinfo.astPlayerInfo[j].bIsPickOK > 0;
             item.RoomMemberType = stPlayerInfo.bObjType;
             item.dwPosOfCamp    = stPlayerInfo.bPosOfCamp;
             item.camp           = com_playercamp;
             item.dwMemberLevel  = stPlayerInfo.dwLevel;
             if (item.RoomMemberType == 1)
             {
                 item.ullUid           = stPlayerInfo.stDetail.stPlayerOfAcnt.ullUid;
                 item.dwMemberPvpLevel = stPlayerInfo.stDetail.stPlayerOfAcnt.dwPvpLevel;
             }
             item.dwObjId    = stPlayerInfo.dwObjId;
             item.MemberName = StringHelper.UTF8BytesToString(ref stPlayerInfo.szName);
             item.ChoiceHero = stPlayerInfo.astChoiceHero;
             item.isGM       = csdt_reconn_camppickinfo.astPlayerInfo[j].stPickHeroInfo.bIsGM > 0;
             if (stPlayerInfo.bObjType == 1)
             {
                 item.dwMemberHeadId = stPlayerInfo.stDetail.stPlayerOfAcnt.dwHeadId;
                 if (stPlayerInfo.stDetail.stPlayerOfAcnt.ullUid == Singleton <CRoleInfoManager> .instance.masterUUID)
                 {
                     this.roomInfo.selfObjID = stPlayerInfo.dwObjId;
                     Singleton <CHeroSelectSystem> .instance.ResetRandHeroLeftCount((int)csdt_reconn_camppickinfo.astPlayerInfo[j].stPickHeroInfo.dwRandomHeroCnt);
                 }
             }
             else if (stPlayerInfo.bObjType == 2)
             {
                 item.dwMemberHeadId = 1;
             }
             this.roomInfo.CampMemberList[i].Add(item);
         }
         this.SortCampMemList(ref this.roomInfo.CampMemberList[i]);
     }
 }
Example #8
0
        public static void OnSelfHeroConfirmed()
        {
            HeroConfirmedPlayerNum++;
            Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            roomInfo.GetMemberInfo(roomInfo.selfInfo.ullUid).isPrepare     = true;
            Singleton <CHeroSelectSystem> .GetInstance().m_isSelectConfirm = true;

            Singleton <CHeroSelectSystem> .GetInstance().RefreshHeroPanel(false);

            if (HeroConfirmedPlayerNum == (FakeHeroSelectList.Count + 1))
            {
                ReqStartSingleWarmBattle();
            }
        }
Example #9
0
        public static void FakeSendChat(string content)
        {
            Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            DebugHelper.Assert(roomInfo != null);
            CChatEntity chatEnt = new CChatEntity {
                ullUid        = roomInfo.selfInfo.ullUid,
                iLogicWorldID = (uint)roomInfo.selfInfo.iLogicWorldId,
                type          = EChaterType.Self,
                text          = content
            };

            CChatUT.GetUser(chatEnt.type, chatEnt.ullUid, chatEnt.iLogicWorldID, out chatEnt.name, out chatEnt.level, out chatEnt.head_url, out chatEnt.stGameVip);
            Singleton <CChatController> .instance.model.channelMgr.Add_ChatEntity(chatEnt, EChatChannel.Select_Hero, 0L, 0);

            Singleton <EventRouter> .instance.BroadCastEvent("Chat_HeorSelectChatData_Change");
        }
Example #10
0
        public static void OnSelfConfirmed(GameObject root, int PlayerNum)
        {
            CMatchingSystem instance = Singleton <CMatchingSystem> .GetInstance();

            instance.confirmPlayerNum++;
            Assets.Scripts.GameSystem.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)
                {
                    GotoHeroSelectPage();
                }
            }
        }
Example #11
0
        public static void SetRoomData(GameObject root, Assets.Scripts.GameSystem.RoomInfo data)
        {
            uint dwMapId = data.roomAttrib.dwMapId;
            ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId);

            DebugHelper.Assert(dataByKey != null);
            SetStartBtnStatus(root, data);
            UpdateBtnStatus(root, data);
            int bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum;

            root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref dataByKey.stLevelCommonInfo.szName);
            root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().text    = Singleton <CTextManager> .instance.GetText(string.Format("Common_Team_Player_Type_{0}", bMaxAcntNum / 2));

            GameObject gameObject = root.transform.Find("Panel_Main/Left_Player1").gameObject;
            MemberInfo memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 1);

            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 2);
            gameObject = root.transform.Find("Panel_Main/Left_Player2").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 2);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 4);
            gameObject = root.transform.Find("Panel_Main/Left_Player3").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 3);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 6);
            gameObject = root.transform.Find("Panel_Main/Left_Player4").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 4);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 8);
            gameObject = root.transform.Find("Panel_Main/Left_Player5").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 5);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 10);
            gameObject = root.transform.Find("Panel_Main/Right_Player1").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 1);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 2);
            gameObject = root.transform.Find("Panel_Main/Right_Player2").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 2);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 4);
            gameObject = root.transform.Find("Panel_Main/Right_Player3").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 3);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 6);
            gameObject = root.transform.Find("Panel_Main/Right_Player4").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 4);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 8);
            gameObject = root.transform.Find("Panel_Main/Right_Player5").gameObject;
            memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 5);
            SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 10);
        }
Example #12
0
        private static void OnConfirmTimout(int seq)
        {
            bInFakeConfirm = false;
            Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo;

            if (roomInfo != null)
            {
                roomInfo.roomAttrib.bWarmBattle = false;
            }
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CMatchingSystem.PATH_MATCHING_CONFIRMBOX);

            if (form != null)
            {
                Singleton <CUIManager> .GetInstance().CloseForm(form);

                Singleton <CUIManager> .GetInstance().OpenTips(Singleton <CTextManager> .GetInstance().GetText("Err_NM_Cancel"), false, 1f, null, new object[0]);

                CSPkg msg = NetworkModule.CreateDefaultCSPKG(0x422);
                Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref msg, false);
            }
        }
Example #13
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();
                }
            }
        }
Example #14
0
        public void BuildRoomInfo(COMDT_JOINMULTGAMERSP_SUCC roomData)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                this.roomInfo                        = new Assets.Scripts.GameSystem.RoomInfo();
                this.roomInfo.iRoomEntity            = roomData.iRoomEntity;
                this.roomInfo.dwRoomID               = roomData.dwRoomID;
                this.roomInfo.dwRoomSeq              = roomData.dwRoomSeq;
                this.roomInfo.roomAttrib.bGameMode   = roomData.stRoomInfo.bGameMode;
                this.roomInfo.roomAttrib.bPkAI       = 0;
                this.roomInfo.roomAttrib.bMapType    = roomData.stRoomInfo.bMapType;
                this.roomInfo.roomAttrib.dwMapId     = roomData.stRoomInfo.dwMapId;
                this.roomInfo.roomAttrib.bWarmBattle = false;
                this.roomInfo.roomAttrib.npcAILevel  = 2;
                this.roomInfo.selfInfo.ullUid        = roomData.ullSelfUid;
                this.roomInfo.selfInfo.iGameEntity   = roomData.iSelfGameEntity;
                this.roomInfo.roomOwner.ullUid       = roomData.stRoomMaster.ullMasterUid;
                this.roomInfo.roomOwner.iGameEntity  = roomData.stRoomMaster.iMasterGameEntity;
                for (int i = 0; i < 2; i++)
                {
                    COM_PLAYERCAMP camp = (COM_PLAYERCAMP)(i + 1);
                    this.roomInfo.CampMemberList[i].Clear();
                    for (int j = 0; j < roomData.stMemInfo.astCampMem[i].dwMemNum; j++)
                    {
                        COMDT_ROOMMEMBER_DT memberDT = roomData.stMemInfo.astCampMem[i].astMemInfo[j];
                        MemberInfo          item     = this.CreateMemInfo(ref memberDT, camp, this.roomInfo.roomAttrib.bWarmBattle);
                        if (item.ullUid == masterRoleInfo.playerUllUID)
                        {
                            this.roomInfo.selfObjID = item.dwObjId;
                        }
                        this.roomInfo.CampMemberList[i].Add(item);
                    }
                    this.SortCampMemList(ref this.roomInfo.CampMemberList[i]);
                }
            }
        }
Example #15
0
 public void Clear()
 {
     this.bInRoom  = false;
     this.roomInfo = null;
 }
Example #16
0
        public void UpdateRoomInfo(COMDT_DESKINFO inDeskInfo, CSDT_CAMPINFO[] inCampInfo)
        {
            uint dwObjId = 0;

            if (this.roomInfo == null)
            {
                this.roomInfo = new Assets.Scripts.GameSystem.RoomInfo();
                this.roomInfo.roomAttrib.bGameMode   = inDeskInfo.bGameMode;
                this.roomInfo.roomAttrib.bPkAI       = 0;
                this.roomInfo.roomAttrib.bMapType    = inDeskInfo.bMapType;
                this.roomInfo.roomAttrib.dwMapId     = inDeskInfo.dwMapId;
                this.roomInfo.roomAttrib.bWarmBattle = Convert.ToBoolean(inDeskInfo.bIsWarmBattle);
                this.roomInfo.roomAttrib.npcAILevel  = inDeskInfo.bAILevel;
                for (int i = 0; i < inCampInfo.Length; i++)
                {
                    COM_PLAYERCAMP com_playercamp = (COM_PLAYERCAMP)(i + 1);
                    CSDT_CAMPINFO  csdt_campinfo  = inCampInfo[i];
                    this.roomInfo.CampMemberList[i].Clear();
                    for (int j = 0; j < csdt_campinfo.dwPlayerNum; j++)
                    {
                        MemberInfo       item         = new MemberInfo();
                        COMDT_PLAYERINFO stPlayerInfo = csdt_campinfo.astCampPlayerInfo[j].stPlayerInfo;
                        item.RoomMemberType = stPlayerInfo.bObjType;
                        item.dwPosOfCamp    = stPlayerInfo.bPosOfCamp;
                        item.camp           = com_playercamp;
                        item.dwMemberLevel  = stPlayerInfo.dwLevel;
                        if (item.RoomMemberType == 1)
                        {
                            item.dwMemberPvpLevel = stPlayerInfo.stDetail.stPlayerOfAcnt.dwPvpLevel;
                        }
                        item.dwObjId    = stPlayerInfo.dwObjId;
                        item.MemberName = StringHelper.UTF8BytesToString(ref stPlayerInfo.szName);
                        item.ChoiceHero = stPlayerInfo.astChoiceHero;
                        if (stPlayerInfo.bObjType == 1)
                        {
                            item.dwMemberHeadId = stPlayerInfo.stDetail.stPlayerOfAcnt.dwHeadId;
                            if (stPlayerInfo.stDetail.stPlayerOfAcnt.ullUid == Singleton <CRoleInfoManager> .instance.masterUUID)
                            {
                                dwObjId = stPlayerInfo.dwObjId;
                                Singleton <CHeroSelectSystem> .instance.ResetRandHeroLeftCount((int)csdt_campinfo.astCampPlayerInfo[j].dwRandomHeroCnt);
                            }
                        }
                        else if (stPlayerInfo.bObjType == 2)
                        {
                            item.dwMemberHeadId = 1;
                        }
                        this.roomInfo.CampMemberList[i].Add(item);
                    }
                    this.SortCampMemList(ref this.roomInfo.CampMemberList[i]);
                }
            }
            else
            {
                this.roomInfo.roomAttrib.bGameMode = inDeskInfo.bGameMode;
                this.roomInfo.roomAttrib.bPkAI     = 0;
                this.roomInfo.roomAttrib.bMapType  = inDeskInfo.bMapType;
                this.roomInfo.roomAttrib.dwMapId   = inDeskInfo.dwMapId;
                for (int k = 0; k < inCampInfo.Length; k++)
                {
                    COM_PLAYERCAMP camp           = (COM_PLAYERCAMP)(k + 1);
                    CSDT_CAMPINFO  csdt_campinfo2 = inCampInfo[k];
                    for (int m = 0; m < csdt_campinfo2.dwPlayerNum; m++)
                    {
                        COMDT_PLAYERINFO comdt_playerinfo2 = csdt_campinfo2.astCampPlayerInfo[m].stPlayerInfo;
                        MemberInfo       memberInfo        = this.roomInfo.GetMemberInfo(camp, comdt_playerinfo2.bPosOfCamp);
                        if (memberInfo != null)
                        {
                            memberInfo.dwObjId    = comdt_playerinfo2.dwObjId;
                            memberInfo.camp       = camp;
                            memberInfo.ChoiceHero = comdt_playerinfo2.astChoiceHero;
                            if ((comdt_playerinfo2.bObjType == 1) && (comdt_playerinfo2.stDetail.stPlayerOfAcnt.ullUid == Singleton <CRoleInfoManager> .instance.masterUUID))
                            {
                                dwObjId = comdt_playerinfo2.dwObjId;
                                Singleton <CHeroSelectSystem> .instance.ResetRandHeroLeftCount((int)csdt_campinfo2.astCampPlayerInfo[m].dwRandomHeroCnt);
                            }
                        }
                    }
                }
            }
            this.roomInfo.selfObjID = dwObjId;
        }
Example #17
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);
                }
            }
        }
Example #18
0
        public static void InitConfirmBox(GameObject root, int PlayerNum, ref Assets.Scripts.GameSystem.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 (int j = 0; j < roomInfo.CampMemberList.Length; j++)
            {
                for (int k = 0; k < roomInfo.CampMemberList[j].Count; k++)
                {
                    MemberInfo info           = roomInfo.CampMemberList[j][k];
                    Transform  transform2     = transform.Find(string.Format("icon{0}", num3));
                    CRoleInfo  masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if ((((roomInfo.roomAttrib.bMapType == 3) && (masterRoleInfo != null)) && (masterRoleInfo.m_gradeOfRank >= 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;
            }
        }
Example #19
0
        private static void DoSelectAction(ref FakeHeroSelect fakeSelect)
        {
            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];
                    }
                    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];
                        }
                    }
                }
                ChosenHeroes[fakeSelect.FakePlayer.ullUid] = dwHeroID;
                fakeSelect.selectedHero = dwHeroID;
                fakeSelect.changeHeroCount++;
                Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CHeroSelectSystem> .GetInstance().m_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 <CHeroSelectSystem> .GetInstance().RefreshHeroPanel(false);
                    }
                }
            }
            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 <CHeroSelectSystem> .GetInstance().RefreshHeroPanel(false);
                }
                if (HeroConfirmedPlayerNum == (FakeHeroSelectList.Count + 1))
                {
                    ReqStartSingleWarmBattle();
                }
            }
        }
Example #20
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);
                }
            }
        }
Example #21
0
        public static void UpdateBtnStatus(GameObject root, Assets.Scripts.GameSystem.RoomInfo data)
        {
            uint dwMapId = data.roomAttrib.dwMapId;
            ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId);

            DebugHelper.Assert(dataByKey != null);
            int  bMaxAcntNum     = dataByKey.stLevelCommonInfo.bMaxAcntNum;
            bool isSelfRoomOwner = Singleton <CRoomSystem> .GetInstance().IsSelfRoomOwner;

            GameObject gameObject = root.transform.Find("Panel_Main/bg1/LeftRobot").gameObject;
            GameObject obj3       = root.transform.Find("Panel_Main/bg1/LeftJoin").gameObject;
            GameObject obj4       = root.transform.Find("Panel_Main/bg2/RightRobot").gameObject;
            GameObject obj5       = root.transform.Find("Panel_Main/bg2/RightJoin").gameObject;

            gameObject.CustomSetActive(false);
            obj3.CustomSetActive(false);
            obj4.CustomSetActive(false);
            obj5.CustomSetActive(false);
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

            if (isSelfRoomOwner)
            {
                if (masterRoleInfo != null)
                {
                    MemberInfo memberInfo = data.GetMemberInfo(masterRoleInfo.playerUllUID);
                    if (memberInfo != null)
                    {
                        COM_PLAYERCAMP camp = (memberInfo.camp != COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? COM_PLAYERCAMP.COM_PLAYERCAMP_1 : COM_PLAYERCAMP.COM_PLAYERCAMP_2;
                        if (data.GetFreePos(memberInfo.camp, bMaxAcntNum) >= 0)
                        {
                            if (memberInfo.camp == COM_PLAYERCAMP.COM_PLAYERCAMP_1)
                            {
                                gameObject.CustomSetActive(true);
                            }
                            else
                            {
                                obj4.CustomSetActive(true);
                            }
                        }
                        if (data.GetFreePos(camp, bMaxAcntNum) >= 0)
                        {
                            if (camp == COM_PLAYERCAMP.COM_PLAYERCAMP_1)
                            {
                                gameObject.CustomSetActive(true);
                                obj3.CustomSetActive(true);
                            }
                            else
                            {
                                obj4.CustomSetActive(true);
                                obj5.CustomSetActive(true);
                            }
                        }
                    }
                }
            }
            else if (masterRoleInfo != null)
            {
                MemberInfo info4 = data.GetMemberInfo(masterRoleInfo.playerUllUID);
                if (info4 != null)
                {
                    COM_PLAYERCAMP com_playercamp2 = (info4.camp != COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? COM_PLAYERCAMP.COM_PLAYERCAMP_1 : COM_PLAYERCAMP.COM_PLAYERCAMP_2;
                    if (data.GetFreePos(com_playercamp2, bMaxAcntNum) >= 0)
                    {
                        if (com_playercamp2 == COM_PLAYERCAMP.COM_PLAYERCAMP_1)
                        {
                            obj3.CustomSetActive(true);
                        }
                        else
                        {
                            obj5.CustomSetActive(true);
                        }
                    }
                }
            }
            CUIEventScript component = gameObject.GetComponent <CUIEventScript>();

            component.m_onClickEventID         = enUIEventID.Room_AddRobot;
            component.m_onClickEventParams.tag = 1;
            component = obj3.GetComponent <CUIEventScript>();
            component.m_onClickEventID         = enUIEventID.Room_ChangePos;
            component.m_onClickEventParams.tag = 1;
            component = obj4.GetComponent <CUIEventScript>();
            component.m_onClickEventID         = enUIEventID.Room_AddRobot;
            component.m_onClickEventParams.tag = 2;
            component = obj5.GetComponent <CUIEventScript>();
            component.m_onClickEventID         = enUIEventID.Room_ChangePos;
            component.m_onClickEventParams.tag = 2;
        }
Example #22
0
        public static void InitMapDataInfo()
        {
            Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CHeroSelectSystem> .GetInstance().m_roomInfo;

            ResDT_LevelCommonInfo mapData = Singleton <CHeroSelectSystem> .GetInstance().m_mapData;

            DebugHelper.Assert(roomInfo != null);
            uint dwMapId = roomInfo.roomAttrib.dwMapId;

            if (roomInfo.roomAttrib.bMapType == 1)
            {
                ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(dataByKey != null);
                mapData.szName           = dataByKey.stLevelCommonInfo.szName;
                mapData.szDesignFileName = dataByKey.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = dataByKey.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = dataByKey.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = dataByKey.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = dataByKey.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = dataByKey.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = dataByKey.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = dataByKey.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = dataByKey.stLevelCommonInfo.iHeroAIType;
            }
            else if (roomInfo.roomAttrib.bMapType == 3)
            {
                ResRankLevelInfo info4 = GameDataMgr.rankLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info4 != null);
                mapData.szName           = info4.stLevelCommonInfo.szName;
                mapData.szDesignFileName = info4.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = info4.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = info4.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = info4.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = info4.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = info4.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = info4.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = info4.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = info4.stLevelCommonInfo.iHeroAIType;
            }
            else if (roomInfo.roomAttrib.bMapType == 2)
            {
                ResCounterPartLevelInfo info5 = GameDataMgr.cpLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info5 != null);
                mapData.szName           = info5.stLevelCommonInfo.szName;
                mapData.szDesignFileName = info5.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = info5.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = info5.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = info5.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = info5.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = info5.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = info5.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = info5.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = info5.stLevelCommonInfo.iHeroAIType;
            }
            else if (roomInfo.roomAttrib.bMapType == 4)
            {
                ResAcntBattleLevelInfo info6 = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info6 != null);
                mapData.szName           = info6.stLevelCommonInfo.szName;
                mapData.szDesignFileName = info6.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = info6.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = info6.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = info6.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = info6.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = info6.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = info6.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = info6.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = info6.stLevelCommonInfo.iHeroAIType;
            }
            else if (roomInfo.roomAttrib.bMapType == 5)
            {
                ResRewardMatchLevelInfo info7 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info7 != null);
                mapData.szName           = info7.stLevelCommonInfo.szName;
                mapData.szDesignFileName = info7.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = info7.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = info7.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = info7.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = info7.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = info7.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = info7.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = info7.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = info7.stLevelCommonInfo.iHeroAIType;
                Singleton <CHeroSelectSystem> .GetInstance().m_mapSubType = (int)info7.dwSubType;
            }
            CSDT_SINGLE_GAME_OF_COMBAT reportInfo = new CSDT_SINGLE_GAME_OF_COMBAT {
                bRoomType = (byte)Singleton <CHeroSelectSystem> .GetInstance().m_roomType,
                dwMapId   = roomInfo.roomAttrib.dwMapId,
                bMapType  = roomInfo.roomAttrib.bMapType,
                bAILevel  = roomInfo.roomAttrib.npcAILevel
            };
            byte bHeroNum     = mapData.bHeroNum;
            uint dwHeroFormId = mapData.dwHeroFormId;

            Singleton <CHeroSelectSystem> .GetInstance().SetPVEDataWithCombat(bHeroNum, dwHeroFormId, reportInfo, "Room Type");
        }