示例#1
0
    //===================================================================================
    //
    // Variable
    //
    //===================================================================================

    //===================================================================================
    //
    // Method
    //
    //===================================================================================
    public void Init(DATA_REWARD_NEW reward)
    {
        DATA_ITEM_NEW item = CDATA_ITEM_NEW.Get(reward.RewardValue);

        if (item == null)
        {
            return;     // error
        }
        if (item.m_enItemType == DATA_ITEM_TYPE_NEW._enItemStatusType.ITEMTYPE_MONEY)
        {
            _ItemNameLabel.text = reward.RewardCount.ToString();
        }
        else
        {
            _ItemNameLabel.text = StringTableManager.GetData(item.iItemName);
        }

        _Item2DSprite.sprite2D = UIResourceMgr.CreateSprite(BUNDLELIST.TEXTURE_ICON_ITEMICON, item.m_szIconName);
    }
    //===================================================================================
    //
    // Method
    //
    //===================================================================================
    public void SetData(DATA_GUILD_TRIBUTE._enTributeEnum enTribute)
    {
        DestroyTributeRewardItem();

        DATA_GUILD_TRIBUTE GuildTributeData = CDATA_GUILD_TRIBUTE.Get(enTribute);

        if (GuildTributeData == null)
        {
#if DEBUG_LOG
            Debug.Log("<color=red> CDATA_GUILD_TRIBUTE.Get(enTribute) is Null  </color>");
#endif
            return;
        }

        Dictionary <int, DATA_REWARD_NEW> RewardData = CDATA_REWARD_NEW.Get(GuildTributeData.enTributeReward);
        if (RewardData == null)
        {
#if DEBUG_LOG
            Debug.Log("<color=red> CDATA_REWARD_NEW.Get(GuildTributeData.enTributeReward) is Null  </color>");
#endif
            return;
        }

        foreach (KeyValuePair <int, DATA_REWARD_NEW> data in RewardData)
        {
            DATA_REWARD_NEW reward = data.Value;
            if (reward == null)
            {
                continue;
            }

            GuildTributeRewardItem TributeRewardItem = UIResourceMgr.CreatePrefab <GuildTributeRewardItem>(BUNDLELIST.PREFABS_UI_GUILD, _ItemInfoGrid.transform, "GuildTributeRewardItem");
            TributeRewardItem.Init(reward);

            _TributeRewardItems.Add(TributeRewardItem);
        }

        ResetPosition();
    }