| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 | using System;using System.Collections.Generic;using Common.Utility.CombatEvent;using Core.Utility;using Fort23.Core;using Fort23.UTool;using GameLogic.Combat.CombatTool;using GameLogic.Combat.Hero;using GameLogic.Combat.Hero.Turntable;using GameLogic.Combat.Skill;using GameLogic.Player;using UnityEngine;using Utility;namespace Fort23.Mono{    [UIBinding(prefab = "ZhuanPanPanel")]    public partial class ZhuanPanPanel : UIComponent    {        private List<gf_widget> _gfWidgets = new List<gf_widget>();        // List<WuXingGongFaWidget> _wuXingGongFaWidgets = new List<WuXingGongFaWidget>();        private Map<WuXingType, WuXingGongFaWidget> _wuXingGongFaWidgets = new Map<WuXingType, WuXingGongFaWidget>();        public async CTask ShowPanel()        {            for (_wuXingGongFaWidgets.Begin(); _wuXingGongFaWidgets.Next();)            {                UIManager.Instance.DormancyGComponent(_wuXingGongFaWidgets.Value);            }            _wuXingGongFaWidgets.Clear();            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 * 103;                double y = c * 0 + d * 103;                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);                _wuXingGongFaWidgets.Add(widget.huangDaoWuXingType, widget);            }            ExercisesAlter(null);        }        private void SetSkillFxMovePlay(SkillSlots skillSlots)        {            WuXingType wuXingType = skillSlots.SkillBasic.wuXingType;            Vector2 startPos = Vector2.zero;            for (int i = 0; i < _gfWidgets.Count; i++)            {                if (_gfWidgets[i].SkillSlots == skillSlots)                {                    startPos=  _gfWidgets[i].transform.position;                }            }            // double hd = skillSlots.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 * 150;            // double y = c * 0 + d * 150;                      Vector2 endPos = _wuXingGongFaWidgets[wuXingType].transform.position;            Vector2 center = endPos - startPos;            center = startPos + (center * 0.5f);            BesselPath besselPath = new BesselPath();            besselPath.controlPoints.Add(startPos);            besselPath.controlPoints.Add(new Vector3(center.x, center.y, -0.5f));            besselPath.controlPoints.Add(endPos);            besselPath.controlPoints.Add(endPos);            Vector2 startPos2 = endPos;            Vector2 endPos2 = currUseSkillRoot.transform.position;            Vector2 center2 = endPos2 - startPos2;            center2 = startPos2 + (center2 * 0.5f);            BesselPath besselPath2 = new BesselPath();            besselPath2.controlPoints.Add(startPos2);            besselPath2.controlPoints.Add(new Vector3(center2.x, center2.y, -0.5f));            besselPath2.controlPoints.Add(endPos2);            besselPath2.controlPoints.Add(endPos2);            BesselPathGroup besselPathGroup = new BesselPathGroup();            besselPathGroup.AddBesselPath(besselPath);            besselPathGroup.AddBesselPath(besselPath2);            GameObject fxObject = null;            switch (wuXingType)            {                case WuXingType.Gold:                    fxObject = fx_skill_jing;                    break;                case WuXingType.Water:                    fxObject = fx_skill_shui;                    break;                case WuXingType.Wood:                    fxObject = fx_skill_huo;                    break;                case WuXingType.Fire:                    fxObject = fx_skill_huo;                    break;                case WuXingType.Earth:                    fxObject = fx_skill_shui;                    break;            }            UseSkillShowFxMono useSkillShowFxMono = CObjectPool.Instance.Fetch<UseSkillShowFxMono>();            ParticleSystemPool particleSystemPool =                GObjectPool.Instance.FetchAsyncForGameObject<ParticleSystemPool>(fxObject, fxObject.name);            particleSystemPool.transform.parent = fxObject.transform.parent;            useSkillShowFxMono.Init(besselPathGroup, particleSystemPool);        }        private void Init()        {        }        public override void AddEvent()        {                        StaticUpdater.Instance.AddLateUpdateCallBack(Update);            CombatEventManager.Instance.AddEventListener(CombatEventType.ExercisesAlter, ExercisesAlter);            CombatEventManager.Instance.AddEventListener(CombatEventType.TaoismSkillAlter, TaoismSkillAlter);            CombatEventManager.Instance.AddEventListener(CombatEventType.AddUseGongFa, AddUseGongFa);            CombatEventManager.Instance.AddEventListener(CombatEventType.UseSkill, UseSkill);            CombatEventManager.Instance.AddEventListener(CombatEventType.UseSkillFinish, UseSkillFinish);        }        public override void DelEvent()        {            StaticUpdater.Instance.RemoveLateUpdateCallBack(Update);            CombatEventManager.Instance.RemoveEventListener(CombatEventType.UseSkill, UseSkill);            CombatEventManager.Instance.RemoveEventListener(CombatEventType.ExercisesAlter, ExercisesAlter);            CombatEventManager.Instance.RemoveEventListener(CombatEventType.TaoismSkillAlter, TaoismSkillAlter);            CombatEventManager.Instance.RemoveEventListener(CombatEventType.AddUseGongFa, AddUseGongFa);            CombatEventManager.Instance.RemoveEventListener(CombatEventType.UseSkillFinish, UseSkillFinish);        }        private async void UseSkillFinish(IEventData ieveData)        {            UseSkillFinishEventData eventData = ieveData as UseSkillFinishEventData;            if (eventData.SkillBasic.CombatHeroEntity.IsEnemy)            {                return;            }            CombatHeroSkillControl combatHeroSkillControl =                eventData.SkillBasic.CombatHeroEntity.CombatHeroSkillControl.This<CombatHeroSkillControl>();            if (combatHeroSkillControl.useSkillCount <= 0)            {                currUseSkillRoot.SetActive(false);            }        }        private async void UseSkill(IEventData ieveData)        {            CombatUseSkillEventData eventData = ieveData as CombatUseSkillEventData;            if (eventData.useSkill.CombatHeroEntity.IsEnemy)            {                return;            }            currUseSkillRoot.SetActive(true);            currUseSkillIcon.icon_name = eventData.useSkill.SelfSkillConfig.icon;        }        private async void AddUseGongFa(IEventData ieveData)        {            AddUseGongFaEventData eventData = ieveData as AddUseGongFaEventData;            SkillBasic skillBasic = eventData.SkillBasic;            if (skillBasic.CombatHeroEntity.IsEnemy)            {                return;            }            SetSkillFxMovePlay(eventData.SkillSlots);            CombatHeroSkillControl combatHeroSkillControl =                skillBasic.CombatHeroEntity.CombatHeroSkillControl.This<CombatHeroSkillControl>();            if (combatHeroSkillControl.useSkillCount > 0 || combatHeroSkillControl.currUseSkill != null)            {                UseQuqueSkill useQuqueSkill =                    await UIManager.Instance.CreateGComponentForObject<UseQuqueSkill>(UseQuqueSkill, null,                        UseQuqueSkillRoot, isInstance: true);                useQuqueSkill.ShowWidget(skillBasic);                useQuqueSkill.transform.SetAsLastSibling();            }        }        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                .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.SkillSlots = skillBasic;                gfWidget.InitWidget(skillBasic, CombatController.currActiveCombat                    .playerHeroEntity);                _gfWidgets.Add(gfWidget);            }        }        public void Update()        {            if (CombatController.currActiveCombat == null ||                CombatController.currActiveCombat.CombatHeroController == null ||                CombatController.currActiveCombat.playerHeroEntity == null || CombatController                    .currActiveCombat.playerHeroEntity.CombatHeroSkillControl == null)            {                return;            }            CombatHeroSkillControl combatHeroSkillControl = CombatController.currActiveCombat                .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);                }            }            for (int i = 0; i < _gfWidgets.Count; i++)            {                gf_widget gfWidget = _gfWidgets[i];                gfWidget.Update();                double hd = gfWidget.SkillSlots.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 * 150;                double y = c * 0 + d * 150;                gfWidget.transform.anchoredPosition = new Vector2((float)x, (float)y);            }        }    }}
 |