首次提交
This commit is contained in:
28
Assets/Scripts/UI/Common/Panel/CommonTopPanel.Designer.cs
generated
Normal file
28
Assets/Scripts/UI/Common/Panel/CommonTopPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,28 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class CommonTopPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Common";
|
||||
public override string UIResName => "CommonTopPanel";
|
||||
|
||||
[AutoFind(Name = "Marquee")]
|
||||
public MarqueeTag Marquee;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<CommonTopPanel>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<CommonTopPanel>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<CommonTopPanel>(); }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbb8f680eb100a84c957fad39fae2e96
|
||||
82
Assets/Scripts/UI/Common/Panel/CommonTopPanel.cs
Normal file
82
Assets/Scripts/UI/Common/Panel/CommonTopPanel.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonTopPanel : UIPanel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
ContentPane.sortingOrder = UIDef.UIOrder.CommonTopPanel;
|
||||
IsShowCursor = false;
|
||||
Lan.Inst.ChangeAction += ChangeLanguageConfirm;
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
InputManager.OnUICanceled += OnUICanceled;
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
{
|
||||
if (action == InputDef.UI.Back)
|
||||
{
|
||||
var panel = UI.Inst.GetUI<HomePanel>();
|
||||
if (panel != null && panel.IsShowing) return;
|
||||
HomePanel.Show();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
// base.OnUpdate();
|
||||
if (Input.GetKeyDown(KeyCode.F9))
|
||||
{
|
||||
PreviewPanel.Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ChangeLanguageConfirm()
|
||||
{
|
||||
var uis = UI.Inst.GetAllUI();
|
||||
List<IUIPanel> panels = new List<IUIPanel>();
|
||||
foreach (var ui in uis)
|
||||
{
|
||||
if (!ui.IsShowing && !ui.IsDotDel)
|
||||
{
|
||||
UI.Inst.DestroyUI(ui.GetType());
|
||||
}
|
||||
else
|
||||
{
|
||||
panels.Add(ui);
|
||||
}
|
||||
}
|
||||
|
||||
//打开的页面重刷多语言
|
||||
foreach (var panel in panels)
|
||||
{
|
||||
panel.SetLanguage();
|
||||
_ui.TrySetPanelLanguage(panel.ContentPane);
|
||||
}
|
||||
|
||||
// Net.Inst.Send(EnmCmdValue.EcvCsAcSetLanguageReq, new CS_AC_SetLanguageReq()
|
||||
// {
|
||||
// AppLanguage = Lan.Inst.GetCurrentCustomLanguageName()
|
||||
// });
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
InputManager.OnUICanceled -= OnUICanceled;
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
Lan.Inst.ChangeAction -= ChangeLanguageConfirm;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Panel/CommonTopPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Panel/CommonTopPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b07b25d31dce1224e913094a95196cbb
|
||||
32
Assets/Scripts/UI/Common/Panel/GMPanel.Designer.cs
generated
Normal file
32
Assets/Scripts/UI/Common/Panel/GMPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class GMPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Common";
|
||||
public override string UIResName => "GMPanel";
|
||||
|
||||
[AutoFind(Name = "InputForce")]
|
||||
public GLabel InputForce;
|
||||
[AutoFind(Name = "BtnOk")]
|
||||
public GButton BtnOk;
|
||||
[AutoFind(Name = "Dir")]
|
||||
public GComboBox Dir;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<GMPanel>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<GMPanel>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<GMPanel>(); }
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Panel/GMPanel.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Panel/GMPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77d73c07771cd2445b26abb2ed0fdbb1
|
||||
30
Assets/Scripts/UI/Common/Panel/GMPanel.cs
Normal file
30
Assets/Scripts/UI/Common/Panel/GMPanel.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class GMPanel : UIPanel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
base.OnInit();
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
base.OnHide();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Panel/GMPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Panel/GMPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e084db244c96e034f8213a921c8c3f9f
|
||||
36
Assets/Scripts/UI/Common/Panel/MessageBox.Designer.cs
generated
Normal file
36
Assets/Scripts/UI/Common/Panel/MessageBox.Designer.cs
generated
Normal file
@@ -0,0 +1,36 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class MessageBox
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Common";
|
||||
public override string UIResName => "MessageBox";
|
||||
|
||||
[AutoFind(Name = "back")]
|
||||
public GImage back;
|
||||
[AutoFind(Name = "TextTitle")]
|
||||
public GTextField TextTitle;
|
||||
[AutoFind(Name = "BtnConfirm")]
|
||||
public GButton BtnConfirm;
|
||||
[AutoFind(Name = "BtnClose")]
|
||||
public GButton BtnClose;
|
||||
[AutoFind(Name = "t0")]
|
||||
public Transition t0;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<MessageBox>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<MessageBox>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<MessageBox>(); }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ce689c460bfe8245948899939807a59
|
||||
96
Assets/Scripts/UI/Common/Panel/MessageBox.cs
Normal file
96
Assets/Scripts/UI/Common/Panel/MessageBox.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class MessageBox : UIPanel
|
||||
{
|
||||
private static string _confirmText;
|
||||
private static string _cancelText;
|
||||
private static string _title;
|
||||
private static string _content;
|
||||
private static Action<bool> _callback;
|
||||
private static int _style;
|
||||
|
||||
public static void Show(string msg, Action<bool> callback, string title = "", int style = 0,
|
||||
string confirm = "", string cancel = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
title = "TEXT_NOTE";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(confirm))
|
||||
{
|
||||
confirm = "TEXT_CONFIRM";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(cancel))
|
||||
{
|
||||
cancel = "TEXT_CANCEL";
|
||||
}
|
||||
|
||||
_confirmText = confirm;
|
||||
_cancelText = cancel;
|
||||
_callback = callback;
|
||||
_content = msg;
|
||||
_title = title;
|
||||
_style = style;
|
||||
Show();
|
||||
}
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
this.AutoAddClick(OnClick);
|
||||
IsModal = true;
|
||||
HideAnim = UIPanelAnimation.GetCenterPopScaleFade(this, true);
|
||||
InputManager.OnUICanceled += OnUICanceled;
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
// TextTitle.SetLanguage(_title);
|
||||
BtnConfirm.SetLanguage(_confirmText);
|
||||
// BtnCancel.SetLanguage(_cancelText);
|
||||
// MessageStyle.selectedIndex = _style;
|
||||
TextTitle.SetLanguage(_content);
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
{
|
||||
if (!IsShowing) return;
|
||||
if (!IsTop) return;
|
||||
if (action == InputDef.UI.Enter)
|
||||
{
|
||||
ClosePanel(true);
|
||||
}
|
||||
else if (action == InputDef.UI.Back)
|
||||
{
|
||||
ClosePanel(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
InputManager.OnUICanceled -= OnUICanceled;
|
||||
}
|
||||
|
||||
|
||||
private void OnClick(GComponent btn)
|
||||
{
|
||||
ClosePanel(btn == BtnConfirm);
|
||||
}
|
||||
|
||||
private void ClosePanel(bool ret)
|
||||
{
|
||||
_callback?.Invoke(ret);
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Panel/MessageBox.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Panel/MessageBox.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e4609ff88d94fa8ad77c3cb17641809
|
||||
28
Assets/Scripts/UI/Common/Panel/Notices.Designer.cs
generated
Normal file
28
Assets/Scripts/UI/Common/Panel/Notices.Designer.cs
generated
Normal file
@@ -0,0 +1,28 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class Notices
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Common";
|
||||
public override string UIResName => "Notices";
|
||||
|
||||
[AutoFind(Name = "show")]
|
||||
public Controller show;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<Notices>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<Notices>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<Notices>(); }
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Panel/Notices.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Panel/Notices.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3ebf93e99f31f245ae973b663ba39b7
|
||||
173
Assets/Scripts/UI/Common/Panel/Notices.cs
Normal file
173
Assets/Scripts/UI/Common/Panel/Notices.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class Notices : UIPanel
|
||||
{
|
||||
public enum NoticeType
|
||||
{
|
||||
Info = 0,
|
||||
Success,
|
||||
Error,
|
||||
Warning,
|
||||
}
|
||||
|
||||
class NoticeData
|
||||
{
|
||||
public NoticeType Type;
|
||||
public string Text;
|
||||
}
|
||||
|
||||
private static bool _isOpen;
|
||||
private static readonly Queue<NoticeData> _msgArr = new();
|
||||
|
||||
private GObjectPool _noticePool;
|
||||
private string _itemUrl;
|
||||
private float _startY;
|
||||
private float _startX;
|
||||
private const int LimitCount = 6; //显示条数上限
|
||||
|
||||
private const int Gap = 8;
|
||||
private const int ItemWidth = 330;
|
||||
private const int ItemHeight = 76;
|
||||
|
||||
public static void Info(string msg, NoticeType noticeType = NoticeType.Info)
|
||||
{
|
||||
if (string.IsNullOrEmpty(msg)) return;
|
||||
Log.Info($"显示一个notice={msg}");
|
||||
if (!_isOpen)
|
||||
{
|
||||
Notices.Show();
|
||||
}
|
||||
|
||||
_msgArr.Enqueue(new NoticeData { Type = noticeType, Text = msg });
|
||||
}
|
||||
|
||||
public static void Success(string msg)
|
||||
{
|
||||
Info(msg, NoticeType.Success);
|
||||
}
|
||||
|
||||
public static void Warning(string msg)
|
||||
{
|
||||
Info(msg, NoticeType.Warning);
|
||||
}
|
||||
|
||||
public static void Error(string msg)
|
||||
{
|
||||
Info(msg, NoticeType.Error);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
ContentPane.sortingOrder = UIDef.UIOrder.Notices;
|
||||
_startY = GRoot.inst.height - ItemHeight - Gap - 110;
|
||||
_startX = GRoot.inst.width - ItemWidth - Gap;
|
||||
_itemUrl = UIPackage.GetItemURL(UIDef.Pack.Common, "NoticeItem");
|
||||
_noticePool = new GObjectPool(ContentPane.container.cachedTransform);
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
_isOpen = true;
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if (_msgArr.Count > 0)
|
||||
{
|
||||
var msg = _msgArr.Dequeue();
|
||||
ShowOnceNotice(msg);
|
||||
//旧的向上移动
|
||||
var count = ContentPane.numChildren - 1;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
GObject obj = ContentPane.GetChildAt(i);
|
||||
if (obj != null)
|
||||
{
|
||||
SetObjRise(obj);
|
||||
}
|
||||
}
|
||||
|
||||
RemoveLimitMsg();
|
||||
}
|
||||
}
|
||||
|
||||
//region notice
|
||||
private void ShowOnceNotice(NoticeData notice)
|
||||
{
|
||||
var item = GetFromPool(_itemUrl) as NoticeItem;
|
||||
if (item == null) return;
|
||||
item.SetData(notice.Text, notice.Type);
|
||||
item.x = _startX;
|
||||
item.y = _startY;
|
||||
|
||||
item.alpha = 1;
|
||||
// item.TweenFade(0, 0.5f).SetDelay(2);
|
||||
// item.TweenMoveY(0, 3).SetEase(EaseType.QuintInOut).OnComplete(() => { ReturnToPool(item); });
|
||||
//显示在固定区域 两秒后消失
|
||||
item.TweenFade(0, 0.5f).SetDelay(3).OnComplete(() => { ReturnToPool(item); });
|
||||
}
|
||||
|
||||
private void SetObjRise(GObject item)
|
||||
{
|
||||
item.TweenMoveY(item.y - item.height - 10, 0.2f).SetEase(EaseType.QuintInOut);
|
||||
}
|
||||
|
||||
private void RemoveLimitMsg()
|
||||
{
|
||||
var count = ContentPane.numChildren;
|
||||
if (count > LimitCount)
|
||||
{
|
||||
for (int i = 0; i < count - LimitCount; i++)
|
||||
{
|
||||
GObject obj = ContentPane.GetChildAt(i);
|
||||
if (obj != null)
|
||||
{
|
||||
if (GTween.IsTweening(obj))
|
||||
{
|
||||
GTween.Kill(obj, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReturnToPool(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private GObject GetFromPool(string url)
|
||||
{
|
||||
var ret = _noticePool.GetObject(url);
|
||||
if (ret == null) return null;
|
||||
ret.visible = true;
|
||||
ContentPane.AddChild(ret);
|
||||
GTween.GetTween(ret, TweenPropType.Y)?.Kill();
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void ReturnToPool(GObject obj)
|
||||
{
|
||||
ContentPane.RemoveChild(obj);
|
||||
_noticePool.ReturnObject(obj);
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
_isOpen = false;
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
_noticePool.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Panel/Notices.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Panel/Notices.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 599ea11cfee0f394bbd7f053c3914f05
|
||||
Reference in New Issue
Block a user