예제 #1
0
        public void SetupView(MailDataItem mailData, Action <MailDataItem> checkBtnCallBack, Action <MailDataItem> getBtnCallBack)
        {
            this._mailData         = mailData;
            this._checkBtnCallBack = checkBtnCallBack;
            this._getBtnCallBack   = getBtnCallBack;
            Image component = base.transform.Find("ItemIconButton/ItemIcon").GetComponent <Image>();
            Image image2    = base.transform.Find("ItemIconButton/ItemIcon/Icon").GetComponent <Image>();

            this.ResetIconImageSize();
            if (this._mailData.hasAttachment)
            {
                RewardUIData data = this._mailData.attachment.itemList[0];
                component.color = MiscData.GetColor("TotalWhite");
                if (data.rewardType == ResourceType.Item)
                {
                    image2.transform.GetComponent <MonoImageFitter>().enabled = true;
                    StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(data.itemID, 1);

                    component.sprite = Miscs.GetSpriteByPrefab(MiscData.Config.ItemRarityBGImgPath[dummyStorageDataItem.rarity]);
                }
                else
                {
                    component.sprite = Miscs.GetSpriteByPrefab(MiscData.Config.ItemRarityBGImgPath[0]);
                    image2.transform.GetComponent <MonoImageFitter>().enabled = false;
                }
                image2.sprite = data.GetIconSprite();
                base.transform.Find("ItemIconButton/Text").GetComponent <Text>().text = "\x00d7" + data.value;
            }
            else
            {
                image2.transform.GetComponent <MonoImageFitter>().enabled = true;
                if (Singleton <MailModule> .Instance.IsMailRead(this._mailData))
                {
                    component.color = MiscData.GetColor("MailUnreadGrey");
                    image2.sprite   = Miscs.GetSpriteByPrefab("SpriteOutput/Mail/IconMailOpen");
                    base.transform.Find("ItemIconButton/Text").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_Desc_MailReaded", new object[0]);
                }
                else
                {
                    component.color = MiscData.GetColor("Blue");
                    image2.sprite   = Miscs.GetSpriteByPrefab("SpriteOutput/Mail/IconMailUnread");
                    base.transform.Find("ItemIconButton/Text").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_Desc_MailUnRead", new object[0]);
                }
            }
            base.transform.Find("ItemIconButton/NewMark").gameObject.SetActive(Singleton <MailModule> .Instance.IsMailNew(this._mailData));
            base.transform.Find("Time/Time").GetComponent <Text>().text    = Miscs.GetBeforeTimeToShow(this._mailData.time);
            base.transform.Find("Info/Content").GetComponent <Text>().text = this.GetMailContentAbstract();
            base.transform.Find("Info/Sender").GetComponent <Text>().text  = this._mailData.sender;
            base.transform.Find("Title/Text").GetComponent <Text>().text   = this._mailData.title;
            base.transform.Find("ActionBtns/GetBtn").gameObject.SetActive(this._mailData.hasAttachment);
        }