fix:1、添加项目
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class JoastCtrl : BaseCtrl
|
||||
{
|
||||
public static JoastCtrl Instance { get; private set; }
|
||||
|
||||
private JoastModel model;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2da16488a9975f34c9be68a519b0e275
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
namespace FlowerPower
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class JoastData
|
||||
{
|
||||
public string ValueStr;
|
||||
|
||||
public float ShowTipsAniTime = 0.2f;
|
||||
|
||||
public float TipsStayAniTime = 1f;
|
||||
|
||||
public float TipsVanishTime = 1.5f;
|
||||
|
||||
public int TipsVanishMoveDic = 100;
|
||||
|
||||
private static List<JoastData> tempTipsData;
|
||||
|
||||
public static JoastData GetTips(string val)
|
||||
{
|
||||
return GetTips(val, 0.2f, 1, 1.5f, 100);
|
||||
}
|
||||
|
||||
public static JoastData GetTips(string val, float ShowTipsAniTime, float TipsStayAniTime, float TipsVanishTime,
|
||||
int TipsVanishMoveDic)
|
||||
{
|
||||
if (tempTipsData == default)
|
||||
{
|
||||
tempTipsData = new List<JoastData>
|
||||
{
|
||||
new(),
|
||||
new()
|
||||
};
|
||||
}
|
||||
|
||||
if (tempTipsData.Count <= 0) return default;
|
||||
var tips = tempTipsData[0];
|
||||
tempTipsData.RemoveAt(0);
|
||||
tips.ValueStr = val;
|
||||
tips.ShowTipsAniTime = ShowTipsAniTime;
|
||||
tips.TipsStayAniTime = TipsStayAniTime;
|
||||
tips.TipsVanishTime = TipsVanishTime;
|
||||
tips.TipsVanishMoveDic = TipsVanishMoveDic;
|
||||
return tips;
|
||||
}
|
||||
|
||||
public void Rest()
|
||||
{
|
||||
tempTipsData.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c708319d9da2ca499b4c7189c3667d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace FlowerPower
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class JoastModel : BaseModel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
private Queue<JoastData> tipsDatas = new Queue<JoastData>();
|
||||
|
||||
public void AddTips(JoastData joastData)
|
||||
{
|
||||
if (tipsDatas.Count > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tipsDatas.Enqueue(joastData);
|
||||
}
|
||||
|
||||
public JoastData GetTips()
|
||||
{
|
||||
return tipsDatas.Count > 0 ? tipsDatas.Dequeue() : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69e2e426856b30041aa4b7e325a0cf10
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,68 @@
|
||||
namespace FlowerPower
|
||||
{
|
||||
using FGUI.PC_Tips;
|
||||
// using FGUI.SC001_Tips;
|
||||
|
||||
public class JoastUI : BaseUI
|
||||
{
|
||||
private JoastUICtrl ctrl;
|
||||
private JoastModel model;
|
||||
private FGUI.PC_Tips.com_tips ui;
|
||||
|
||||
public JoastUI(JoastUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.JoastUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "PC_Tips";
|
||||
uiInfo.assetName = "com_tips";
|
||||
uiInfo.layerType = UILayerType.Tips;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = false;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
CommonHelper.FadeOut(ui);
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as com_tips;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
JoastData joastData = args as JoastData;
|
||||
if (joastData != default)
|
||||
{
|
||||
ui.node_tips.text_tips.text = joastData.ValueStr;
|
||||
ui.t0.Play(() =>
|
||||
{
|
||||
uiCtrlDispatcher.Dispatch(UICtrlMsg.SCTipsUI_Close, joastData);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
CtrlCloseUI();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
// CommonHelper.FadeIn(ui);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5005af43da49e742865966690c41bdb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,95 @@
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class JoastUICtrl : BaseUICtrl
|
||||
{
|
||||
private JoastUI ui;
|
||||
private JoastModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.SCTipsUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.SCTipsUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
model = moduleManager.GetModel(ModelConst.JoastModel) as JoastModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new JoastUI(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, AddTips);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CheckNext);
|
||||
}
|
||||
|
||||
private void CheckNext(object obj)
|
||||
{
|
||||
JoastData joastData = obj as JoastData;
|
||||
joastData.Rest();
|
||||
CloseUI();
|
||||
ShowTips();
|
||||
}
|
||||
|
||||
private void ShowTips()
|
||||
{
|
||||
if (ui != null) return;
|
||||
JoastData joastData = model.GetTips();
|
||||
if (joastData != default)
|
||||
{
|
||||
OpenUI(joastData);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddTips(object obj)
|
||||
{
|
||||
JoastData joastData = obj as JoastData;
|
||||
if (joastData == default) return;
|
||||
model.AddTips(joastData);
|
||||
ShowTips();
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, AddTips);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CheckNext);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c303cafc3cceab45a532640f306b2bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user