Exemple #1
0
 public void Open(SCPKG_INVITE_JOIN_GAME_REQ info)
 {
     this.InitEvt();
     this.ShowNormal(info);
     if (this.listScript != null)
     {
         int count = this.m_configTexts.get_Count();
         this.listScript.SetElementAmount(count);
     }
 }
Exemple #2
0
        public void ShowNormal(SCPKG_INVITE_JOIN_GAME_REQ info)
        {
            string          text            = CUIUtility.RemoveEmoji(StringHelper.UTF8BytesToString(ref info.stInviterInfo.szName));
            stUIEventParams stUIEventParams = default(stUIEventParams);

            stUIEventParams.tag = (int)info.bIndex;
            int num = 15;

            int.TryParse(Singleton <CTextManager> .get_instance().GetText("MessageBox_Close_Time"), ref num);
            this.form = Singleton <CUIManager> .GetInstance().OpenForm(string.Format("{0}{1}", "UGUI/Form/Common/", "Form_BeInvited.prefab"), false, false);

            GameObject gameObject = this.form.transform.Find("Panel/Panel/normal").gameObject;

            if (gameObject != null)
            {
                gameObject.CustomSetActive(true);
            }
            GameObject gameObject2 = this.form.transform.Find("Panel/Panel/refuse").gameObject;

            if (gameObject2 != null)
            {
                gameObject2.CustomSetActive(false);
            }
            this.listNode     = this.form.transform.Find("Panel/Panel/refuse/reasonPanel/DropList").gameObject;
            this.listScript   = this.listNode.transform.Find("List").GetComponent <CUIListScript>();
            this.m_inputFiled = this.form.transform.Find("Panel/Panel/refuse/reasonPanel/InputField").GetComponent <InputField>();
            this.m_sendBtn    = this.form.transform.Find("Panel/Panel/refuse/btnGroup/Button_Send").gameObject;
            this.form.transform.Find("Panel/Panel/refuse/MatchInfo").GetComponent <Text>().text = Singleton <CTextManager> .get_instance().GetText("Invite_Refuse_Title");

            if (this.form != null)
            {
                string text2 = null;
                string text3 = null;
                if (info.bInviteType == 1)
                {
                    ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(info.stInviteDetail.get_stRoomDetail().bMapType, info.stInviteDetail.get_stRoomDetail().dwMapId);
                    stUIEventParams.heroId      = (uint)info.stInviteDetail.get_stRoomDetail().bMapType;
                    stUIEventParams.weakGuideId = info.stInviteDetail.get_stRoomDetail().dwMapId;
                    if (pvpMapCommonInfo != null)
                    {
                        text2 = Singleton <CTextManager> .get_instance().GetText("Invite_Map_Desc", new string[]
                        {
                            ((int)(pvpMapCommonInfo.bMaxAcntNum / 2)).ToString(),
                            ((int)(pvpMapCommonInfo.bMaxAcntNum / 2)).ToString(),
                            Utility.UTF8Convert(pvpMapCommonInfo.szName)
                        });
                    }
                    text3 = Singleton <CTextManager> .GetInstance().GetText("Invite_Match_Type_4");
                }
                else if (info.bInviteType == 2)
                {
                    ResDT_LevelCommonInfo pvpMapCommonInfo2 = CLevelCfgLogicManager.GetPvpMapCommonInfo(info.stInviteDetail.get_stTeamDetail().bMapType, info.stInviteDetail.get_stTeamDetail().dwMapId);
                    stUIEventParams.heroId      = (uint)info.stInviteDetail.get_stTeamDetail().bMapType;
                    stUIEventParams.weakGuideId = info.stInviteDetail.get_stTeamDetail().dwMapId;
                    if (pvpMapCommonInfo2 != null)
                    {
                        text2 = Singleton <CTextManager> .get_instance().GetText("Invite_Map_Desc", new string[]
                        {
                            ((int)(pvpMapCommonInfo2.bMaxAcntNum / 2)).ToString(),
                            ((int)(pvpMapCommonInfo2.bMaxAcntNum / 2)).ToString(),
                            Utility.UTF8Convert(pvpMapCommonInfo2.szName)
                        });
                    }
                    if (info.stInviteDetail.get_stTeamDetail().bMapType == 3)
                    {
                        text3 = Singleton <CTextManager> .GetInstance().GetText("Invite_Match_Type_1");
                    }
                    else
                    {
                        text3 = Singleton <CTextManager> .GetInstance().GetText((info.stInviteDetail.get_stTeamDetail().bPkAI != 1) ? "Invite_Match_Type_3" : "Invite_Match_Type_2");
                    }
                }
                string text4 = Singleton <CTextManager> .get_instance().GetText("Be_Invited_Tips", new string[]
                {
                    text3,
                    text2
                });

                this.form.m_formWidgets[8].GetComponent <Text>().text = text4;
                uint   dwRelationMask = info.stInviterInfo.dwRelationMask;
                string text5;
                if ((dwRelationMask & 1u) > 0u)
                {
                    text5 = Singleton <CTextManager> .get_instance().GetText("Invite_Src_Type_1");

                    stUIEventParams.tag2 = 0;
                }
                else if ((dwRelationMask & 2u) > 0u)
                {
                    text5 = Singleton <CTextManager> .get_instance().GetText("Invite_Src_Type_4");

                    stUIEventParams.tag2 = 1;
                }
                else if ((dwRelationMask & 4u) > 0u)
                {
                    text5 = Singleton <CTextManager> .get_instance().GetText("Invite_Src_Type_5");

                    stUIEventParams.tag2 = 2;
                    CSDT_LBS_USER_INFO lBSUserInfo = Singleton <CFriendContoller> .get_instance().model.GetLBSUserInfo(info.stInviterInfo.ullUid, info.stInviterInfo.dwLogicWorldID, CFriendModel.LBSGenderType.Both);

                    if (lBSUserInfo != null)
                    {
                        stUIEventParams.tagUInt = lBSUserInfo.dwGameSvrEntity;
                    }
                }
                else
                {
                    text5 = Singleton <CTextManager> .get_instance().GetText("Invite_Src_Type_1");

                    stUIEventParams.tag2 = 3;
                }
                string text6 = string.Format(Singleton <CTextManager> .get_instance().GetText("Be_Invited_FromType"), text5);
                this.form.m_formWidgets[6].GetComponent <Text>().text = text6;
                stUIEventParams.tagStr             = string.Format("<color=#FFFFFF>{0}</color> {1} {2}", text, text4, text6);
                stUIEventParams.commonUInt64Param1 = info.stInviterInfo.ullUid;
                stUIEventParams.taskId             = info.stInviterInfo.dwLogicWorldID;
                stUIEventParams.tag3 = (int)info.bInviteType;
                if (num != 0)
                {
                    Transform transform = this.form.transform.Find("closeTimer");
                    if (transform != null)
                    {
                        this.timerScript = transform.GetComponent <CUITimerScript>();
                        if (this.timerScript != null)
                        {
                            this.timerScript.enabled = true;
                            this.timerScript.SetTotalTime((float)num);
                            this.timerScript.StartTimer();
                            this.timerScript.m_eventIDs[1]    = enUIEventID.Invite_TimeOut;
                            this.timerScript.m_eventParams[1] = stUIEventParams;
                        }
                    }
                }
                this.form.m_formWidgets[0].GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Invite_RefuseReason_Send, stUIEventParams);
                this.form.m_formWidgets[1].GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Invite_AcceptInvite, stUIEventParams);
                this.form.m_formWidgets[5].GetComponent <Text>().text = text;
                COM_SNSGENDER bGender   = info.stInviterInfo.bGender;
                Image         component = this.form.m_formWidgets[4].GetComponent <Image>();
                component.gameObject.CustomSetActive(bGender != 0);
                if (bGender == 1)
                {
                    CUIUtility.SetImageSprite(component, string.Format("{0}icon/Ico_boy.prefab", "UGUI/Sprite/Dynamic/"), null, true, false, false, false);
                }
                else if (bGender == 2)
                {
                    CUIUtility.SetImageSprite(component, string.Format("{0}icon/Ico_girl.prefab", "UGUI/Sprite/Dynamic/"), null, true, false, false, false);
                }
                CUIHttpImageScript component2 = this.form.m_formWidgets[3].GetComponent <CUIHttpImageScript>();
                component2.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(StringHelper.UTF8BytesToString(ref info.stInviterInfo.szHeadUrl)));
                MonoSingleton <NobeSys> .GetInstance().SetHeadIconBk(this.form.m_formWidgets[2].GetComponent <Image>(), (int)info.stInviterInfo.dwHeadImgId);

                MonoSingleton <NobeSys> .GetInstance().SetHeadIconBkEffect(this.form.m_formWidgets[2].GetComponent <Image>(), (int)info.stInviterInfo.dwHeadImgId, this.form, 1f);

                this.form.m_formWidgets[7].CustomSetActive(info.stInviterInfo.bGradeOfRank > 0);
                if (info.stInviterInfo.bGradeOfRank > 0)
                {
                    CLadderView.ShowRankDetail(this.form.m_formWidgets[7], info.stInviterInfo.bGradeOfRank, 0u, 1u, false, true, false, true, true);
                }
            }
        }
Exemple #3
0
    public void battleInvitation(SCPKG_INVITE_JOIN_GAME_REQ info)
    {
        if (!this.m_bInstall)
        {
            return;
        }
        if (!this.m_bStart)
        {
            return;
        }
        try
        {
            string    text           = CUIUtility.RemoveEmoji(StringHelper.UTF8BytesToString(ref info.stInviterInfo.szName));
            ulong     ullUid         = info.stInviterInfo.ullUid;
            string    text2          = string.Empty;
            ulong     num            = 0uL;
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                text2 = masterRoleInfo.Name;
                num   = masterRoleInfo.playerUllUID;
            }
            string text3 = string.Empty;
            if (info.bInviteType == 1)
            {
                ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(info.stInviteDetail.stRoomDetail.bMapType, info.stInviteDetail.stRoomDetail.dwMapId);
                if (pvpMapCommonInfo != null)
                {
                    text3 = Singleton <CTextManager> .instance.GetText("Invite_Map_Desc", new string[]
                    {
                        ((int)(pvpMapCommonInfo.bMaxAcntNum / 2)).ToString(),
                        ((int)(pvpMapCommonInfo.bMaxAcntNum / 2)).ToString(),
                        Utility.UTF8Convert(pvpMapCommonInfo.szName)
                    });
                }
            }
            else if (info.bInviteType == 2)
            {
                ResDT_LevelCommonInfo pvpMapCommonInfo2 = CLevelCfgLogicManager.GetPvpMapCommonInfo(info.stInviteDetail.stTeamDetail.bMapType, info.stInviteDetail.stTeamDetail.dwMapId);
                if (pvpMapCommonInfo2 != null)
                {
                    text3 = Singleton <CTextManager> .instance.GetText("Invite_Map_Desc", new string[]
                    {
                        ((int)(pvpMapCommonInfo2.bMaxAcntNum / 2)).ToString(),
                        ((int)(pvpMapCommonInfo2.bMaxAcntNum / 2)).ToString(),
                        Utility.UTF8Convert(pvpMapCommonInfo2.szName)
                    });
                }
            }
            string jsonString = string.Format("{{ \"user_id\" : \"{0}\",\"user_name\" : \" {1} \", \"friend_id\":\" {2} \",\"friend_name\":\" {3} \",\"battle_mode\":\" {4} \"}}", new object[]
            {
                num,
                text2,
                ullUid,
                text,
                text3
            });
            TGALive.battleInvitation(jsonString);
        }
        catch (Exception ex)
        {
            Debug.Log("TGA" + ex.ToString());
        }
    }