Example #1
0
        private void Setup()
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;

            VersusTowerParam[] versusTowerParam = instance.GetVersusTowerParam();
            if (versusTowerParam == null)
            {
                return;
            }
            for (int index = versusTowerParam.Length - 1; index >= 0; --index)
            {
                if (!((string)versusTowerParam[index].VersusTowerID != instance.VersusTowerMatchName) && !string.IsNullOrEmpty((string)versusTowerParam[index].ArrivalIteminame))
                {
                    GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.template);
                    if (Object.op_Inequality((Object)gameObject, (Object)null))
                    {
                        DataSource.Bind <VersusTowerParam>(gameObject, versusTowerParam[index]);
                        VersusTowerRewardItem component = (VersusTowerRewardItem)gameObject.GetComponent <VersusTowerRewardItem>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            component.Refresh();
                        }
                        if (Object.op_Inequality((Object)this.parent, (Object)null))
                        {
                            gameObject.get_transform().SetParent(this.parent.get_transform(), false);
                        }
                    }
                }
            }
            this.template.SetActive(false);
        }
 public void OnUpdateItems(int idx, GameObject obj)
 {
     if (idx < 0 || idx >= this.m_Max || this.m_Param == null)
     {
         obj.SetActive(false);
     }
     else
     {
         obj.SetActive(true);
         DataSource.Bind <VersusTowerParam>(obj, this.m_Param[idx]);
         if (this.Arrival)
         {
             VersusTowerRewardItem component = (VersusTowerRewardItem)obj.GetComponent <VersusTowerRewardItem>();
             if (!Object.op_Inequality((Object)component, (Object)null))
             {
                 return;
             }
             component.Refresh(VersusTowerRewardItem.REWARD_TYPE.Arrival, 0);
         }
         else
         {
             VersusSeasonRewardInfo component = (VersusSeasonRewardInfo)obj.GetComponent <VersusSeasonRewardInfo>();
             if (!Object.op_Inequality((Object)component, (Object)null))
             {
                 return;
             }
             component.Refresh();
         }
     }
 }
Example #3
0
        private void SetupRewardItem()
        {
            GameManager          instance           = MonoSingleton <GameManager> .Instance;
            VsTowerMatchEndParam towerMatchEndParam = instance.GetVsTowerMatchEndParam();
            VersusTowerParam     versusTowerParam   = instance.GetCurrentVersusTowerParam(towerMatchEndParam.floor);

            if (versusTowerParam == null || string.IsNullOrEmpty((string)versusTowerParam.ArrivalIteminame) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.rewardObj, (UnityEngine.Object)null))
            {
                return;
            }
            DataSource.Bind <VersusTowerParam>(this.rewardObj, versusTowerParam);
            VersusTowerRewardItem component = (VersusTowerRewardItem)this.rewardObj.GetComponent <VersusTowerRewardItem>();

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
            {
                return;
            }
            component.Refresh(VersusTowerRewardItem.REWARD_TYPE.Arrival, 0);
        }
Example #4
0
        public void Refresh()
        {
            if (Object.op_Equality((Object)this.template, (Object)null))
            {
                return;
            }
            VersusTowerParam dataOfClass = DataSource.FindDataOfClass <VersusTowerParam>(((Component)this).get_gameObject(), (VersusTowerParam)null);

            if (dataOfClass != null)
            {
                while (this.mItems.Count < dataOfClass.SeasonIteminame.Length)
                {
                    GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.template);
                    if (Object.op_Inequality((Object)gameObject, (Object)null))
                    {
                        if (Object.op_Inequality((Object)this.parent, (Object)null))
                        {
                            gameObject.get_transform().SetParent(this.parent.get_transform(), false);
                        }
                        this.mItems.Add(gameObject);
                    }
                }
                for (int idx = 0; idx < dataOfClass.SeasonIteminame.Length; ++idx)
                {
                    GameObject mItem = this.mItems[idx];
                    if (Object.op_Inequality((Object)mItem, (Object)null))
                    {
                        DataSource.Bind <VersusTowerParam>(mItem, dataOfClass);
                        mItem.SetActive(true);
                        VersusTowerRewardItem component = (VersusTowerRewardItem)mItem.GetComponent <VersusTowerRewardItem>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            component.Refresh(VersusTowerRewardItem.REWARD_TYPE.Season, idx);
                        }
                    }
                }
            }
            this.template.SetActive(false);
        }