private void CreateDifficultyBtns(List <DifficultKind> list) { this._listDifficultyBtn = new List <UIDifficultyBtn>(); int cnt = 0; list.ForEach(delegate(DifficultKind x) { this._listDifficultyBtn.Add(UIDifficultyBtn.Instantiate(this._prefabUIDifficultBtn.GetComponent <UIDifficultyBtn>(), this._uiGridBtns.get_transform(), x, cnt)); this._listDifficultyBtn.get_Item(cnt).set_name(string.Format("DifficultyBtn{0}", (int)x)); this._listDifficultyBtn.get_Item(cnt).isFocus = false; this._listDifficultyBtn.get_Item(cnt).toggle.group = 1; this._listDifficultyBtn.get_Item(cnt).toggle.set_enabled(false); this._listDifficultyBtn.get_Item(cnt).toggle.onDecide = delegate { this.OnDecideDifficulty(this._listDifficultyBtn.get_Item(this._nIndex).difficultKind); }; this._listDifficultyBtn.get_Item(cnt).toggle.onActive = Util.CreateEventDelegateList(this, "OnActive", cnt); if (this._listDifficultyBtn.get_Item(cnt).index == 0) { this._listDifficultyBtn.get_Item(cnt).toggle.startsActive = true; } cnt++; }); this._uiGridBtns.Reposition(); }
private void CreateDifficultyBtns(List <DifficultKind> list) { _listDifficultyBtn = new List <UIDifficultyBtn>(); int cnt = 0; list.ForEach(delegate(DifficultKind x) { _listDifficultyBtn.Add(UIDifficultyBtn.Instantiate(((Component)_prefabUIDifficultBtn).GetComponent <UIDifficultyBtn>(), _uiGridBtns.transform, x, cnt)); _listDifficultyBtn[cnt].name = $"DifficultyBtn{(int)x}"; _listDifficultyBtn[cnt].isFocus = false; _listDifficultyBtn[cnt].toggle.group = 1; _listDifficultyBtn[cnt].toggle.enabled = false; _listDifficultyBtn[cnt].toggle.onDecide = delegate { OnDecideDifficulty(_listDifficultyBtn[_nIndex].difficultKind); }; _listDifficultyBtn[cnt].toggle.onActive = Util.CreateEventDelegateList(this, "OnActive", cnt); if (_listDifficultyBtn[cnt].index == 0) { _listDifficultyBtn[cnt].toggle.startsActive = true; } cnt++; }); _uiGridBtns.Reposition(); }
public static UIDifficultyBtn Instantiate(UIDifficultyBtn prefab, Transform parent, DifficultKind iKind, int nIndex) { UIDifficultyBtn uIDifficultyBtn = UnityEngine.Object.Instantiate(prefab); uIDifficultyBtn.transform.parent = parent; uIDifficultyBtn.transform.localScaleOne(); uIDifficultyBtn.transform.localPositionZero(); uIDifficultyBtn.Init(iKind, nIndex); return(uIDifficultyBtn); }
public static UIDifficultyBtn Instantiate(UIDifficultyBtn prefab, Transform parent, DifficultKind iKind, int nIndex) { UIDifficultyBtn uIDifficultyBtn = Object.Instantiate <UIDifficultyBtn>(prefab); uIDifficultyBtn.get_transform().set_parent(parent); uIDifficultyBtn.get_transform().localScaleOne(); uIDifficultyBtn.get_transform().localPositionZero(); uIDifficultyBtn.Init(iKind, nIndex); return(uIDifficultyBtn); }