コード例 #1
0
 void CloseWindow()
 {
     m_SureAction = null;
     //rewardGrid.CleanUp();
     m_MRBtn = null;
     gameObject.SetActive(false);
 }
コード例 #2
0
    //public void AddItem(RewardAwardItem.ItemType nItemType, int nItemID, int nItemCount, int itemIndex = 0, int itemStatus = 0, int vipLevel = 0, IChooseItem ins = null,Action sureAction=null,bool isDefaultCanDoSign=false)
    public void UpdateChestRewards(AccumulateSignInfo itemInfo, int awardIndex, MonthRewardItem MRBtn)
    {
        int itemIndex = 0;

        if (itemInfo.Exp > 0)
        {
            SetRewardItem(-1, RewardAwardItem.ItemType.ITEM_EXP, itemInfo.Exp, ref itemIndex);
            itemIndex++;
        }
        if (itemInfo.Money > 0)
        {
            SetRewardItem(-1, RewardAwardItem.ItemType.ITEM_MONEY, itemInfo.Money, ref itemIndex);
            itemIndex++;
        }
        if (itemInfo.BindYuanbao > 0)
        {
            SetRewardItem(-1, RewardAwardItem.ItemType.ITEM_YUANBAO, itemInfo.BindYuanbao, ref itemIndex);
            itemIndex++;
        }


        if (itemInfo.ItemDataID1 > 0)
        {
            SetRewardItem(itemInfo.ItemDataID1, RewardAwardItem.ItemType.ITEM_ITEM, itemInfo.ItemCount1, ref itemIndex);
            itemIndex++;
        }

        if (itemIndex < 4)
        {
            if (itemInfo.ItemDataID2 > 0)
            {
                SetRewardItem(itemInfo.ItemDataID2, RewardAwardItem.ItemType.ITEM_ITEM, itemInfo.ItemCount2, ref itemIndex);
                itemIndex++;
            }
        }

        if (itemIndex < 4)
        {
            if (itemInfo.ItemDataID3 > 0)
            {
                SetRewardItem(itemInfo.ItemDataID3, RewardAwardItem.ItemType.ITEM_ITEM, itemInfo.ItemCount3, ref itemIndex);
                itemIndex++;
            }
        }


        if (itemIndex < 4)
        {
            if (itemInfo.ItemDataID4 > 0)
            {
                SetRewardItem(itemInfo.ItemDataID4, RewardAwardItem.ItemType.ITEM_ITEM, itemInfo.ItemCount4, ref itemIndex);
                itemIndex++;
            }
        }
        int count = m_RewardItem.Length;

        for (int i = 0; i < count; ++i)
        {
            if (m_RewardItem[i] != null)
            {
                if (i < itemIndex)
                {
                    m_RewardItem[i].gameObject.SetActive(true);
                }
                else
                {
                    m_RewardItem[i].gameObject.SetActive(false);
                }
            }
        }
        int signedCount = GameManager.gameManager.PlayerDataPool.AlreadySingedCount;

        if (signedCount >= awardIndex * 5)
        {
            if (itemInfo.ItemStatus == 1)
            {
                m_btn.SetActive(false);
                m_bClose.SetActive(false);
                m_ConditionStr         = StrDictionary.GetClientDictionaryString("#{11288}");
                m_lblCondition.text    = m_ConditionStr;
                m_lblCondition.enabled = true;
            }
            else
            {
                m_btn.SetActive(true);
                m_bClose.SetActive(false);
                m_lblCondition.enabled = false;
            }
        }
        else
        {
            m_btn.SetActive(false);
            m_bClose.SetActive(true);
            int leftDays = awardIndex * 5 - signedCount;
            m_lblCondition.text    = StrDictionary.GetClientDictionaryString("#{11424}", leftDays);
            m_lblCondition.enabled = true;
        }
        m_lbltitle.text          = StrDictionary.GetClientDictionaryString("#{4641}", signedCount);
        m_MRBtn                  = MRBtn;
        rewardGrid.repositionNow = true;
        gameObject.SetActive(true);
    }