首次提交
This commit is contained in:
8
Assets/Scripts/Common/Def/ErrorCode.cs
Normal file
8
Assets/Scripts/Common/Def/ErrorCode.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace NBF
|
||||
{
|
||||
public class ErrorCode
|
||||
{
|
||||
public const int Success = 0;
|
||||
public const int Error = 1;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Common/Def/ErrorCode.cs.meta
Normal file
3
Assets/Scripts/Common/Def/ErrorCode.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 059e898abe0b45988f002ca7e6ff9540
|
||||
timeCreated: 1756365454
|
||||
147
Assets/Scripts/Common/Def/GameDef.cs
Normal file
147
Assets/Scripts/Common/Def/GameDef.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class InteractiveData
|
||||
{
|
||||
public UIDef.InteractiveType Type;
|
||||
public string Icon = "op-door";
|
||||
public string Name;
|
||||
public string Use1;
|
||||
public string Use2;
|
||||
public string Use1Title = "进入";
|
||||
public string Use2Title;
|
||||
}
|
||||
|
||||
public class GameDef
|
||||
{
|
||||
public const int NormalFOV = 50;
|
||||
public const int ZoomedFOV = 25;
|
||||
|
||||
public static List<InteractiveData> InteractiveDataList = new List<InteractiveData>()
|
||||
{
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Boat,
|
||||
Name = "船",
|
||||
Icon = "op-boat",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "上船"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Bank,
|
||||
Name = "银行",
|
||||
Icon = "op-bank",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Canteen,
|
||||
Name = "餐厅",
|
||||
Icon = "op-door",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "热饭"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Oven,
|
||||
Name = "烤箱",
|
||||
Icon = "op-oven",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "使用"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Tent,
|
||||
Name = "帐篷",
|
||||
Icon = "op-tent",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "打开"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Drying,
|
||||
Name = "晾干器",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "使用"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Bonfire,
|
||||
Name = "篝火",
|
||||
Icon = "op-fire",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "使用"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Fumigate,
|
||||
Name = "烟熏箱",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "使用"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.FoodShop,
|
||||
Name = "食品商店",
|
||||
Icon = "op-door",
|
||||
Use1 = "1,1",
|
||||
Use2 = "1,1",
|
||||
Use1Title = "进入",
|
||||
Use2Title = "退货"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.FishingShop,
|
||||
Name = "钓鱼商店",
|
||||
Icon = "op-door",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.ToolsShop,
|
||||
Name = "工业品店",
|
||||
Icon = "op-door",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.VendingMachine,
|
||||
Name = "自动贩卖机",
|
||||
Icon = "op-vending",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Wharf,
|
||||
Name = "码头",
|
||||
Icon = "op-wharf",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.FishBazaar,
|
||||
Name = "鱼市",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.ReserveBazaar,
|
||||
Name = "订购市场",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Common/Def/GameDef.cs.meta
Normal file
3
Assets/Scripts/Common/Def/GameDef.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0e959f45daf44f2b7bf1efe6e8fbc2b
|
||||
timeCreated: 1747147951
|
||||
163
Assets/Scripts/Common/Def/InputDef.cs
Normal file
163
Assets/Scripts/Common/Def/InputDef.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class InputDef
|
||||
{
|
||||
public class UI
|
||||
{
|
||||
public static Dictionary<string, List<string>> Icons = new Dictionary<string, List<string>>();
|
||||
|
||||
[InputIcon("icon_controller_123", "icon_controller_2")]
|
||||
public const string Back = "Back";
|
||||
|
||||
[InputIcon("icon_controller_129", "icon_controller_1")]
|
||||
public const string Enter = "Enter";
|
||||
|
||||
[InputIcon("icon_controller_129", "icon_controller_1")]
|
||||
public const string Reset = "Reset";
|
||||
|
||||
[InputIcon("icon_controller_127", "icon_controller_19")]
|
||||
public const string Tab = "Tab";
|
||||
|
||||
[InputIcon("icon_controller_29", "icon_controller_89")]
|
||||
public const string Prev = "Prev";
|
||||
|
||||
[InputIcon("icon_controller_30", "icon_controller_77")]
|
||||
public const string Next = "Next";
|
||||
|
||||
[InputIcon("icon_controller_98", "icon_controller_27")]
|
||||
public const string SubPrev = "SubPrev";
|
||||
|
||||
[InputIcon("icon_controller_75", " icon_controller_28")]
|
||||
public const string SubNext = "SubNext";
|
||||
|
||||
[InputIcon("", "")] public const string Left = "Left";
|
||||
[InputIcon("", "")] public const string Right = "Right";
|
||||
[InputIcon("", "")] public const string Up = "Up";
|
||||
[InputIcon("", "")] public const string Down = "Down";
|
||||
}
|
||||
|
||||
public static class Player
|
||||
{
|
||||
public static Dictionary<string, List<string>> Icons = new Dictionary<string, List<string>>();
|
||||
public const string Run = "Run";
|
||||
public const string Use1 = "Use1";
|
||||
public const string Use2 = "Use2";
|
||||
|
||||
public const string QuickStarts = "Quick";
|
||||
public const string Quick1 = "Quick1";
|
||||
public const string Quick2 = "Quick2";
|
||||
public const string Quick3 = "Quick3";
|
||||
public const string Quick4 = "Quick4";
|
||||
public const string Quick5 = "Quick5";
|
||||
public const string Quick6 = "Quick6";
|
||||
public const string Quick7 = "Quick7";
|
||||
public const string Quick8 = "Quick8";
|
||||
public const string Quick9 = "Quick9";
|
||||
|
||||
public const string ToBag = "ToBag";
|
||||
|
||||
public const string Move = "Move";
|
||||
public const string Look = "Look";
|
||||
public const string UseTorch = "UseTorch";
|
||||
}
|
||||
|
||||
#region Load Icon
|
||||
|
||||
public static void LoadIcon()
|
||||
{
|
||||
// 获取InputDef类型
|
||||
Type inputDefType = typeof(NBF.InputDef);
|
||||
|
||||
// 检查UI类
|
||||
Type uiType = inputDefType.GetNestedType("UI");
|
||||
if (uiType != null)
|
||||
{
|
||||
var uiFields = GetInputIconFieldsFromType(uiType);
|
||||
if (uiFields.Count > 0)
|
||||
{
|
||||
foreach (var field in uiFields)
|
||||
{
|
||||
InputIconAttribute attribute =
|
||||
(InputIconAttribute)Attribute.GetCustomAttribute(field, typeof(InputIconAttribute));
|
||||
|
||||
string value = (string)field.GetValue(null); // 获取常量值
|
||||
if (attribute != null)
|
||||
{
|
||||
List<string> icons = new List<string>
|
||||
{
|
||||
attribute.KeyBoardIcon,
|
||||
attribute.ControllerIcon
|
||||
};
|
||||
UI.Icons[value] = icons;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查Player类
|
||||
Type playerType = inputDefType.GetNestedType("Player");
|
||||
if (playerType != null)
|
||||
{
|
||||
var playerFields = GetInputIconFieldsFromType(playerType);
|
||||
if (playerFields.Count > 0)
|
||||
{
|
||||
foreach (var field in playerFields)
|
||||
{
|
||||
InputIconAttribute attribute =
|
||||
(InputIconAttribute)Attribute.GetCustomAttribute(field, typeof(InputIconAttribute));
|
||||
|
||||
string value = (string)field.GetValue(null); // 获取常量值
|
||||
if (attribute != null)
|
||||
{
|
||||
List<string> icons = new List<string>
|
||||
{
|
||||
attribute.KeyBoardIcon,
|
||||
attribute.ControllerIcon
|
||||
};
|
||||
Player.Icons[value] = icons;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// foreach (var key in InputDef.UI.Icons.Keys)
|
||||
// {
|
||||
// var icons = InputDef.UI.Icons[key];
|
||||
// Log.Error($"KEY={key} icon={string.Join(",", icons)}");
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// 从特定类型获取带有InputIconAttribute的常量字段
|
||||
private static List<FieldInfo> GetInputIconFieldsFromType(Type type)
|
||||
{
|
||||
List<FieldInfo> result = new List<FieldInfo>();
|
||||
|
||||
// 只获取公共常量字段
|
||||
FieldInfo[] fields = type.GetFields(
|
||||
BindingFlags.Public |
|
||||
BindingFlags.Static |
|
||||
BindingFlags.FlattenHierarchy);
|
||||
|
||||
foreach (FieldInfo field in fields)
|
||||
{
|
||||
// 检查是否是常量且带有InputIconAttribute
|
||||
if (field.IsLiteral && !field.IsInitOnly &&
|
||||
Attribute.IsDefined(field, typeof(InputIconAttribute)))
|
||||
{
|
||||
result.Add(field);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Common/Def/InputDef.cs.meta
Normal file
3
Assets/Scripts/Common/Def/InputDef.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c1d17072df749909ccc26de605346d1
|
||||
timeCreated: 1748104048
|
||||
10
Assets/Scripts/Common/Def/SelectorRodSetting.cs
Normal file
10
Assets/Scripts/Common/Def/SelectorRodSetting.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace NBF
|
||||
{
|
||||
public enum SelectorRodSetting
|
||||
{
|
||||
Speed = 0,
|
||||
Drag = 1,
|
||||
Leeder = 2
|
||||
}
|
||||
|
||||
}
|
||||
3
Assets/Scripts/Common/Def/SelectorRodSetting.cs.meta
Normal file
3
Assets/Scripts/Common/Def/SelectorRodSetting.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca512e729d2e4ef290f30f075bcdd698
|
||||
timeCreated: 1744039906
|
||||
110
Assets/Scripts/Common/Def/States.cs
Normal file
110
Assets/Scripts/Common/Def/States.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
namespace NBF
|
||||
{
|
||||
public static class States
|
||||
{
|
||||
public const uint None = 0;
|
||||
|
||||
|
||||
public static class Fish
|
||||
{
|
||||
/// <summary>
|
||||
/// 攻击
|
||||
/// </summary>
|
||||
public const uint Attack = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 吃饵
|
||||
/// </summary>
|
||||
public const uint Bite = 2;
|
||||
|
||||
/// <summary>
|
||||
/// 销毁
|
||||
/// </summary>
|
||||
public const uint Destroy = 3;
|
||||
|
||||
/// <summary>
|
||||
/// 逃避
|
||||
/// </summary>
|
||||
public const uint Escape = 4;
|
||||
|
||||
/// <summary>
|
||||
/// 中钩
|
||||
/// </summary>
|
||||
public const uint Hooked = 5;
|
||||
|
||||
/// <summary>
|
||||
/// 捕食攻击
|
||||
/// </summary>
|
||||
public const uint PredatorAttack = 6;
|
||||
|
||||
/// <summary>
|
||||
/// 捕食者游泳
|
||||
/// </summary>
|
||||
public const uint PredatorSwim = 7;
|
||||
|
||||
/// <summary>
|
||||
/// 显示大鱼
|
||||
/// </summary>
|
||||
public const uint ShowBig = 8;
|
||||
|
||||
/// <summary>
|
||||
/// 显示小鱼
|
||||
/// </summary>
|
||||
public const uint ShowSmall = 9;
|
||||
|
||||
/// <summary>
|
||||
/// 游动
|
||||
/// </summary>
|
||||
public const uint Swim = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 游走
|
||||
/// </summary>
|
||||
public const uint SwimAway = 11;
|
||||
}
|
||||
|
||||
public static class Float
|
||||
{
|
||||
public const uint Broken = 1;
|
||||
public const uint Floating = 2;
|
||||
public const uint Flying = 3;
|
||||
public const uint Hanging = 4;
|
||||
public const uint Hidden = 5;
|
||||
public const uint Hitched = 6;
|
||||
public const uint IdlePitch = 7;
|
||||
public const uint OnTip = 8;
|
||||
public const uint Pitching = 9;
|
||||
public const uint ShowBigFish = 10;
|
||||
public const uint ShowItem = 11;
|
||||
public const uint ShowSmallFish = 12;
|
||||
public const uint Swallowed = 13;
|
||||
}
|
||||
|
||||
public static class Hook
|
||||
{
|
||||
public const uint Floating = 1;
|
||||
public const uint Flying = 2;
|
||||
public const uint Hanging = 3;
|
||||
public const uint Hidden = 4;
|
||||
public const uint Hitched = 5;
|
||||
public const uint Showing = 6;
|
||||
}
|
||||
|
||||
public static class Lure
|
||||
{
|
||||
public const uint Broken = 1;
|
||||
public const uint Floating = 2;
|
||||
public const uint Flying = 3;
|
||||
public const uint Hanging = 4;
|
||||
public const uint Hidden = 5;
|
||||
public const uint Hitched = 6;
|
||||
public const uint IdlePitch = 7;
|
||||
public const uint OnTip = 8;
|
||||
public const uint Pitching = 9;
|
||||
public const uint ShowBigFish = 10;
|
||||
public const uint ShowItem = 11;
|
||||
public const uint ShowSmallFish = 12;
|
||||
public const uint Swallowed = 13;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Common/Def/States.cs.meta
Normal file
3
Assets/Scripts/Common/Def/States.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c891633bb59482ab0e95249873a664c
|
||||
timeCreated: 1743521988
|
||||
103
Assets/Scripts/Common/Def/UIDef.cs
Normal file
103
Assets/Scripts/Common/Def/UIDef.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class UIDef
|
||||
{
|
||||
public const string UIRoot = "Assets/ResRaw/Fgui/";
|
||||
|
||||
public class DefaultScreen
|
||||
{
|
||||
public const int Width = 1920;
|
||||
public const int Height = 1080;
|
||||
}
|
||||
|
||||
public class Pack
|
||||
{
|
||||
public const string Common = "Common";
|
||||
public const string CommonIcon = "CommonIcon";
|
||||
public const string CommonFlag = "CommonFlag";
|
||||
public const string Main = "Main";
|
||||
}
|
||||
|
||||
public class UIOrder
|
||||
{
|
||||
public const int CommonTopPanel = 200;
|
||||
public const int Loading = 500;
|
||||
public const int Guide = 900;
|
||||
public const int Notices = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// 屏蔽Combo操作
|
||||
/// </summary>
|
||||
public const int Forbid = 2000;
|
||||
|
||||
/// <summary>
|
||||
/// 转菊花
|
||||
/// </summary>
|
||||
public const int Wait = 2001;
|
||||
|
||||
/// <summary>
|
||||
/// 引导屏蔽所有操作
|
||||
/// </summary>
|
||||
public const int GuideForbid = 2002;
|
||||
|
||||
/// <summary>
|
||||
/// 网络错误弹框
|
||||
/// </summary>
|
||||
public const int NetDisconnect = 2100;
|
||||
|
||||
/// <summary>
|
||||
/// 最顶层层 GM之类的用
|
||||
/// </summary>
|
||||
public const int Max = 3100;
|
||||
}
|
||||
|
||||
public enum InteractiveType
|
||||
{
|
||||
[InspectorName("船")] Boat = 1,
|
||||
|
||||
[InspectorName("银行")] Bank = 2,
|
||||
|
||||
[InspectorName("餐厅")] Canteen = 3,
|
||||
|
||||
[InspectorName("烤箱")] Oven = 4,
|
||||
|
||||
[InspectorName("帐篷")] Tent = 5,
|
||||
|
||||
[InspectorName("晾干器")] Drying = 6,
|
||||
|
||||
[InspectorName("篝火")] Bonfire = 7,
|
||||
|
||||
[InspectorName("烟熏箱")] Fumigate = 8,
|
||||
|
||||
[InspectorName("食品商店")] FoodShop = 11,
|
||||
|
||||
[InspectorName("钓鱼商店")] FishingShop = 12,
|
||||
|
||||
[InspectorName("工业品店")] ToolsShop = 13,
|
||||
|
||||
[InspectorName("自动贩卖机")] VendingMachine = 14,
|
||||
|
||||
[InspectorName("码头")] Wharf = 15,
|
||||
|
||||
[InspectorName("鱼市")] FishBazaar = 21,
|
||||
|
||||
[InspectorName("订购市场")] ReserveBazaar = 22
|
||||
}
|
||||
|
||||
public class ID
|
||||
{
|
||||
public const int Loading = 1;
|
||||
public const int Home = 2;
|
||||
public const int SettingPanel = 3;
|
||||
public const int HelpPanel = 4;
|
||||
public const int MapPanel = 5;
|
||||
|
||||
public const int ShopPanel = 10;
|
||||
public const int MakePanel = 11;
|
||||
public const int BagPanel = 12;
|
||||
public const int FishBagPanel = 13;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Common/Def/UIDef.cs.meta
Normal file
3
Assets/Scripts/Common/Def/UIDef.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50d4cd26b49d4053bf5d1c6f6674630a
|
||||
timeCreated: 1742307596
|
||||
Reference in New Issue
Block a user