mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
GUI rearrangement
This commit is contained in:
parent
04f8c6a2e4
commit
2e50221118
90 changed files with 435 additions and 1440 deletions
34
Assets/Scripts/Keybinds/Keybind.cs
Normal file
34
Assets/Scripts/Keybinds/Keybind.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class Keybind
|
||||
{
|
||||
public string command;
|
||||
public bool requiresAnimationDef = true;
|
||||
public bool repeatable = false;
|
||||
public KeybindData win;
|
||||
public KeybindData mac;
|
||||
|
||||
[XmlIgnore] public List<KeyCode> keyModifiers { get { return GetKeybindData().keyModifiers; } }
|
||||
[XmlIgnore] public KeyCode keyCode { get { return GetKeybindData().keyCode; } }
|
||||
|
||||
private KeybindData GetKeybindData()
|
||||
{
|
||||
bool runningOSX = Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor;
|
||||
return runningOSX ? mac : win;
|
||||
}
|
||||
}
|
||||
|
||||
public class KeybindData
|
||||
{
|
||||
[XmlArray("keyModifiers"), XmlArrayItem("li")] public List<KeyCode> keyModifiers = new List<KeyCode>();
|
||||
public KeyCode keyCode = KeyCode.None;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Keybinds/Keybind.cs.meta
Normal file
11
Assets/Scripts/Keybinds/Keybind.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c58a5b7884732464c9e5c1e1b226e68a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
59
Assets/Scripts/Keybinds/KeybindConfig.cs
Normal file
59
Assets/Scripts/Keybinds/KeybindConfig.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
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
|
||||
{
|
||||
private static List<Keybind> keybinds = new List<Keybind>();
|
||||
private static bool initialized = false;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
string path = Path.Combine(Application.streamingAssetsPath, "keybindConfig.xml");
|
||||
keybinds = XmlUtility.ReadXML<List<Keybind>>(path);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
public static List<Keybind> GetAllKeybinds()
|
||||
{
|
||||
if (initialized == false)
|
||||
{ Initialize(); }
|
||||
|
||||
return keybinds;
|
||||
}
|
||||
|
||||
public static string GetKeybindLabel(string command)
|
||||
{
|
||||
string label = "";
|
||||
Keybind keybind = GetAllKeybinds()?.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();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Keybinds/KeybindConfig.cs.meta
Normal file
11
Assets/Scripts/Keybinds/KeybindConfig.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7e87ce98f12877c4d932352535e01268
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue