Skip to content

Instantly share code, notes, and snippets.

@chuwilliamson
Created May 17, 2016 01:38
Show Gist options
  • Save chuwilliamson/eca4c58697fae7a8fc680f6d9ce864f6 to your computer and use it in GitHub Desktop.
Save chuwilliamson/eca4c58697fae7a8fc680f6d9ce864f6 to your computer and use it in GitHub Desktop.
[Serializable]
public enum ButtonCode
{
A,
B,
X,
Y,
DpadUp,
DpadDown,
DpadLeft,
DpadRight,
Start,
Back,
LBumper,
RBumper,
LStick,
RStick,
}
[Serializable]
public struct Key<TCode>
{
public string name;
public string description;
public TCode keyCode;
public Key(string a_Name, string a_Description, TCode a_KeyCode)
{
name = a_Name;
description = a_Description;
keyCode = a_KeyCode;
}
}
[Serializable]
public class Keys
{
public Keys()
{
Key<KeyCode> k1 = new Key<KeyCode>("Skill 1", "First Skill", KeyCode.Q);
Key<KeyCode> k2 = new Key<KeyCode>("Skill 1", "First Skill", KeyCode.E);
m_keys.Add(k1);
m_keys.Add(k2);
}
public List<Key<KeyCode>> m_keys = new List<Key<KeyCode>>();
}
[Serializable]
public class Axii
{
public Axii()
{
Key<ButtonCode> k1 = new Key<ButtonCode>("Skill 1", "First Skill", ButtonCode.DpadUp);
Key<ButtonCode> k2 = new Key<ButtonCode>("Skill 1", "First Skill", ButtonCode.DpadDown);
m_Axii.Add(k1);
m_Axii.Add(k2);
}
[XmlArray("MovementAxii"), XmlArrayItem(typeof(Key<ButtonCode>), ElementName = "Axis")]
public List<Key<ButtonCode>> m_Axii = new List<Key<ButtonCode>>();
}
[Serializable]
public enum KeyCode
{
//
// Summary:
// ///
// Not assigned (never returned as the result of a keystroke).
// ///
Q = 0,
//
// Summary:
// ///
// The backspace key.
// ///
E = 8,
//
}
[Serializable]
[XmlRoot("UserConfig")]
public class UserConfiguration
{
public UserConfiguration()
{
skillKeyCodes = new Keys();
axisKeys = new Axii();
}
public Axii axisKeys;
public Keys skillKeyCodes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment