setting change

This commit is contained in:
Bob.Song
2026-02-02 17:58:39 +08:00
parent f33f61f515
commit 55a92d9b23
127 changed files with 803 additions and 222 deletions

View File

@@ -11,7 +11,7 @@ MonoBehaviour:
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4b7ca52a950d1494aa1184cdc7700c3d, type: 3}
m_Name: SoapSettings
m_EditorClassIdentifier:
m_EditorClassIdentifier: Obvious.Soap.Editor::Obvious.Soap.Editor.SoapSettings
VariableDisplayMode: 0
NamingOnCreationMode: 0
CreatePathMode: 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -909,6 +909,85 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &869065583
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 869065584}
- component: {fileID: 869065586}
- component: {fileID: 869065585}
m_Layer: 5
m_Name: Text (Legacy)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &869065584
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 869065583}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1439106037}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -20.035}
m_SizeDelta: {x: 160, y: 70.0701}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &869065585
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 869065583}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Text
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 9ca2618301686b342867f34f731938f0, type: 3}
m_FontSize: 32
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u9009\u9879"
--- !u!222 &869065586
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 869065583}
m_CullTransparentMesh: 1
--- !u!1 &884989002
GameObject:
m_ObjectHideFlags: 0
@@ -1128,6 +1207,121 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1439106032
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1439106037}
- component: {fileID: 1439106036}
- component: {fileID: 1439106035}
- component: {fileID: 1439106034}
- component: {fileID: 1439106033}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1439106033
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1439106032}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b189222c6db8433db1239d314f92cf9f, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::DontDestroy
--- !u!114 &1439106034
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1439106032}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4513599
--- !u!114 &1439106035
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1439106032}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &1439106036
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1439106032}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &1439106037
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1439106032}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 869065584}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &1729919008
GameObject:
m_ObjectHideFlags: 0
@@ -1629,8 +1823,8 @@ Camera:
y: 0
width: 1
height: 1
near clip plane: 0.1
far clip plane: 3000
near clip plane: 0.01
far clip plane: 5000
field of view: 60.000004
orthographic: 0
orthographic size: 5
@@ -1858,3 +2052,4 @@ SceneRoots:
- {fileID: 1199298675}
- {fileID: 646846706}
- {fileID: 159075240}
- {fileID: 1439106037}

View File

@@ -0,0 +1,43 @@
using System.Collections.Generic;
using NBC;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
namespace NBF
{
public class InputIconData
{
public string MapName;
public Dictionary<string, string> KeyboardIcons = new Dictionary<string, string>();
public string GetIcon(string actionName)
{
if (KeyboardIcons.TryGetValue(actionName, out var keyboardIcon))
{
return keyboardIcon;
}
return string.Empty;
}
public void CacheInputActionIcons(ReadOnlyArray<InputAction> actions)
{
KeyboardIcons.Clear();
foreach (var inputAction in actions)
{
foreach (var binding in inputAction.bindings)
{
var path = binding.effectivePath.Replace("<", "").Replace(">", "").Replace("/", "_");
if (path.Contains("Keyboard") || path.Contains("keyboard"))
{
path = path.Replace("Keyboard", "keyboard");
KeyboardIcons.TryAdd(inputAction.name, path);
Log.Info($"ActionIcons {inputAction.name}={path}");
}
}
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6eb3efcd3474440ea2c7d6549db02c4c
timeCreated: 1770015242

View File

@@ -41,6 +41,9 @@ namespace NBF
public static bool IsOp2;
public const string InputMapUI = "UI";
public const string InputMapPlayer = "Player";
public static event Action<bool> OnOp1Action;
public static event Action<bool> OnOp2Action;
@@ -157,13 +160,13 @@ namespace NBF
private void AddEvent()
{
CacheInputActionIcons(PlayerInputControl.asset.actionMaps);
foreach (var actionMap in PlayerInputControl.asset.actionMaps)
{
actionMap.Enable();
if (actionMap.name == "UI")
if (actionMap.name == InputMapUI)
{
_uiInputActionMap = actionMap;
CacheInputActionIcons(actionMap.actions);
foreach (var action in actionMap.actions)
{
if (action.type == InputActionType.Button)
@@ -175,7 +178,7 @@ namespace NBF
//var fileName = binding.effectivePath.Replace("<", "").Replace(">", "").Replace("/", "_");
}
}
else if (actionMap.name == "Player")
else if (actionMap.name == InputMapPlayer)
{
foreach (var action in actionMap.actions)
{
@@ -278,7 +281,9 @@ namespace NBF
private readonly Dictionary<object, List<UIInputInvoke>> _panelActions =
new Dictionary<object, List<UIInputInvoke>>();
private Dictionary<string, string> _keyboardIcons = new Dictionary<string, string>();
// private Dictionary<string, string> _keyboardIcons = new Dictionary<string, string>();
private Dictionary<string, InputIconData> InputIconData = new Dictionary<string, InputIconData>();
public void On(object obj)
{
@@ -350,34 +355,26 @@ namespace NBF
return ret;
}
public string GetUIKeyCode(string actionName)
public string GetInputIcon(string map, string actionName)
{
if (_keyboardIcons.TryGetValue(actionName, out var keyboardIcon))
if (InputIconData.TryGetValue(map, out var data))
{
return keyboardIcon;
return data.GetIcon(actionName);
}
return string.Empty;
}
private void CacheInputActionIcons(ReadOnlyArray<InputAction> actions)
private void CacheInputActionIcons(ReadOnlyArray<InputActionMap> actionMaps)
{
_keyboardIcons.Clear();
foreach (var inputAction in actions)
foreach (var actionMap in actionMaps)
{
foreach (var binding in inputAction.bindings)
{
var path = binding.effectivePath.Replace("<", "").Replace(">", "").Replace("/", "_");
if (path.Contains("Keyboard") || path.Contains("keyboard"))
{
path = path.Replace("Keyboard", "keyboard");
_keyboardIcons.TryAdd(inputAction.name, path);
Log.Info($"ActionIcons {inputAction.name}={path}");
}
}
var data = new InputIconData();
data.CacheInputActionIcons(actionMap.actions);
InputIconData[actionMap.name] = data;
}
}

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputInfoSetting : KeyBoardOption
{
public override string Name => "InputInfo";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Info;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a8d104a89f6949538773fd9600f9e5ea
timeCreated: 1770014466

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputKeepnetSetting : KeyBoardOption
{
public override string Name => "InputKeepnet";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Keepnet;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7c725fd5631a48b4832ea6b7ff4b6c02
timeCreated: 1770014596

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputMakeSetting : KeyBoardOption
{
public override string Name => "InputMake";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Make;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 80f08e4bc7bd46928cdee1bcfc91d818
timeCreated: 1770014640

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputMapSetting : KeyBoardOption
{
public override string Name => "InputMap";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Map;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b5002a562cc44982993e36995f5e13a4
timeCreated: 1770014702

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputOpenBagSetting : KeyBoardOption
{
public override string Name => "InputOpenBag";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.OpenBag;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 80ac633ee5a5464f9f2baf871c03f25b
timeCreated: 1770014552

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputOpenQuickSetting: KeyBoardOption
{
public override string Name => "InputMap";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Map;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f07900d8fce94aa8bcc7a2baf2f19b5a
timeCreated: 1770014735

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputSelectBaitSetting : KeyBoardOption
{
public override string Name => "InputSelectBait";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.SelectBait;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 299babdb703341829075f9ff4b762c7b
timeCreated: 1770014278

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputSelectFoodSetting : KeyBoardOption
{
public override string Name => "InputSelectFood";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.SelectFood;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 75643d3acb5146839b78b714cf014ee1
timeCreated: 1770014339

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputSelectItemSetting : KeyBoardOption
{
public override string Name => "InputSelectItem";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.SelectItem;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: acc89667bf654d73b827e4f61d206056
timeCreated: 1770014227

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputSkillSetting : KeyBoardOption
{
public override string Name => "InputSkill";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Skill;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 203702381cd040fabe806fa585e02ee7
timeCreated: 1770014495

View File

@@ -0,0 +1,17 @@
using UnityEngine.InputSystem;
namespace NBF.Setting
{
public class InputUseBrailSetting : KeyBoardOption
{
public override string Name => "InputUseBrail";
public override string Group => SettingsDef.Group.Keyboard;
public override string Tab => SettingsDef.Tab.Keyboard;
public override InputAction InputAction => InputManager.PlayerInputControl.Player.UseBrail;
protected override void OnApply()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7cd4bb63bb664dfaa9422503493e9767
timeCreated: 1770014382

View File

@@ -61,6 +61,7 @@ namespace NBC.Asset
{
return assetProvider.Asset as T;
}
return null;
}
@@ -385,6 +386,9 @@ namespace NBC.Asset
_monoGameObject = new GameObject("Assets", typeof(Mono));
Mono.AddUpdate(Update);
InitializationTask task;
#if UNITY_STANDALONE_WIN
Const.NotCache = true;
#endif
if (Const.Simulate)
{
task = new EditorInitializationTask();

View File

@@ -9,7 +9,8 @@ namespace NBC.Asset
public const string VersionFileName = "version.json";
public static bool IsWebGLPlatform => Application.platform == RuntimePlatform.WebGLPlayer;
public static readonly string SavePath =
$"{Application.persistentDataPath}{Path.DirectorySeparatorChar}{BundleDirName}{Path.DirectorySeparatorChar}";
@@ -20,9 +21,10 @@ namespace NBC.Asset
public static bool Offline;
public static bool Simulate;
public static bool NotCache;
public static int DownloadTimeOut = 10;
public static string GetStreamingPath(string file)
{
@@ -31,6 +33,11 @@ namespace NBC.Asset
public static string GetCachePath(string file)
{
if (NotCache)
{
return GetStreamingPath(file);
}
return $"{SavePath}{file}";
}
@@ -45,6 +52,7 @@ namespace NBC.Asset
{
return $"{RemoteUrl}/{file}";
}
return $"{RemoteUrl}{BundleDirName}/{file}";
}
}

View File

@@ -1,7 +1,7 @@
namespace NBC.Asset
{
/// <summary>
/// 离线模式初始化任务
/// 移动端离线模式初始化任务
/// </summary>
internal sealed class OfflineInitializationTask : InitializationTask
{
@@ -10,9 +10,13 @@
protected override void OnStart()
{
_taskList.AddTask(new CheckCoverInstallTask());
_taskList.AddTask(new UnpackVersionTask());
_taskList.AddTask(new CheckUnpackPackageTask());
if (!Const.NotCache)
{
_taskList.AddTask(new CheckCoverInstallTask());
_taskList.AddTask(new UnpackVersionTask());
_taskList.AddTask(new CheckUnpackPackageTask());
}
_taskList.AddTask(new RunFunctionTask(Addressable.Load));
_taskList.Run(TaskRunner.Def);
}

View File

@@ -14,7 +14,7 @@ namespace NBC
new Dictionary<SystemLanguage, Dictionary<string, string>>();
/// <summary>
/// 当前语言图片配置键值对
/// 当前语言和字体
/// </summary>
private Dictionary<string, string> _currentLanguageDictionary = new Dictionary<string, string>();
@@ -31,26 +31,26 @@ namespace NBC
public void AddLanguage(SystemLanguage language)
{
var configDic = Lan.Inst.GetLanguageFontConfig(LanguageConst.languageMap[language]);
string fontLocation = "Fonts/";//"Assets/Resources/Fonts/";
// string fontLocation = "Fonts/";//"Assets/Resources/Fonts/";
//字体使用前需要先注册
foreach (var config in configDic.Values)
{
if (config.Type == "1")
{
DynamicFont font = new DynamicFont();
font.name = config.Name;
font.nativeFont = Resources.Load<Font>(fontLocation + config.RelativePath);
FontManager.RegisterFont(font);
}
else if (config.Type == "2")
{
TMP_FontAsset fontAsset =
Resources.Load<TMP_FontAsset>(fontLocation + config.RelativePath) as TMP_FontAsset;
TMPFont font = new TMPFont();
font.name = config.Name; //这个名字要和编辑器里字体资源的名字一致
font.fontAsset = fontAsset;
FontManager.RegisterFont(font);
}
// if (config.Type == "1")
// {
// DynamicFont font = new DynamicFont();
// font.name = config.Name;
// font.nativeFont = Resources.Load<Font>(fontLocation + config.RelativePath);
// FontManager.RegisterFont(font);
// }
// else if (config.Type == "2")
// {
// TMP_FontAsset fontAsset =
// Resources.Load<TMP_FontAsset>(fontLocation + config.RelativePath) as TMP_FontAsset;
// TMPFont font = new TMPFont();
// font.name = config.Name; //这个名字要和编辑器里字体资源的名字一致
// font.fontAsset = fontAsset;
// FontManager.RegisterFont(font);
// }
}
var font2KeyDic = Lan.Inst.GetFont2KeyDic();
@@ -59,11 +59,8 @@ namespace NBC
{
keys.Add(pair.Key, configDic[pair.Value].Name);
}
if (keys != null)
{
_languages[language] = keys;
}
_languages[language] = keys;
}
public bool UseLanguage(SystemLanguage language)

View File

@@ -14,10 +14,11 @@ namespace NBC
private Dictionary<int, ILanguage> _lanModuleDic = new Dictionary<int, ILanguage>();
/// <summary>
/// 变化通知事件
/// </summary>
private Action _changeAction;
public event Action ChangeAction;
public LanguageManager()
{
@@ -79,7 +80,7 @@ namespace NBC
value.UseLanguage(language);
}
_changeAction?.Invoke();
ChangeAction?.Invoke();
}
public void AddLanguage(SystemLanguage language, bool isDefault = false)
@@ -95,16 +96,6 @@ namespace NBC
}
}
public void OnChange(Action callback)
{
_changeAction += callback;
}
public void OffChange(Action callback)
{
_changeAction -= callback;
}
#region config
private readonly Dictionary<string, LanguageConfig> _languageConfigs = new Dictionary<string, LanguageConfig>();

View File

@@ -16,11 +16,7 @@ namespace NBC
bool IsShowing { get; }
bool IsCanVisible { get; }
bool IsDotDel { get; }
/// <summary>
/// 不能返回
/// </summary>
bool IsDontBack { get; }
bool IsModal { get; }
@@ -30,6 +26,7 @@ namespace NBC
void SetData(object args);
object GetData();
string[] GetDependPackages();
void SetLanguage();
void Init();
void Show();

View File

@@ -190,6 +190,7 @@ namespace NBC
Show();
}
/// <summary>
/// 设置刷新多语言
/// </summary>

View File

@@ -137,7 +137,14 @@ namespace NBC
if (curField == null) return;
var textFormat = curField.textFormat;
var font = Lan.GetLanFontByCurFont(textFormat.font);
Log.Info($"font={textFormat.font}");
var fontName = textFormat.font;
if (string.IsNullOrEmpty(fontName))
{
fontName = UIConfig.defaultFont;
}
var font = Lan.GetLanFontByCurFont(fontName);
if (font == null) return;
textFormat.font = font;
curField.textFormat = textFormat;

View File

@@ -8,7 +8,7 @@ namespace NBF
public string ActionName;
public string ShowName;
public virtual void SetData(string actionName, string showName)
public virtual void SetData(string actionName, string showName, string map = InputManager.InputMapUI)
{
this.ActionName = actionName;
this.ShowName = showName;
@@ -21,7 +21,7 @@ namespace NBF
title = Lan.Get(actionName);
}
var iconName = InputManager.Instance.GetUIKeyCode(ActionName);
var iconName = InputManager.Instance.GetInputIcon(map, ActionName);
icon = UIPackage.GetItemURL(UIDef.Pack.Common, iconName);
}
}

View File

@@ -1,5 +1,6 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System.Collections.Generic;
using UnityEngine;
using NBC;
@@ -11,6 +12,7 @@ namespace NBF
{
ContentPane.sortingOrder = UIDef.UIOrder.CommonTopPanel;
IsShowCursor = false;
Lan.Inst.ChangeAction += ChangeLanguageConfirm;
}
protected override void OnShow()
@@ -26,21 +28,34 @@ namespace NBF
}
}
private void OnUICanceled(string action)
private void ChangeLanguageConfirm()
{
if (action == InputDef.UI.Back)
var uis = UI.Inst.GetAllUI();
List<IUIPanel> panels = new List<IUIPanel>();
foreach (var ui in uis)
{
var uis = UI.Inst.GetAllUI();
foreach (var ui in uis)
if (!ui.IsShowing && !ui.IsDotDel)
{
if (ui.ContentPane.sortingOrder > 0) continue;
if (ui.IsTop && !ui.IsDontBack)
{
UI.Inst.HideUI(ui.GetType());
break;
}
UI.Inst.DestroyUI(ui.GetType());
}
else
{
panels.Add(ui);
}
}
//打开的页面重刷多语言
foreach (var panel in panels)
{
panel.SetLanguage();
_ui.TrySetPanelLanguage(panel.ContentPane);
}
// Net.Inst.Send(EnmCmdValue.EcvCsAcSetLanguageReq, new CS_AC_SetLanguageReq()
// {
// AppLanguage = Lan.Inst.GetCurrentCustomLanguageName()
// });
}
protected override void OnHide()
@@ -49,7 +64,7 @@ namespace NBF
protected override void OnDestroy()
{
base.OnDestroy();
Lan.Inst.ChangeAction -= ChangeLanguageConfirm;
}
}
}

View File

@@ -30,17 +30,18 @@ namespace NBF
{
// InputWaitingPanel.Show(true);
// UI.Inst.OpenUI<InputWaitingPanel>();
// 取消当前绑定
var settingPanel = UI.Inst.GetUI<SettingPanel>();
settingPanel.InputWait.visible = true;
Option.InputAction.Disable();
// 开始重绑定操作
rebindingOperation = Option.InputAction.PerformInteractiveRebinding(Option.BindingIndex)
.OnMatchWaitForAnother(0.1f)
.OnComplete(operation => RebindComplete())
.OnCancel(operation => RebindCanceled())
.Start();
SettingWaitInputPanel.Show();
// // 取消当前绑定
// var settingPanel = UI.Inst.GetUI<SettingPanel>();
// settingPanel.InputWait.visible = true;
// Option.InputAction.Disable();
//
// // 开始重绑定操作
// rebindingOperation = Option.InputAction.PerformInteractiveRebinding(Option.BindingIndex)
// .OnMatchWaitForAnother(0.1f)
// .OnComplete(operation => RebindComplete())
// .OnCancel(operation => RebindCanceled())
// .Start();
}
private void RebindComplete()
@@ -48,12 +49,6 @@ namespace NBF
rebindingOperation.Dispose();
UpdateValueText();
Option.InputAction.Enable();
var settingPanel = UI.Inst.GetUI<SettingPanel>();
settingPanel.InputWait.visible = false;
// UI.Inst.HideUI<InputWaitingPanel>();
// startRebindObject.SetActive(true);
// waitingForInputObject.SetActive(false);
}
private void RebindCanceled()

View File

@@ -15,6 +15,7 @@ namespace NBF
{
BtnPrev.onClick.Set(OnPrev);
BtnNext.onClick.Set(OnNext);
BtnControl.onClick.Set(OnControl);
Slider.onChanged.Set(OnSliderChanged);
ComboBox.onChanged.Set(OnComboBoxChanged);
}
@@ -163,7 +164,12 @@ namespace NBF
}
}
private void UpdateValueText()
public void OnControl()
{
SettingWaitInputPanel.Show(this);
}
public void UpdateValueText()
{
Pages.visible = false;
if (Option is RangeOption range)
@@ -183,6 +189,17 @@ namespace NBF
Pages.SetCurrent(multiOption.GetValue());
}
else if (Option is KeyBoardOption keyBoardOption)
{
UpdateControlInfo();
}
}
private void UpdateControlInfo()
{
// BtnControl
if (Option is not KeyBoardOption keyBoardOption) return;
BtnControl.SetData(keyBoardOption.InputAction.name, keyBoardOption.Name, InputManager.InputMapPlayer);
}
}
}

View File

@@ -24,8 +24,8 @@ namespace NBF
public BottomMenu BottomMenu;
[AutoFind(Name = "Mask")]
public GLabel Mask;
[AutoFind(Name = "InputWait")]
public GComponent InputWait;
[AutoFind(Name = "Title")]
public GComponent Title;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ UI.Inst.OpenUI<SettingPanel>(param); }

View File

@@ -0,0 +1,30 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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 SettingWaitInputPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
public override string UIPackName => "Main";
public override string UIResName => "SettingWaitInputPanel";
[AutoFind(Name = "TextTime")]
public GTextField TextTime;
[AutoFind(Name = "BtnCancel")]
public BtnTitleInputControl BtnCancel;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ UI.Inst.OpenUI<SettingWaitInputPanel>(param); }
public static void Hide(){ UI.Inst.HideUI<SettingWaitInputPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<SettingWaitInputPanel>(); }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 516cf8ed4abe3a14a8e101f8ec0d6924

View File

@@ -0,0 +1,73 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
using NBF.Setting;
using UnityEngine.InputSystem;
namespace NBF
{
public partial class SettingWaitInputPanel : UIPanel
{
private SettingItem _settingItem;
private InputOption _inputOption;
private InputActionRebindingExtensions.RebindingOperation rebindingOperation;
protected override void OnShow()
{
_settingItem = GetData() as SettingItem;
if (_settingItem == null)
{
Hide();
return;
}
if (_settingItem.Option is InputOption inputOption)
{
_inputOption = inputOption;
OnRebinding();
}
}
#region
private void OnRebinding()
{
// 开始重绑定操作
rebindingOperation = _inputOption.InputAction.PerformInteractiveRebinding(_inputOption.BindingIndex)
.OnMatchWaitForAnother(0.1f)
.OnComplete(operation => RebindComplete())
.OnCancel(operation => RebindCanceled())
.Start();
}
private void RebindComplete()
{
rebindingOperation.Dispose();
_inputOption.InputAction.Enable();
UpdateValueText();
}
private void RebindCanceled()
{
rebindingOperation.Dispose();
_inputOption.InputAction.Enable();
Hide();
}
private void UpdateValueText()
{
_settingItem.UpdateValueText();
Hide();
}
#endregion
[InputInvoke(InputDef.UI.Back)]
private void OnBack()
{
Hide();
}
}
}

View File

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