예제 #1
0
 private void OnBtnComplete(CUIEvent ciEvent)
 {
     if (this.m_urlAction != null && this.m_urlAction.Execute())
     {
         this.OnCloseIDIPForm(null);
     }
     else if (this.m_bGoto && this.m_bShow && this.m_btnUrl != string.Empty)
     {
         NoticeSys.BTN_DOSOMTHING btnDoSth = this.m_btnDoSth;
         string text = this.m_btnUrl;
         this.OnCloseIDIPForm(null);
         if (btnDoSth == NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_URL)
         {
             CUICommonSystem.OpenUrl(text, true, 0);
         }
         else if (btnDoSth == NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_GAME)
         {
             int num = 0;
             int.TryParse(text, ref num);
             if (num > 0)
             {
                 CUICommonSystem.JumpForm((RES_GAME_ENTRANCE_TYPE)num, 0, 0, null);
             }
         }
         text = string.Empty;
     }
 }
예제 #2
0
    private bool CheckIsBtnUrl(string msgUrl, ref bool bTitle, ref string sTitle, ref NoticeSys.BTN_DOSOMTHING btnDoSth, ref string url)
    {
        if (msgUrl == null)
        {
            url      = string.Empty;
            btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
            bTitle   = false;
            return(false);
        }
        string text  = "#";
        string text2 = "&end";
        string text3 = "&";
        int    num   = msgUrl.IndexOf(text);

        if (num < 0)
        {
            url      = string.Empty;
            btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
            bTitle   = false;
            return(false);
        }
        int num2 = msgUrl.IndexOf(text2);

        if (num2 < 0)
        {
            url      = string.Empty;
            btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
            bTitle   = false;
            return(false);
        }
        int num3 = msgUrl.IndexOf(text3);

        if (num3 < 0)
        {
            url      = string.Empty;
            btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
            bTitle   = false;
            return(false);
        }
        string text4 = msgUrl.Substring(num + text.get_Length(), num3 - num - text.get_Length());

        if (text4.Contains("title="))
        {
            string text5 = text4.Substring("title=".get_Length());
            sTitle = Uri.UnescapeDataString(text5);
            bTitle = true;
        }
        else if (text4.Contains("button=0"))
        {
            btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_URL;
        }
        else if (text4.Contains("button=1"))
        {
            btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_GAME;
        }
        else if (text4.Contains("button=2"))
        {
            btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NOTSHOW;
        }
        string text6 = string.Empty;

        if (num2 - num3 - text3.get_Length() > 0)
        {
            text6 = msgUrl.Substring(num3 + text3.get_Length(), num2 - num3 - text3.get_Length());
        }
        if (bTitle)
        {
            url      = text6;
            btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
            return(true);
        }
        if (text6.Contains("url="))
        {
            url = text6.Substring("url=".get_Length());
            return(true);
        }
        url      = string.Empty;
        btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
        bTitle   = false;
        return(false);
    }
예제 #3
0
    private void ProcessShowNoticeWindown(ApolloNoticeData noticeData)
    {
        this.m_bGoto      = false;
        this.m_bLoadImage = false;
        string msgID  = noticeData.MsgID;
        string openID = noticeData.OpenID;
        string text   = noticeData.MsgUrl;
        ListView <UrlAction> listView = UrlAction.ParseFromText(noticeData.ContentUrl, null);

        if (listView.Count > 0)
        {
            this.m_urlAction = listView[0];
        }
        else
        {
            this.m_urlAction = null;
        }
        if (text == null)
        {
            text = string.Empty;
        }
        APOLLO_NOTICETYPE         msgType     = noticeData.MsgType;
        string                    startTime   = noticeData.StartTime;
        APOLLO_NOTICE_CONTENTTYPE contentType = noticeData.ContentType;
        string                    msgTitle    = noticeData.MsgTitle;
        string                    msgContent  = noticeData.MsgContent;

        NoticeSys.PrintLog(string.Concat(new object[]
        {
            " msgID ",
            noticeData.MsgID,
            " MsgUrl",
            text,
            "msgtitle = ",
            msgTitle,
            " content ",
            msgContent,
            " openid= ",
            openID,
            " MsgType  = ",
            msgType,
            " contenturl =",
            noticeData.ContentUrl
        }));
        uint num = 0u;

        if (this.m_CurState == NoticeSys.NOTICE_STATE.LOGIN_After)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                num = masterRoleInfo.PvpLevel;
            }
        }
        else
        {
            num = 0u;
        }
        this.m_btnUrl   = string.Empty;
        this.m_btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
        if (msgType == APOLLO_NOTICETYPE.APO_NOTICETYPE_ALERT)
        {
            bool flag  = false;
            bool flag2 = this.CheckIsBtnUrl(text, ref flag, ref this.m_ImageModleTitle, ref this.m_btnDoSth, ref this.m_btnUrl);
            if (flag2)
            {
                if (flag)
                {
                    bool flag3 = false;
                    flag2 = this.CheckIsBtnUrl("#" + this.m_btnUrl + "&end", ref flag3, ref this.m_ImageModleTitle, ref this.m_btnDoSth, ref this.m_btnUrl);
                }
                if (this.m_btnDoSth == NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NOTSHOW && this.m_btnUrl != MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString())
                {
                    NoticeSys.PrintLog("noticesys not show " + this.m_btnUrl);
                    return;
                }
                NoticeSys.PrintLog("find url " + this.m_btnUrl + " ori = " + text);
            }
            else
            {
                NoticeSys.PrintLog("find url   ori = " + text);
            }
            if (this.m_CurState == NoticeSys.NOTICE_STATE.LOGIN_After && num <= 5u)
            {
                this.m_btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE;
                this.m_btnUrl   = string.Empty;
            }
            if (this.m_Form == null)
            {
                this.m_Form = Singleton <CUIManager> .GetInstance().OpenForm(NoticeSys.s_formNoticeLoginPath, false, true);
            }
            Transform transform = this.m_Form.gameObject.transform.Find("Panel/BtnGroup/Button_Complte");
            if (this.m_btnUrl != string.Empty && this.m_btnDoSth != NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE)
            {
                this.m_bGoto = true;
            }
            else
            {
                this.m_bGoto = false;
            }
            this.m_bShow        = true;
            this.m_TextContent  = Utility.GetComponetInChild <Text>(this.m_Form.gameObject, "Panel/ScrollRect/Content/Text");
            this.m_ImageContent = Utility.GetComponetInChild <Image>(this.m_Form.gameObject, "Panel/Image");
            this.m_ImageDefault = Utility.GetComponetInChild <Image>(this.m_Form.gameObject, "Panel/ImageDefalut");
            this.m_Title        = Utility.GetComponetInChild <Text>(this.m_Form.gameObject, "Panel/GameObject/Title/ContentTitle");
            this.m_TitleBoard   = this.m_Form.gameObject.transform.Find("Panel/GameObject/Title").gameObject;
            this.m_TextContent.gameObject.CustomSetActive(false);
            this.m_ImageContent.gameObject.CustomSetActive(false);
            if (this.m_ImageDefault)
            {
                this.m_ImageDefault.gameObject.CustomSetActive(false);
            }
            this.m_Title.set_text(msgTitle);
            if (contentType != APOLLO_NOTICE_CONTENTTYPE.APO_CONTENTTYPE_IMAGE)
            {
                if (contentType == APOLLO_NOTICE_CONTENTTYPE.APO_SCONTENTTYPE_TEXT)
                {
                    this.m_TextContent.gameObject.CustomSetActive(true);
                    this.m_TextContent.set_text(msgContent);
                    this.m_TitleBoard.CustomSetActive(true);
                    RectTransform component = this.m_TextContent.transform.parent.gameObject.GetComponent <RectTransform>();
                    if (component)
                    {
                        component.sizeDelta = new Vector2(0f, this.m_TextContent.get_preferredHeight() + 50f);
                    }
                }
                else if (contentType == APOLLO_NOTICE_CONTENTTYPE.APO_CONTENTTYPE_WEB && this.m_urlAction != null)
                {
                    this.m_bShow = true;
                    this.m_TitleBoard.CustomSetActive(true);
                    this.m_Title.set_text(this.m_ImageModleTitle);
                    if (this.m_ImageDefault)
                    {
                        this.m_ImageDefault.gameObject.CustomSetActive(true);
                    }
                    this.m_ImageContent.gameObject.CustomSetActive(false);
                    base.StartCoroutine(MonoSingleton <IDIPSys> .GetInstance().DownloadImage(this.m_urlAction.target, delegate(Texture2D text2)
                    {
                        if (this.m_bShow && this.m_ImageContent != null)
                        {
                            this.m_ImageContent.gameObject.CustomSetActive(true);
                            if (this.m_ImageDefault)
                            {
                                this.m_ImageDefault.gameObject.CustomSetActive(false);
                            }
                            this.m_bLoadImage = true;
                            this.m_ImageContent.SetSprite(Sprite.Create(text2, new Rect(0f, 0f, (float)text2.width, (float)text2.height), new Vector2(0.5f, 0.5f)), ImageAlphaTexLayout.None);
                            BugLocateLogSys.Log("noticesysy contenturl " + this.m_urlAction.target);
                        }
                    }, 0));
                }
            }
        }
    }