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

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

@@ -57,4 +57,9 @@ namespace NBF
Sort = sort;
}
}
[AttributeUsage(AttributeTargets.Field)]
public class UIInputAttribute : BaseAttribute
{
}
}

View File

@@ -20,8 +20,6 @@ namespace NBF
public class UIOrder
{
public const int MeteorChest = 90;
public const int MainPanel = 100;
public const int CommonTopPanel = 200;
public const int Loading = 500;
public const int Guide = 900;

View File

@@ -2,7 +2,7 @@
{
public class Lan
{
public static LanguageManager _inst;
private static LanguageManager _inst;
public static LanguageManager Inst
{

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace NBC
@@ -47,9 +48,17 @@ namespace NBC
language = (SystemLanguage)value;
}
}
var list = LanguageConst.languageMap.Values.ToList();
var findLan = list.FindIndex(t => t.Language == language);
if (findLan < 0)
{
language = SystemLanguage.English;
}
UseLanguage(language);
}
public void UseLanguage(SystemLanguage language)
{
_currentLanguage = language;

View File

@@ -17,6 +17,11 @@ namespace NBC
bool IsCanVisible { get; }
bool IsDotDel { get; }
/// <summary>
/// 不能返回
/// </summary>
bool IsDontBack { get; }
bool IsModal { get; }
bool IsShowCursor { get; }
@@ -25,7 +30,7 @@ namespace NBC
void SetData(object args);
object GetData();
string[] GetDependPackages();
System.Collections.Generic.Dictionary<string, string> GetLanguageConfig();
void Init();
void Show();
void Hide();

View File

@@ -24,7 +24,7 @@ namespace NBC
public virtual bool IsCanVisible => ContentPane != null && ContentPane.parent != null && ContentPane.visible;
public bool IsDotDel { get; protected set; }
public bool IsDontBack { get; protected set; }
public virtual string UIPackRootUrl => string.Empty;
public virtual string UIPackName { get; set; }
@@ -76,10 +76,6 @@ namespace NBC
return new string[] { };
}
public virtual Dictionary<string, string> GetLanguageConfig()
{
return new Dictionary<string, string>();
}
public void Init()
{
@@ -194,6 +190,15 @@ namespace NBC
Show();
}
/// <summary>
/// 设置刷新多语言
/// </summary>
public void SetLanguage()
{
_ui.TrySetPanelLanguage(ContentPane);
OnSetLanguage();
}
public void HideImmediately()
{
// ContentPane.visible = false;
@@ -227,6 +232,7 @@ namespace NBC
private void OpenAnimBegin()
{
OnShow();
SetLanguage();
_ui?.DispatchEventWith(UIEvents.UIShow, this);
}
@@ -257,6 +263,13 @@ namespace NBC
{
}
/// <summary>
/// 代码设置多语言OnShow后和语言变化时会调用
/// </summary>
protected virtual void OnSetLanguage()
{
}
/// <summary>
/// 显示界面显示
/// </summary>
@@ -264,13 +277,12 @@ namespace NBC
protected virtual void OnShow()
{
}
/// <summary>
/// 显示界面完成(动画后)
/// </summary>
protected virtual void OnShowed()
{
}
protected virtual void OnUpdate()

View File

@@ -131,12 +131,12 @@ namespace NBC
curField = gtextField;
}
if (curField != null)
{
// var textFormat = curField.textFormat;
// textFormat.font = Lan.GetLanFontByCurFont(textFormat.font);
// curField.textFormat = textFormat;
}
if (curField == null) return;
var textFormat = curField.textFormat;
var font = Lan.GetLanFontByCurFont(textFormat.font);
if (font == null) return;
textFormat.font = font;
curField.textFormat = textFormat;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 6f1a2150bd924a06ab285e5e5b2f7878
timeCreated: 1742647242

View File

@@ -1,651 +0,0 @@
// using System.Collections.Generic;
// using System.Runtime.InteropServices;
// // using Rewired;
// using UnityEngine;
// using UnityEngine.SceneManagement;
//
// public class InputManager : MonoBehaviour
// {
// public struct POINT
// {
// public int X;
//
// public int Y;
// }
//
//
// // [Tooltip("Rewired Input Manager's player used for handling player's input")]
// // private Player player;
//
// public bool IgnoreAllInput = false;
//
//
// public static bool IsMouseLeft;
// public static bool IsMouseRight;
//
//
// private bool isPaused;
//
// private float MouseX = Screen.width / 2;
//
// private float MouseY = Screen.height / 2;
//
// private float deltaMouseX;
//
// private float deltaMouseY;
//
// private float slowDownReeling;
//
// private float slowDownFloat;
//
// private bool reelUpClicked;
//
// private bool reelDownClicked;
//
//
// public static Vector2 movementAxis;
//
// public static bool isJumping;
//
// public static bool isCameraChange;
//
// public static bool isUnderwaterCamera;
//
// public static bool isUnderwaterCameraZoomUp;
//
// public static bool isUnderwaterCameraZoomDown;
//
// public static bool isUnderwaterCameraFloatZoom;
//
// public static bool LT;
//
// public static bool showUI = true;
//
//
// public static bool underwaterCameraMini;
//
// public static bool isHeadFlashLight;
//
// public static bool quickHelp;
//
// public static bool isEagleEye;
//
// public static bool isRunning;
//
// public static bool isReelReeling;
//
// public static bool isReelSpeedUp;
//
// public static bool isReelSpeedDown;
//
// public static bool isReelSpeedMax;
//
// public static bool isReelDragUp;
//
// public static bool isReelDragDown;
//
// public static bool isCastNear;
//
// public static bool isCastFar;
//
// public static bool isPullUpRod;
//
//
// public static bool isCastReset;
//
// public static bool isDeepthFloatUp;
//
// public static bool isDeepthFloatDown;
//
//
// public static bool isShowSlot0;
//
// public static bool isShowSlot1;
//
// public static bool isShowSlot2;
//
// public static bool isShowSlot3;
//
// public static bool isShowSlot4;
//
//
// public static bool RB;
//
// [DllImport("user32.dll")]
// private static extern bool SetCursorPos(int X, int Y);
//
// [DllImport("user32.dll")]
// private static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
//
// [DllImport("user32.dll")]
// public static extern bool GetCursorPos(out POINT lpPoint);
//
// private void Start()
// {
// player = ReInput.players.GetPlayer(0);
// MouseMap mouseMapInstance = ReInput.mapping.GetMouseMapInstance(0, 0);
// MouseMap mouseMapInstanceSavedOrDefault = ReInput.mapping.GetMouseMapInstanceSavedOrDefault(0, 0, 0);
// KeyboardMap keyboardMapInstance = ReInput.mapping.GetKeyboardMapInstance(0, 0);
// KeyboardMap keyboardMapInstanceSavedOrDefault = ReInput.mapping.GetKeyboardMapInstanceSavedOrDefault(0, 0, 0);
// int num = mouseMapInstance.ButtonMaps.Count - mouseMapInstanceSavedOrDefault.ButtonMaps.Count;
// for (int i = 0; i < num; i++)
// {
// Debug.Log("Added new map: " + mouseMapInstance.ButtonMaps[mouseMapInstance.ButtonMaps.Count - 1 - i]
// .actionDescriptiveName);
// mouseMapInstanceSavedOrDefault.ButtonMaps.Add(
// mouseMapInstance.ButtonMaps[mouseMapInstance.ButtonMaps.Count - 1 - i]);
// }
//
// num = keyboardMapInstance.ButtonMaps.Count - keyboardMapInstanceSavedOrDefault.ButtonMaps.Count;
// for (int j = 0; j < num; j++)
// {
// Debug.Log("Added new map: " + keyboardMapInstance.ButtonMaps[keyboardMapInstance.ButtonMaps.Count - 1 - j]
// .actionDescriptiveName);
// keyboardMapInstanceSavedOrDefault.ButtonMaps.Add(
// keyboardMapInstance.ButtonMaps[keyboardMapInstance.ButtonMaps.Count - 1 - j]);
// }
//
// num = mouseMapInstance.AxisMaps.Count - mouseMapInstanceSavedOrDefault.AxisMaps.Count;
// for (int k = 0; k < num; k++)
// {
// Debug.Log(mouseMapInstance.AxisMaps[mouseMapInstance.AxisMaps.Count - 1 - k].actionDescriptiveName);
// mouseMapInstanceSavedOrDefault.AxisMaps.Add(
// mouseMapInstance.ButtonMaps[mouseMapInstance.ButtonMaps.Count - 1 - k]);
// }
//
// ReInput.userDataStore?.Save();
// ReInput.userDataStore?.SavePlayerData(0);
// ReInput.userDataStore?.Load();
// }
//
// private void recheckMouseDeltaPosition()
// {
// GetCursorPos(out var lpPoint);
// deltaMouseX = Mathf.Abs((float)lpPoint.X - Input.mousePosition.x);
// deltaMouseY = Mathf.Abs((float)lpPoint.Y + (Input.mousePosition.y - (float)Screen.height));
// }
//
// public void SetCursorPositionToScreenCenter()
// {
// recheckMouseDeltaPosition();
// MouseX = Screen.width / 2;
// MouseY = Screen.height / 2;
// SetCursorPos((int)(deltaMouseX + (float)(Screen.width / 2)), (int)(deltaMouseY + (float)(Screen.height / 2)));
// }
//
// private void Update()
// {
// if (IgnoreAllInput)
// {
// return;
// }
//
// if (Input.GetMouseButtonDown(0))
// {
// IsMouseLeft = true;
// }
//
// if (Input.GetMouseButtonUp(0))
// {
// IsMouseLeft = false;
// }
//
// if (Input.GetMouseButtonDown(1))
// {
// IsMouseRight = true;
// }
//
// if (Input.GetMouseButtonUp(1))
// {
// IsMouseRight = false;
// }
//
// // if (player.GetButtonDown("PressRMB"))
// // {
// // Debug.Log("PRESSEDDDDD");
// // }
//
//
// if (player.GetButtonDown("rodPullUpButton") && CanPullUpRod())
// {
// isPullUpRod = true;
// }
//
// if (player.GetButtonUp("rodPullUpButton"))
// {
// isPullUpRod = false;
// }
//
// if (player.GetButtonDown("LT"))
// {
// LT = true;
// }
//
// if (player.GetButtonUp("LT"))
// {
// LT = false;
// }
//
// if (player.GetButtonDown("RB"))
// {
// RB = true;
// }
//
// if (player.GetButtonUp("RB"))
// {
// RB = false;
// }
//
// if (player.GetButtonDown("reelSpeedMax"))
// {
// isReelSpeedMax = true;
// // isreelSpeedMaxHold = true;
// }
// else if (player.GetButtonUp("reelSpeedMax"))
// {
// isReelSpeedMax = false;
// // isreelSpeedMaxHold = false;
// }
// else if (RB)
// {
// if (reelUpClicked)
// {
// isReelSpeedMax = true;
// }
// else
// {
// isReelSpeedMax = false;
// }
// }
//
// // if (!isreelSpeedMaxHold)
// // {
// // isReelSpeedMax = false;
// // }
//
// if (player.GetButtonDown("quickHelpKey"))
// {
// quickHelp = !quickHelp;
// }
//
//
// movementAxis = Vector2.zero;
// // if (!SRDebug.Instance.IsDebugPanelVisible)
// {
// if (Application.isFocused)
// {
// movementAxis.x = player.GetAxis("moveHorizontal") * Time.deltaTime * 500f;
// movementAxis.y = player.GetAxis("moveVertical") * Time.deltaTime * 500f;
// }
// }
//
//
// if (player.GetButtonDown("reelSpeedUp"))
// {
// reelUpClicked = true;
// }
//
// if (player.GetButtonUp("reelSpeedUp"))
// {
// isReelSpeedUp = false;
// reelUpClicked = false;
// }
//
// if (player.GetButtonDown("reelSpeedDown"))
// {
// reelDownClicked = true;
// }
//
// if (player.GetButtonUp("reelSpeedDown"))
// {
// isReelSpeedDown = false;
// reelDownClicked = false;
// }
//
// // if (FScriptsHandler.Instance != null && FScriptsHandler.Instance.m_PlayerMain.currentRod != null &&
// // (!LT || FScriptsHandler.Instance.m_PlayerMain.currentRod.rodType != 0) && !RB)
// // {
// // if (reelUpClicked)
// // {
// // if (slowDownReeling >= 1f)
// // {
// // isReelSpeedUp = true;
// // slowDownReeling = 0f;
// // }
// // else
// // {
// // isReelSpeedUp = false;
// // slowDownReeling += Time.deltaTime * 100f;
// // }
// // }
// //
// // if (reelDownClicked)
// // {
// // if (slowDownReeling >= 1f)
// // {
// // isReelSpeedDown = true;
// // slowDownReeling = 0f;
// // }
// // else
// // {
// // isReelSpeedDown = false;
// // slowDownReeling += Time.deltaTime * 100f;
// // }
// // }
// // }
//
//
// if (player.GetButtonDown("jumping"))
// {
// isJumping = true;
// }
// else
// {
// isJumping = false;
// }
//
//
//
// if (player.GetButtonDown("runKey"))
// {
// isRunning = true;
// }
//
// if (player.GetButtonUp("runKey"))
// {
// isRunning = false;
// }
//
// if (player.GetButtonDown("cameraTypeViewKey"))
// {
// isCameraChange = !isCameraChange;
// }
//
// if (player.GetButtonDown("showGUIKey"))
// {
// showUI = !showUI;
// }
//
//
// if (player.GetButtonDown("eagleEye"))
// {
// isEagleEye = true;
// }
//
// if (player.GetButtonUp("eagleEye"))
// {
// isEagleEye = false;
// }
//
// if (player.GetButtonDown("underwaterCameraKey"))
// {
// isUnderwaterCamera = !isUnderwaterCamera;
// }
//
// if (player.GetButtonDown("underwaterMiniCameraKey"))
// {
// underwaterCameraMini = !underwaterCameraMini;
// }
//
// if (player.GetButtonDown("underwaterZoomUpCameraKey"))
// {
// isUnderwaterCameraZoomUp = true;
// }
//
// if (player.GetButtonUp("underwaterZoomUpCameraKey"))
// {
// isUnderwaterCameraZoomUp = false;
// }
//
// if (player.GetButtonDown("underwaterZoomDownCameraKey"))
// {
// isUnderwaterCameraZoomDown = true;
// }
//
// if (player.GetButtonUp("underwaterZoomDownCameraKey"))
// {
// isUnderwaterCameraZoomDown = false;
// }
//
// if (player.GetButtonDown("underwaterZoomFloat"))
// {
// isUnderwaterCameraFloatZoom = true;
// }
// else
// {
// isUnderwaterCameraFloatZoom = false;
// }
//
// if (player.GetButtonDown("showSlot0"))
// {
// isShowSlot0 = true;
// Debug.LogError("showSlot0======");
// }
// else
// {
// isShowSlot0 = false;
// }
//
// if (player.GetButtonDown("showSlot1"))
// {
// isShowSlot1 = true;
// Debug.LogError("showSlot1======");
// }
// else
// {
// isShowSlot1 = false;
// }
//
// if (player.GetButtonDown("showSlot2"))
// {
// isShowSlot2 = true;
// Debug.LogError("showSlot2======");
// }
// else
// {
// isShowSlot2 = false;
// }
//
// if (player.GetButtonDown("showSlot3"))
// {
// isShowSlot3 = true;
// }
// else
// {
// isShowSlot3 = false;
// }
//
// if (player.GetButtonDown("showSlot4"))
// {
// isShowSlot4 = true;
// }
// else
// {
// isShowSlot4 = false;
// }
//
//
// // if (!isCastFar)
// // {
// // if (GameManager.Instance.currentLevelPopUp != null)
// // {
// // return;
// // }
// //
// // if (player.GetButtonDown("NearCastButton"))
// // {
// // isCastNear = true;
// // }
// // else if (player.GetButtonUp("NearCastButton") && isCastNear)
// // {
// // isCastNear = false;
// // }
// // }
// //
// // if (!isCastNear)
// // {
// // if (GameManager.Instance.currentLevelPopUp != null)
// // {
// // return;
// // }
// //
// // if (player.GetButtonDown("FarCastButton"))
// // {
// // isCastFar = true;
// // }
// // else if (player.GetButtonUp("FarCastButton") && isCastFar)
// // {
// // isCastFar = false;
// // }
// // }
// //
//
// if (player.GetButtonTimePressed("resetCast") >= 1.0)
// {
// isCastReset = true;
// }
// else
// {
// isCastReset = false;
// }
//
//
// if (player.GetButtonDown("reelDragUp"))
// {
// isReelDragUp = true;
// }
// else
// {
// isReelDragUp = false;
// }
//
// if (player.GetButtonDown("reelDragDown"))
// {
// isReelDragDown = true;
// }
// else
// {
// isReelDragDown = false;
// }
//
//
// if (player.GetButtonDown("headFlashLight"))
// {
// isHeadFlashLight = !isHeadFlashLight;
// }
//
//
// if (player.GetButtonDown("floatDeepthUp"))
// {
// isDeepthFloatUp = true;
// }
// else
// {
// isDeepthFloatUp = false;
// }
//
// if (player.GetButtonDown("floatDeepthDown"))
// {
// isDeepthFloatDown = true;
// }
// else
// {
// isDeepthFloatDown = false;
// }
//
// if (player.GetButtonDown("Reeling"))
// {
// isReelReeling = true;
// }
//
// if (player.GetButtonUp("Reeling"))
// {
// isReelReeling = false;
// }
//
// if (LT && !RB)
// {
// if (reelUpClicked)
// {
// if (slowDownFloat >= 1f)
// {
// isDeepthFloatUp = true;
// slowDownFloat = 0f;
// }
// else
// {
// isDeepthFloatUp = false;
// slowDownFloat += Time.deltaTime * 10f;
// }
// }
//
// if (reelDownClicked)
// {
// if (slowDownFloat >= 1f)
// {
// isDeepthFloatDown = true;
// slowDownFloat = 0f;
// }
// else
// {
// isDeepthFloatDown = false;
// slowDownFloat += Time.deltaTime * 10f;
// }
// }
// }
//
// }
//
// private bool CanPullUpRod()
// {
// // if (FScriptsHandler.Instance == null)
// // {
// // return false;
// // }
// //
// // if (FScriptsHandler.Instance.m_PlayerMain == null)
// // {
// // return false;
// // }
// //
// // if (FScriptsHandler.Instance.m_PlayerMain.currentRod == null)
// // {
// // return false;
// // }
// //
// // if (FScriptsHandler.Instance.m_PlayerMain.currentRod.fishingLine == null)
// // {
// // return false;
// // }
// //
// // if (FScriptsHandler.Instance.m_PlayerMain.currentRod.fishingLine.ropeToHookDistance <= 1f)
// // {
// // if (FScriptsHandler.Instance.m_PlayerMain.currentRod.currentFish != null ||
// // FScriptsHandler.Instance.m_PlayerMain.currentRod.takeFish != null)
// // {
// // return true;
// // }
// //
// // return false;
// // }
//
// return true;
// }
//
// public static void ResetMouseButtonsTriggers()
// {
// isCastNear = false;
// isCastFar = false;
// isReelReeling = false;
// }
//
// private void OnApplicationFocus(bool hasFocus)
// {
// isPaused = !hasFocus;
// }
//
// private void OnApplicationPause(bool pauseStatus)
// {
// isPaused = pauseStatus;
// }
// }

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 06ccb0a1e4364d43bf431b652400cd31
timeCreated: 1742311542

View File

@@ -61,9 +61,27 @@ namespace NBF
private void Init()
{
InitService();
InitLanguage();
InitUI();
}
#region
private void InitLanguage()
{
Lan.Inst.AddLanguageModule((int)LanguageModuleType.Text, new LanguageText());
Lan.Inst.AddLanguageModule((int)LanguageModuleType.Image, new LanguageImage());
Lan.Inst.AddLanguageModule((int)LanguageModuleType.Font, new LanguageFont());
foreach (var key in LanguageConst.languageMap.Keys)
{
Lan.Inst.AddLanguage(key);
}
UI.Inst.SetUILanguage<UILangeageConfig>();
}
#endregion
#region UI
@@ -118,6 +136,7 @@ namespace NBF
InputDef.LoadIcon();
// UI.Inst.OpenUI<FishingShopPanel>();
LoadData();
UI.Inst.OpenUI<CommonTopPanel>();
// Fishing.Inst.Go(1);
// UI.Inst.OpenUI<SettingPanel>();
UI.Inst.OpenUI<HomePanel>();

View File

@@ -24,6 +24,7 @@ namespace NBF
private void OnUICanceled(string action)
{
if (!IsTop) return;
if (action == InputDef.UI.SubPrev)
{
}
@@ -46,59 +47,11 @@ namespace NBF
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();
}
BottomMenu.Use(this);
}
protected override void OnHide()
{
BottomMenu.OnBack -= OnBack;
// BottomMenu.OnTab -= OnResetSettings;
BottomMenu.OnEnter -= OnApplySettings;
BottomMenu.UnUse();
InputManager.OnUICanceled -= OnUICanceled;
}

View File

@@ -11,6 +11,7 @@ namespace NBF
UIObjectFactory.SetPackageItemExtension(BottomMenu.URL, typeof(BottomMenu));
UIObjectFactory.SetPackageItemExtension(ClassifyList.URL, typeof(ClassifyList));
UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu));
UIObjectFactory.SetPackageItemExtension(MarqueeTag.URL, typeof(MarqueeTag));
UIObjectFactory.SetPackageItemExtension(BtnTextInputControl.URL, typeof(BtnTextInputControl));
UIObjectFactory.SetPackageItemExtension(BtnTitleInputControl.URL, typeof(BtnTitleInputControl));
UIObjectFactory.SetPackageItemExtension(NoticeItem.URL, typeof(NoticeItem));

View File

@@ -13,6 +13,7 @@ namespace NBF
UIObjectFactory.SetPackageItemExtension(HomeMainPage.URL, typeof(HomeMainPage));
UIObjectFactory.SetPackageItemExtension(HomeActivityPage.URL, typeof(HomeActivityPage));
UIObjectFactory.SetPackageItemExtension(HomeRankPage.URL, typeof(HomeRankPage));
UIObjectFactory.SetPackageItemExtension(HomeStatisticsPage.URL, typeof(HomeStatisticsPage));
UIObjectFactory.SetPackageItemExtension(HomeButtonGroups.URL, typeof(HomeButtonGroups));
}
}

View File

@@ -0,0 +1,27 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class MarqueeTag
{
public const string URL = "ui://6hgkvlaulvqll9";
public GRichTextField TextContent1;
public GRichTextField TextContent2;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
TextContent1 = (GRichTextField)GetChild("TextContent1");
TextContent2 = (GRichTextField)GetChild("TextContent2");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6a9cfe2c247599a4aacfea389e45ce14

View File

@@ -0,0 +1,15 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class MarqueeTag : GComponent
{
private void OnInited()
{
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 70a1e1d821a7bc24e8eac7cc9bbf074b

View File

@@ -9,10 +9,7 @@ namespace NBF
{
public partial class BottomMenu : GComponent
{
public event Action OnBack;
public event Action OnEnter;
public event Action OnTab;
public event Action OnUse;
private IUIPanel _panel;
private void OnInited()
{
@@ -26,27 +23,18 @@ namespace NBF
item.OnAction?.Invoke();
}
public void UnUse()
{
OnBack = null;
OnEnter = null;
OnTab = null;
OnUse = null;
InputManager.OnUICanceled -= OnAction;
}
public void Use()
public void Use(IUIPanel panel)
{
_panel = panel;
List.RemoveChildrenToPool();
LeftList.RemoveChildrenToPool();
InputManager.OnUICanceled += OnAction;
AddButtonItem(OnUse, "");
AddButtonItem(OnTab, InputDef.UI.Tab);
AddButtonItem(OnEnter, InputDef.UI.Enter);
AddButtonItem(OnBack, InputDef.UI.Back);
// AddButtonItem(OnUse, "");
// AddButtonItem(OnTab, InputDef.UI.Tab);
// AddButtonItem(OnEnter, InputDef.UI.Enter);
// AddButtonItem(OnBack, InputDef.UI.Back);
}
private void AddButtonItem(Action action, string actionName)
@@ -63,6 +51,7 @@ namespace NBF
private void OnAction(string action)
{
if (_panel == null || !_panel.IsShowing || !_panel.IsTop) return;
var children = List.GetChildren();
foreach (var child in children)
{

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 059888fe216d4a789f01c3289be01645
timeCreated: 1748933992

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

@@ -53,8 +53,9 @@ namespace NBF
ShowAnim = UIPanelAnimation.GetCenterScaleBig(this);
HideAnim = UIPanelAnimation.GetCenterScaleBig(this, true);
IsModal = true;
IsDontBack = true;
}
protected override void OnShow()
{
TextTitle.text = _title;

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4021be5a688e4880815366add9c9e2fd
timeCreated: 1748941707

View File

@@ -0,0 +1,22 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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 FishBagPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
[AutoFind(Name = "back")]
public GImage back;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 55a42f040765e1948898ff81902abff4

View File

@@ -0,0 +1,33 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
namespace NBF
{
public partial class FishBagPanel : UIPanel
{
public override string UIPackName => "Main";
public override string UIResName => "FishBagPanel";
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: 6de4d8117b1b09340b4d11dd47e74b32

View File

@@ -14,6 +14,7 @@ namespace NBF
protected override void OnInit()
{
IsShowCursor = false;
IsDontBack = true;
}
protected override void OnShow()

View File

@@ -11,13 +11,13 @@ namespace NBF
{
public const string URL = "ui://hxr7rc7plvqln";
public GButton BtnMap;
public GButton BtnMessage;
public GButton BtnGo;
public GButton BtnMake;
public GButton BtnExit;
public GButton BtnSettings;
public GButton BtnStatistics;
public GButton BtnFishBag;
public GButton BtnBag;
public GButton BtnSkill;
public GButton BtnMap;
public GButton BtnPass;
public GButton BtnMission;
public GButton BtnTournament;
@@ -26,13 +26,13 @@ namespace NBF
{
base.ConstructFromXML(xml);
BtnMap = (GButton)GetChild("BtnMap");
BtnMessage = (GButton)GetChild("BtnMessage");
BtnGo = (GButton)GetChild("BtnGo");
BtnMake = (GButton)GetChild("BtnMake");
BtnExit = (GButton)GetChild("BtnExit");
BtnSettings = (GButton)GetChild("BtnSettings");
BtnStatistics = (GButton)GetChild("BtnStatistics");
BtnFishBag = (GButton)GetChild("BtnFishBag");
BtnBag = (GButton)GetChild("BtnBag");
BtnSkill = (GButton)GetChild("BtnSkill");
BtnMap = (GButton)GetChild("BtnMap");
BtnPass = (GButton)GetChild("BtnPass");
BtnMission = (GButton)GetChild("BtnMission");
BtnTournament = (GButton)GetChild("BtnTournament");

View File

@@ -17,7 +17,7 @@ namespace NBF
{
if (btn == BtnExit)
{
MessageBox.Show("确定推出到桌面吗?", (b) =>
MessageBox.Show("确定退出吗?", (b) =>
{
if (b) Application.Quit();
});
@@ -30,6 +30,18 @@ namespace NBF
{
UI.Inst.OpenUI<BagPanel>();
}
else if (btn == BtnFishBag)
{
UI.Inst.OpenUI<FishBagPanel>();
}
else if (btn == BtnMake)
{
UI.Inst.OpenUI<MakePanel>();
}
else if (btn == BtnMap)
{
UI.Inst.OpenUI<MapPanel>();
}
}
}
}

View File

@@ -56,7 +56,7 @@ namespace NBF
var nowPage = GetPage(index);
if (nowPage != null)
{
nowPage.Show();
nowPage.Show(this);
_currentPage = nowPage;
}
}

View File

@@ -1,15 +1,11 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class HomeMainPage : HomePageBase
{
private void OnInited()
{
}
@@ -22,15 +18,12 @@ namespace NBF
protected override void OnHide()
{
BottomMenu.OnBack -= OnBack;
BottomMenu.OnEnter -= OnApplySettings;
BottomMenu.UnUse();
InputManager.OnUICanceled -= OnUICanceled;
}
private void OnUICanceled(string action)
{
if (!Panel.IsTop) return;
if (action == InputDef.UI.SubPrev)
{
}
@@ -47,18 +40,7 @@ namespace NBF
private void UseBottomMenu()
{
BottomMenu.OnBack += OnBack;
BottomMenu.OnEnter += OnApplySettings;
BottomMenu.Use();
}
private void OnApplySettings()
{
}
private void OnBack()
{
UI.Inst.HideUI<HomePanel>();
BottomMenu.Use(Panel);
}
}
}

View File

@@ -6,8 +6,11 @@ namespace NBF
{
public int Page;
public void Show()
public HomePanel Panel;
public void Show(HomePanel panel)
{
Panel = panel;
ShowAnimation();
OnShow();
}
@@ -34,10 +37,7 @@ namespace NBF
private void HideAnimation()
{
GTween.Kill(this);
TweenFade(0, 0.2f).OnComplete(() =>
{
visible = false;
});
TweenFade(0, 0.2f).OnComplete(() => { visible = false; });
}
#endregion

View File

@@ -0,0 +1,25 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class HomeStatisticsPage
{
public const string URL = "ui://hxr7rc7plvql13";
public BottomMenu BottomMenu;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
BottomMenu = (BottomMenu)GetChild("BottomMenu");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

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

View File

@@ -0,0 +1,15 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class HomeStatisticsPage : GComponent
{
private void OnInited()
{
}
}
}

View File

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

View File

@@ -26,7 +26,7 @@ namespace NBF
protected override void OnInit()
{
base.OnInit();
ContentPane.sortingOrder = UIDef.UIOrder.Loading;
}
protected override void OnShow()

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 40364b7c47864017827ec33f9d7333b1
timeCreated: 1748941666

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 MakePanel
{
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: 0325840d66749994ca0ba6436eaef4aa

View File

@@ -0,0 +1,33 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
namespace NBF
{
public partial class MakePanel : UIPanel
{
public override string UIPackName => "Main";
public override string UIResName => "MakePanel";
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: 12d3dad5e220cfd47907482e50d15e13

22
Assets/Scripts/UI/MapPanel.Designer.cs generated Normal file
View File

@@ -0,0 +1,22 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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 MapPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
[AutoFind(Name = "back")]
public GImage back;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
}
}

View File

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

View File

@@ -0,0 +1,33 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
namespace NBF
{
public partial class MapPanel : UIPanel
{
public override string UIPackName => "Main";
public override string UIResName => "MapPanel";
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: 69a29998a66d1ec4cb15ebb8e5de9cb6

View File

@@ -21,6 +21,7 @@ namespace NBF
{
base.OnInit();
IsShowCursor = true;
IsDontBack = true;
var groupNames = Settings.Instance.GetAllGroups();
foreach (var group in groupNames)
@@ -73,29 +74,7 @@ namespace NBF
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();
BottomMenu.Use(this);
}
private void OnApplySettings()
@@ -149,6 +128,14 @@ namespace NBF
SetListSelected(List.selectedIndex + 1);
}
}
else if (action == InputDef.UI.Back)
{
OnBack();
}
else if (action == InputDef.UI.Enter)
{
OnApplySettings();
}
}
private void SetListSelected(int selectedIndex)
@@ -181,7 +168,6 @@ namespace NBF
private void OnBack()
{
if (Settings.Instance.HaveNotAppleSettings())
{
MessageBox.Show("还有未保存的信息", (b) =>
@@ -201,10 +187,6 @@ namespace NBF
protected override void OnHide()
{
base.OnHide();
BottomMenu.OnBack -= OnBack;
BottomMenu.OnTab -= OnResetSettings;
BottomMenu.OnEnter -= OnApplySettings;
BottomMenu.UnUse();
InputManager.OnUICanceled -= OnUICanceled;
}

View File

@@ -47,11 +47,9 @@ namespace NBF
private void UseBottomMenu()
{
BottomMenu.OnBack += Hide;
BottomMenu.Use();
BottomMenu.Use(this);
}
private void ChangeTab(int index)
{
@@ -81,12 +79,6 @@ namespace NBF
// }
}
protected override void OnHide()
{
base.OnHide();
BottomMenu.UnUse();
}
protected override void OnDestroy()
{
base.OnDestroy();

View File

@@ -0,0 +1,7 @@
namespace NBF
{
public static class UIInputExtensions
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e9bfb9f042814fb787428551c801aada
timeCreated: 1748944711

View File

@@ -36,5 +36,35 @@ namespace NBF
return derivedTypes;
}
/// <summary>
/// 获取所有标记指定特性的方法
/// </summary>
/// <param name="classType">查找类</param>
/// <param name="attributeType">特性类</param>
/// <returns></returns>
public static List<MethodInfo> GetMethodsWithUIInputAttribute(Type classType, Type attributeType)
{
List<MethodInfo> methodsWithAttribute = new List<MethodInfo>();
if (classType == null)
{
return methodsWithAttribute;
}
// 获取所有方法,包括公共、非公共、实例和静态方法
MethodInfo[] allMethods = classType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic);
foreach (MethodInfo method in allMethods)
{
if (method.GetCustomAttributes(attributeType, false).Length > 0)
{
methodsWithAttribute.Add(method);
}
}
return methodsWithAttribute;
}
}
}