public void AddClickEvent(Transform transform, EventDelegate.Callback callBack) { if (callBack == null) { return; } UIToolkits.AddChildComponentMouseClick(transform.gameObject, callBack); }
public override void OnCreate() { base.OnCreate(); AddChildComponentMouseClick("EditorBtn", OnEditStageClicked); m_fruitBoard = UIToolkits.FindChild(mUIObject.transform, "FruitBoard").gameObject; m_jellyBoard = UIToolkits.FindChild(mUIObject.transform, "JellyBoard").gameObject; m_scoreBoard = UIToolkits.FindChild(mUIObject.transform, "ScoreBoard").gameObject; m_collectBoard = UIToolkits.FindChild(mUIObject.transform, "CollectBoard").gameObject; for (int i = 0; i < 3; ++i) { m_collectSprite[i] = GetChildComponent <UISprite>("Collect" + i); m_collectLabel[i] = GetChildComponent <UILabel>("CollectLabel" + i); m_coolDownSprite[i] = GetChildComponent <UISprite>("CoolDown" + (i + 1).ToString()); m_coolDownSprite[i].gameObject.SetActive(false); m_itemBtn[i] = GetChildComponent <UIButton>("UseItem" + (i + 1).ToString() + "Btn"); m_background[i] = GetChildComponent <UISprite>("Background" + (i + 1).ToString()); } UIToolkits.AddChildComponentMouseClick(m_itemBtn[0].gameObject, delegate() { UserOrBuyItem(PurchasedItem.ItemInGame_Resort); }); UIToolkits.AddChildComponentMouseClick(m_itemBtn[1].gameObject, delegate() { UserOrBuyItem(PurchasedItem.ItemInGame_Hammer); }); UIToolkits.AddChildComponentMouseClick(m_itemBtn[2].gameObject, delegate() { if (GlobalVars.CurStageData.TimeLimit > 0 && !GameLogic.Singleton.IsStoppingTime) { UserOrBuyItem(PurchasedItem.ItemInGame_TimeStoper); } else if (GlobalVars.CurStageData.ChocolateCount > 0 && !GameLogic.Singleton.IsStopingChocoGrow) { UserOrBuyItem(PurchasedItem.ItemInGame_ChocoStoper); } }); m_showCoinTweener = mUIObject.GetComponent <TweenPosition>(); m_debugBtn = GetChildComponent <UIButton>("EditorBtn"); }
public bool AddChildComponentMouseClick(string name, EventDelegate.Callback callBack) { return(UIToolkits.AddChildComponentMouseClick(mUIObject.transform, name, callBack)); }