Esempio n. 1
0
        public static void SetPlayerSlotData(GameObject item, TeamMember memberInfo, bool bAvailable)
        {
            if (bAvailable)
            {
                bool bActive          = false;
                bool flag2            = false;
                bool isSelfTeamMaster = Singleton <CMatchingSystem> .GetInstance().IsSelfTeamMaster;

                if (memberInfo == null)
                {
                    item.CustomSetActive(true);
                    item.transform.Find("Occupied").gameObject.CustomSetActive(false);
                }
                else
                {
                    PlayerUniqueID stTeamMaster = Singleton <CMatchingSystem> .GetInstance().teamInfo.stTeamMaster;

                    bActive = (stTeamMaster.ullUid == memberInfo.uID.ullUid) && (stTeamMaster.iGameEntity == memberInfo.uID.iGameEntity);
                    PlayerUniqueID stSelfInfo = Singleton <CMatchingSystem> .GetInstance().teamInfo.stSelfInfo;

                    flag2 = (stSelfInfo.ullUid == memberInfo.uID.ullUid) && (stSelfInfo.iGameEntity == memberInfo.uID.iGameEntity);
                    item.CustomSetActive(true);
                    item.transform.Find("Occupied").gameObject.CustomSetActive(true);
                    Utility.GetComponetInChild <CUIEventScript>(item, "Occupied/BtnKick").m_onClickEventParams.tag = (int)memberInfo.dwPosOfTeam;
                    CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CInviteSystem.PATH_INVITE_FORM);

                    bool flag4 = true;
                    if (form != null)
                    {
                        flag4 = form.GetWidget(7).GetComponent <CUIListScript>().GetSelectedIndex() == 0;
                    }
                    string str = !flag4 ? Singleton <CInviteSystem> .GetInstance().GetInviteGuildMemberName(memberInfo.uID.ullUid) : Singleton <CInviteSystem> .GetInstance().GetInviteFriendName(memberInfo.uID.ullUid, (uint)memberInfo.uID.iLogicWorldId);

                    item.transform.Find("Occupied/txtPlayerName").GetComponent <Text>().text = !string.IsNullOrEmpty(str) ? str : memberInfo.MemberName;
                    item.transform.Find("Occupied/BtnKick").gameObject.CustomSetActive(isSelfTeamMaster && !flag2);
                    Transform transform  = item.transform.Find("Occupied/HeadBg/NobeIcon");
                    Transform transform2 = item.transform.Find("Occupied/HeadBg/NobeImag");
                    Transform transform3 = item.transform.Find("Occupied/BtnAddFriend");
                    if (flag2)
                    {
                        if (!CSysDynamicBlock.bFriendBlocked)
                        {
                            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo != null)
                            {
                                Transform transform4 = item.transform.Find("Occupied/HeadBg/imgHead");
                                if (transform4 != null)
                                {
                                    transform4.GetComponent <CUIHttpImageScript>().SetImageUrl(masterRoleInfo.HeadUrl);
                                }
                            }
                        }
                        if (transform3 != null)
                        {
                            transform3.gameObject.CustomSetActive(false);
                        }
                    }
                    else
                    {
                        bool flag5 = Singleton <CFriendContoller> .instance.model.IsGameFriend(memberInfo.uID.ullUid, (uint)memberInfo.uID.iLogicWorldId);

                        COMDT_FRIEND_INFO comdt_friend_info = Singleton <CFriendContoller> .instance.model.getFriendByUid(memberInfo.uID.ullUid, !flag5?CFriendModel.FriendType.SNS : CFriendModel.FriendType.GameFriend);

                        if (comdt_friend_info != null)
                        {
                            string str2 = Utility.UTF8Convert(comdt_friend_info.szHeadUrl);
                            if (!string.IsNullOrEmpty(str2) && !CSysDynamicBlock.bFriendBlocked)
                            {
                                Transform transform5 = item.transform.Find("Occupied/HeadBg/imgHead");
                                if (transform5 != null)
                                {
                                    transform5.GetComponent <CUIHttpImageScript>().SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(str2));
                                }
                            }
                        }
                        if (!CSysDynamicBlock.bFriendBlocked)
                        {
                            if (Singleton <CFriendContoller> .instance.model.GetGameOrSnsFriend(memberInfo.uID.ullUid, (uint)memberInfo.uID.iLogicWorldId) == null)
                            {
                                if (transform3 != null)
                                {
                                    transform3.gameObject.CustomSetActive(true);
                                    CUIEventScript component = transform3.GetComponent <CUIEventScript>();
                                    if (component != null)
                                    {
                                        component.m_onClickEventParams.commonUInt64Param1 = memberInfo.uID.ullUid;
                                        component.m_onClickEventParams.commonUInt32Param1 = (uint)memberInfo.uID.iLogicWorldId;
                                    }
                                }
                            }
                            else if (transform3 != null)
                            {
                                transform3.gameObject.CustomSetActive(false);
                            }
                        }
                        else if (transform3 != null)
                        {
                            transform3.gameObject.CustomSetActive(false);
                        }
                    }
                }
                item.transform.Find("Occupied/imgOwner").gameObject.CustomSetActive(bActive);
            }
            else
            {
                item.CustomSetActive(false);
            }
        }
Esempio n. 2
0
        public static void SetPlayerSlotData(GameObject item, TeamMember memberInfo, bool bAvailable)
        {
            if (bAvailable)
            {
                bool bActive          = false;
                bool isSelfTeamMaster = Singleton <CMatchingSystem> .GetInstance().IsSelfTeamMaster;

                if (memberInfo == null)
                {
                    item.CustomSetActive(true);
                    item.transform.Find("Occupied").gameObject.CustomSetActive(false);
                }
                else
                {
                    PlayerUniqueID stTeamMaster = Singleton <CMatchingSystem> .GetInstance().teamInfo.stTeamMaster;

                    bActive = (stTeamMaster.ullUid == memberInfo.uID.ullUid && stTeamMaster.iGameEntity == memberInfo.uID.iGameEntity);
                    PlayerUniqueID stSelfInfo = Singleton <CMatchingSystem> .GetInstance().teamInfo.stSelfInfo;

                    bool flag = stSelfInfo.ullUid == memberInfo.uID.ullUid && stSelfInfo.iGameEntity == memberInfo.uID.iGameEntity;
                    item.CustomSetActive(true);
                    item.transform.Find("Occupied").gameObject.CustomSetActive(true);
                    CUIEventScript componetInChild = Utility.GetComponetInChild <CUIEventScript>(item, "Occupied/BtnKick");
                    componetInChild.m_onClickEventParams.tag = (int)memberInfo.dwPosOfTeam;
                    CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CInviteSystem.PATH_INVITE_FORM);

                    bool flag2 = true;
                    if (form != null)
                    {
                        CUIListScript component = form.GetWidget(7).GetComponent <CUIListScript>();
                        flag2 = (component.GetSelectedIndex() == 0);
                    }
                    string text = flag2 ? Singleton <CInviteSystem> .GetInstance().GetInviteFriendName(memberInfo.uID.ullUid, (uint)memberInfo.uID.iLogicWorldId) : Singleton <CInviteSystem> .GetInstance().GetInviteGuildMemberName(memberInfo.uID.ullUid);

                    item.transform.Find("Occupied/txtPlayerName").GetComponent <Text>().set_text(string.IsNullOrEmpty(text) ? memberInfo.MemberName : text);
                    item.transform.Find("Occupied/BtnKick").gameObject.CustomSetActive(isSelfTeamMaster && !flag);
                    Transform transform  = item.transform.Find("Occupied/HeadBg/NobeIcon");
                    Transform transform2 = item.transform.Find("Occupied/HeadBg/NobeImag");
                    Transform transform3 = item.transform.Find("Occupied/BtnAddFriend");
                    if (flag)
                    {
                        if (!CSysDynamicBlock.bFriendBlocked)
                        {
                            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo != null)
                            {
                                Transform transform4 = item.transform.Find("Occupied/HeadBg/imgHead");
                                if (transform4)
                                {
                                    transform4.GetComponent <CUIHttpImageScript>().SetImageUrl(masterRoleInfo.HeadUrl);
                                }
                            }
                        }
                        if (transform3 != null)
                        {
                            transform3.gameObject.CustomSetActive(false);
                        }
                    }
                    else
                    {
                        Transform transform5 = item.transform.Find("Occupied/HeadBg/imgHead");
                        if (!CSysDynamicBlock.bFriendBlocked)
                        {
                            if (transform5)
                            {
                                transform5.GetComponent <CUIHttpImageScript>().SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(memberInfo.snsHeadUrl));
                            }
                        }
                        else if (transform5)
                        {
                            transform5.GetComponent <CUIHttpImageScript>().SetImageUrl(null);
                        }
                        if (!CSysDynamicBlock.bFriendBlocked)
                        {
                            if (Singleton <CFriendContoller> .instance.model.GetGameOrSnsFriend(memberInfo.uID.ullUid, (uint)memberInfo.uID.iLogicWorldId) == null)
                            {
                                if (transform3 != null)
                                {
                                    transform3.gameObject.CustomSetActive(true);
                                    CUIEventScript component2 = transform3.GetComponent <CUIEventScript>();
                                    if (component2 != null)
                                    {
                                        component2.m_onClickEventParams.commonUInt64Param1 = memberInfo.uID.ullUid;
                                        component2.m_onClickEventParams.commonUInt32Param1 = (uint)memberInfo.uID.iLogicWorldId;
                                    }
                                }
                            }
                            else if (transform3 != null)
                            {
                                transform3.gameObject.CustomSetActive(false);
                            }
                        }
                        else if (transform3 != null)
                        {
                            transform3.gameObject.CustomSetActive(false);
                        }
                    }
                }
                item.transform.Find("Occupied/imgOwner").gameObject.CustomSetActive(bActive);
            }
            else
            {
                item.CustomSetActive(false);
            }
        }
Esempio n. 3
0
        public static void SetTeamData(GameObject root, TeamInfo data)
        {
            uint dwMapId     = data.stTeamInfo.dwMapId;
            int  bMapType    = data.stTeamInfo.bMapType;
            int  bMaxAcntNum = 0;

            switch (bMapType)
            {
            case 1:
            case 4:
            {
                ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(dataByKey != null);
                root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref dataByKey.stLevelCommonInfo.szName);
                bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum;
                break;
            }

            case 3:
            {
                ResRankLevelInfo info2 = GameDataMgr.rankLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info2 != null);
                root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref info2.stLevelCommonInfo.szName);
                bMaxAcntNum = 4;
                break;
            }

            case 5:
            {
                ResRewardMatchLevelInfo info3 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info3 != null);
                root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref info3.stLevelCommonInfo.szName);
                bMaxAcntNum = info3.stLevelCommonInfo.bMaxAcntNum;
                break;
            }
            }
            if (bMapType == 3)
            {
                root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText("Common_Team_Player_Type_6");
            }
            else
            {
                root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText(string.Format("Common_Team_Player_Type_{0}", bMaxAcntNum / 2));
            }
            CMatchingView.SetStartBtnStatus(root);
            GameObject gameObject = root.transform.Find("Panel_Main/Player1").gameObject;
            TeamMember memberInfo = CMatchingView.GetMemberInfo(data, 1);

            CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 2);
            gameObject = root.transform.Find("Panel_Main/Player2").gameObject;
            memberInfo = CMatchingView.GetMemberInfo(data, 2);
            CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 4);
            gameObject = root.transform.Find("Panel_Main/Player3").gameObject;
            memberInfo = CMatchingView.GetMemberInfo(data, 3);
            CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 6);
            gameObject = root.transform.Find("Panel_Main/Player4").gameObject;
            memberInfo = CMatchingView.GetMemberInfo(data, 4);
            CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 8);
            gameObject = root.transform.Find("Panel_Main/Player5").gameObject;
            memberInfo = CMatchingView.GetMemberInfo(data, 5);
            CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 10);
        }