diff --git a/Assets/ResRaw/Fgui/Common/Common_atlas0.png b/Assets/ResRaw/Fgui/Common/Common_atlas0.png index 35baddb41..d38190e2d 100644 Binary files a/Assets/ResRaw/Fgui/Common/Common_atlas0.png and b/Assets/ResRaw/Fgui/Common/Common_atlas0.png differ diff --git a/Assets/ResRaw/Fgui/Common/Common_fui.bytes b/Assets/ResRaw/Fgui/Common/Common_fui.bytes index 0db222ea2..506f93fe0 100644 Binary files a/Assets/ResRaw/Fgui/Common/Common_fui.bytes and b/Assets/ResRaw/Fgui/Common/Common_fui.bytes differ diff --git a/Assets/ResRaw/Fgui/CommonNew/CommonNew_atlas0.png b/Assets/ResRaw/Fgui/CommonNew/CommonNew_atlas0.png index b5f881484..84bfaaed2 100644 Binary files a/Assets/ResRaw/Fgui/CommonNew/CommonNew_atlas0.png and b/Assets/ResRaw/Fgui/CommonNew/CommonNew_atlas0.png differ diff --git a/Assets/ResRaw/Fgui/CommonNew/CommonNew_fui.bytes b/Assets/ResRaw/Fgui/CommonNew/CommonNew_fui.bytes index daec44b73..18e2f137c 100644 Binary files a/Assets/ResRaw/Fgui/CommonNew/CommonNew_fui.bytes and b/Assets/ResRaw/Fgui/CommonNew/CommonNew_fui.bytes differ diff --git a/Assets/ResRaw/Fgui/Main/Main_fui.bytes b/Assets/ResRaw/Fgui/Main/Main_fui.bytes index e588d87d3..1a8bcc5b7 100644 Binary files a/Assets/ResRaw/Fgui/Main/Main_fui.bytes and b/Assets/ResRaw/Fgui/Main/Main_fui.bytes differ diff --git a/Assets/Scripts/Fishing/New/View/Player/States/Anim.meta b/Assets/Scripts/Fishing/New/View/Player/States/Anim.meta deleted file mode 100644 index 59a6141c7..000000000 --- a/Assets/Scripts/Fishing/New/View/Player/States/Anim.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 18a6db7ab47a454ba05592a6ae895bb9 -timeCreated: 1774362636 \ No newline at end of file diff --git a/Assets/Scripts/Init.cs b/Assets/Scripts/Init.cs index b357b0669..3f07bafd9 100644 --- a/Assets/Scripts/Init.cs +++ b/Assets/Scripts/Init.cs @@ -60,8 +60,10 @@ namespace NBF { // await Task.Delay(100); CommonTopPanel.Show(); - // SettingPanel.Show(); - LoginPanel.Show(); + SettingPanel.Show(); + // LoginPanel.Show(); + + // TestPanel.Show(); // SettingPanel.Show(); diff --git a/Assets/Scripts/Model/RoleModel.cs b/Assets/Scripts/Model/RoleModel.cs index 0249128f0..4d15fe84d 100644 --- a/Assets/Scripts/Model/RoleModel.cs +++ b/Assets/Scripts/Model/RoleModel.cs @@ -147,7 +147,7 @@ namespace NBF if (response.ErrorCode == ErrorCode.Success) { SetBindItemData(id, response.Rigs); - Notices.Show("配件变更成功"); + Notices.Success("配件变更成功"); } else { @@ -168,7 +168,7 @@ namespace NBF if (response.ErrorCode == ErrorCode.Success) { SetBindItemData(id, response.Rigs); - Notices.Show("配件变更成功"); + Notices.Success("配件变更成功"); } else { @@ -236,7 +236,7 @@ namespace NBF Slots.Clear(); Slots.AddRange(response.Slots); // SetBindItemData(id, response.Rigs); - Notices.Show("插槽设置成功"); + Notices.Success("插槽设置成功"); } else { diff --git a/Assets/Scripts/UI/Binders/CommonBinder.cs b/Assets/Scripts/UI/Binders/CommonBinder.cs index bf09c8702..2c8714ee9 100644 --- a/Assets/Scripts/UI/Binders/CommonBinder.cs +++ b/Assets/Scripts/UI/Binders/CommonBinder.cs @@ -26,8 +26,9 @@ namespace NBF UIObjectFactory.SetPackageItemExtension(BtnTextInputControl.URL, typeof(BtnTextInputControl)); UIObjectFactory.SetPackageItemExtension(UserMenuInfo.URL, typeof(UserMenuInfo)); UIObjectFactory.SetPackageItemExtension(CommonItemList.URL, typeof(CommonItemList)); - UIObjectFactory.SetPackageItemExtension(NoticeItem.URL, typeof(NoticeItem)); + UIObjectFactory.SetPackageItemExtension(NotificationItem.URL, typeof(NotificationItem)); UIObjectFactory.SetPackageItemExtension(BtnInputControl.URL, typeof(BtnInputControl)); + UIObjectFactory.SetPackageItemExtension(AlertItem.URL, typeof(AlertItem)); UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem)); UIObjectFactory.SetPackageItemExtension(BtnSubMenu.URL, typeof(BtnSubMenu)); UIObjectFactory.SetPackageItemExtension(ModelViewer.URL, typeof(ModelViewer)); diff --git a/Assets/Scripts/UI/Common/Items/AlertItem.Designer.cs b/Assets/Scripts/UI/Common/Items/AlertItem.Designer.cs new file mode 100644 index 000000000..d1a8cfee8 --- /dev/null +++ b/Assets/Scripts/UI/Common/Items/AlertItem.Designer.cs @@ -0,0 +1,25 @@ +/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/ + + +using FairyGUI; +using FairyGUI.Utils; +using NBC; + +namespace NBF +{ + public partial class AlertItem + { + public const string URL = "ui://6hgkvlaur7eg18m"; + + public Controller show; + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + show = GetController("show"); + OnInited(); + UILanguage.TrySetComponentLanguage(this); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/AlertItem.Designer.cs.meta b/Assets/Scripts/UI/Common/Items/AlertItem.Designer.cs.meta new file mode 100644 index 000000000..af56f0d2b --- /dev/null +++ b/Assets/Scripts/UI/Common/Items/AlertItem.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 84369ab20bf2d024a862f3ec74340867 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/AlertItem.cs b/Assets/Scripts/UI/Common/Items/AlertItem.cs new file mode 100644 index 000000000..405ad493a --- /dev/null +++ b/Assets/Scripts/UI/Common/Items/AlertItem.cs @@ -0,0 +1,20 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class AlertItem : GLabel + { + private void OnInited() + { + } + + public void SetData(string msg) + { + title = msg; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/AlertItem.cs.meta b/Assets/Scripts/UI/Common/Items/AlertItem.cs.meta new file mode 100644 index 000000000..07d220a67 --- /dev/null +++ b/Assets/Scripts/UI/Common/Items/AlertItem.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f1c70c1b4e60af94c8316470514c6e53 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/NoticeItem.Designer.cs b/Assets/Scripts/UI/Common/Items/NotificationItem.Designer.cs similarity index 96% rename from Assets/Scripts/UI/Common/Items/NoticeItem.Designer.cs rename to Assets/Scripts/UI/Common/Items/NotificationItem.Designer.cs index c317c31ab..0472f4104 100644 --- a/Assets/Scripts/UI/Common/Items/NoticeItem.Designer.cs +++ b/Assets/Scripts/UI/Common/Items/NotificationItem.Designer.cs @@ -7,7 +7,7 @@ using NBC; namespace NBF { - public partial class NoticeItem + public partial class NotificationItem { public const string URL = "ui://6hgkvlaur03uj7"; diff --git a/Assets/Scripts/UI/Common/Items/NoticeItem.Designer.cs.meta b/Assets/Scripts/UI/Common/Items/NotificationItem.Designer.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/Items/NoticeItem.Designer.cs.meta rename to Assets/Scripts/UI/Common/Items/NotificationItem.Designer.cs.meta diff --git a/Assets/Scripts/UI/Common/Items/NoticeItem.cs b/Assets/Scripts/UI/Common/Items/NotificationItem.cs similarity index 88% rename from Assets/Scripts/UI/Common/Items/NoticeItem.cs rename to Assets/Scripts/UI/Common/Items/NotificationItem.cs index 1088adff0..26bb04e04 100644 --- a/Assets/Scripts/UI/Common/Items/NoticeItem.cs +++ b/Assets/Scripts/UI/Common/Items/NotificationItem.cs @@ -6,7 +6,7 @@ using NBC; namespace NBF { - public partial class NoticeItem : GComponent + public partial class NotificationItem : GComponent { private void OnInited() { diff --git a/Assets/Scripts/UI/Common/Items/NoticeItem.cs.meta b/Assets/Scripts/UI/Common/Items/NotificationItem.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/Items/NoticeItem.cs.meta rename to Assets/Scripts/UI/Common/Items/NotificationItem.cs.meta diff --git a/Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs b/Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs index f48d7939e..873c64067 100644 --- a/Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs +++ b/Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs @@ -12,7 +12,6 @@ namespace NBF public const string URL = "ui://6hgkvlaufcfggr"; public Controller showTitleCtrl; - public GImage back; public GList List; public override void ConstructFromXML(XML xml) @@ -20,7 +19,6 @@ namespace NBF base.ConstructFromXML(xml); showTitleCtrl = GetController("showTitleCtrl"); - back = (GImage)GetChild("back"); List = (GList)GetChild("List"); OnInited(); UILanguage.TrySetComponentLanguage(this); diff --git a/Assets/Scripts/UI/Common/Panel/Information.meta b/Assets/Scripts/UI/Common/Panel/Information.meta new file mode 100644 index 000000000..4f37c6f5f --- /dev/null +++ b/Assets/Scripts/UI/Common/Panel/Information.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b22c6fd5099247e0aee146cef865175c +timeCreated: 1774403352 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/Information/Alert.cs b/Assets/Scripts/UI/Common/Panel/Information/Alert.cs new file mode 100644 index 000000000..0693c08a7 --- /dev/null +++ b/Assets/Scripts/UI/Common/Panel/Information/Alert.cs @@ -0,0 +1,131 @@ +using System.Collections.Generic; +using FairyGUI; +using NBC; + +namespace NBF +{ + public class Alert : INoticeComponent + { + private static bool _init; + + private const int Gap = 8; + private const int ItemWidth = 300; + private const int ItemHeight = 42; + + + private float _startY; + private float _startX; + private const int LimitCount = 6; //显示条数上限 + private GObjectPool _noticePool; + private static readonly Queue _msgArr = new(); + + protected GComponent ContentPane; + + + public static void Show(string msg) + { + if (string.IsNullOrEmpty(msg)) return; + Log.Info($"显示一个notice={msg}"); + if (!_init) + { + NoticesPanel.TryAddNoticeComponent(new Alert()); + } + + _msgArr.Enqueue(msg); + } + + + public void OnInit(GComponent root) + { + _init = true; + ContentPane = root; + _noticePool = new GObjectPool(ContentPane.container.cachedTransform); + _startY = GRoot.inst.height - ItemHeight - Gap - 90; + _startX = GRoot.inst.width * 0.5f - ItemWidth * 0.5f; + } + + public 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(); + } + } + + public void OnDestroy() + { + _noticePool.Clear(); + } + + + private void ShowOnceNotice(string msg) + { + var item = GetFromPool(AlertItem.URL) as AlertItem; + if (item == null) return; + item.SetData(msg); + item.x = _startX; + item.y = _startY; + + item.alpha = 1; + //显示在固定区域 两秒后消失 + item.TweenFade(0, 0.5f).SetDelay(5).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); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/Information/Alert.cs.meta b/Assets/Scripts/UI/Common/Panel/Information/Alert.cs.meta new file mode 100644 index 000000000..640c1967d --- /dev/null +++ b/Assets/Scripts/UI/Common/Panel/Information/Alert.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 02c8803ebf5f404da737ff0f699f5866 +timeCreated: 1774402864 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/Information/INoticeComponent.cs b/Assets/Scripts/UI/Common/Panel/Information/INoticeComponent.cs new file mode 100644 index 000000000..6e58da735 --- /dev/null +++ b/Assets/Scripts/UI/Common/Panel/Information/INoticeComponent.cs @@ -0,0 +1,11 @@ +using FairyGUI; + +namespace NBF +{ + public interface INoticeComponent + { + void OnInit(GComponent root); + void OnUpdate(); + void OnDestroy(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/Information/INoticeComponent.cs.meta b/Assets/Scripts/UI/Common/Panel/Information/INoticeComponent.cs.meta new file mode 100644 index 000000000..8cacdde07 --- /dev/null +++ b/Assets/Scripts/UI/Common/Panel/Information/INoticeComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c5292036b17c4e4988a2d5bf383737ab +timeCreated: 1774403415 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/MessageBox.Designer.cs b/Assets/Scripts/UI/Common/Panel/Information/MessageBox.Designer.cs similarity index 100% rename from Assets/Scripts/UI/Common/Panel/MessageBox.Designer.cs rename to Assets/Scripts/UI/Common/Panel/Information/MessageBox.Designer.cs diff --git a/Assets/Scripts/UI/Common/Panel/MessageBox.Designer.cs.meta b/Assets/Scripts/UI/Common/Panel/Information/MessageBox.Designer.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/Panel/MessageBox.Designer.cs.meta rename to Assets/Scripts/UI/Common/Panel/Information/MessageBox.Designer.cs.meta diff --git a/Assets/Scripts/UI/Common/Panel/MessageBox.cs b/Assets/Scripts/UI/Common/Panel/Information/MessageBox.cs similarity index 100% rename from Assets/Scripts/UI/Common/Panel/MessageBox.cs rename to Assets/Scripts/UI/Common/Panel/Information/MessageBox.cs diff --git a/Assets/Scripts/UI/Common/Panel/MessageBox.cs.meta b/Assets/Scripts/UI/Common/Panel/Information/MessageBox.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/Panel/MessageBox.cs.meta rename to Assets/Scripts/UI/Common/Panel/Information/MessageBox.cs.meta diff --git a/Assets/Scripts/UI/Common/Panel/Notices.cs b/Assets/Scripts/UI/Common/Panel/Information/Notices.cs similarity index 74% rename from Assets/Scripts/UI/Common/Panel/Notices.cs rename to Assets/Scripts/UI/Common/Panel/Information/Notices.cs index 91b0aae79..344516693 100644 --- a/Assets/Scripts/UI/Common/Panel/Notices.cs +++ b/Assets/Scripts/UI/Common/Panel/Information/Notices.cs @@ -1,14 +1,10 @@ -// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 - -using System.Collections.Generic; +using System.Collections.Generic; using FairyGUI; -using UnityEngine; using NBC; -using UIPanel = NBC.UIPanel; namespace NBF { - public partial class Notices : UIPanel + public class Notices : INoticeComponent { public enum NoticeType { @@ -23,27 +19,29 @@ namespace NBF public NoticeType Type; public string Text; } - - private static bool _isOpen; - private static readonly Queue _msgArr = new(); - private GObjectPool _noticePool; - private string _itemUrl; - private float _startY; - private float _startX; - private const int LimitCount = 6; //显示条数上限 + private static bool _init; private const int Gap = 8; private const int ItemWidth = 330; - private const int ItemHeight = 76; + + + private float _startY; + private float _startX; + private const int LimitCount = 6; //显示条数上限 + private GObjectPool _noticePool; + private static readonly Queue _msgArr = new(); + + protected GComponent ContentPane; + public static void Info(string msg, NoticeType noticeType = NoticeType.Info) { if (string.IsNullOrEmpty(msg)) return; Log.Info($"显示一个notice={msg}"); - if (!_isOpen) + if (!_init) { - Notices.Show(); + NoticesPanel.TryAddNoticeComponent(new Notices()); } _msgArr.Enqueue(new NoticeData { Type = noticeType, Text = msg }); @@ -65,21 +63,16 @@ namespace NBF } - protected override void OnInit() + public void OnInit(GComponent root) { - 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"); + _init = true; + ContentPane = root; _noticePool = new GObjectPool(ContentPane.container.cachedTransform); + _startY = Gap + 140; + _startX = GRoot.inst.width - ItemWidth - Gap; } - protected override void OnShow() - { - _isOpen = true; - } - - protected override void OnUpdate() + public void OnUpdate() { if (_msgArr.Count > 0) { @@ -100,25 +93,28 @@ namespace NBF } } - //region notice + public void OnDestroy() + { + _noticePool.Clear(); + } + + private void ShowOnceNotice(NoticeData notice) { - var item = GetFromPool(_itemUrl) as NoticeItem; + var item = GetFromPool(NotificationItem.URL) as NotificationItem; 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); + item.TweenMoveY(item.y + item.height + Gap, 0.2f).SetEase(EaseType.QuintInOut); } private void RemoveLimitMsg() @@ -159,15 +155,5 @@ namespace NBF ContentPane.RemoveChild(obj); _noticePool.ReturnObject(obj); } - - protected override void OnHide() - { - _isOpen = false; - } - - protected override void OnDestroy() - { - _noticePool.Clear(); - } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/Information/Notices.cs.meta b/Assets/Scripts/UI/Common/Panel/Information/Notices.cs.meta new file mode 100644 index 000000000..a033cedc3 --- /dev/null +++ b/Assets/Scripts/UI/Common/Panel/Information/Notices.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5a2c129ec53a45f29b5a3ad6d4869d8a +timeCreated: 1774402966 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/Notices.Designer.cs b/Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.Designer.cs similarity index 71% rename from Assets/Scripts/UI/Common/Panel/Notices.Designer.cs rename to Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.Designer.cs index e3f1df6f2..f944a7211 100644 --- a/Assets/Scripts/UI/Common/Panel/Notices.Designer.cs +++ b/Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.Designer.cs @@ -8,21 +8,21 @@ using System.Collections.Generic; namespace NBF { /// - public partial class Notices + public partial class NoticesPanel { public GObject this[string aKey] => ContentPane.GetChild(aKey); public override string UIPackName => "Common"; - public override string UIResName => "Notices"; + public override string UIResName => "NoticesPanel"; [AutoFind(Name = "show")] public Controller show; public override string[] GetDependPackages(){ return new string[] {}; } - public static void Show(object param = null){ UI.Inst.OpenUI(param); } + public static void Show(object param = null){ UI.Inst.OpenUI(param); } - public static void Hide(){ UI.Inst.HideUI(); } + public static void Hide(){ UI.Inst.HideUI(); } - public static void Del(){ UI.Inst.DestroyUI(); } + public static void Del(){ UI.Inst.DestroyUI(); } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/Notices.Designer.cs.meta b/Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.Designer.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/Panel/Notices.Designer.cs.meta rename to Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.Designer.cs.meta diff --git a/Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.cs b/Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.cs new file mode 100644 index 000000000..5dc39d233 --- /dev/null +++ b/Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.cs @@ -0,0 +1,82 @@ +// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 + +using System.Collections.Generic; +using System.Linq; +using FairyGUI; +using UnityEngine; +using NBC; +using UIPanel = NBC.UIPanel; + +namespace NBF +{ + public partial class NoticesPanel : UIPanel + { + private static HashSet _noticeComponents = new(); + private static Queue _waitAddComponents = new(); + private static bool _isOpen; + + public static void TryAddNoticeComponent(INoticeComponent noticeComponent) + { + if (!_isOpen) + { + Show(); + } + + if (_noticeComponents.Any(iNoticeComponent => iNoticeComponent.GetType() == noticeComponent.GetType())) + { + return; + } + + if (_waitAddComponents.Any(waitAddComponent => waitAddComponent.GetType() == noticeComponent.GetType())) + { + return; + } + + _waitAddComponents.Enqueue(noticeComponent); + } + + + protected override void OnInit() + { + ContentPane.sortingOrder = UIDef.UIOrder.Notices; + } + + protected override void OnShow() + { + _isOpen = true; + } + + protected override void OnUpdate() + { + foreach (var noticeComponent in _noticeComponents) + { + noticeComponent?.OnUpdate(); + } + + if (_waitAddComponents.Count > 0) + { + var com = _waitAddComponents.Dequeue(); + var noticeComponent = UIPackage.CreateObject(UIDef.Pack.Common, "CommonContainer") as GComponent; + noticeComponent.width = ContentPane.width; + noticeComponent.height = ContentPane.height; + ContentPane.AddChild(noticeComponent); + com.OnInit(noticeComponent); + _noticeComponents.Add(com); + } + } + + + protected override void OnHide() + { + _isOpen = false; + } + + protected override void OnDestroy() + { + foreach (var noticeComponent in _noticeComponents) + { + noticeComponent?.OnDestroy(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Panel/Notices.cs.meta b/Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/Panel/Notices.cs.meta rename to Assets/Scripts/UI/Common/Panel/Information/NoticesPanel.cs.meta diff --git a/Assets/Scripts/UI/Common/Panel/TestPanel.Designer.cs b/Assets/Scripts/UI/Common/Panel/TestPanel.Designer.cs index b240748a7..252af0ce7 100644 --- a/Assets/Scripts/UI/Common/Panel/TestPanel.Designer.cs +++ b/Assets/Scripts/UI/Common/Panel/TestPanel.Designer.cs @@ -18,6 +18,10 @@ namespace NBF public MainMenu MainMenu; [AutoFind(Name = "SubMenu")] public CommonSubMenu SubMenu; + [AutoFind(Name = "BtnTest1")] + public GButton BtnTest1; + [AutoFind(Name = "BtnTest2")] + public GButton BtnTest2; public override string[] GetDependPackages(){ return new string[] {}; } public static void Show(object param = null){ UI.Inst.OpenUI(param); } diff --git a/Assets/Scripts/UI/Common/Panel/TestPanel.cs b/Assets/Scripts/UI/Common/Panel/TestPanel.cs index 7f706f9ba..411c78c36 100644 --- a/Assets/Scripts/UI/Common/Panel/TestPanel.cs +++ b/Assets/Scripts/UI/Common/Panel/TestPanel.cs @@ -1,11 +1,29 @@ // 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 +using FairyGUI; using UnityEngine; using NBC; +using UIPanel = NBC.UIPanel; namespace NBF { public partial class TestPanel : UIPanel { + protected override void OnInit() + { + this.AutoAddClick(OnClick); + } + + public void OnClick(GComponent btn) + { + if (btn == BtnTest1) + { + Notices.Info("测试1"); + } + else if (btn == BtnTest2) + { + Alert.Show("测试2"); + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Common2Binder.cs b/Assets/Scripts/UI/Common2Binder.cs index 1f278ac13..8e87693e1 100644 --- a/Assets/Scripts/UI/Common2Binder.cs +++ b/Assets/Scripts/UI/Common2Binder.cs @@ -18,7 +18,7 @@ namespace NBF UIObjectFactory.SetPackageItemExtension(BtnTextInputControl.URL, typeof(BtnTextInputControl)); UIObjectFactory.SetPackageItemExtension(CommonItemList.URL, typeof(CommonItemList)); UIObjectFactory.SetPackageItemExtension(BtnTitleInputControl.URL, typeof(BtnTitleInputControl)); - UIObjectFactory.SetPackageItemExtension(NoticeItem.URL, typeof(NoticeItem)); + UIObjectFactory.SetPackageItemExtension(NotificationItem.URL, typeof(NotificationItem)); UIObjectFactory.SetPackageItemExtension(CommonSubMenu.URL, typeof(CommonSubMenu)); UIObjectFactory.SetPackageItemExtension(BtnInputControl.URL, typeof(BtnInputControl)); UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem)); diff --git a/Assets/Scripts/UI/ItemDetailPanel.Designer.cs b/Assets/Scripts/UI/ItemDetailPanel.Designer.cs new file mode 100644 index 000000000..5aefd9309 --- /dev/null +++ b/Assets/Scripts/UI/ItemDetailPanel.Designer.cs @@ -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 +{ + /// + public partial class ItemDetailPanel + { + public GObject this[string aKey] => ContentPane.GetChild(aKey); + public override string UIPackName => "Common"; + public override string UIResName => "ItemDetailPanel"; + + [AutoFind(Name = "style")] + public Controller style; + public override string[] GetDependPackages(){ return new string[] {}; } + + public static void Show(object param = null){ UI.Inst.OpenUI(param); } + + public static void Hide(){ UI.Inst.HideUI(); } + + public static void Del(){ UI.Inst.DestroyUI(); } + + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/ItemDetailPanel.Designer.cs.meta b/Assets/Scripts/UI/ItemDetailPanel.Designer.cs.meta new file mode 100644 index 000000000..4622ce31e --- /dev/null +++ b/Assets/Scripts/UI/ItemDetailPanel.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1a56d8c2ef3e8aa4c945f60e3811960d \ No newline at end of file diff --git a/Assets/Scripts/UI/ItemDetailPanel.cs b/Assets/Scripts/UI/ItemDetailPanel.cs new file mode 100644 index 000000000..84c9f8161 --- /dev/null +++ b/Assets/Scripts/UI/ItemDetailPanel.cs @@ -0,0 +1,11 @@ +// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 + +using UnityEngine; +using NBC; + +namespace NBF +{ + public partial class ItemDetailPanel : UIPanel + { + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/ItemDetailPanel.cs.meta b/Assets/Scripts/UI/ItemDetailPanel.cs.meta new file mode 100644 index 000000000..31796591c --- /dev/null +++ b/Assets/Scripts/UI/ItemDetailPanel.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9c40f1ff900783e489e95cc37f33ad84 \ No newline at end of file diff --git a/FGUIProject/assets/Common/Com/Buttons/BtnInputName.xml b/FGUIProject/assets/Common/Com/Buttons/BtnInputName.xml index 7f0350afe..8b91b74b4 100644 --- a/FGUIProject/assets/Common/Com/Buttons/BtnInputName.xml +++ b/FGUIProject/assets/Common/Com/Buttons/BtnInputName.xml @@ -2,7 +2,7 @@ - + diff --git a/FGUIProject/assets/Common/Com/CommonContainer.xml b/FGUIProject/assets/Common/Com/CommonContainer.xml index b9406532d..cacd517e2 100644 --- a/FGUIProject/assets/Common/Com/CommonContainer.xml +++ b/FGUIProject/assets/Common/Com/CommonContainer.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/FGUIProject/assets/Common/Com/Menu/CommonMenu.xml b/FGUIProject/assets/Common/Com/Menu/CommonMenu.xml index a4da5a6cc..68e0889ba 100644 --- a/FGUIProject/assets/Common/Com/Menu/CommonMenu.xml +++ b/FGUIProject/assets/Common/Com/Menu/CommonMenu.xml @@ -5,10 +5,7 @@ - - - - + @@ -16,12 +13,14 @@ - - - + + - + + + + - + \ No newline at end of file diff --git a/FGUIProject/assets/Common/Com/SelectPageItem.xml b/FGUIProject/assets/Common/Com/SelectPageItem.xml index d56f58dc5..cedaef627 100644 --- a/FGUIProject/assets/Common/Com/SelectPageItem.xml +++ b/FGUIProject/assets/Common/Com/SelectPageItem.xml @@ -1,10 +1,10 @@ - + - + - +