123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- 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>();
- private ParticleSystemPool fx_ui_zhuangPan;
- public async CTask ShowPanel()
- {
- CTaskAwaitBuffer cTaskAwaitBuffer = new CTaskAwaitBuffer();
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>("fx_ui_jin_tw", Prestore: true));
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>("fx_ui_shui_tw", Prestore: true));
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>("fx_ui_mu_tw", Prestore: true));
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>("fx_ui_huo_tw", Prestore: true));
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>("fx_ui_tu_tw", Prestore: true));
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>("fx_ui_zhuanpanBuff_xingchendao",
- delegate(ParticleSystemPool pool)
- {
- fx_ui_zhuangPan=pool;
- pool.transform.SetParent(pan);
- pool.transform.localPosition=new Vector3(0, 0, 0);
- pool.SetActive(false);
- }));
- await cTaskAwaitBuffer.WaitAll();
- cTaskAwaitBuffer.Dispose();
- 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 async CTask 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 endPos2 = currUseSkillRoot.transform.position;
- BesselPath besselPath = new BesselPath();
- besselPath.controlPoints.Add(startPos);
- besselPath.controlPoints.Add(startPos);
- besselPath.controlPoints.Add(endPos2);
- besselPath.controlPoints.Add(endPos2);
- BesselPathGroup besselPathGroup = new BesselPathGroup();
- besselPathGroup.AddBesselPath(besselPath);
- // besselPathGroup.AddBesselPath(besselPath2);
- // GameObject fxObject = null;
- string fxName = null;
- string fxName_end = null;
- string fxName_tar = null;
- switch (wuXingType)
- {
- case WuXingType.Gold:
- // fxObject = fx_skill_jing;
- fxName = "fx_ui_jin_tw";
- fxName_end = "fx_ui_jin_end";
- fxName_tar = "fx_ui_jin_tar";
- break;
- case WuXingType.Water:
- // fxObject = fx_skill_shui;
- fxName = "fx_ui_shui_tw";
- fxName_end = "fx_ui_shui_end";
- fxName_tar = "fx_ui_shui_tar";
- break;
- case WuXingType.Wood:
- // fxObject = fx_skill_huo;
- fxName = "fx_ui_mu_tw";
- fxName_end = "fx_ui_mu_end";
- fxName_tar = "fx_ui_mu_tar";
- break;
- case WuXingType.Fire:
- // fxObject = fx_skill_huo;
- fxName = "fx_ui_huo_tw";
- fxName_end = "fx_ui_huo_end";
- fxName_tar = "fx_ui_huo_tar";
- break;
- case WuXingType.Earth:
- // fxObject = fx_skill_shui;
- fxName = "fx_ui_tu_tw";
- fxName_end = "fx_ui_tu_end";
- fxName_tar = "fx_ui_tu_tar";
- break;
- }
- UseSkillShowFxMono useSkillShowFxMono = CObjectPool.Instance.Fetch<UseSkillShowFxMono>();
- ParticleSystemPool particleSystemPool1 = null;
- ParticleSystemPool particleSystemPool2 = null;
- ParticleSystemPool particleSystemPool3 = null;
- using (CTaskAwaitBuffer cTaskAwaitBuffer = new CTaskAwaitBuffer())
- {
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>(fxName,
- delegate(ParticleSystemPool pool)
- {
- particleSystemPool1 = pool;
- particleSystemPool1.SetParent(fxRoot);
- particleSystemPool1.transform.position = startPos;
- }));
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>(fxName_end,
- delegate(ParticleSystemPool pool)
- {
- particleSystemPool2 = pool;
- particleSystemPool2.SetParent(fxRoot);
- particleSystemPool2.transform.position = endPos2;
- particleSystemPool2.SetActive(false);
- }));
- cTaskAwaitBuffer.AddTask(
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>(fxName_tar,
- delegate(ParticleSystemPool pool)
- {
- particleSystemPool3 = pool;
- particleSystemPool3.SetParent(fxRoot);
- particleSystemPool3.transform.position =
- _wuXingGongFaWidgets[wuXingType].transform.position;
- particleSystemPool3.SetActive(false);
- }));
- await cTaskAwaitBuffer.WaitAll();
- }
- // particleSystemPool.transform.parent = fxObject.transform.parent;
- useSkillShowFxMono.Init(besselPathGroup, particleSystemPool1, particleSystemPool2, particleSystemPool3);
- }
- 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;
- }
- string fxName_end = "";
- switch (eventData.useSkill.wuXingType)
- {
- case WuXingType.Gold:
- // fxObject = fx_skill_jing;
- fxName_end = "fx_ui_jin_end";
- break;
- case WuXingType.Water:
- // fxObject = fx_skill_shui;
- fxName_end = "fx_ui_shui_end";
- break;
- case WuXingType.Wood:
- // fxObject = fx_skill_huo;
- fxName_end = "fx_ui_mu_end";
- break;
- case WuXingType.Fire:
- // fxObject = fx_skill_huo;
- fxName_end = "fx_ui_huo_end";
- break;
- case WuXingType.Earth:
- // fxObject = fx_skill_shui;
- fxName_end = "fx_ui_tu_end";
- break;
- }
- Vector2 endPos2 = currUseSkillRoot.transform.position;
- GObjectPool.Instance.FetchAsync<ParticleSystemPool>(fxName_end,
- delegate(ParticleSystemPool pool)
- {
- pool.SetParent(fxRoot);
- pool.transform.position = endPos2;
- });
- 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 > 1 || 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)
- {
- if (fx_ui_zhuangPan != null)
- {
- fx_ui_zhuangPan.gameObject.SetActive(ds60101.isSkillActive);
- }
- zhuanpan_chongneng.gameObject.SetActive(!ds60101.isSkillActive);
- zhuanpan_chongneng.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);
- }
- }
- }
- }
|