123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- 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<gf_widget> _gfWidgets = new List<gf_widget>();
- public static async CTask OpenZhuanPanPanel()
- {
- ZhuanPanPanel zhuanPanPanel =
- await UIManager.Instance.LoadAndOpenPanel<ZhuanPanPanel>(null, UILayer.Bottom);
- zhuanPanPanel.ShowPanel();
- }
- public async CTask ShowPanel()
- {
- UIManager.Instance.DormancyAllGComponent<WuXingGongFaWidget>();
- 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>(
- 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<gf_widget>();
- CombatHeroSkillControl combatHeroSkillControl = CombatController.currActiveCombat.CombatHeroController
- .playerHeroEntity.CombatHeroSkillControl
- .This<CombatHeroSkillControl>();
- 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<gf_widget>(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<CombatHeroSkillControl>();
- 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);
- }
- }
- }
- }
|