diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_Minus.png b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_-.png similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_Minus.png rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_-.png diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_Minus.png.meta b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_-.png.meta similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_Minus.png.meta rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_-.png.meta diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_Semicolon.png b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_;.png similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_Semicolon.png rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_;.png diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_Semicolon.png.meta b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_;.png.meta similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_Semicolon.png.meta rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_;.png.meta diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_EQUALS.png b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_=.png similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_EQUALS.png rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_=.png diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_EQUALS.png.meta b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_=.png.meta similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_EQUALS.png.meta rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_=.png.meta diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_LeftBracket.png b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_[.png similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_LeftBracket.png rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_[.png diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_LeftBracket.png.meta b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_[.png.meta similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_LeftBracket.png.meta rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_[.png.meta diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_RightBracket.png b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_].png similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_RightBracket.png rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_].png diff --git a/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_RightBracket.png.meta b/l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_].png.meta similarity index 100% rename from l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_RightBracket.png.meta rename to l2-unity/Assets/Resources/Data/UI/Assets/SkillBar/Shortcuts/ShortcutWnd_DF_Key_].png.meta diff --git a/l2-unity/Assets/Resources/Data/UI/_Elements/L2StyleSheet.uss b/l2-unity/Assets/Resources/Data/UI/_Elements/L2StyleSheet.uss index 498fb871a..a3bc78f00 100644 --- a/l2-unity/Assets/Resources/Data/UI/_Elements/L2StyleSheet.uss +++ b/l2-unity/Assets/Resources/Data/UI/_Elements/L2StyleSheet.uss @@ -1819,6 +1819,21 @@ background-image: none; } +.shortcut-key { + flex-grow: 1; + position: absolute; + height: 16px; + width: 32px; + top: 2px; + left: 2px; + flex-direction: row; + -unity-background-scale-mode: scale-to-fit; +} + +.skillbar-slot.empty .shortcut-key { + display: none; +} + .action-slot.empty .slot-bg-container { border-width: 0; padding: 0; diff --git a/l2-unity/Assets/Resources/Data/UI/_Elements/Template/SkillbarSlot.uxml b/l2-unity/Assets/Resources/Data/UI/_Elements/Template/SkillbarSlot.uxml index 85a56905f..8247b84e4 100644 --- a/l2-unity/Assets/Resources/Data/UI/_Elements/Template/SkillbarSlot.uxml +++ b/l2-unity/Assets/Resources/Data/UI/_Elements/Template/SkillbarSlot.uxml @@ -3,6 +3,7 @@ + diff --git a/l2-unity/Assets/Resources/Scenes/Tests/Test.unity b/l2-unity/Assets/Resources/Scenes/Tests/Test.unity index cea0da46d..c12fcd0ef 100644 --- a/l2-unity/Assets/Resources/Scenes/Tests/Test.unity +++ b/l2-unity/Assets/Resources/Scenes/Tests/Test.unity @@ -225,19 +225,14 @@ GameObject: m_Component: - component: {fileID: 149149314} - component: {fileID: 149149313} - - component: {fileID: 149149312} - component: {fileID: 149149315} - component: {fileID: 149149316} - component: {fileID: 149149317} - component: {fileID: 149149318} - - component: {fileID: 149149319} - - component: {fileID: 149149320} - - component: {fileID: 149149321} - component: {fileID: 149149322} - - component: {fileID: 149149326} - component: {fileID: 149149325} - - component: {fileID: 149149324} - - component: {fileID: 149149323} + - component: {fileID: 149149326} + - component: {fileID: 149149327} m_Layer: 0 m_Name: UI m_TagString: Untagged @@ -245,45 +240,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &149149312 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 149149311} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4ecd1a0a0495f174fb7ecee096229e89, type: 3} - m_Name: - m_EditorClassIdentifier: - _expanded: 0 - _gearTab: - _tabName: Tab - _autoscroll: 1 - _selectedSlot: -1 - _tabs: - - _tabName: All - _autoscroll: 1 - _selectedSlot: -1 - _filteredCategories: - - _tabName: Equip - _autoscroll: 1 - _selectedSlot: -1 - _filteredCategories: 000102 - - _tabName: Supplies - _autoscroll: 1 - _selectedSlot: -1 - _filteredCategories: 0504 - - _tabName: Quest - _autoscroll: 1 - _selectedSlot: -1 - _filteredCategories: 03 - _usedSlots: 0 - _slotCount: 0 - _currentWeight: 0 - _maximumWeight: 0 - _adenaCount: 0 --- !u!114 &149149313 MonoBehaviour: m_ObjectHideFlags: 0 @@ -379,49 +335,6 @@ MonoBehaviour: m_EditorClassIdentifier: _defaultSkillbarCount: 2 _expandedSkillbarCount: 0 ---- !u!114 &149149319 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 149149311} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 14bf3f2dcfcbba64aade5b0f3ee646a6, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!114 &149149320 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 149149311} - m_Enabled: 0 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 90c3fb83fa7e05d4e85e87bffbb0b9f4, type: 3} - m_Name: - m_EditorClassIdentifier: - _chatWindowMinWidth: 225 - _chatWindowMaxWidth: 500 - _chatWindowMinHeight: 175 - _chatWindowMaxHeight: 600 - _tabs: [] - _chatOpened: 0 - _chatInputCharacterLimit: 64 ---- !u!114 &149149321 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 149149311} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a74cdee76f988fd4aa5bfa3027894c59, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &149149322 MonoBehaviour: m_ObjectHideFlags: 0 @@ -434,7 +347,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2b9275d71bba04749bfde79eeea369f8, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &149149323 +--- !u!114 &149149325 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -443,10 +356,10 @@ MonoBehaviour: m_GameObject: {fileID: 149149311} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b94893c878af06c4c9a304dab137ef13, type: 3} + m_Script: {fileID: 11500000, guid: 675288a14a68dc54f875a1c7aa89c846, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &149149324 +--- !u!114 &149149326 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -455,22 +368,19 @@ MonoBehaviour: m_GameObject: {fileID: 149149311} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2b9275d71bba04749bfde79eeea369f8, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!114 &149149325 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 149149311} - m_Enabled: 0 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 675288a14a68dc54f875a1c7aa89c846, type: 3} + m_Script: {fileID: 11500000, guid: 90c3fb83fa7e05d4e85e87bffbb0b9f4, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &149149326 + _chatWindowMinWidth: 225 + _chatWindowMaxWidth: 500 + _chatWindowMinHeight: 175 + _chatWindowMaxHeight: 600 + _tabs: + - _tabName: All + _autoscroll: 1 + _chatOpened: 0 + _chatInputCharacterLimit: 64 +--- !u!114 &149149327 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -479,9 +389,24 @@ MonoBehaviour: m_GameObject: {fileID: 149149311} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9777a5511b4fe9c439f8b3f3c927ad6c, type: 3} + m_Script: {fileID: 11500000, guid: 4ecd1a0a0495f174fb7ecee096229e89, type: 3} m_Name: m_EditorClassIdentifier: + _expanded: 0 + _gearTab: + _tabName: Tab + _autoscroll: 1 + _selectedSlot: -1 + _tabs: + - _tabName: All + _autoscroll: 0 + _selectedSlot: 0 + _filteredCategories: + _usedSlots: 0 + _slotCount: 0 + _currentWeight: 0 + _maximumWeight: 0 + _adenaCount: 0 --- !u!1001 &445805727 PrefabInstance: m_ObjectHideFlags: 0 @@ -688,6 +613,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 742913640} + - component: {fileID: 742913643} + - component: {fileID: 742913642} m_Layer: 0 m_Name: Game m_TagString: Untagged @@ -710,6 +637,30 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &742913642 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 742913639} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a74cdee76f988fd4aa5bfa3027894c59, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &742913643 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 742913639} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 14bf3f2dcfcbba64aade5b0f3ee646a6, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &813744334 GameObject: m_ObjectHideFlags: 0 diff --git a/l2-unity/Assets/Scripts/Database/IconManager.cs b/l2-unity/Assets/Scripts/Database/IconManager.cs index 7dd32fda4..6d8e6e6ec 100644 --- a/l2-unity/Assets/Scripts/Database/IconManager.cs +++ b/l2-unity/Assets/Scripts/Database/IconManager.cs @@ -1,22 +1,23 @@ using System.Collections.Generic; using UnityEngine; -public class IconManager +public class IconTable { private string _iconFolder = "Data\\SysTextures\\Icon"; private Texture2D _noImageIcon; private Dictionary _icons = new Dictionary(); + private Dictionary _keyIcons = new Dictionary(); - private static IconManager _instance; - public static IconManager Instance + private static IconTable _instance; + public static IconTable Instance { get { if (_instance == null) { - _instance = new IconManager(); + _instance = new IconTable(); } return _instance; @@ -26,9 +27,11 @@ public static IconManager Instance public void Initialize() { _noImageIcon = GetNoImageIcon(); + + CacheIcons(); } - public void CacheIcons() + private void CacheIcons() { foreach (Weapon weapon in ItemTable.Instance.Weapons.Values) { diff --git a/l2-unity/Assets/Scripts/Database/KeyImageTable.cs b/l2-unity/Assets/Scripts/Database/KeyImageTable.cs new file mode 100644 index 000000000..03b1dfcf0 --- /dev/null +++ b/l2-unity/Assets/Scripts/Database/KeyImageTable.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using UnityEngine; + +public class KeyImageTable +{ + private string _iconFolder = "Data\\UI\\Assets\\SkillBar\\Shortcuts"; + private Dictionary _keyImages = new Dictionary(); + + private static KeyImageTable _instance; + public static KeyImageTable Instance + { + get + { + if (_instance == null) + { + _instance = new KeyImageTable(); + } + + return _instance; + } + } + + public void Initialize() { + _keyImages = new Dictionary(); + } + + public Texture2D LoadTextureByKey(string name) + { + if(_keyImages.TryGetValue(name, out Texture2D result)) { + return result; + } + + string icon = _iconFolder + "\\ShortcutWnd_DF_Key_" + name; + result = Resources.Load(icon); + + if (result != null) + { + _keyImages.Add(name, result); + return result; + } + + Debug.LogWarning($"Missing icon: {name}."); + + return null; + } +} diff --git a/l2-unity/Assets/Scripts/Database/KeyImageTable.cs.meta b/l2-unity/Assets/Scripts/Database/KeyImageTable.cs.meta new file mode 100644 index 000000000..b17df05af --- /dev/null +++ b/l2-unity/Assets/Scripts/Database/KeyImageTable.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e974b7a98ad48ec4dbd9c4d12f07c0ab \ No newline at end of file diff --git a/l2-unity/Assets/Scripts/Game/Manager/GameManager.cs b/l2-unity/Assets/Scripts/Game/Manager/GameManager.cs index 690e3de03..4678dd3da 100644 --- a/l2-unity/Assets/Scripts/Game/Manager/GameManager.cs +++ b/l2-unity/Assets/Scripts/Game/Manager/GameManager.cs @@ -48,12 +48,15 @@ void Awake() Destroy(this); } - _loadingCamera = GameObject.Find("LoadingCamera").GetComponent(); - if (_loadingCamera == null) + GameObject camObject = GameObject.Find("LoadingCamera"); + if (camObject == null) { Debug.LogError("Can't find loading camera"); return; } + + camObject.TryGetComponent(out _loadingCamera); + StartLoading(); } @@ -81,8 +84,8 @@ private void LoadTables() ModelTable.Instance.Initialize(); LogongrpTable.Instance.Initialize(); SystemMessageTable.Instance.Initialize(); - IconManager.Instance.Initialize(); - IconManager.Instance.CacheIcons(); + IconTable.Instance.Initialize(); + KeyImageTable.Instance.Initialize(); } public void LogIn() diff --git a/l2-unity/Assets/Scripts/Game/Shortcut/PlayerShortcuts.cs b/l2-unity/Assets/Scripts/Game/Shortcut/PlayerShortcuts.cs index bd61caf90..aee046b3c 100644 --- a/l2-unity/Assets/Scripts/Game/Shortcut/PlayerShortcuts.cs +++ b/l2-unity/Assets/Scripts/Game/Shortcut/PlayerShortcuts.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; +using UnityEngine.InputSystem; public class PlayerShortcuts : MonoBehaviour { @@ -46,6 +47,11 @@ private void Update() return; } + VerifySkillbarInputs(); + } + + private void VerifySkillbarInputs() + { foreach (Shortcut shortcut in _shortcuts.Values) { for (int i = 0; i < _pageMap.Length; i++) @@ -62,6 +68,11 @@ private void Update() } } + public string GetKeybindForShortcut(int skillbarId, int slot) { + InputAction action = InputManager.Instance.SkillbarActions[skillbarId, slot]; + return action.GetBindingDisplayString(0).ToUpper(); + } + public void UseShortcut(Shortcut shortcut) { Debug.LogWarning($"Use shortcut {shortcut.Page * MAXIMUM_SHORTCUTS_PER_BAR + shortcut.Slot}."); diff --git a/l2-unity/Assets/Scripts/Input/InputManager.cs b/l2-unity/Assets/Scripts/Input/InputManager.cs index 17a03fe69..028916fd8 100644 --- a/l2-unity/Assets/Scripts/Input/InputManager.cs +++ b/l2-unity/Assets/Scripts/Input/InputManager.cs @@ -26,9 +26,6 @@ public class InputManager : MonoBehaviour private InputAction _systemMenuAction; private InputAction _validateAction; - // Skillbar - private InputAction[,] _skillbarActions; - #endregion #region InputValues @@ -65,6 +62,8 @@ public class InputManager : MonoBehaviour [field: SerializeField] public bool OpenActions { get; private set; } [field: SerializeField] public bool CloseWindow { get; private set; } [field: SerializeField] public bool Validate { get; private set; } + + public InputAction[,] SkillbarActions { get; private set; } public bool[,] SkillbarInputs { get; private set; } #endregion @@ -111,13 +110,13 @@ private void SetupInputActions() _systemMenuAction = _playerInput.actions["SystemMenu"]; _validateAction = _playerInput.actions["Validate"]; - _skillbarActions = new InputAction[5, 12]; + SkillbarActions = new InputAction[5, 12]; for (int skillbar = 1; skillbar <= 5; skillbar++) { for (int i = 1; i <= 12; i++) { - _skillbarActions[skillbar - 1, i - 1] = _playerInput.actions[$"Shortcut{skillbar}-{i}"]; + SkillbarActions[skillbar - 1, i - 1] = _playerInput.actions[$"Shortcut{skillbar}-{i}"]; } } @@ -185,7 +184,7 @@ private void UpdateInputs() { for (int i = 0; i < 12; i++) { - SkillbarInputs[skillbar, i] = _skillbarActions[skillbar, i].WasPerformedThisFrame(); + SkillbarInputs[skillbar, i] = SkillbarActions[skillbar, i].WasPerformedThisFrame(); } } } diff --git a/l2-unity/Assets/Scripts/UI/Game/Action/ActionSlot.cs b/l2-unity/Assets/Scripts/UI/Game/Action/ActionSlot.cs index 201b19a2d..e48b5fcbf 100644 --- a/l2-unity/Assets/Scripts/UI/Game/Action/ActionSlot.cs +++ b/l2-unity/Assets/Scripts/UI/Game/Action/ActionSlot.cs @@ -32,7 +32,7 @@ public void AssignAction(ActionType actionType) ActionId = (int)actionType; Action = ActionNameTable.Instance.GetAction(actionType); - _slotBg.style.backgroundImage = IconManager.Instance.LoadTextureByName(Action.Icon); + _slotBg.style.backgroundImage = IconTable.Instance.LoadTextureByName(Action.Icon); if (_tooltipManipulator != null) { diff --git a/l2-unity/Assets/Scripts/UI/Game/Inventory/InventorySlot.cs b/l2-unity/Assets/Scripts/UI/Game/Inventory/InventorySlot.cs index d3f02cda8..4b6de0cd2 100644 --- a/l2-unity/Assets/Scripts/UI/Game/Inventory/InventorySlot.cs +++ b/l2-unity/Assets/Scripts/UI/Game/Inventory/InventorySlot.cs @@ -64,7 +64,7 @@ public void AssignItem(ItemInstance item) if (_slotElement != null) { - StyleBackground background = new StyleBackground(IconManager.Instance.GetIcon(_id)); + StyleBackground background = new StyleBackground(IconTable.Instance.GetIcon(_id)); _slotBg.style.backgroundImage = background; AddTooltip(item); diff --git a/l2-unity/Assets/Scripts/UI/Game/Inventory/InventoryWindow.cs b/l2-unity/Assets/Scripts/UI/Game/Inventory/InventoryWindow.cs index b79029501..bf15cdce0 100644 --- a/l2-unity/Assets/Scripts/UI/Game/Inventory/InventoryWindow.cs +++ b/l2-unity/Assets/Scripts/UI/Game/Inventory/InventoryWindow.cs @@ -58,6 +58,23 @@ private void Awake() { Destroy(this); } + + // ItemTable.Instance.Initialize(); + // ItemNameTable.Instance.Initialize(); + // ItemStatDataTable.Instance.Initialize(); + // ArmorgrpTable.Instance.Initialize(); + // EtcItemgrpTable.Instance.Initialize(); + // WeapongrpTable.Instance.Initialize(); + // ItemTable.Instance.CacheItems(); + // NpcgrpTable.Instance.Initialize(); + // NpcNameTable.Instance.Initialize(); + // ActionNameTable.Instance.Initialize(); + // SysStringTable.Instance.Initialize(); + // SkillNameTable.Instance.Initialize(); + // SkillgrpTable.Instance.Initialize(); + // SystemMessageTable.Instance.Initialize(); + // IconTable.Instance.Initialize(); + // KeyImageTable.Instance.Initialize(); } private void OnDestroy() @@ -131,7 +148,7 @@ protected override IEnumerator BuildWindow(VisualElement root) UpdateItemList(_playerItems); #if UNITY_EDITOR - //DebugData(); + // DebugData(); #endif } @@ -351,17 +368,6 @@ public void SelectSlot(int slot) #if UNITY_EDITOR public void DebugData() { - /* TO REMOVE FOR TESTING ONLY */ - ItemTable.Instance.Initialize(); - ItemNameTable.Instance.Initialize(); - ItemStatDataTable.Instance.Initialize(); - ArmorgrpTable.Instance.Initialize(); - EtcItemgrpTable.Instance.Initialize(); - WeapongrpTable.Instance.Initialize(); - ItemTable.Instance.CacheItems(); - IconManager.Instance.Initialize(); - IconManager.Instance.CacheIcons(); - /* TO REMOVE FOR TESTING ONLY */ List _playerItems = new List(); diff --git a/l2-unity/Assets/Scripts/UI/Game/Skillbar/AbstractSkillbar.cs b/l2-unity/Assets/Scripts/UI/Game/Skillbar/AbstractSkillbar.cs index a73ef6edc..f361921d4 100644 --- a/l2-unity/Assets/Scripts/UI/Game/Skillbar/AbstractSkillbar.cs +++ b/l2-unity/Assets/Scripts/UI/Game/Skillbar/AbstractSkillbar.cs @@ -100,7 +100,7 @@ private void CreateSlot(int position) VisualElement slotElement = SkillbarWindow.Instance.BarSlotTemplate.Instantiate()[0]; anchor.Add(slotElement); - SkillbarSlot slot = new SkillbarSlot(slotElement, _page * PlayerShortcuts.MAXIMUM_SHORTCUTS_PER_BAR + position); + SkillbarSlot slot = new SkillbarSlot(slotElement, _page * PlayerShortcuts.MAXIMUM_SHORTCUTS_PER_BAR + position, _skillbarIndex, position); _barSlots.Add(slot); } diff --git a/l2-unity/Assets/Scripts/UI/Game/Skillbar/SkillbarSlot.cs b/l2-unity/Assets/Scripts/UI/Game/Skillbar/SkillbarSlot.cs index 7b20b4f54..a39f0c122 100644 --- a/l2-unity/Assets/Scripts/UI/Game/Skillbar/SkillbarSlot.cs +++ b/l2-unity/Assets/Scripts/UI/Game/Skillbar/SkillbarSlot.cs @@ -7,11 +7,17 @@ public class SkillbarSlot : L2ClickableSlot private ButtonClickSoundManipulator _buttonClickSoundManipulator; private L2Slot _innerSlot; private Shortcut _shortcut; + private int _skillbarId; + private int _slot; + private VisualElement _keyElement; - public SkillbarSlot(VisualElement slotElement, int position) : base(slotElement, position, SlotType.SkillBar, true, false) + public SkillbarSlot(VisualElement slotElement, int position, int skillbarId, int slot) : base(slotElement, position, SlotType.SkillBar, true, false) { _slotElement = slotElement; _position = position; + _skillbarId = skillbarId; + _slot = slot; + _keyElement = _slotElement.Q("Key"); } public void AssignShortcut(Shortcut shortcut) @@ -45,7 +51,7 @@ public void AssignItem(int objectId) ((InventorySlot)_innerSlot).AssignItem(item); ((L2ClickableSlot)_innerSlot).UnregisterClickableCallback(); - _slotElement.RemoveFromClassList("empty"); + UpdateInputInfo(); } public void AssignAction(int objectId) @@ -54,9 +60,21 @@ public void AssignAction(int objectId) ((ActionSlot)_innerSlot).AssignAction((ActionType)objectId); ((L2ClickableSlot)_innerSlot).UnregisterClickableCallback(); - _slotElement.RemoveFromClassList("empty"); + UpdateInputInfo(); } + private void UpdateInputInfo() { + _slotElement.RemoveFromClassList("empty"); + + string key = PlayerShortcuts.Instance.GetKeybindForShortcut(_skillbarId, _slot); + + Texture2D inputTexture = KeyImageTable.Instance.LoadTextureByKey(key); + + if(inputTexture != null) { + _keyElement.style.backgroundImage = inputTexture; + _keyElement.style.width = inputTexture.width; + } + } public override void ClearManipulators() { diff --git a/l2-unity/Assets/Scripts/UI/Game/Skillbar/SkillbarWindow.cs b/l2-unity/Assets/Scripts/UI/Game/Skillbar/SkillbarWindow.cs index 0527157e0..1e7a8b578 100644 --- a/l2-unity/Assets/Scripts/UI/Game/Skillbar/SkillbarWindow.cs +++ b/l2-unity/Assets/Scripts/UI/Game/Skillbar/SkillbarWindow.cs @@ -300,12 +300,12 @@ private IEnumerator DelayDebug() List shortcuts = new List(); for (int i = 0; i < PlayerShortcuts.MAXIMUM_SHORTCUTS_PER_BAR; i++) { - Shortcut shortcut = new Shortcut(i, 0, Shortcut.TYPE_ITEM, 57, -1); + Shortcut shortcut = new Shortcut(i, 0, Shortcut.TYPE_ACTION, (int) ActionType.Attack, -1); shortcuts.Add(shortcut); } - for (int i = 0; i < 6; i++) + for (int i = 0; i < PlayerShortcuts.MAXIMUM_SHORTCUTS_PER_BAR; i++) { - Shortcut shortcut = new Shortcut(i, 1, Shortcut.TYPE_ITEM, 57, -1); + Shortcut shortcut = new Shortcut(i, 1, Shortcut.TYPE_ACTION, (int) ActionType.Pickup, -1); shortcuts.Add(shortcut); } diff --git a/l2-unity/UserSettings/EditorUserSettings.asset b/l2-unity/UserSettings/EditorUserSettings.asset index ce6632d3d..6c5461560 100644 --- a/l2-unity/UserSettings/EditorUserSettings.asset +++ b/l2-unity/UserSettings/EditorUserSettings.asset @@ -27,13 +27,13 @@ EditorUserSettings: value: 0501035e51535f0a580c55744322594412164d292d2a20627c2c1f60bbb7376b flags: 0 RecentlyUsedSceneGuid-6: - value: 510652550602510f0c5e557140720f4415161b7d7c2974337e7f4863b1b8366d + value: 535305525354580c550d0d7447215a4413154d727978206029284863b4e43068 flags: 0 RecentlyUsedSceneGuid-7: value: 52000d555300590d5d585877422606444e154f73797074697a7c1837e7b93160 flags: 0 RecentlyUsedSceneGuid-8: - value: 535305525354580c550d0d7447215a4413154d727978206029284863b4e43068 + value: 510652550602510f0c5e557140720f4415161b7d7c2974337e7f4863b1b8366d flags: 0 RecentlyUsedSceneGuid-9: value: 5500505106040c0e0e5c087645740a44174f4879287023357b714c36e3b8663a diff --git a/l2-unity/UserSettings/Layouts/default-6000.dwlt b/l2-unity/UserSettings/Layouts/default-6000.dwlt index 724af0fee..dfd36bb0f 100644 --- a/l2-unity/UserSettings/Layouts/default-6000.dwlt +++ b/l2-unity/UserSettings/Layouts/default-6000.dwlt @@ -1170,7 +1170,7 @@ MonoBehaviour: m_AudioPlay: 0 m_DebugDrawModesUseInteractiveLightBakingData: 0 m_Position: - m_Target: {x: 4595.2744, y: -121.459915, z: -172.67984} + m_Target: {x: 4728.6714, y: -72.29238, z: -1728.6232} speed: 2 m_Value: {x: 4595.2744, y: -121.459915, z: -172.67984} m_RenderMode: 0 @@ -1218,11 +1218,11 @@ MonoBehaviour: m_GridAxis: 1 m_gridOpacity: 0.5 m_Rotation: - m_Target: {x: -0.01971266, y: 0.93401736, z: -0.052181385, w: -0.3528461} + m_Target: {x: -0.05237779, y: 0.9161899, z: -0.12753218, w: -0.37628233} speed: 2 m_Value: {x: -0.019712662, y: 0.93401724, z: -0.05218137, w: -0.35284606} m_Size: - m_Target: 1.2247449 + m_Target: 10 speed: 2 m_Value: 1.2247449 m_Ortho: @@ -1321,7 +1321,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: e0b50a00 m_LastClickedID: 701920 - m_ExpandedIDs: 00000000b0ca0100 + m_ExpandedIDs: 00000000dcca0100deca0100e0ca0100e2ca0100e4ca0100e6ca0100e8ca0100eaca0100ecca0100eeca0100 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -1350,7 +1350,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 00000000b0ca0100 + m_ExpandedIDs: 00000000dcca0100deca0100e0ca0100e2ca0100e4ca0100e6ca0100e8ca0100eaca0100ecca0100eeca0100 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: