bingo 项目提交
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using BingoBrain.Core;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class JEffectCtrl : BaseCtrl
|
||||
{
|
||||
public static JEffectCtrl Instance { get; private set; }
|
||||
|
||||
private JEffectModel model;
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41f6717a950245f6ae62ca7ea34318fa
|
||||
timeCreated: 1680252293
|
||||
@@ -0,0 +1,23 @@
|
||||
using BingoBrain.Core;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class JEffectModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnReset()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce60155fc9eb43a8a94b7b08a05a4890
|
||||
timeCreated: 1680252293
|
||||
@@ -0,0 +1,184 @@
|
||||
using System;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using Spine.Unity;
|
||||
using BingoBrain.Core;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class JEffectUI : BaseUI
|
||||
{
|
||||
private JEffectUICtrl ctrl;
|
||||
private JEffectModel model;
|
||||
private FGUI.JFx.com_FX ui;
|
||||
|
||||
private Transform parTrf;
|
||||
|
||||
public JEffectUI(JEffectUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.JEffectUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "JFx";
|
||||
uiInfo.assetName = "com_FX";
|
||||
uiInfo.layerType = UILayerType.Animation;
|
||||
}
|
||||
|
||||
public void PlayFx(FxPlayData fxPlayData)
|
||||
{
|
||||
var data = fxPlayData;
|
||||
GameObject arg;
|
||||
Transform trf;
|
||||
Action recFx;
|
||||
if (data.isParticleSystem)
|
||||
{
|
||||
FX.Instance.GetFx<ParticleSystem>(data.fxType, ps =>
|
||||
{
|
||||
var system = ps;
|
||||
system.Play();
|
||||
arg = system.gameObject;
|
||||
trf = system.transform;
|
||||
recFx = delegate { FX.Instance.RecFx(data.fxType, system); };
|
||||
DoSomething(data, trf, arg, recFx);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
FX.Instance.GetFx<SkeletonAnimation>(data.fxType, sk =>
|
||||
{
|
||||
var system = sk;
|
||||
trf = system.transform;
|
||||
arg = system.gameObject;
|
||||
recFx = delegate { FX.Instance.RecFx(data.fxType, system); };
|
||||
DoSomething(data, trf, arg, recFx);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void DoSomething(FxPlayData data, Transform trf, GameObject arg, Action recFx)
|
||||
{
|
||||
trf.SetParent(parTrf);
|
||||
arg.SetLayer("UI");
|
||||
var cb = SetSortingOrder(arg);
|
||||
data.endEvent += (e) => cb?.Invoke();
|
||||
|
||||
var startPot = GameHelper.FguiToUnityLocalPot(data.startPot);
|
||||
|
||||
trf.localPosition = startPot;
|
||||
trf.localScale = Vector3.one * data.size;
|
||||
trf.localEulerAngles = Vector3.zero;
|
||||
data.startEvent?.Invoke(arg);
|
||||
|
||||
IsfvKit.StartAction("1", () =>
|
||||
{
|
||||
data.endEvent?.Invoke(arg);
|
||||
|
||||
|
||||
recFx?.Invoke();
|
||||
|
||||
FxPlayData.Release(data);
|
||||
}, data.duration);
|
||||
}
|
||||
|
||||
private Action SetSortingOrder(GameObject obj)
|
||||
{
|
||||
Action action = null;
|
||||
var renders = obj.GetComponentsInChildren<Renderer>();
|
||||
foreach (var render in renders)
|
||||
{
|
||||
if (render == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
render.sortingOrder += 300;
|
||||
action += () => { render.sortingOrder -= 300; };
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.JFx.com_FX;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
parTrf = ui.displayObject.cachedTransform;
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class FxPlayData
|
||||
{
|
||||
private static Jcna<FxPlayData> _Pool = new();
|
||||
|
||||
public static FxPlayData Get(Fx_Type fx_Type, float _duration, Vector2 _pot)
|
||||
{
|
||||
var data = _Pool.Get();
|
||||
if (_pot == Vector2.zero)
|
||||
{
|
||||
data.startPot = GRoot.inst.size / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.startPot = _pot;
|
||||
}
|
||||
|
||||
if (_duration == 0)
|
||||
{
|
||||
data.duration = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.duration = _duration;
|
||||
}
|
||||
|
||||
data.fxType = fx_Type;
|
||||
return data;
|
||||
}
|
||||
|
||||
public static void Release(FxPlayData data)
|
||||
{
|
||||
data.duration = 0;
|
||||
data.startEvent = null;
|
||||
data.endEvent = null;
|
||||
data.isParticleSystem = true;
|
||||
data.startPot = Vector2.zero;
|
||||
_Pool.Release(data);
|
||||
}
|
||||
|
||||
public float duration;
|
||||
|
||||
public Fx_Type fxType;
|
||||
|
||||
public bool isParticleSystem = true;
|
||||
|
||||
public Vector2 startPot;
|
||||
|
||||
public Action<GameObject> startEvent;
|
||||
|
||||
public Action<GameObject> endEvent;
|
||||
|
||||
public int size = 100;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27bc141811004d56a5f23d6ae5b7659c
|
||||
timeCreated: 1680252293
|
||||
@@ -0,0 +1,86 @@
|
||||
using BingoBrain.Core;
|
||||
using BingoBrain.HotFix;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class JEffectUICtrl : BaseUICtrl
|
||||
{
|
||||
private JEffectUI ui;
|
||||
private JEffectModel model;
|
||||
|
||||
private uint openUIMsg = SkinInfo.JEffectUI_Open;
|
||||
private uint closeUIMsg = SkinInfo.JEffectUI_Close;
|
||||
|
||||
private bool isOpen = false;
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null || ui.isClose)
|
||||
{
|
||||
ui = new JEffectUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
|
||||
ui = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
uiCtrlDispatcher.AddListener(SkinInfo.PlayUIFX, PlayFx);
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
uiCtrlDispatcher.RemoveListener(SkinInfo.PlayUIFX, PlayFx);
|
||||
}
|
||||
|
||||
private void PlayFx(object obj)
|
||||
{
|
||||
if (!isOpen)
|
||||
{
|
||||
OpenUI();
|
||||
}
|
||||
|
||||
var fxType = (FxPlayData)obj;
|
||||
ui.PlayFx(fxType);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5d323f9395043d48accae55876f6718
|
||||
timeCreated: 1680252293
|
||||
Reference in New Issue
Block a user