Пример #1
0
    public void Refresh()
    {
        this.mTxTitle.set_text(TramcarManager.Instance.TRAMCAR_NAME[this.Data.quality]);
        ResourceManager.SetSprite(this.mImgTask, ResourceManager.GetIconSprite("kuangche_" + this.Data.quality));
        this.mBtnBast.get_gameObject().SetActive(this.Data.quality >= 5 && (VIPManager.Instance.IsVIPCardOn() || (EntityWorld.Instance.EntSelf.VipLv >= TramcarManager.Instance.BastTramcarVip && VIPManager.Instance.IsVIPPrivilegeOn())));
        this.ClearReward();
        List <DropItem> tramcarRewards = TramcarManager.Instance.TramcarRewards;

        if (tramcarRewards != null)
        {
            for (int i = 0; i < tramcarRewards.get_Count(); i++)
            {
                if (tramcarRewards.get_Item(i).typeId == 1)
                {
                    this.mTxExp.set_text("经验:" + AttrUtility.GetExpValueStr(tramcarRewards.get_Item(i).count *(long)this.Data.parament / 100L));
                }
                else if (tramcarRewards.get_Item(i).typeId == 2)
                {
                    this.mTxGole.set_text("金币:" + AttrUtility.GetGoldValueStr(tramcarRewards.get_Item(i).count *(long)this.Data.parament / 100L));
                }
                else
                {
                    this.CreateRewards(tramcarRewards.get_Item(i).typeId, tramcarRewards.get_Item(i).count *(long)this.Data.parament / 100L);
                }
            }
        }
    }
Пример #2
0
    private GameObject CreateRewards(int id, long num)
    {
        GameObject go = this.GetUnusedItem();

        if (go == null)
        {
            go = ResourceManager.GetInstantiate2Prefab("TaskRewardItem");
            go.GetComponent <Button>().get_onClick().AddListener(delegate
            {
                int num2 = int.Parse(go.get_name());
                if (num2 != 1)
                {
                    ItemTipUIViewModel.ShowItem(num2, null);
                }
            });
            UGUITools.SetParent(this.mGrid, go, false);
            this.mItems.Add(go);
        }
        go.set_name(id.ToString());
        ResourceManager.SetSprite(go.GetComponent <Image>(), GameDataUtils.GetItemFrame(id));
        ResourceManager.SetSprite(go.get_transform().FindChild("Image").GetComponent <Image>(), GameDataUtils.GetItemIcon(id));
        string text = num.ToString();

        if (id == 1)
        {
            text = AttrUtility.GetExpValueStr(num);
        }
        else if (id == 2)
        {
            text = AttrUtility.GetGoldValueStr(num);
        }
        go.get_transform().FindChild("Text").GetComponent <Text>().set_text(text);
        Items items = DataReader <Items> .Get(id);

        if (items == null || items.step <= 0)
        {
            go.get_transform().FindChild("ItemStep").get_gameObject().SetActive(false);
        }
        else
        {
            go.get_transform().FindChild("ItemStep").get_gameObject().SetActive(true);
            go.get_transform().FindChild("ItemStep").FindChild("ItemStepText").GetComponent <Text>().set_text(string.Format(GameDataUtils.GetChineseContent(505023, false), items.step));
        }
        go.SetActive(true);
        return(go);
    }