public void SwitchChoose(int newTab) { if (newTab == -1 || model.nowTab == newTab) { return; } model.nowTab = newTab; for (int i = 0; i < view.tabGroup.tabs.Count; i++) { CardsTabView childView = view.tabGroup.tabs[i] as CardsTabView; childView.BG.color = Color.white; } { CardsTabView childView = view.tabGroup.tabs [newTab] as CardsTabView; childView.BG.color = Color.red; } if (newTab == 0) { ShowCards(); } HideCardDetail(); }
public void SwitchChoose(int newTab) { if (newTab == -1 || model.nowTab == newTab) { return; } model.nowTab = newTab; //TODO: 修改tag text显示颜色 for (int i = 0; i < view.tabGroup.tabs.Count; i++) { CardsTabView childView = view.tabGroup.tabs[i] as CardsTabView; //childView.BG.color = Color.white; childView.BG.transform.localScale = Vector3.one; childView.TitlePic.sprite = titlePicSprite[i * 2]; } { CardsTabView childView = view.tabGroup.tabs [newTab] as CardsTabView; childView.BG.transform.localScale = Vector3.Scale(childView.BG.transform.localScale, new Vector3(1.1f, 1.1f, 1.1f)); childView.TitlePic.sprite = titlePicSprite[newTab * 2 + 1]; } if (newTab == 0) { ShowCardsAll(); } else if (newTab == 1) { ShowCards(eCardType.ABILITY); } else if (newTab == 2) { ShowCards(eCardType.ITEM); } else if (newTab == 3) { ShowCards(eCardType.ITEM); } HideCardDetail(); }
public void SwitchChoose(int newTab) { if (newTab == -1 || model.nowTab == newTab) { return; } model.nowTab = newTab; for (int i = 0; i < view.TypeTabGroup.tabs.Count; i++) { CardsTabView childView = view.TypeTabGroup.tabs[i] as CardsTabView; childView.BG.color = Color.white; } { CardsTabView childView = view.TypeTabGroup.tabs[newTab] as CardsTabView; childView.BG.color = Color.red; } List <string> skills = new List <string>(); if (newTab == 0) { skills = pSkillMgr.GetSkillByType(eSkillType.None); } else if (newTab == 1) { skills = pSkillMgr.GetSkillByType(eSkillType.Koucai); } else if (newTab == 2) { skills = pSkillMgr.GetSkillByType(eSkillType.Game); } else if (newTab == 3) { skills = pSkillMgr.GetSkillByType(eSkillType.None); } model.NowSkills = skills; for (int i = 0; i < view.SkillPanels.Count; i++) { view.SkillPanels[i].gameObject.SetActive(false); } view.SkillPanels[newTab].gameObject.SetActive(true); SwitchTabInit(); //foreach (SkillItemView vv in view.SkillViewList) //{ // resLoader.ReleaseGO("UI/Schedule/ScheduleItem",vv.root.gameObject); //} //view.SkillViewList.Clear(); //foreach (string sid in skills) //{ // SkillAsset sa = pSkillMgr.GetSkillAsset(sid); // GameObject go = resLoader.Instantiate("UI/Schedule/ScheduleItem", view.ChoicesContainer); // SkillItemView vv = new SkillItemView(); // vv.BindView(go.transform); // vv.Title.text = sa.SkillName; // view.SkillViewList.Add(vv); // vv.Unselect(); // ClickEventListerner listener = vv.Icon.gameObject.GetComponent<ClickEventListerner>(); // if (listener == null) // { // listener = vv.Icon.gameObject.AddComponent<ClickEventListerner>(); // } // listener.ClearClickEvent(); // listener.OnClickEvent += delegate { // SelectSkill(vv); // }; //} HideDetail(); }
public void SwitchChoose(int newTab) { if (newTab == -1 || model.nowTab == newTab) { return; } model.nowTab = newTab; for (int i = 0; i < view.TypeTabGroup.tabs.Count; i++) { CardsTabView childView = view.TypeTabGroup.tabs[i] as CardsTabView; childView.BG.color = Color.white; } { CardsTabView childView = view.TypeTabGroup.tabs[newTab] as CardsTabView; childView.BG.color = Color.red; } List <string> skills = new List <string>(); if (newTab == 0) { skills = pSkillMgr.GetSkillByType("common"); } else if (newTab == 1) { skills = pSkillMgr.GetSkillByType("quality"); } else if (newTab == 2) { skills = pSkillMgr.GetSkillByType("caiyi"); } else if (newTab == 3) { skills = pSkillMgr.GetSkillByType("game"); } model.NowSkills = skills; foreach (SkillItemView vv in view.SkillViewList) { resLoader.ReleaseGO("UI/Schedule/ScheduleItem", vv.root.gameObject); } view.SkillViewList.Clear(); foreach (string sid in skills) { SkillAsset sa = pSkillMgr.GetSkillAsset(sid); GameObject go = resLoader.Instantiate("UI/Schedule/ScheduleItem", view.ChoicesContainer); SkillItemView vv = new SkillItemView(); vv.BindView(go.transform); vv.Title.text = sa.SkillName; view.SkillViewList.Add(vv); vv.Unselect(); ClickEventListerner listener = vv.Icon.gameObject.GetComponent <ClickEventListerner>(); if (listener == null) { listener = vv.Icon.gameObject.AddComponent <ClickEventListerner>(); } listener.ClearClickEvent(); listener.OnClickEvent += delegate { SelectSkill(vv); }; } HideDetail(); }