public override void Awake() { base.Awake(); var t = controller.transform; DiscountLab = t.GetComponent <UILabel>("Content/Discount/DiscountLab"); PriceValueLab = t.GetComponent <UILabel>("Content/PriceBtn/PriceValue"); DescriptLab = t.GetComponent <UILabel>("Content/Tip/Label"); OverTimeLab = t.GetComponent <UILabel>("Content/TimeLabel"); ItemsGrid = t.GetComponent <UIGrid>("Content/GiftGrid"); ItemsList = new List <LTShowItem> (); for (int i = 0; i < ItemsGrid.transform.childCount; ++i) { ItemsList.Add(ItemsGrid.GetChild(i).GetMonoILRComponent <LTShowItem>()); } t.GetComponent <ConsecutiveClickCoolTrigger>("Content/PriceBtn").clickEvent.Add(new EventDelegate(OnBtnClick)); }
public void SetItemActive(Items itemType, int index) { if (index != -1) { GameObject go = ItemRefs[index]; if (go == null) { go = ItemRefs[index] = ItemsGrid.GetChild(index).transform.Find("Image").gameObject; } bool isActive = Inventory.GetItemCount(itemType) != 0; go.SetActive(isActive); ActiveItems[index] = isActive; // First item in here, so let's select it if (isActive && GetActiveCount() == 1) { MoveCursor(0); Inventory.UpdateSelectedItem(Constants.SelectableItems[CurrentIndex]); } } }
public override void Awake() { base.Awake(); var t = mDMono.transform; IconSp = t.GetComponent <UISprite>("BG/IconObj/Icon"); NameLab = t.GetComponent <UILabel>("NameLabel"); DiscountLab = t.GetComponent <UILabel>("Discount/DiscountLab"); PriceValueLab = t.GetComponent <UILabel>("PriceBtn/PriceValue"); TagLab = t.GetComponent <UILabel>("Tag/Label"); TagObj = t.FindEx("Tag").gameObject; OverTimeLab = t.GetComponent <UILabel>("TimeLabel"); ItemsGrid = t.GetComponent <UIGrid>("GiftGrid"); ItemsList = new List <LTShowItem>(); for (int i = 0; i < ItemsGrid.transform.childCount; ++i) { ItemsList.Add(ItemsGrid.GetChild(i).GetMonoILRComponent <LTShowItem>()); } t.GetComponent <ConsecutiveClickCoolTrigger>("PriceBtn").clickEvent.Add(new EventDelegate(OnBtnClick)); }