Ejemplo n.º 1
0
    private void OnOpenMiniProfile(CUIEvent uiEvent)
    {
        ulong num  = 0uL;
        int   num2 = 0;

        this.m_bUp     = false;
        this.m_OpenSrc = (CMiniPlayerInfoSystem.OpenSrc)uiEvent.m_eventParams.tag;
        CMiniPlayerInfoSystem.OpenSrc openSrc = this.m_OpenSrc;
        if (openSrc != CMiniPlayerInfoSystem.OpenSrc.Rank)
        {
            if (openSrc == CMiniPlayerInfoSystem.OpenSrc.Chat)
            {
                if (Singleton <CChatController> .GetInstance().view.CurTab == EChatChannel.Lobby)
                {
                    num  = uiEvent.m_eventParams.commonUInt64Param1;
                    num2 = uiEvent.m_eventParams.tag2;
                }
                else if (Singleton <CChatController> .GetInstance().view.CurTab == EChatChannel.Guild || Singleton <CChatController> .GetInstance().view.CurTab == EChatChannel.GuildMatchTeam)
                {
                    num  = uiEvent.m_eventParams.commonUInt64Param1;
                    num2 = uiEvent.m_eventParams.tag2;
                }
                else if (Singleton <CChatController> .GetInstance().view.CurTab == EChatChannel.Settle)
                {
                    num        = uiEvent.m_eventParams.commonUInt64Param1;
                    num2       = uiEvent.m_eventParams.tag2;
                    this.m_bUp = true;
                }
                else if (Singleton <CChatController> .GetInstance().view.CurTab == EChatChannel.Friend_Chat)
                {
                    CChatSysData sysData = Singleton <CChatController> .GetInstance().model.sysData;

                    if (sysData == null)
                    {
                        Debug.LogError("Open mini profile failed, CChatSysData is null");
                        return;
                    }
                    num  = sysData.ullUid;
                    num2 = (int)sysData.dwLogicWorldId;
                }
            }
        }
        else
        {
            num  = uiEvent.m_eventParams.commonUInt64Param1;
            num2 = uiEvent.m_eventParams.tag2;
        }
        if (num > 0uL)
        {
            if (num == this.m_CurSelectedUuid && num2 == this.m_CurSelectedLogicWorld)
            {
                return;
            }
            this.m_CurSelectedUuid       = num;
            this.m_CurSelectedLogicWorld = num2;
            Singleton <CPlayerInfoSystem> .GetInstance().ShowPlayerDetailInfo(num, num2, CPlayerInfoSystem.DetailPlayerInfoSource.DefaultOthers, false);
        }
    }
Ejemplo n.º 2
0
    private void OnPlayerInfoSystemRecivedMsg(CSPkg msg)
    {
        if (msg.stPkgData.stGetAcntDetailInfoRsp.iErrCode != 0)
        {
            Singleton <CUIManager> .GetInstance().OpenMessageBox(string.Format("Error Code {0}", msg.stPkgData.stGetAcntDetailInfoRsp.iErrCode), false);

            return;
        }
        this.m_BackPlayeInfoMsg = msg;
        this.m_PlayerProfile.ConvertServerDetailData(msg.stPkgData.stGetAcntDetailInfoRsp.stAcntDetail.stOfSucc);
        CUIFormScript cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(CMiniPlayerInfoSystem.sPlayerInfoFormPath, false, true);

        if (cUIFormScript == null)
        {
            return;
        }
        if (this.m_bUp)
        {
            cUIFormScript.SetPriority(enFormPriority.Priority5);
        }
        else
        {
            cUIFormScript.RestorePriority();
        }
        GameObject    widget        = cUIFormScript.GetWidget(0);
        RectTransform rectTransform = cUIFormScript.transform.Find("panel") as RectTransform;

        if (rectTransform == null)
        {
            Debug.LogError("mini player info form's panel is null");
            Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm);
        }
        CMiniPlayerInfoSystem.OpenSrc openSrc = this.m_OpenSrc;
        if (openSrc != CMiniPlayerInfoSystem.OpenSrc.Rank)
        {
            if (openSrc == CMiniPlayerInfoSystem.OpenSrc.Chat)
            {
                CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CChatController.ChatFormPath);

                if (form == null)
                {
                    Debug.LogError("can't get chat form");
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm);

                    return;
                }
                RectTransform rectTransform2 = form.transform.Find("node/null") as RectTransform;
                if (rectTransform2 == null)
                {
                    Debug.LogError("chat form's close btn is null");
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm);

                    return;
                }
                widget.CustomSetActive(true);
                Vector3[] array = new Vector3[4];
                rectTransform2.GetWorldCorners(array);
                Vector2   vector      = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array[3]);
                Vector2   screenPoint = new Vector2(0f, vector.y);
                Vector3[] array2      = new Vector3[4];
                rectTransform.GetWorldCorners(array2);
                float num = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array2[3]).x - CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array2[0]).x;
                if (vector.x + num + 100f > (float)Screen.width)
                {
                    screenPoint.x = (float)Screen.width - num - 15f;
                }
                else
                {
                    screenPoint = new Vector2(vector.x + 20f, vector.y);
                }
                rectTransform.position = CUIUtility.ScreenToWorldPoint(cUIFormScript.GetCamera(), screenPoint, rectTransform.position.z);
            }
        }
        else
        {
            CUIFormScript form2 = Singleton <CUIManager> .GetInstance().GetForm(RankingSystem.s_rankingForm);

            if (form2 == null)
            {
                Debug.LogError("can't get ranking form");
                Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm);

                return;
            }
            RectTransform rectTransform3 = form2.transform.Find("bg") as RectTransform;
            if (rectTransform3 == null)
            {
                Debug.LogError("ranking form's bg is null");
                Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm);

                return;
            }
            widget.CustomSetActive(true);
            Vector3[] array3 = new Vector3[4];
            rectTransform3.GetWorldCorners(array3);
            Vector2   vector2      = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array3[2]);
            Vector2   screenPoint2 = new Vector2(0f, vector2.y - 100f);
            Vector3[] array4       = new Vector3[4];
            rectTransform.GetWorldCorners(array4);
            float num2 = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array4[3]).x - CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array4[0]).x;
            if (vector2.x + 80f + num2 > (float)Screen.width)
            {
                screenPoint2.x = (float)Screen.width - num2 - 15f;
            }
            else
            {
                screenPoint2.x = vector2.x + 80f;
            }
            rectTransform.position = CUIUtility.ScreenToWorldPoint(cUIFormScript.GetCamera(), screenPoint2, rectTransform.position.z);
        }
        Text componetInChild = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/Name/Text");

        if (componetInChild != null)
        {
            componetInChild.set_text(this.m_PlayerProfile.Name());
        }
        COMDT_FRIEND_INFO info = Singleton <CFriendContoller> .instance.model.GetInfo(CFriendModel.FriendType.GameFriend, this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld);

        COMDT_FRIEND_INFO info2 = Singleton <CFriendContoller> .instance.model.GetInfo(CFriendModel.FriendType.SNS, this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld);

        Text componetInChild2 = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/Online/Text");

        if (componetInChild2 != null)
        {
            if (this.m_PlayerProfile.IsOnLine())
            {
                COMDT_FRIEND_INFO cOMDT_FRIEND_INFO = (info == null) ? ((info2 == null) ? null : info2) : info;
                if (cOMDT_FRIEND_INFO != null)
                {
                    COM_ACNT_GAME_STATE friendInGamingState = Singleton <CFriendContoller> .instance.model.GetFriendInGamingState(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld);

                    if (friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_IDLE)
                    {
                        componetInChild2.set_text(string.Format("<color=#00ff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Online")));
                    }
                    else if (friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_SINGLEGAME || friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_MULTIGAME)
                    {
                        componetInChild2.set_text(string.Format("<color=#ffff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Gaming")));
                    }
                    else if (friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_TEAM)
                    {
                        componetInChild2.set_text(string.Format("<color=#ffff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Teaming")));
                    }
                }
                else
                {
                    componetInChild2.set_text(string.Format("<color=#00ff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Online")));
                }
            }
            else
            {
                Text   text  = componetInChild2;
                string text2 = Singleton <CTextManager> .GetInstance().GetText("Common_Offline");

                componetInChild2.set_text(text2);
                text.set_text(text2);
            }
        }
        Text componetInChild3 = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/DuanWei/Text");

        if (componetInChild3 != null)
        {
            string rankName = CLadderView.GetRankName(this.m_PlayerProfile.GetRankGrade(), (uint)this.m_PlayerProfile.GetRankClass());
            componetInChild3.set_text(string.IsNullOrEmpty(rankName) ? Singleton <CTextManager> .GetInstance().GetText("Common_NoData") : rankName);
        }
        Text componetInChild4 = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/Team/Text");
        Text componetInChild5 = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/Position/Text");

        if (!CGuildSystem.IsInNormalGuild(this.m_PlayerProfile.GuildState) || string.IsNullOrEmpty(this.m_PlayerProfile.GuildName))
        {
            if (componetInChild4 != null)
            {
                componetInChild4.set_text(Singleton <CTextManager> .GetInstance().GetText("PlayerInfo_Guild"));
            }
            if (componetInChild5 != null)
            {
                componetInChild5.set_text(Singleton <CTextManager> .GetInstance().GetText("PlayerInfo_Guild"));
            }
        }
        else
        {
            if (componetInChild4 != null)
            {
                componetInChild4.set_text(this.m_PlayerProfile.GuildName);
            }
            if (componetInChild5 != null)
            {
                componetInChild5.set_text(CGuildHelper.GetPositionName(this.m_PlayerProfile.GuildState));
            }
        }
        GameObject obj        = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/AddFriend");
        GameObject obj2       = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/Profile");
        GameObject obj3       = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/3v3");
        GameObject obj4       = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/5v5");
        GameObject gameObject = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/Block");
        GameObject obj5       = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/Complaints");

        obj5.CustomSetActive(false);
        obj2.CustomSetActive(true);
        openSrc = this.m_OpenSrc;
        if (openSrc != CMiniPlayerInfoSystem.OpenSrc.Rank)
        {
            if (openSrc == CMiniPlayerInfoSystem.OpenSrc.Chat)
            {
                switch (Singleton <CChatController> .GetInstance().view.CurTab)
                {
                case EChatChannel.Lobby:
                case EChatChannel.GuildMatchTeam:
                    obj3.CustomSetActive(false);
                    obj4.CustomSetActive(false);
                    if (info != null || info2 != null)
                    {
                        obj.CustomSetActive(false);
                    }
                    else
                    {
                        obj.CustomSetActive(true);
                    }
                    gameObject.CustomSetActive(true);
                    obj5.CustomSetActive(false);
                    this.SetBlockButtonBlocked(gameObject, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld));
                    break;

                case EChatChannel.Guild:
                    if (info != null || info2 != null)
                    {
                        obj.CustomSetActive(false);
                        obj3.CustomSetActive(true);
                        obj4.CustomSetActive(true);
                    }
                    else
                    {
                        obj.CustomSetActive(true);
                        obj3.CustomSetActive(false);
                        obj4.CustomSetActive(false);
                    }
                    gameObject.CustomSetActive(true);
                    obj5.CustomSetActive(false);
                    this.SetBlockButtonBlocked(gameObject, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld));
                    break;

                case EChatChannel.Friend_Chat:
                    obj.CustomSetActive(false);
                    obj3.CustomSetActive(true);
                    obj4.CustomSetActive(true);
                    gameObject.CustomSetActive(true);
                    obj5.CustomSetActive(false);
                    this.SetBlockButtonBlocked(gameObject, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld));
                    break;

                case EChatChannel.Settle:
                    obj.CustomSetActive(false);
                    obj3.CustomSetActive(false);
                    obj4.CustomSetActive(false);
                    gameObject.CustomSetActive(true);
                    obj5.CustomSetActive(false);
                    this.SetBlockButtonBlocked(gameObject, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld));
                    break;
                }
            }
        }
        else
        {
            if (info != null || info2 != null)
            {
                obj.CustomSetActive(false);
                obj3.CustomSetActive(true);
                obj4.CustomSetActive(true);
            }
            else
            {
                obj.CustomSetActive(true);
                obj3.CustomSetActive(false);
                obj4.CustomSetActive(false);
            }
            gameObject.CustomSetActive(false);
            obj5.CustomSetActive(false);
        }
    }