private void ShowType(EHEROSHOWTYPE type) { if (showGo != null) { showGo.SetParent(Hide_trf); } if (LOfficer_obj.activeInHierarchy) { LOfficer_obj.SetActive(false); Left_obj.SetActive(true); } if (Divination_obj.activeInHierarchy) { Divination_obj.SetActive(false); takeoff_btn.gameObject.SetActive(false); take_btn.gameObject.SetActive(false); Equip_obj.SetActive(true); Dress_btn.gameObject.SetActive(true); Intensify_btn.gameObject.SetActive(true); } ShowLeft(); switch (type) { case EHEROSHOWTYPE.Card: ShowCard(); break; case EHEROSHOWTYPE.Officer: ShowOfficer(); break; case EHEROSHOWTYPE.Divination: ShowDivination(); break; case EHEROSHOWTYPE.Skill: ShowSkill(); break; case EHEROSHOWTYPE.Relation: ShowRelation(); break; case EHEROSHOWTYPE.Detail: ShowDetail(); break; } showType = type; }
private void ShowDivination() { showGo = Divination_trf; showGo.SetParent(Right_trf); Divination_obj.SetActive(true); takeoff_btn.gameObject.SetActive(true); take_btn.gameObject.SetActive(true); Dress_btn.gameObject.SetActive(false); Intensify_btn.gameObject.SetActive(false); Equip_obj.SetActive(false); HeroDivinationView hdv = Divination_obj.GetComponent <HeroDivinationView>(); hdv.SetHeroTotemView(heroData); EventListener.Get(gotoDiv_btn.gameObject).OnClick = e => { UIFace.GetSingleton().Open(UIID.Divination); }; int count = divparent_trf.childCount; TotemData[] mData = TotemMgr.GetSingleton().GetUnDressTotem(); while (count > mData.Length) { DestroyImmediate(divparent_trf.GetChild(0).gameObject); count = divparent_trf.childCount; } for (int i = 0; i < mData.Length; ++i) { TotemData data = mData[i]; if (data.HeroID != 0) { continue; } GameObject totem; if (i < count) { totem = divparent_trf.GetChild(i).gameObject; } else { totem = Instantiate(totemGo, divparent_trf); } DivinationItemView div = totem.GetComponent <DivinationItemView>(); div.SetView(data); EventListener.Get(totem).OnClick = e => { ZEventSystem.Register(EventConst.TAKETOTEM, this, "TakeTotem"); UIFace.GetSingleton().Open(UIID.DivinationTip, data, SHOWBUTTON.Etake); }; EventListener.Get(totem).BegineDragEvent = e => { divination_sr.OnBeginDrag(e); }; EventListener.Get(totem).DragEvent = e => { divination_sr.OnDrag(e); }; EventListener.Get(totem).EndDragEvent = e => { divination_sr.OnEndDrag(e); }; } Vector2 size = divination_sr.content.sizeDelta; size.y = Mathf.CeilToInt(mData.Length / 3f) * 159 + 26; divination_sr.content.sizeDelta = size; EventListener.Get(take_btn.gameObject).OnClick = e => { if (mData.Length <= 0) { return; } int index = mData.Length - 1; TotemData[] totems = heroData.GetTotem(); if (totems.Length == 0) { CanvasView.Instance.AddNotice("没有可用的气运槽"); return; } for (int i = 0, length = totems.Length; i < length; ++i) { TotemMgr.GetSingleton().TakeTotem(mData[i], heroData); } ShowSide(false); }; EventListener.Get(takeoff_btn.gameObject).OnClick = e => { TotemData[] totems = heroData.GetTotem(); for (int i = 0, length = totems.Length; i < length; ++i) { if (totems[i] == null) { continue; } TotemMgr.GetSingleton().TakeOffTotem(totems[i]); } ShowSide(false); }; }
public void ShowLeft() { Name_txt.text = heroData.JsonData.name; show_txt.text = heroData.Officer > 0 ? JsonMgr.GetSingleton().GetOfficerByID(heroData.Officer).Post : ""; //需要获取武将官阶的官职列表并对dd赋值 int[] unlock = JsonMgr.GetSingleton().GetHeroRareByID(heroData.Rare).UnLock; for (int i = 0; i < officerText.Length; ++i) { if (i >= unlock.Length) { officerText[i].text = ""; continue; } Officer o = JsonMgr.GetSingleton().GetOfficerByID(unlock[i]); string txt = officerText[i].text = o.Post; EventListener.Get(officerText[i].gameObject).OnClick = e => { show_txt.text = txt; ShowPopList(null); HeroMgr.GetSingleton().TakeOfficer(heroData, o.ID); if (showType == EHEROSHOWTYPE.Detail) { ShowDetail(); } }; } Vector2 size = scrollRect.content.sizeDelta; size.y = unlock.Length * 53; scrollRect.content.sizeDelta = size; EventListener.Get(hero_obj).OnClick = e => { if (player != null && !player.IsPlaying) { player.RandomPlay(true); } }; EventListener.Get(hero_obj).BegineDragEvent = e => { previousX = Input.mousePosition.x; }; EventListener.Get(hero_obj).DragEvent = e => { offset = previousX - Input.mousePosition.x; previousX = Input.mousePosition.x; Herotf.Rotate(Vector3.up, offset * scale, Space.Self); }; HeroEquipView hev = Equip_obj.GetComponent <HeroEquipView>(); hev.SetView(heroData); EventListener.Get(Dress_btn.gameObject).OnClick = e => { EquipData[] equips = heroData.GetEquip(); for (int i = 0; i < equips.Length; ++i) { EquipData data = equips[i]; if (data == null) { string md5 = EquipMgr.GetSingleton().TestCanDress((EquipPart)i + 1, heroData); EquipData equip = EquipMgr.GetSingleton().GetEquipDataByUID(md5); if (equip != null) { EquipMgr.GetSingleton().TakeEquip(equip, heroData); hev.SetView(heroData); } } } }; EventListener.Get(Intensify_btn.gameObject).OnClick = e => { EquipData[] equips = heroData.GetEquip(); bool canUp = false; for (int i = 0; i < equips.Length; ++i) { EquipData data = equips[i]; if (data == null || data.StrengthenLv == HeroMgr.MaxHeroLevel) { continue; } canUp = true; EquipMgr.GetSingleton().UpEquip(data); hev.SetView(heroData); } if (!canUp) { CanvasView.Instance.AddNotice("暂时没有可强化装备"); } }; }