private void controlKeyChange(ControlKey _key) { if (timer.Enabled) { timer.Enabled = false; lb_keyChange.Text = "Press the key you want to use"; } if (currKey != ControlKey.NON && currKey != _key) { setLabelColor(currKey, Color.DarkGray); currKey = _key; setLabelColor(_key, Color.Wheat); lb_keyChange.Visible = true; } else if (currKey == _key) { currKey = ControlKey.NON; setLabelColor(_key, Color.DarkGray); lb_keyChange.Visible = false; } else { currKey = _key; setLabelColor(_key, Color.Wheat); lb_keyChange.Visible = true; } }
private bool IsCKDown(ControlKey key) { bool down = false; switch (key.Type) { case ControlKeyType.PC: if (Input.GetKey(ControlHelper.ReturnKeyCode(key.KeyValue))) return true; break; case ControlKeyType.Xbox: if (scheme == null) { if (XCI.GetButton(ControlHelper.ReturnXboxButton(key.KeyValue))) return true; } else if (XCI.GetButton(ControlHelper.ReturnXboxButton(key.KeyValue), scheme.controllerID)) return true; break; default: Debug.LogError("Action: KeyType not recognized. Please implement the inputType"); break; } if (down) scheme.InputType = key.Type; return down; }
public void ReceiveMessage(ControlKey key, bool edge) { switch (key) { case ControlKey.Down: Down = edge; break; case ControlKey.Left: Left = edge; break; case ControlKey.LeftMouse: leftMouse = edge; break; case ControlKey.Right: Right = edge; break; case ControlKey.RightMouse: rightMouse = edge; break; case ControlKey.Up: Up = edge; break; case ControlKey.ThrottleDown: ThrottleDown = edge; break; case ControlKey.ThrottleUp: ThrottleUp = edge; break; case ControlKey.Eject: Eject = edge; break; } }
protected string BuildLinkUrl(int moduleId, ControlKey controlKey, params string[] queryStringParameters) { Array.Resize(ref queryStringParameters, queryStringParameters.Length + 2); queryStringParameters[queryStringParameters.Length - 1] = "modId=" + moduleId.ToString(CultureInfo.InvariantCulture); queryStringParameters[queryStringParameters.Length - 2] = "key=" + controlKey.ToString(); return(this.BuildLinkUrl(queryStringParameters)); }
public static void ControlMessage(ControlKey key, bool edge) { var msg = Network.Client.CreateMessage(); msg.Write((byte)NetMsgType.Control); msg.Write((byte)key); msg.Write(edge); Network.Client.SendMessage(msg, NetDeliveryMethod.ReliableSequenced, 0); }
public static void ControlMessage(ControlKey key, bool edge) { var msg = Network.Client.CreateMessage(); msg.Write((byte)NetMsgType.Control); msg.Write((byte)key); msg.Write(edge); Network.Client.SendMessage(msg, NetDeliveryMethod.ReliableSequenced, 0); }
public override bool UpdateControl(ControlKey controlKey, string newControl) { bool controlsUpdated = base.UpdateControl(controlKey, newControl); if (controlsUpdated) { UpdateStringToKeyCodeDic(); } return(controlsUpdated); }
/// <summary> /// Gets all controls currently loaded /// </summary> /// <returns>All controls currently loaded</returns> public ControlKey[] GetAllControls() { ControlKey[] ret = new ControlKey[names.Count]; int i = 0; foreach (string str in names) { ret[i] = new ControlKey(str, StringToKeyCode(keys[i])); i++; } return(ret); }
private void setLabelColor(ControlKey _key, Color _col) { switch (_key) { case ControlKey.NON: { break; } case ControlKey.FORWARD: { lb_keyFwd.ForeColor = _col; break; } case ControlKey.BACKWARD: { lb_keyback.ForeColor = _col; break; } case ControlKey.STRAFE_LEFT: { lb_keyLeft.ForeColor = _col; break; } case ControlKey.STRAFE_RIGHT: { lb_keyRight.ForeColor = _col; break; } case ControlKey.SPRINT: { lb_keySprint.ForeColor = _col; break; } case ControlKey.JUMP: { lb_keyJump.ForeColor = _col; break; } case ControlKey.USE: { lb_keyUse.ForeColor = _col; break; } } }
public void ShouldReportIfKeyIsNotUnique() { AddmlRecordDefinition recordDefinition = new AddmlRecordDefinitionBuilder() .Build(); AddmlFieldDefinition fieldDefinition = new AddmlFieldDefinitionBuilder() .WithRecordDefinition(recordDefinition) .IsPartOfPrimaryKey(true) .Build(); AddmlFieldDefinition fieldDefinition2 = new AddmlFieldDefinitionBuilder() .WithRecordDefinition(recordDefinition) .IsPartOfPrimaryKey(false) .Build(); FlatFile flatFile = new FlatFile(recordDefinition.AddmlFlatFileDefinition); ControlKey test = new ControlKey(); test.Run(flatFile); test.Run(new Arkade.Core.Addml.Record(recordDefinition, new List <Field> { new Field(fieldDefinition, "A"), new Field(fieldDefinition, "A"), new Field(fieldDefinition2, "B") })); test.Run(new Arkade.Core.Addml.Record(recordDefinition, new List <Field> { new Field(fieldDefinition, "A"), new Field(fieldDefinition, "B"), new Field(fieldDefinition2, "B") })); test.Run(new Arkade.Core.Addml.Record(recordDefinition, new List <Field> { new Field(fieldDefinition, "A"), new Field(fieldDefinition, "C"), new Field(fieldDefinition2, "B") })); test.Run(new Arkade.Core.Addml.Record(recordDefinition, new List <Field> { new Field(fieldDefinition, "A"), new Field(fieldDefinition, "B"), new Field(fieldDefinition2, "B") })); test.Run(new Arkade.Core.Addml.Record(recordDefinition, new List <Field> { new Field(fieldDefinition, "A"), new Field(fieldDefinition, "C"), new Field(fieldDefinition2, "C") })); test.EndOfFile(); TestRun testRun = test.GetTestRun(); testRun.IsSuccess().Should().BeFalse(); testRun.Results.Count.Should().Be(1); testRun.Results[0].Location.ToString().Should().Be(recordDefinition.GetIndex().ToString()); testRun.Results[0].Message.Should().Be("Følgende primærnøkkelverdier er ikke unike: A,B A,C"); }
public ControlKey[] AddTo(ControlKey[] array, ControlKey valToAdd) { ControlKey[] ret = new ControlKey[array.Length + 1]; int i = 0; foreach (ControlKey k in array) { ret[i] = k; i++; } ret [i] = valToAdd; return(ret); }
/// <summary> /// Removes a specific control based on it's name. /// </summary> /// <returns><c>true</c>, if control was removed, <c>false</c> otherwise. (Will return false if canceled by event handler)</returns> /// <param name="name">Name.</param> public bool RemoveControl(string name) { ControlKey s = GetControl(names.IndexOf(name)); foreach (SACEventHandler eventHandler in SettingsAndControls.EventHandlers) { SACEventHandler.SACRemoveControlEvent e = eventHandler.OnControlRemove(new SACEventHandler.SACRemoveControlEvent(s)); if (e.IsCanceled()) { return(false); } } names.Remove(name); keys.Remove(KeyCodeToString(s.keyCode)); return(true); }
private static ModifierKeys GetModKey(ControlKey cKey) { switch (cKey) { case ControlKey.CTRL: return(ModifierKeys.Control); case ControlKey.ALT: return(ModifierKeys.Alt); case ControlKey.SHIFT: return(ModifierKeys.Shift); case ControlKey.NONE: return(ModifierKeys.None); default: return(ModifierKeys.None); } }
public void ReceiveMessage(ControlKey key, bool edge) { switch (key) { case ControlKey.Down: Down = edge; break; case ControlKey.Left: Left = edge; break; case ControlKey.LeftMouse: leftMouse = edge; break; case ControlKey.Right: Right = edge; break; case ControlKey.RightMouse: rightMouse = edge; break; case ControlKey.Up: Up = edge; break; case ControlKey.ThrottleDown: ThrottleDown = edge; break; case ControlKey.ThrottleUp: ThrottleUp = edge; break; case ControlKey.Eject: Eject = edge; break; } }
public virtual bool UpdateControl(ControlKey controlKey, string newControl) { if (newControl.IsInList(left, right, forward, back, pause, confirm, cancel)) { return(false); } switch (controlKey) { case ControlKey.Left: left = newControl; break; case ControlKey.Right: right = newControl; break; case ControlKey.Forward: forward = newControl; break; case ControlKey.Back: back = newControl; break; case ControlKey.Pause: pause = newControl; break; case ControlKey.Confirm: confirm = newControl; break; case ControlKey.Cancel: cancel = newControl; break; } return(true); }
private bool IsCKDown(ControlKey key) { bool down = false; switch (key.Type) { case ControlKeyType.PC: if (Input.GetKey(ControlHelper.ReturnKeyCode(key.KeyValue))) { return(true); } break; case ControlKeyType.Xbox: if (scheme == null) { if (XCI.GetButton(ControlHelper.ReturnXboxButton(key.KeyValue))) { return(true); } } else if (XCI.GetButton(ControlHelper.ReturnXboxButton(key.KeyValue), scheme.controllerID)) { return(true); } break; default: Debug.LogError("Action: KeyType not recognized. Please implement the inputType"); break; } if (down) { scheme.InputType = key.Type; } return(down); }
/// <summary> /// Builds a URL for this ModuleId, loading the given <see cref="ControlKey"/>. /// </summary> /// <param name="moduleId">The module id of the module for which the control key is being used.</param> /// <param name="controlKey">The control key to determine which control to load.</param> /// <returns> /// A URL with the given criteria /// </returns> protected string BuildLinkUrl(int moduleId, ControlKey controlKey) { return this.BuildLinkUrl(moduleId, controlKey.ToString()); }
public SACAddControlEvent(ControlKey KeyBeingAdded) { this.controlBeingAdded = KeyBeingAdded; }
protected string BuildLinkUrl(int moduleId, ControlKey controlKey) { return(this.BuildLinkUrl("modId=" + moduleId.ToString(CultureInfo.InvariantCulture), "key=" + controlKey.ToString())); }
public SACChangeControlEvent(Controls _old, Controls _new, int Changed) { this._old = _old.GetControl(Changed); this._new = _new.GetControl(Changed); }
void Awake() { _ADD_S_Setting = new Setting(_ADD_S_name, new SACString("Setting Value"), _ADD_S_type); _ADD_C_Key = new ControlKey("New Control", KeyCode.None); }
protected override ControlKey OnGenerateLayoutTree(ref UIOperationContext context, ControlKey parent, ControlKey?existingKey) { var result = base.OnGenerateLayoutTree(ref context, parent, existingKey); context.Layout.SetTag(result, LayoutTags.Spacer); return(result); }
/// <summary> /// Builds a URL for this ModuleId, loading the given <see cref="ControlKey"/>. /// </summary> /// <param name="moduleId">The module id of the module for which the control key is being used.</param> /// <param name="controlKey">The control key to determine which control to load.</param> /// <returns> /// A URL with the given criteria /// </returns> protected string BuildLinkUrl(int moduleId, ControlKey controlKey) { return this.BuildLinkUrl(moduleId, controlKey.ToString()); }
public static void SetKeyTo(ControlKey key, KeyCode keycode) { key.keycode = keycode; }
// // Summary: // Returns true during the frame the user releases the key identified by the control // ControlKey parameter. // // Parameters: // control: public static bool GetKeyUp(ControlKey control) { return(Input.GetKeyUp(control.keycode)); }
public static void SendControlMsg(bool edge, ControlKey key) { Console.WriteLine("Sending Control Message: " + key + (edge ? "Pressed" : "Released")); MessageWriter.ControlMessage(key, edge); }
public static bool RRotatePressed(ControlKey key) { return (key & ControlKey.RRotate) == ControlKey.RRotate; }
public override void OnInspectorGUI() { SettingsAndControls sac = (SettingsAndControls)target; RectOffset defPadding = GUI.skin.box.padding; TextAnchor defAlign = GUI.skin.textField.alignment; TextAnchor defBoxAlign = GUI.skin.box.alignment; GUI.skin.box.padding = new RectOffset(5, 5, 5, 5); GUI.skin.box.alignment = TextAnchor.MiddleCenter; GUI.skin.textField.alignment = TextAnchor.MiddleCenter; serializedObject.Update(); int fs = center.fontSize; center.fontSize = 16; EditorGUILayout.BeginVertical(); GUILayout.Space(20); GUILayout.Box(_Logo, center); EditorGUILayout.LabelField("Simple Settings And Controls", center); center.fontSize = fs; EditorGUILayout.LabelField("By Nathan Fiscaletti (Fisc510)", center); EditorGUILayout.LabelField("V1.8", center); GUILayout.Space(20); EditorGUILayout.EndVertical(); showDefaultInputs = EditorGUILayout.Foldout(showDefaultInputs, "Default Controls"); if (showDefaultInputs) { EditorGUILayout.BeginVertical(); int i = 0; try{ for (i = 0; i < sac.DefaultInputs.Length; i++) { EditorGUILayout.BeginHorizontal("Box"); EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField(sac.DefaultInputs[i].Name, name, GUILayout.Width(Screen.width * .32f)); EditorGUILayout.TextField("Control", yellow, GUILayout.Width(Screen.width * .32f)); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); //EditorGUILayout.LabelField("Key Value", name, GUILayout.Width(Screen.width * .35f)); sac.DefaultInputs[i].keyCode = (KeyCode)EditorGUILayout.EnumPopup(sac.DefaultInputs[i].keyCode); EditorGUILayout.EndVertical(); bool delete = GUILayout.Button("X"); EditorGUILayout.EndHorizontal(); if (delete) { sac.DefaultInputs = RemoveAt(sac.DefaultInputs, i); break; } } }catch (System.Exception e) { ResetTarget(); } if (i == 0) { EditorGUILayout.LabelField("No Default Controls Defined", red); } if (showAddControl) { GUILayout.BeginVertical("Box", GUILayout.MinWidth(0), GUILayout.Width(Screen.width * .90f)); if (showErrorControl) { GUILayout.Label(controlError, red); } GUILayout.Label("Add New Control", center); GUILayout.BeginHorizontal(); GUILayout.Label("Name", center, GUILayout.Width(Screen.width * .45f)); GUILayout.Label("Value", center, GUILayout.Width(Screen.width * .45f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(center); _ADD_C_Key.Name = EditorGUILayout.TextField(_ADD_C_Key.Name, GUILayout.Width(Screen.width * .45f)); _ADD_C_Key.keyCode = (KeyCode)EditorGUILayout.EnumPopup(_ADD_C_Key.keyCode); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); bool cancel = GUILayout.Button("Cancel"); bool _add = GUILayout.Button("Add!"); if (cancel) { _ADD_C_Key = new ControlKey("New Control", KeyCode.None); showAddControl = false; showErrorControl = false; } if (_add) { if (CheckControlAdd(sac.DefaultInputs)) { controlError = "'" + _ADD_C_Key.Name + "' is already defined."; showErrorControl = true; } else { sac.DefaultInputs = AddTo(sac.DefaultInputs, _ADD_C_Key); _ADD_C_Key = new ControlKey("New Control", KeyCode.None); showAddControl = false; showErrorControl = false; } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.BeginHorizontal(); if (i > 0) { bool removeAll = GUILayout.Button("Remove All"); if (removeAll) { sac.DefaultInputs = new ControlKey[] {}; } } if (!showAddControl) { bool add = GUILayout.Button("Add New Control"); if (add) { showAddControl = true; } } GUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } showDefaultSettings = EditorGUILayout.Foldout(showDefaultSettings, "Default Settings"); if (showDefaultSettings) { EditorGUILayout.BeginHorizontal(center); EditorGUILayout.BeginVertical(); int i = 0; try{ for (i = 0; i < sac.DefaultCustomSettings.Length; i++) { EditorGUILayout.BeginHorizontal("Box"); EditorGUILayout.BeginHorizontal(center); EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField(sac.DefaultCustomSettings[i].Name, name, GUILayout.Width(Screen.width * .32f)); EditorGUILayout.LabelField("(" + System.Enum.GetName(typeof(Setting.SettingType), (int)sac.DefaultCustomSettings[i].Type) + ")", yellow, GUILayout.Width(Screen.width * .32f)); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(center); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(center); switch (sac.DefaultCustomSettings[i].Type) { case Setting.SettingType.STRING: { sac.DefaultCustomSettings[i]._VAL_String = new SACString(EditorGUILayout.TextField(sac.DefaultCustomSettings[i]._VAL_String.GetString())); break; } case Setting.SettingType.BOOLEAN: { sac.DefaultCustomSettings[i]._VAL_Bool = new SACBool(EditorGUILayout.Toggle(sac.DefaultCustomSettings[i]._VAL_Bool.GetBool())); break; } case Setting.SettingType.COLOR: { Color col = EditorGUILayout.ColorField(sac.DefaultCustomSettings[i]._VAL_Color.GetColor()); sac.DefaultCustomSettings[i]._VAL_Color = new SACColor(col.r, col.g, col.b, col.a); break; } case Setting.SettingType.FLOAT: { sac.DefaultCustomSettings[i]._VAL_Float = new SACFloat(EditorGUILayout.FloatField(sac.DefaultCustomSettings[i]._VAL_Float.GetFloat())); break; } case Setting.SettingType.INTEGER: { sac.DefaultCustomSettings[i]._VAL_Int = new SACInt(EditorGUILayout.IntField(sac.DefaultCustomSettings[i]._VAL_Int.GetInt())); break; } case Setting.SettingType.QUATERNION: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); sac.DefaultCustomSettings[i]._VAL_Quaternion = new SACQuaternion(new Quaternion(EditorGUILayout.FloatField("X", sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().x, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().y, sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().z, sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().w)); sac.DefaultCustomSettings[i]._VAL_Quaternion = new SACQuaternion(new Quaternion(sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().x, EditorGUILayout.FloatField("Y", sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().y, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().z, sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().w)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); sac.DefaultCustomSettings[i]._VAL_Quaternion = new SACQuaternion(new Quaternion(sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().x, sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().y, EditorGUILayout.FloatField("Z", sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().z, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().w)); sac.DefaultCustomSettings[i]._VAL_Quaternion = new SACQuaternion(new Quaternion(sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().x, sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().y, sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().z, EditorGUILayout.FloatField("W", sac.DefaultCustomSettings[i]._VAL_Quaternion.GetQuaternion().w, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } case Setting.SettingType.VECTOR2: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); sac.DefaultCustomSettings[i]._VAL_Vector2 = new SACVector2(new Vector2(EditorGUILayout.FloatField("X", sac.DefaultCustomSettings[i]._VAL_Vector2.GetVector2().x, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Vector2.GetVector2().y)); sac.DefaultCustomSettings[i]._VAL_Vector2 = new SACVector2(new Vector2(sac.DefaultCustomSettings[i]._VAL_Vector2.GetVector2().x, EditorGUILayout.FloatField("Y", sac.DefaultCustomSettings[i]._VAL_Vector2.GetVector2().y, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } case Setting.SettingType.VECTOR3: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); sac.DefaultCustomSettings[i]._VAL_Vector3 = new SACVector3(new Vector3(EditorGUILayout.FloatField("X", sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().x, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().y, sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().z)); sac.DefaultCustomSettings[i]._VAL_Vector3 = new SACVector3(new Vector3(sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().x, EditorGUILayout.FloatField("Y", sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().y, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().z)); sac.DefaultCustomSettings[i]._VAL_Vector3 = new SACVector3(new Vector3(sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().x, sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().y, EditorGUILayout.FloatField("Z", sac.DefaultCustomSettings[i]._VAL_Vector3.GetVector3().z, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } case Setting.SettingType.VECTOR4: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); sac.DefaultCustomSettings[i]._VAL_Vector4 = new SACVector4(new Vector4(EditorGUILayout.FloatField("X", sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().x, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().y, sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().z, sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().w)); sac.DefaultCustomSettings[i]._VAL_Vector4 = new SACVector4(new Vector4(sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().x, EditorGUILayout.FloatField("Y", sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().y, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().z, sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().w)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); sac.DefaultCustomSettings[i]._VAL_Vector4 = new SACVector4(new Vector4(sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().x, sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().y, EditorGUILayout.FloatField("Z", sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().z, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().w)); sac.DefaultCustomSettings[i]._VAL_Vector4 = new SACVector4(new Vector4(sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().x, sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().y, sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().z, EditorGUILayout.FloatField("W", sac.DefaultCustomSettings[i]._VAL_Vector4.GetVector4().w, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } case Setting.SettingType.TIME: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); sac.DefaultCustomSettings[i]._VAL_DateTime = new SACDate(new System.DateTime(sac.DefaultCustomSettings[i]._VAL_DateTime.year, EditorGUILayout.IntField("M", sac.DefaultCustomSettings[i]._VAL_DateTime.month, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_DateTime.day, sac.DefaultCustomSettings[i]._VAL_DateTime.hour, sac.DefaultCustomSettings[i]._VAL_DateTime.min, sac.DefaultCustomSettings[i]._VAL_DateTime.sec)); sac.DefaultCustomSettings[i]._VAL_DateTime = new SACDate(new System.DateTime(sac.DefaultCustomSettings[i]._VAL_DateTime.year, sac.DefaultCustomSettings[i]._VAL_DateTime.month, EditorGUILayout.IntField("D", sac.DefaultCustomSettings[i]._VAL_DateTime.day, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_DateTime.hour, sac.DefaultCustomSettings[i]._VAL_DateTime.min, sac.DefaultCustomSettings[i]._VAL_DateTime.sec)); sac.DefaultCustomSettings[i]._VAL_DateTime = new SACDate(new System.DateTime(EditorGUILayout.IntField("Y", sac.DefaultCustomSettings[i]._VAL_DateTime.year, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_DateTime.month, sac.DefaultCustomSettings[i]._VAL_DateTime.day, sac.DefaultCustomSettings[i]._VAL_DateTime.hour, sac.DefaultCustomSettings[i]._VAL_DateTime.min, sac.DefaultCustomSettings[i]._VAL_DateTime.sec)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); sac.DefaultCustomSettings[i]._VAL_DateTime = new SACDate(new System.DateTime(sac.DefaultCustomSettings[i]._VAL_DateTime.year, sac.DefaultCustomSettings[i]._VAL_DateTime.month, sac.DefaultCustomSettings[i]._VAL_DateTime.day, EditorGUILayout.IntField("H", sac.DefaultCustomSettings[i]._VAL_DateTime.hour, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_DateTime.min, sac.DefaultCustomSettings[i]._VAL_DateTime.sec)); sac.DefaultCustomSettings[i]._VAL_DateTime = new SACDate(new System.DateTime(sac.DefaultCustomSettings[i]._VAL_DateTime.year, sac.DefaultCustomSettings[i]._VAL_DateTime.month, sac.DefaultCustomSettings[i]._VAL_DateTime.day, sac.DefaultCustomSettings[i]._VAL_DateTime.hour, EditorGUILayout.IntField("M", sac.DefaultCustomSettings[i]._VAL_DateTime.min, GUILayout.MinWidth(0)), sac.DefaultCustomSettings[i]._VAL_DateTime.sec)); sac.DefaultCustomSettings[i]._VAL_DateTime = new SACDate(new System.DateTime(sac.DefaultCustomSettings[i]._VAL_DateTime.year, sac.DefaultCustomSettings[i]._VAL_DateTime.month, sac.DefaultCustomSettings[i]._VAL_DateTime.day, sac.DefaultCustomSettings[i]._VAL_DateTime.hour, sac.DefaultCustomSettings[i]._VAL_DateTime.min, EditorGUILayout.IntField("S", sac.DefaultCustomSettings[i]._VAL_DateTime.sec, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } default: { break; } } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(center, GUILayout.Width(Screen.width * .05f)); bool delete = GUILayout.Button("X"); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); if (delete) { sac.DefaultCustomSettings = RemoveAt(sac.DefaultCustomSettings, i); break; } GUILayout.Space(5); } }catch (System.Exception e) { ResetTarget(); } if (i == 0) { EditorGUILayout.LabelField("No Default Settings Defined", red); } if (showAddSetting) { GUILayout.BeginVertical("Box", GUILayout.MinWidth(0), GUILayout.Width(Screen.width * .90f)); if (showErrorSetting) { GUILayout.Label(settingError, red); } GUILayout.Label("Add New Setting", center); GUILayout.BeginHorizontal(); GUILayout.Label("Key", center, GUILayout.Width(Screen.width * .3f)); GUILayout.Label("Type", center, GUILayout.Width(Screen.width * .3f)); GUILayout.Label("Value", center, GUILayout.Width(Screen.width * .3f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(center); _ADD_S_name = EditorGUILayout.TextField(_ADD_S_name, GUILayout.Width(Screen.width * .3f)); _ADD_S_type = (Setting.SettingType)EditorGUILayout.EnumPopup(_ADD_S_type, GUILayout.Width(Screen.width * .3f)); _ADD_S_Setting.Name = _ADD_S_name; _ADD_S_Setting.Type = _ADD_S_type; //START switch (_ADD_S_type) { case Setting.SettingType.STRING: { _ADD_S_Setting._VAL_String = new SACString(EditorGUILayout.TextField(_ADD_S_Setting._VAL_String.GetString())); break; } case Setting.SettingType.BOOLEAN: { _ADD_S_Setting._VAL_Bool = new SACBool(EditorGUILayout.Toggle(_ADD_S_Setting._VAL_Bool.GetBool())); break; } case Setting.SettingType.COLOR: { Color col = EditorGUILayout.ColorField(_ADD_S_Setting._VAL_Color.GetColor()); _ADD_S_Setting._VAL_Color = new SACColor(col.r, col.g, col.b, col.a); break; } case Setting.SettingType.FLOAT: { _ADD_S_Setting._VAL_Float = new SACFloat(EditorGUILayout.FloatField(_ADD_S_Setting._VAL_Float.GetFloat())); break; } case Setting.SettingType.INTEGER: { _ADD_S_Setting._VAL_Int = new SACInt(EditorGUILayout.IntField(_ADD_S_Setting._VAL_Int.GetInt())); break; } case Setting.SettingType.QUATERNION: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); _ADD_S_Setting._VAL_Quaternion = new SACQuaternion(new Quaternion(EditorGUILayout.FloatField("X", _ADD_S_Setting._VAL_Quaternion.GetQuaternion().x, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Quaternion.GetQuaternion().y, _ADD_S_Setting._VAL_Quaternion.GetQuaternion().z, _ADD_S_Setting._VAL_Quaternion.GetQuaternion().w)); _ADD_S_Setting._VAL_Quaternion = new SACQuaternion(new Quaternion(_ADD_S_Setting._VAL_Quaternion.GetQuaternion().x, EditorGUILayout.FloatField("Y", _ADD_S_Setting._VAL_Quaternion.GetQuaternion().y, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Quaternion.GetQuaternion().z, _ADD_S_Setting._VAL_Quaternion.GetQuaternion().w)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); _ADD_S_Setting._VAL_Quaternion = new SACQuaternion(new Quaternion(_ADD_S_Setting._VAL_Quaternion.GetQuaternion().x, _ADD_S_Setting._VAL_Quaternion.GetQuaternion().y, EditorGUILayout.FloatField("Z", _ADD_S_Setting._VAL_Quaternion.GetQuaternion().z, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Quaternion.GetQuaternion().w)); _ADD_S_Setting._VAL_Quaternion = new SACQuaternion(new Quaternion(_ADD_S_Setting._VAL_Quaternion.GetQuaternion().x, _ADD_S_Setting._VAL_Quaternion.GetQuaternion().y, _ADD_S_Setting._VAL_Quaternion.GetQuaternion().z, EditorGUILayout.FloatField("W", _ADD_S_Setting._VAL_Quaternion.GetQuaternion().w, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } case Setting.SettingType.VECTOR2: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); _ADD_S_Setting._VAL_Vector2 = new SACVector2(new Vector2(EditorGUILayout.FloatField("X", _ADD_S_Setting._VAL_Vector2.GetVector2().x, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Vector2.GetVector2().y)); _ADD_S_Setting._VAL_Vector2 = new SACVector2(new Vector2(_ADD_S_Setting._VAL_Vector2.GetVector2().x, EditorGUILayout.FloatField("Y", _ADD_S_Setting._VAL_Vector2.GetVector2().y, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } case Setting.SettingType.VECTOR3: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); _ADD_S_Setting._VAL_Vector3 = new SACVector3(new Vector3(EditorGUILayout.FloatField("X", _ADD_S_Setting._VAL_Vector3.GetVector3().x, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Vector3.GetVector3().y, _ADD_S_Setting._VAL_Vector3.GetVector3().z)); _ADD_S_Setting._VAL_Vector3 = new SACVector3(new Vector3(_ADD_S_Setting._VAL_Vector3.GetVector3().x, EditorGUILayout.FloatField("Y", _ADD_S_Setting._VAL_Vector3.GetVector3().y, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Vector3.GetVector3().z)); _ADD_S_Setting._VAL_Vector3 = new SACVector3(new Vector3(_ADD_S_Setting._VAL_Vector3.GetVector3().x, _ADD_S_Setting._VAL_Vector3.GetVector3().y, EditorGUILayout.FloatField("Z", _ADD_S_Setting._VAL_Vector3.GetVector3().z, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } case Setting.SettingType.VECTOR4: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); _ADD_S_Setting._VAL_Vector4 = new SACVector4(new Vector4(EditorGUILayout.FloatField("X", _ADD_S_Setting._VAL_Vector4.GetVector4().x, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Vector4.GetVector4().y, _ADD_S_Setting._VAL_Vector4.GetVector4().z, _ADD_S_Setting._VAL_Vector4.GetVector4().w)); _ADD_S_Setting._VAL_Vector4 = new SACVector4(new Vector4(_ADD_S_Setting._VAL_Vector4.GetVector4().x, EditorGUILayout.FloatField("Y", _ADD_S_Setting._VAL_Vector4.GetVector4().y, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Vector4.GetVector4().z, _ADD_S_Setting._VAL_Vector4.GetVector4().w)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); _ADD_S_Setting._VAL_Vector4 = new SACVector4(new Vector4(_ADD_S_Setting._VAL_Vector4.GetVector4().x, _ADD_S_Setting._VAL_Vector4.GetVector4().y, EditorGUILayout.FloatField("Z", _ADD_S_Setting._VAL_Vector4.GetVector4().z, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_Vector4.GetVector4().w)); _ADD_S_Setting._VAL_Vector4 = new SACVector4(new Vector4(_ADD_S_Setting._VAL_Vector4.GetVector4().x, _ADD_S_Setting._VAL_Vector4.GetVector4().y, _ADD_S_Setting._VAL_Vector4.GetVector4().z, EditorGUILayout.FloatField("W", _ADD_S_Setting._VAL_Vector4.GetVector4().w, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } case Setting.SettingType.TIME: { GUILayout.BeginVertical(); EditorGUIUtility.labelWidth = 15; GUILayout.BeginHorizontal(); _ADD_S_Setting._VAL_DateTime = new SACDate(new System.DateTime(_ADD_S_Setting._VAL_DateTime.year, EditorGUILayout.IntField("M", _ADD_S_Setting._VAL_DateTime.month, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_DateTime.day, _ADD_S_Setting._VAL_DateTime.hour, _ADD_S_Setting._VAL_DateTime.min, _ADD_S_Setting._VAL_DateTime.sec)); _ADD_S_Setting._VAL_DateTime = new SACDate(new System.DateTime(_ADD_S_Setting._VAL_DateTime.year, _ADD_S_Setting._VAL_DateTime.month, EditorGUILayout.IntField("D", _ADD_S_Setting._VAL_DateTime.day, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_DateTime.hour, _ADD_S_Setting._VAL_DateTime.min, _ADD_S_Setting._VAL_DateTime.sec)); _ADD_S_Setting._VAL_DateTime = new SACDate(new System.DateTime(EditorGUILayout.IntField("Y", _ADD_S_Setting._VAL_DateTime.year, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_DateTime.month, _ADD_S_Setting._VAL_DateTime.day, _ADD_S_Setting._VAL_DateTime.hour, _ADD_S_Setting._VAL_DateTime.min, _ADD_S_Setting._VAL_DateTime.sec)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); _ADD_S_Setting._VAL_DateTime = new SACDate(new System.DateTime(_ADD_S_Setting._VAL_DateTime.year, _ADD_S_Setting._VAL_DateTime.month, _ADD_S_Setting._VAL_DateTime.day, EditorGUILayout.IntField("H", _ADD_S_Setting._VAL_DateTime.hour, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_DateTime.min, _ADD_S_Setting._VAL_DateTime.sec)); _ADD_S_Setting._VAL_DateTime = new SACDate(new System.DateTime(_ADD_S_Setting._VAL_DateTime.year, _ADD_S_Setting._VAL_DateTime.month, _ADD_S_Setting._VAL_DateTime.day, _ADD_S_Setting._VAL_DateTime.hour, EditorGUILayout.IntField("M", _ADD_S_Setting._VAL_DateTime.min, GUILayout.MinWidth(0)), _ADD_S_Setting._VAL_DateTime.sec)); _ADD_S_Setting._VAL_DateTime = new SACDate(new System.DateTime(_ADD_S_Setting._VAL_DateTime.year, _ADD_S_Setting._VAL_DateTime.month, _ADD_S_Setting._VAL_DateTime.day, _ADD_S_Setting._VAL_DateTime.hour, _ADD_S_Setting._VAL_DateTime.min, EditorGUILayout.IntField("S", _ADD_S_Setting._VAL_DateTime.sec, GUILayout.MinWidth(0)))); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); break; } default: { break; } } //END GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); bool cancel = GUILayout.Button("Cancel"); bool _add = GUILayout.Button("Add!"); if (cancel) { _ADD_S_name = "New Setting"; _ADD_S_type = Setting.SettingType.STRING; _ADD_S_Setting = new Setting(_ADD_S_name, new SACString("Setting Value"), _ADD_S_type); showAddSetting = false; showErrorSetting = false; } if (_add) { if (CheckSettingAdd(sac.DefaultCustomSettings)) { settingError = "'" + _ADD_S_name + "' is already defined"; showErrorSetting = true; } else { sac.DefaultCustomSettings = AddTo(sac.DefaultCustomSettings, _ADD_S_Setting); _ADD_S_name = "New Setting"; _ADD_S_type = Setting.SettingType.STRING; _ADD_S_Setting = new Setting(_ADD_S_name, new SACString("Setting Value"), _ADD_S_type); showAddSetting = false; showErrorSetting = false; } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.BeginHorizontal(); if (i > 0) { bool removeAll = GUILayout.Button("Remove All"); if (removeAll) { sac.DefaultCustomSettings = new Setting[] {}; } } if (!showAddSetting) { bool add = GUILayout.Button("Add New Setting"); if (add) { showAddSetting = true; } } GUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); } showFileName = EditorGUILayout.Foldout(showFileName, "Save File Name"); if (showFileName) { EditorGUILayout.BeginVertical(); GUIStyle italic = new GUIStyle(); italic.fontStyle = FontStyle.Italic; italic.normal.textColor = Color.blue; italic.hover.textColor = Color.magenta; italic.padding.left = 5; if (GUILayout.Button("Persistent Data Path/ (Click To Open)", italic)) { Application.OpenURL(Application.persistentDataPath); } sac.FileName = EditorGUILayout.TextField(sac.FileName); EditorGUILayout.EndVertical(); } if (GUI.changed) { EditorUtility.SetDirty(sac); } serializedObject.ApplyModifiedProperties(); GUILayout.Space(20); GUI.skin.box.padding = defPadding; GUI.skin.box.alignment = defBoxAlign; GUI.skin.textField.alignment = defAlign; }
/// <summary> /// Builds a URL for the given <paramref name="tabId"/>, using the given queryString parameters. /// </summary> /// <param name="tabId">The tab id of the page to navigate to.</param> /// <param name="moduleId">The module id of the module for which the control key is being used.</param> /// <param name="controlKey">The control key to determine which control to load.</param> /// <param name="queryStringParameters">Any other queryString parameters.</param> /// <returns> /// A URL to the given <paramref name="tabId"/>, with the given queryString parameters /// </returns> protected string BuildLinkUrl(int tabId, int moduleId, ControlKey controlKey, params string[] queryStringParameters) { return this.BuildLinkUrl(tabId, moduleId, controlKey.ToString(), queryStringParameters); }
private void Launcher_KeyDown(object sender, KeyEventArgs e) { if (currKey != ControlKey.NON) { string s = translateKeyCode(e); if (s == "") { lb_keyChange.Text = "INVALID KEY!"; timer.Enabled = true; setLabelColor(currKey, Color.DarkGray); currKey = ControlKey.NON; return; } switch (currKey) { case ControlKey.FORWARD: { fwd.name = s; lb_keyFwd.Text = fwd.name; lb_keyFwd.ForeColor = Color.DarkGray; break; } case ControlKey.BACKWARD: { back.name = s; lb_keyback.Text = back.name; lb_keyback.ForeColor = Color.DarkGray; break; } case ControlKey.STRAFE_LEFT: { strafeL.name = s; lb_keyLeft.Text = strafeL.name; lb_keyLeft.ForeColor = Color.DarkGray; break; } case ControlKey.STRAFE_RIGHT: { strafeR.name = s; lb_keyRight.Text = strafeR.name; lb_keyRight.ForeColor = Color.DarkGray; break; } case ControlKey.SPRINT: { sprint.name = s; lb_keySprint.Text = sprint.name; lb_keySprint.ForeColor = Color.DarkGray; break; } case ControlKey.JUMP: { jump.name = s; lb_keyJump.Text = jump.name; lb_keyJump.ForeColor = Color.DarkGray; break; } case ControlKey.USE: { use.name = s; lb_keyUse.Text = use.name; lb_keyUse.ForeColor = Color.DarkGray; break; } } currKey = ControlKey.NON; lb_keyChange.Visible = false; } }
public SACRemoveControlEvent(ControlKey removedKey) { this.controlBeingRemoved = removedKey; }
protected string BuildLinkUrl(int moduleId, ControlKey controlKey) { return this.BuildLinkUrl("modId=" + moduleId.ToString(CultureInfo.InvariantCulture), "key=" + controlKey.ToString()); }
/// <summary> /// Builds a URL for the given <paramref name="tabId"/>, using the given queryString parameters. /// </summary> /// <param name="tabId">The tab id of the page to navigate to.</param> /// <param name="moduleId">The module id of the module for which the control key is being used.</param> /// <param name="controlKey">The control key to determine which control to load.</param> /// <param name="queryStringParameters">Any other queryString parameters.</param> /// <returns> /// A URL to the given <paramref name="tabId"/>, with the given queryString parameters /// </returns> protected string BuildLinkUrl(int tabId, int moduleId, ControlKey controlKey, params string[] queryStringParameters) { return this.BuildLinkUrl(tabId, moduleId, controlKey.ToString(), queryStringParameters); }
protected string BuildLinkUrl(int moduleId, ControlKey controlKey, params string[] queryStringParameters) { Array.Resize(ref queryStringParameters, queryStringParameters.Length + 2); queryStringParameters[queryStringParameters.Length - 1] = "modId=" + moduleId.ToString(CultureInfo.InvariantCulture); queryStringParameters[queryStringParameters.Length - 2] = "key=" + controlKey.ToString(); return this.BuildLinkUrl(queryStringParameters); }
protected override ControlKey OnGenerateLayoutTree(ref UIOperationContext context, ControlKey parent, ControlKey?existingKey) { return(ControlKey.Invalid); }
protected override ControlKey OnGenerateLayoutTree(ref UIOperationContext context, ControlKey parent, ControlKey?existingKey) { var decorator = GetDefaultDecorator(context.DecorationProvider); Aligner.ExtraMargins = decorator.Margins; var result = base.OnGenerateLayoutTree(ref context, parent, existingKey); context.Layout.SetTag(result, LayoutTags.Tooltip); return(result); }
public static void SendControlMsg(bool edge, ControlKey key) { Console.WriteLine("Sending Control Message: " + key + (edge ? "Pressed" : "Released")); MessageWriter.ControlMessage(key, edge); }
public override void OnInspectorGUI() { #region Original if (SavedFoldoutShared("OriginalGUI")) { EditorGUI.indentLevel++; base.OnInspectorGUI(); EditorGUI.indentLevel--; EditorGUILayout.Space(); } #endregion //Prep ControlScheme ct = (ControlScheme)target; EditorGUILayout.Space(); #region Action selection and setting // Set & select a new action list EditorGUILayout.BeginHorizontal(); selectedIndex = EditorGUILayout.Popup(selectedIndex, AllEnumsNames); if (GUILayout.Button("ResetActions")) { ct.SetActionsFromEnum(AllEnums[selectedIndex]); } EditorGUILayout.EndHorizontal(); #endregion #region PlayerID & Xbox ID // PlayerID EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("PlayerID", GUILayout.Width(60.0f)); ct.playerID = EditorGUILayout.IntField(ct.playerID, GUILayout.Width(20.0f)); EditorGUILayout.LabelField("XboxSupport: " + ct.XboxSupport.ToString()); } EditorGUILayout.EndHorizontal(); if (xboxSupport) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("ControllerID", GUILayout.Width(80.0f)); ct.controllerID = EditorGUILayout.IntField(ct.controllerID, GUILayout.Width(20.0f)); EditorGUILayout.LabelField("LastInput: " + ct.InputType.ToString()); } EditorGUILayout.EndHorizontal(); } #endregion #region Horizontal if (SavedFoldoutShared("Horizontal Axis")) { int delete = -1; bool add = false; for (int i = 0; i < ct.Horizontal.AxisKeys.Count; i++) { GUILayout.BeginHorizontal(); if (i == 0 && GUILayout.Button("+", GUILayout.Width(20.0f))) { add = true; } else if (i != 0 && GUILayout.Button("x", GUILayout.Width(20.0f))) { delete = i; } ct.Horizontal.AxisKeys[i].OnGui(); GUILayout.EndHorizontal(); } if (delete >= 0) { ct.Horizontal.AxisKeys.RemoveAt(delete); } if (add) { ct.Horizontal.AxisKeys.Add(AxisKey.PC(KeyCode.LeftArrow, KeyCode.RightArrow)); } } #endregion #region Vertical if (SavedFoldoutShared("Vertical Axis")) { int delete = -1; bool add = false; for (int i = 0; i < ct.Vertical.AxisKeys.Count; i++) { GUILayout.BeginHorizontal(); if (i == 0 && GUILayout.Button("+", GUILayout.Width(20.0f))) { add = true; } else if (i != 0 && GUILayout.Button("x", GUILayout.Width(20.0f))) { delete = i; } ct.Vertical.AxisKeys[i].OnGui(); GUILayout.EndHorizontal(); } if (delete >= 0) { ct.Vertical.AxisKeys.RemoveAt(delete); } if (add) { ct.Vertical.AxisKeys.Add(AxisKey.PC(KeyCode.DownArrow, KeyCode.UpArrow)); } } #endregion #region Actions if (SavedFoldoutShared("Actions")) { for (int i = 0; i < ct.Actions.Count; i++) { EditorGUI.indentLevel++; // For each action - Show a foldout if (SavedFoldoutShared(ct.Actions[i].Name)) { int delete = -1; bool add = false; EditorGUI.indentLevel++; if (ct.Actions[i].Keys.Count == 0 && GUILayout.Button("Add a key")) { add = true; } for (int j = 0; j < ct.Actions[i].Keys.Count; j++) { GUILayout.BeginHorizontal(); if (j == 0 && GUILayout.Button("+", GUILayout.Width(20.0f))) { add = true; } else if (j != 0 && GUILayout.Button("x", GUILayout.Width(20.0f))) { delete = j; } ct.Actions[i].Keys[j].OnGui(); GUILayout.EndHorizontal(); } EditorGUI.indentLevel--; if (delete >= 0) { ct.Actions[i].Keys.RemoveAt(delete); } if (add) { ct.Actions[i].Keys.Add(ControlKey.PCKey(KeyCode.KeypadEnter)); } } EditorGUI.indentLevel--; } } #endregion if (GUI.changed) { xboxSupport = ((ControlScheme)(target)).XboxSupport; ScriptableObjectHelper.RefreshAsset(ct); } }