using System; using System.Collections.Generic; using Common.Utility.CombatEvent; using Fort23.Core; using GameLogic.Combat.CombatTool; using GameLogic.Combat.Hero; using GameLogic.Combat.Hero.Turntable; using GameLogic.Combat.Skill; using UnityEngine; namespace Fort23.Mono { [UIBinding(prefab = "ZhuanPanPanel")] public partial class ZhuanPanPanel : UIPanel { private List _gfWidgets = new List(); public static async CTask OpenZhuanPanPanel() { ZhuanPanPanel zhuanPanPanel = await UIManager.Instance.LoadAndOpenPanel(null, UILayer.Bottom); zhuanPanPanel.ShowPanel(); } public async CTask ShowPanel() { UIManager.Instance.DormancyAllGComponent(); for (int i = 0; i < 5; i++) { double hd = i * 72 * Math.PI / 180f; double a = Math.Cos(hd); double b = -Math.Sin(hd); double c = Math.Sin(hd); double d = a; double x = a * 0 + b * 120; double y = c * 0 + d * 120; int index = i; WuXingGongFaWidget widget = await UIManager.Instance.CreateGComponentForObject( WuXingGongFaWidget, null, root: pan, isInstance: true); widget.transform.anchoredPosition = new Vector2((float)x, (float)y); widget.ShowWidget(index); } } private void Init() { } protected override void AddEvent() { StaticUpdater.Instance.AddLateUpdateCallBack(Update); CombatEventManager.Instance.AddEventListener(CombatEventType.ExercisesAlter, ExercisesAlter); CombatEventManager.Instance.AddEventListener(CombatEventType.TaoismSkillAlter, TaoismSkillAlter); } protected override void DelEvent() { StaticUpdater.Instance.RemoveLateUpdateCallBack(Update); CombatEventManager.Instance.RemoveEventListener(CombatEventType.ExercisesAlter, ExercisesAlter); // CombatEventManager.Instance.RemoveEventListener(CombatEventType.AddUseGongFa, AddUseGongFa); CombatEventManager.Instance.RemoveEventListener(CombatEventType.TaoismSkillAlter, TaoismSkillAlter); } public override void AddButtonEvent() { lanLiang_button.onClick.AddListener(() => { SkillSelectPanel.OpenSkillSelectPanel(); }); } private void TaoismSkillAlter(IEventData iEventData) { } private async void ExercisesAlter(IEventData iEventData) { _gfWidgets.Clear(); UIManager.Instance.DormancyAllGComponent(); CombatHeroSkillControl combatHeroSkillControl = CombatController.currActiveCombat.CombatHeroController .playerHeroEntity.CombatHeroSkillControl .This(); for (int i = 0; i < combatHeroSkillControl.SkillTurntable.allSkillSlots.Count; i++) { SkillSlots skillBasic = combatHeroSkillControl.SkillTurntable.allSkillSlots[i]; if (skillBasic == null) { continue; } gf_widget gfWidget = await UIManager.Instance.CreateGComponentForObject(this.gf_widget, null, Gf_root, isInstance: true); gfWidget.SkillBasic = skillBasic; gfWidget.InitWidget(skillBasic); _gfWidgets.Add(gfWidget); } } public void Update() { if (CombatController.currActiveCombat == null || CombatController.currActiveCombat.CombatHeroController == null || CombatController.currActiveCombat.CombatHeroController.playerHeroEntity == null || CombatController .currActiveCombat.CombatHeroController.playerHeroEntity.CombatHeroSkillControl == null) { return; } CombatHeroSkillControl combatHeroSkillControl = CombatController.currActiveCombat.CombatHeroController .playerHeroEntity.CombatHeroSkillControl .This(); if (combatHeroSkillControl.taoismSkillBasic != null) { DS60101 ds60101 = combatHeroSkillControl.taoismSkillBasic as DS60101; if (ds60101 != null) { lanLiang.fillAmount = ds60101.currEnergy / ds60101.SelfSkillConfig.effectValue[1]; lanLiang.color = !ds60101._updateTime ? new Color(1f, 0.96f, 0f) : new Color(0.96f, 0f, 1f); } } // lanLiang.fillAmount = combatHeroSkillControl.addChongNeng / 150f; // lanLiang.color = !combatHeroSkillControl.isKuoLiQuanKai // ? new Color(1f, 0.96f, 0f) // : new Color(0.96f, 0f, 1f); for (int i = 0; i < _gfWidgets.Count; i++) { gf_widget gfWidget = _gfWidgets[i]; // if (gfWidget.useCount != gfWidget.SkillBasic.useCount) // { // gfWidget.useCount = gfWidget.SkillBasic.useCount; // switch (gfWidget.SkillBasic.useTriggerType) // { // case 0: // jin.Play("show", false); // break; // case 1: // mu.Play("show", false); // break; // case 2: // shui.Play("show", false); // break; // case 3: // huo.Play("show", false); // break; // case 4: // tu.Play("show", false); // break; // } // } double hd = gfWidget.SkillBasic.angle * Math.PI / 180f; double a = Math.Cos(hd); double b = -Math.Sin(hd); double c = Math.Sin(hd); double d = a; double x = a * 0 + b * 60; double y = c * 0 + d * 60; gfWidget.transform.anchoredPosition = new Vector2((float)x, (float)y); } } } }