-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
205 additions
and
150 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class KeyImageTable | ||
{ | ||
private string _iconFolder = "Data\\UI\\Assets\\SkillBar\\Shortcuts"; | ||
private Dictionary<string, Texture2D> _keyImages = new Dictionary<string, Texture2D>(); | ||
|
||
private static KeyImageTable _instance; | ||
public static KeyImageTable Instance | ||
{ | ||
get | ||
{ | ||
if (_instance == null) | ||
{ | ||
_instance = new KeyImageTable(); | ||
} | ||
|
||
return _instance; | ||
} | ||
} | ||
|
||
public void Initialize() { | ||
_keyImages = new Dictionary<string, Texture2D>(); | ||
} | ||
|
||
public Texture2D LoadTextureByKey(string name) | ||
{ | ||
if(_keyImages.TryGetValue(name, out Texture2D result)) { | ||
return result; | ||
} | ||
|
||
string icon = _iconFolder + "\\ShortcutWnd_DF_Key_" + name; | ||
result = Resources.Load<Texture2D>(icon); | ||
|
||
if (result != null) | ||
{ | ||
_keyImages.Add(name, result); | ||
return result; | ||
} | ||
|
||
Debug.LogWarning($"Missing icon: {name}."); | ||
|
||
return null; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.