/// <summary> /// select combine hero . /// </summary> /// <returns><c>true</c>, if num < max can select, <c>false</c> can't select.</returns> public bool HeroSelect(HeroButton heroButton, bool select) { if (heroButton == null) { return(false); } if (CanClickEnable()) { return(false); } Debugger.Log("instanceid:" + heroButton.HeroInfo.instanceID); if (select) { return(HeroCombineProxy.instance.AddHeroToCombineMaterial(heroButton.HeroInfo.instanceID)); } else { return(HeroCombineProxy.instance.RemoveHeroFromCombineMaterial(heroButton.HeroInfo.instanceID)); } }
private IEnumerator AnimationCompleteCoroutine(float time) { yield return(new WaitForSeconds(time)); Debugger.Log("animation complete"); //show new hero icon _newHeroGO = CreateGameObject(heroButtonPrefab.gameObject, combineNewHeroRootTrans); HeroInfo info = HeroProxy.instance.GetHeroInfo((uint)HeroCombineProxy.instance.NewHeroIntanceId); if (info == null) { Debugger.LogError(string.Format("combine HeroInfo is not find id:{0}", HeroCombineProxy.instance.NewHeroIntanceId)); } HeroButton btn = _newHeroGO.GetComponent <HeroButton>(); btn.SetHeroInfo(info); btn.HideLevel(); //delay time to reset all StartCoroutine(ResetToOriginCoroutine(2)); }
public void ClickHeroButtonHandle(HeroButton hb) { HeroSelect(hb, !hb.IsSelected); int count = HeroCombineProxy.instance.CombineMaterialDictionary.Count; if (count == 0) { if (dropDownSort.value != 0) { _ignoreClickHeroTableSort = true; dropDownSort.value = 0; } } else { if (dropDownSort.value != hb.HeroInfo.advanceLevel) { _ignoreClickHeroTableSort = true; dropDownSort.value = hb.HeroInfo.advanceLevel; } } RefreshUIHandle(); }
private void RefreshUIMaterialHandle() { HeroCombineProxy HeroCombineProxyInstance = HeroCombineProxy.instance; SortedDictionary <CombinePosition, uint> materials = HeroCombineProxyInstance.CombineMaterialDictionary; CombinePosition pos; HeroInfo info; for (int i = 0, count = combineMaterialRootTran.Length; i < count; i++) { pos = (CombinePosition)(i + 1); info = HeroCombineProxyInstance.GetHeroAt(pos); if (info == null) { TransformUtil.ClearChildren(combineMaterialRootTran[i], true); } else { HeroButton b = combineMaterialRootTran[i].GetComponentInChildren <HeroButton>(); if (b != null) { b.SetHeroInfo(info); b.HideLevel(); } else { GameObject go = CreateGameObject(heroButtonPrefab.gameObject, combineMaterialRootTran[i]); go.transform.localScale = new Vector3(0.68f, 0.68f, 1); b = go.GetComponent <HeroButton>(); b.SetHeroInfo(info); b.HideLevel(); } b.SetSelect(true); b.HideMark(); } } }