Esempio n. 1
0
 public void SetParam(ChatLogParam param, SRPG_Button.ButtonClickEvent OnClickEvent)
 {
     if (param == null)
     {
         ((Component)this).get_gameObject().SetActive(false);
         this.mChatLogParam = (ChatLogParam)null;
     }
     else
     {
         this.mChatLogParam = param;
         ChatWindow.MessageTemplateType type = ChatWindow.MessageTemplateType.OtherUser;
         if (MonoSingleton <GameManager> .Instance.Player.FUID == param.fuid)
         {
             type = ChatWindow.MessageTemplateType.User;
         }
         else if (string.IsNullOrEmpty(param.fuid))
         {
             type = ChatWindow.MessageTemplateType.System;
         }
         ((Component)this).get_gameObject().SetActive(true);
         this.Refresh(param, type);
         SRPG_Button component = (SRPG_Button)this.GetIcon.GetComponent <SRPG_Button>();
         if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
         {
             return;
         }
         ((UnityEventBase)component.get_onClick()).RemoveAllListeners();
         if (!(param.fuid != MonoSingleton <GameManager> .Instance.Player.FUID))
         {
             return;
         }
         component.AddListener(OnClickEvent);
     }
 }
Esempio n. 2
0
 public void AddMessage(ChatLogParam _param)
 {
     this.AddMessage(new List <ChatLogParam>()
     {
         _param
     });
 }
Esempio n. 3
0
        public int UpdateLogItem(ChatLogParam param, int num = 0)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            ChatWindow.\u003CUpdateLogItem\u003Ec__AnonStorey23D itemCAnonStorey23D = new ChatWindow.\u003CUpdateLogItem\u003Ec__AnonStorey23D();
            // ISSUE: reference to a compiler-generated field
            itemCAnonStorey23D.param = param;
            // ISSUE: reference to a compiler-generated field
            itemCAnonStorey23D.\u003C\u003Ef__this = this;
            GameObject gameObject = num >= this.mItems.Count ? (GameObject)null : this.mItems[num];

            // ISSUE: reference to a compiler-generated field
            if (itemCAnonStorey23D.param == null)
            {
                if (Object.op_Inequality((Object)gameObject, (Object)null))
                {
                    gameObject.SetActive(false);
                }
                return(-1);
            }
            gameObject.SetActive(true);
            ChatLogItem component1 = (ChatLogItem)gameObject.GetComponent <ChatLogItem>();

            if (Object.op_Equality((Object)component1, (Object)null))
            {
                return(-1);
            }
            ChatWindow.MessageTemplateType type = ChatWindow.MessageTemplateType.OtherUser;
            // ISSUE: reference to a compiler-generated field
            if (string.IsNullOrEmpty(itemCAnonStorey23D.param.fuid))
            {
                type = ChatWindow.MessageTemplateType.Official;
            }
            else
            {
                // ISSUE: reference to a compiler-generated field
                if (this.gm.Player.FUID == itemCAnonStorey23D.param.fuid)
                {
                    type = ChatWindow.MessageTemplateType.User;
                }
            }
            // ISSUE: reference to a compiler-generated field
            component1.Refresh(itemCAnonStorey23D.param, type);
            SRPG_Button component2 = (SRPG_Button)component1.GetIcon.GetComponent <SRPG_Button>();

            // ISSUE: reference to a compiler-generated field
            if (Object.op_Inequality((Object)component2, (Object)null) && itemCAnonStorey23D.param.fuid != this.gm.Player.FUID)
            {
                // ISSUE: method pointer
                ((UnityEvent)component2.get_onClick()).AddListener(new UnityAction((object)itemCAnonStorey23D, __methodptr(\u003C\u003Em__255)));
            }
            else
            {
                ((UnityEventBase)component2.get_onClick()).RemoveAllListeners();
            }
            // ISSUE: reference to a compiler-generated field
            return(itemCAnonStorey23D.param.id);
        }
Esempio n. 4
0
        public void Clear()
        {
            ((Component)this).get_gameObject().SetActive(false);
            SRPG_Button component = (SRPG_Button)this.GetIcon.GetComponent <SRPG_Button>();

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
            {
                return;
            }
            ((UnityEventBase)component.get_onClick()).RemoveAllListeners();
            this.mChatLogParam = (ChatLogParam)null;
        }
Esempio n. 5
0
        private void RefreshCloseShowMessage()
        {
            if (!Object.op_Inequality((Object)this.ClosedShowMessage, (Object)null) || !this.ClosedShowMessage.get_activeInHierarchy())
            {
                return;
            }
            Transform child = this.ClosedShowMessage.get_transform().FindChild("text");

            UnityEngine.UI.Text component = (UnityEngine.UI.Text)((Component)child).GetComponent <UnityEngine.UI.Text>();
            if (Object.op_Equality((Object)child, (Object)null))
            {
                return;
            }
            string str = string.Empty;

            if (this.mChatLogOffical != null && this.mChatLogOffical.messages.Count > 0)
            {
                ChatLogParam message = this.mChatLogOffical.messages[this.mChatLogOffical.messages.Count - 1];
                int          id      = message.id;
                str = "[" + message.name + "]:" + message.message;
            }
            else if (this.mChatLog != null && this.mChatLog.messages.Count > 0)
            {
                ChatLogParam message = this.mChatLog.messages[this.mChatLog.messages.Count - 1];
                int          id      = message.id;
                if (message.fuid != this.gm.Player.FUID)
                {
                    string source = this.FilterMessage(message.message);
                    if (source.All <char>((Func <char, bool>)(x =>
                    {
                        if ((int)x != 42)
                        {
                            return((int)x == 32);
                        }
                        return(true);
                    })))
                    {
                        return;
                    }
                    str = "[" + message.name + "]:" + source;
                    if (message.message == string.Empty)
                    {
                        str = "[" + message.name + "] " + LocalizedText.Get("sys.CHAT_SEND_STAMP");
                    }
                }
            }
            component.set_text(str);
        }
Esempio n. 6
0
 private void UpdateMessageBadgeState()
 {
     if (!Object.op_Inequality((Object)this.UpdateMessageBadge, (Object)null))
     {
         return;
     }
     if (this.mOpened)
     {
         this.UpdateMessageBadge.SetActive(false);
     }
     else if (this.mChatLogOffical != null && this.mChatLogOffical.messages.Count > 0)
     {
         if (this.mChatLogOffical.messages[this.mChatLogOffical.messages.Count - 1].id == this.mLastIDOffical)
         {
             return;
         }
         this.UpdateMessageBadge.SetActive(true);
         this.RefreshCloseShowMessage();
     }
     else
     {
         if (this.mChatLog == null || this.mChatLog.messages.Count <= 0)
         {
             return;
         }
         ChatLogParam message = this.mChatLog.messages[this.mChatLog.messages.Count - 1];
         int          id      = message.id;
         if (this.mLastMessageID > -1)
         {
             if (id == this.mLastMessageID || !(message.fuid != this.gm.Player.FUID))
             {
                 return;
             }
             this.UpdateMessageBadge.SetActive(true);
             this.RefreshCloseShowMessage();
         }
         else
         {
             this.UpdateMessageBadge.SetActive((TimeManager.ServerTime - TimeManager.FromUnixTime(message.posted_at)).TotalSeconds < (double)ChatWindow.SPAN_UPDATE_MESSAGE_UICLOSE);
         }
     }
 }
Esempio n. 7
0
        private void RefreshPushLog()
        {
            if (this.mCurrentChatTab == ChatWindow.SelectChatTab.Offical)
            {
                return;
            }
            ChatLogParam message = this.mChatLogOffical.messages[this.mChatLogOffical.messages.Count - 1];

            if (this.mLastIDOffical == message.id)
            {
                return;
            }
            Transform   transform = this.PushOfficalMessage.get_transform().Find("item");
            ChatLogItem component = (ChatLogItem)((Component)transform).GetComponent <ChatLogItem>();

            if (!Object.op_Inequality((Object)component, (Object)null))
            {
                return;
            }
            ((Component)transform).get_gameObject().SetActive(true);
            component.RefreshPushMessage(message, ChatWindow.MessageTemplateType.Official);
        }
Esempio n. 8
0
        public void RefreshPushMessage(ChatLogParam param, ChatWindow.MessageTemplateType type)
        {
            if (param == null)
            {
                return;
            }
            if (this.mCoroutine != null)
            {
                this.StopCoroutine(this.mCoroutine);
                this.mCoroutine = (Coroutine)null;
            }
            if (Object.op_Equality((Object)this.mRoot, (Object)null))
            {
                if (!Object.op_Inequality((Object)((Component)this).get_transform().get_parent(), (Object)null))
                {
                    return;
                }
                this.mRoot = ((Component)((Component)this).get_transform().get_parent()).get_gameObject();
            }
            this.MessageIcon.SetActive(false);
            this.MessageLog.SetActive(false);
            this.MyMessageIcon.SetActive(false);
            this.MyMessageLog.SetActive(false);
            this.AdminMessageLog.SetActive(false);
            Transform transform = this.mMessageRoot.Find("status");

            ((Text)((Component)transform.Find("name").Find("text")).GetComponent <Text>()).set_text(param.name);
            ((Text)((Component)transform.Find("fuid").Find("text")).GetComponent <Text>()).set_text(LocalizedText.Get("sys.TEXT_CHAT_FUID", new object[1]
            {
                (object)param.fuid.Substring(param.fuid.Length - 4, 4)
            }));
            ((Text)((Component)transform.Find("postat").Find("text")).GetComponent <Text>()).set_text(ChatLogItem.GetPostAt(param.posted_at));
            this.TextRootObject = (RectTransform)((Component)this.mMessageRoot.Find("messages")).GetComponent <RectTransform>();
            if (!Object.op_Inequality((Object)this.mRoot, (Object)null) || !this.mRoot.get_activeInHierarchy())
            {
                return;
            }
            this.StartCoroutine(this.RefreshTextLine(param.message));
        }
Esempio n. 9
0
        public void Refresh(ChatLogParam param, ChatWindow.MessageTemplateType type)
        {
            if (param == null)
            {
                return;
            }
            if (this.mCoroutine != null)
            {
                this.StopCoroutine(this.mCoroutine);
                this.mCoroutine = (Coroutine)null;
            }
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.mRoot, (UnityEngine.Object)null))
            {
                if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)((Component)this).get_transform().get_parent(), (UnityEngine.Object)null))
                {
                    return;
                }
                this.mRoot = ((Component)((Component)this).get_transform().get_parent()).get_gameObject();
            }
            this.MessageIcon.SetActive(false);
            this.MessageLog.SetActive(false);
            this.MyMessageIcon.SetActive(false);
            this.MyMessageLog.SetActive(false);
            this.SystemMessageRootObj.SetActive(false);
            switch (type)
            {
            case ChatWindow.MessageTemplateType.OtherUser:
                this.MessageIcon.SetActive(true);
                this.MessageLog.SetActive(true);
                this.mStampRoot     = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AnyStampObj, (UnityEngine.Object)null) ? (Transform)null : this.AnyStampObj.get_transform();
                this.mNameObj       = this.AnyNameObj;
                this.mFuIDObj       = this.AnyFuIDObj;
                this.mPostAtObj     = this.AnyPostAtObj;
                this.mStampImageObj = this.AnyStampImageObj;
                this.mMessageObj    = this.AnyMessageTextObj;
                this.mLogRoot       = this.AnyLogRoot;
                this.mLogImg        = (Image)((Component)this.AnyLogRoot).GetComponent <Image>();
                break;

            case ChatWindow.MessageTemplateType.User:
                this.MyMessageIcon.SetActive(true);
                this.MyMessageLog.SetActive(true);
                this.mStampRoot     = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.MyStampObj, (UnityEngine.Object)null) ? (Transform)null : this.MyStampObj.get_transform();
                this.mNameObj       = this.MyNameObj;
                this.mFuIDObj       = this.MyFuIDObj;
                this.mPostAtObj     = this.MyPostAtObj;
                this.mStampImageObj = this.MyStampImageObj;
                this.mMessageObj    = this.MyMessageTextObj;
                this.mLogRoot       = this.MyLogRoot;
                this.mLogImg        = (Image)((Component)this.MyLogRoot).GetComponent <Image>();
                break;

            case ChatWindow.MessageTemplateType.System:
                this.SystemMessageRootObj.SetActive(true);
                this.SystemMessageTextObj.set_text(param.message);
                this.mCoroutine = this.StartCoroutine(this.RefreshTextLine(param.message));
                return;
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Icon, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.LeftIcon, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.RightIcon, (UnityEngine.Object)null))
            {
                RawImage  target    = type != ChatWindow.MessageTemplateType.User ? this.LeftIcon : this.RightIcon;
                UnitParam unitParam = MonoSingleton <GameManager> .Instance.MasterParam.GetUnitParam(param.icon);

                if (unitParam != null)
                {
                    if (!string.IsNullOrEmpty(param.skin_iname) && UnityEngine.Object.op_Inequality((UnityEngine.Object)target, (UnityEngine.Object)null))
                    {
                        ArtifactParam skin = Array.Find <ArtifactParam>(MonoSingleton <GameManager> .Instance.MasterParam.Artifacts.ToArray(), (Predicate <ArtifactParam>)(p => p.iname == param.skin_iname));
                        MonoSingleton <GameManager> .Instance.ApplyTextureAsync(target, AssetPath.UnitSkinIconSmall(unitParam, skin, param.job_iname));
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.ApplyTextureAsync(target, AssetPath.UnitIconSmall(unitParam, param.job_iname));
                    }
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mNameObj, (UnityEngine.Object)null))
            {
                this.mNameObj.set_text(param.name);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mFuIDObj, (UnityEngine.Object)null))
            {
                this.mFuIDObj.set_text(LocalizedText.Get("sys.TEXT_CHAT_FUID", new object[1]
                {
                    (object)param.fuid.Substring(param.fuid.Length - 4, 4)
                }));
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mPostAtObj, (UnityEngine.Object)null))
            {
                this.mPostAtObj.set_text(ChatLogItem.GetPostAt(param.posted_at));
            }
            if ((int)param.message_type == 1)
            {
                if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mRoot, (UnityEngine.Object)null) || !this.mRoot.get_activeInHierarchy())
                {
                    return;
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mStampRoot, (UnityEngine.Object)null))
                {
                    ((Component)this.mStampRoot).get_gameObject().SetActive(false);
                }
                this.mCoroutine = this.StartCoroutine(this.RefreshTextLine(param.message));
            }
            else
            {
                if ((int)param.message_type != 2 || !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mRoot, (UnityEngine.Object)null) || !this.mRoot.get_activeInHierarchy())
                {
                    return;
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mStampRoot, (UnityEngine.Object)null))
                {
                    ((Component)this.mStampRoot).get_gameObject().SetActive(true);
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Element, (UnityEngine.Object)null))
                {
                    int stampSize = this.STAMP_SIZE;
                    VerticalLayoutGroup component = (VerticalLayoutGroup)((Component)this.mLogRoot).GetComponent <VerticalLayoutGroup>();
                    this.Element.set_minHeight((float)(stampSize + ((LayoutGroup)component).get_padding().get_top() + ((LayoutGroup)component).get_padding().get_bottom() + (int)Mathf.Abs((float)this.mLogRoot.get_anchoredPosition().y)));
                }
                ((Behaviour)this.mLogImg).set_enabled(false);
                this.mCoroutine = this.StartCoroutine(this.RefreshStamp(param.stamp_id));
            }
        }