主界面相关

This commit is contained in:
bob
2025-06-03 14:28:20 +08:00
parent 8ba78d5d1c
commit 9334999332
43 changed files with 534 additions and 14 deletions

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 BagPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
[AutoFind(Name = "back")]
public GImage back;
[AutoFind(Name = "Menu")]
public CommonMenu Menu;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
}
}

View File

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

View File

@@ -0,0 +1,110 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
namespace NBF
{
public partial class BagPanel : UIPanel
{
public override string UIPackName => "Main";
public override string UIResName => "BagPanel";
protected override void OnInit()
{
base.OnInit();
Menu.OnTabChange += ChangeTab;
}
protected override void OnShow()
{
InputManager.OnUICanceled += OnUICanceled;
UseBottomMenu();
}
private void OnUICanceled(string action)
{
if (action == InputDef.UI.SubPrev)
{
}
else if (action == InputDef.UI.SubNext)
{
}
else if (action == InputDef.UI.Up)
{
}
else if (action == InputDef.UI.Down)
{
}
}
private void ChangeTab(int index)
{
if (index < 0) return;
Log.Info($"Change tab index={index}");
}
private void UseBottomMenu()
{
BottomMenu.OnTab += () =>
{
var i = Random.Range(1, 13);
if (i < 3)
{
Notices.Success("离开晶科科技看就看");
}
else if (i < 6)
{
Notices.Warning("离开晶科科技看就看");
}
else if (i < 9)
{
Notices.Error("离开晶科科技看就看");
}
else if (i < 12)
{
Notices.Info("离开晶科科技看就看");
}
};
BottomMenu.OnBack += OnBack;
BottomMenu.OnEnter += OnApplySettings;
BottomMenu.Use();
}
private void OnApplySettings()
{
}
private void OnBack()
{
if (Settings.Instance.HaveNotAppleSettings())
{
MessageBox.Show("还有未保存的信息", (b) =>
{
if (b)
{
Hide();
}
});
}
else
{
Hide();
}
}
protected override void OnHide()
{
BottomMenu.OnBack -= OnBack;
// BottomMenu.OnTab -= OnResetSettings;
BottomMenu.OnEnter -= OnApplySettings;
BottomMenu.UnUse();
InputManager.OnUICanceled -= OnUICanceled;
}
protected override void OnDestroy()
{
base.OnDestroy();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 06f449f341e3a19438e38e1038fd25d5