mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
UI 2.0
This commit is contained in:
parent
c3c0a05ac0
commit
3d859555ad
324 changed files with 13886 additions and 7446 deletions
55
Assets/Scripts/KeybindConfig.cs
Normal file
55
Assets/Scripts/KeybindConfig.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class KeybindConfig : Singleton<KeybindConfig>
|
||||
{
|
||||
private static List<Keybind> keybinds = new List<Keybind>();
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
string path = Path.Combine(Application.streamingAssetsPath, "keybindConfig.xml");
|
||||
|
||||
keybinds = XmlUtility.ReadXML<List<Keybind>>(path);
|
||||
}
|
||||
|
||||
public List<Keybind> GetAllKeybinds()
|
||||
{
|
||||
return keybinds;
|
||||
}
|
||||
|
||||
public string GetKeybindLabel(string command)
|
||||
{
|
||||
string label = "";
|
||||
Keybind keybind = keybinds.FirstOrDefault(x => x.command == command);
|
||||
|
||||
if (keybind == null) return label;
|
||||
|
||||
List<KeyCode> keyModifiers = keybind.keyModifiers;
|
||||
KeyCode keyCode = keybind.keyCode;
|
||||
|
||||
foreach (KeyCode modKeyCode in keyModifiers)
|
||||
{
|
||||
switch (modKeyCode)
|
||||
{
|
||||
case KeyCode.LeftShift: label += "Shift + "; break;
|
||||
case KeyCode.LeftControl: label += "Ctrl + "; break;
|
||||
case KeyCode.LeftAlt: label += "Alt + "; break;
|
||||
case KeyCode.LeftCommand: label += "Cmd + "; break;
|
||||
case KeyCode.RightShift: label += "Right shift + "; break;
|
||||
case KeyCode.RightControl: label += "Right ctrl + "; break;
|
||||
case KeyCode.RightAlt: label += "Right alt + "; break;
|
||||
case KeyCode.RightCommand: label += "Right cmd + "; break;
|
||||
}
|
||||
}
|
||||
|
||||
return label += keyCode.ToString();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue