rimworld-animation-studio/Assets/Scripts/Keybinds/Keybind.cs
2022-10-20 00:32:13 -05:00

34 lines
1 KiB
C#

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;
}
}