主页面相关内容和快捷键修改

This commit is contained in:
bob
2025-06-03 18:04:28 +08:00
parent 9334999332
commit 372e81508e
101 changed files with 607 additions and 833 deletions

View File

@@ -0,0 +1,20 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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);
[AutoFind(Name = "Marquee")]
public MarqueeTag Marquee;
public override string[] GetDependPackages(){ return new string[] {}; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: bbb8f680eb100a84c957fad39fae2e96

View File

@@ -0,0 +1,49 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
namespace NBF
{
public partial class CommonTopPanel : UIPanel
{
public override string UIPackName => "Common";
public override string UIResName => "CommonTopPanel";
protected override void OnInit()
{
ContentPane.sortingOrder = UIDef.UIOrder.CommonTopPanel;
}
protected override void OnShow()
{
InputManager.OnUICanceled += OnUICanceled;
}
private void OnUICanceled(string action)
{
if (action == InputDef.UI.Back)
{
var uis = UI.Inst.GetAllUI();
foreach (var ui in uis)
{
if (ui.ContentPane.sortingOrder > 0) continue;
if (ui.IsTop && !IsDontBack)
{
ui.Hide();
}
}
}
}
protected override void OnHide()
{
InputManager.OnUICanceled -= OnUICanceled;
}
protected override void OnDestroy()
{
base.OnDestroy();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b07b25d31dce1224e913094a95196cbb

View File

@@ -0,0 +1,24 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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);
[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[] {}; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 77d73c07771cd2445b26abb2ed0fdbb1

View File

@@ -0,0 +1,33 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
namespace NBF
{
public partial class GMPanel : UIPanel
{
public override string UIPackName => "Common";
public override string UIResName => "GMPanel";
protected override void OnInit()
{
base.OnInit();
}
protected override void OnShow()
{
base.OnShow();
}
protected override void OnHide()
{
base.OnHide();
}
protected override void OnDestroy()
{
base.OnDestroy();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e084db244c96e034f8213a921c8c3f9f

View 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 MessageBox
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
[AutoFind(Name = "MessageStyle")]
public Controller MessageStyle;
[AutoFind(Name = "back")]
public GImage back;
[AutoFind(Name = "box")]
public GImage box;
[AutoFind(Name = "TextTitle")]
public GTextField TextTitle;
[AutoFind(Name = "TextContent")]
public GTextField TextContent;
[AutoFind(Name = "BtnConfirm")]
public BtnTitleInputControl BtnConfirm;
[AutoFind(Name = "BtnCancel")]
public BtnTitleInputControl BtnCancel;
public override string[] GetDependPackages(){ return new string[] {}; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7ce689c460bfe8245948899939807a59

View File

@@ -0,0 +1,74 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System;
using FairyGUI;
using UnityEngine;
using NBC;
using UIPanel = NBC.UIPanel;
namespace NBF
{
public partial class MessageBox : UIPanel
{
public override string UIPackName => "Common";
public override string UIResName => "MessageBox";
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 = Lan.Get("TEXT_NOTE");
}
if (string.IsNullOrEmpty(confirm))
{
confirm = Lan.Get("TEXT_CONFIRM");
}
if (string.IsNullOrEmpty(cancel))
{
cancel = Lan.Get("TEXT_CANCEL");
}
_confirmText = confirm;
_cancelText = cancel;
_callback = callback;
_content = msg;
_title = title;
_style = style;
UI.Inst.OpenUI<MessageBox>();
}
protected override void OnInit()
{
this.AutoAddClick(OnClick);
ShowAnim = UIPanelAnimation.GetCenterScaleBig(this);
HideAnim = UIPanelAnimation.GetCenterScaleBig(this, true);
IsModal = true;
IsDontBack = true;
}
protected override void OnShow()
{
TextTitle.text = _title;
BtnConfirm.title = _confirmText;
BtnCancel.title = _cancelText;
TextContent.text = _content;
MessageStyle.selectedIndex = _style;
}
private void OnClick(GComponent btn)
{
_callback?.Invoke(btn == BtnConfirm);
Hide();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8e4609ff88d94fa8ad77c3cb17641809

View File

@@ -0,0 +1,20 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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);
[AutoFind(Name = "show")]
public Controller show;
public override string[] GetDependPackages(){ return new string[] {}; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d3ebf93e99f31f245ae973b663ba39b7

View File

@@ -0,0 +1,178 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
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;
}
public override string UIPackName => "Common";
public override string UIResName => "Notices";
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)
{
UI.Inst.OpenUI<Notices>();
}
_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);
MonoManager.Inst.OnUpdate += OnUpdate;
}
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();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 599ea11cfee0f394bbd7f053c3914f05