using System; using System.Collections.Generic; using UnityEngine; namespace ProBuilder2.Common { // Token: 0x0200003E RID: 62 public class pb_Shortcut { // Token: 0x0600020C RID: 524 RVA: 0x0001C7CB File Offset: 0x0001ABCB public pb_Shortcut(string a, string d, KeyCode k, EventModifiers e) { this.action = a; this.description = d; this.key = k; this.eventModifiers = e; } // Token: 0x0600020D RID: 525 RVA: 0x0001C7F0 File Offset: 0x0001ABF0 public pb_Shortcut(string str) { try { string[] array = str.Split(new char[] { '-' }); this.action = array[0]; this.description = array[1]; int num; if (int.TryParse(array[2], out num)) { this.key = (KeyCode)num; } if (int.TryParse(array[3], out num)) { this.eventModifiers = (EventModifiers)num; } } catch { Debug.LogWarning("Failed parsing shortcut: " + str); } } // Token: 0x0600020E RID: 526 RVA: 0x0001C880 File Offset: 0x0001AC80 public bool Matches(KeyCode key, EventModifiers modifiers) { return this.key == key && this.eventModifiers == modifiers; } // Token: 0x0600020F RID: 527 RVA: 0x0001C89C File Offset: 0x0001AC9C public static int IndexOf(pb_Shortcut[] shortcuts, KeyCode k, EventModifiers e) { for (int i = 0; i < shortcuts.Length; i++) { if (shortcuts[i].key == k && shortcuts[i].eventModifiers == e) { return i; } } return -1; } // Token: 0x06000210 RID: 528 RVA: 0x0001C8DC File Offset: 0x0001ACDC public static IEnumerable DefaultShortcuts() { return new List { new pb_Shortcut("Escape", "Top Level", KeyCode.Escape, EventModifiers.None), new pb_Shortcut("Toggle Geometry Mode", "Geometry Level", KeyCode.G, EventModifiers.None), new pb_Shortcut("Toggle Selection Mode", "Toggle Selection Mode. If Toggle Mode Shortcuts is disabled, this shortcut does not apply.", KeyCode.H, EventModifiers.None), new pb_Shortcut("Set Trigger", "Sets all selected objects to entity type Trigger.", KeyCode.T, EventModifiers.None), new pb_Shortcut("Set Occluder", "Sets all selected objects to entity type Occluder.", KeyCode.O, EventModifiers.None), new pb_Shortcut("Set Collider", "Sets all selected objects to entity type Collider.", KeyCode.C, EventModifiers.None), new pb_Shortcut("Set Mover", "Sets all selected objects to entity type Mover.", KeyCode.M, EventModifiers.None), new pb_Shortcut("Set Detail", "Sets all selected objects to entity type Brush.", KeyCode.B, EventModifiers.None), new pb_Shortcut("Toggle Handle Pivot", "Toggles the orientation of the ProBuilder selection handle.", KeyCode.P, EventModifiers.None), new pb_Shortcut("Set Pivot", "Center pivot around current selection.", KeyCode.J, EventModifiers.Command), new pb_Shortcut("Delete Face", "Deletes all selected faces.", KeyCode.Backspace, EventModifiers.FunctionKey), new pb_Shortcut("Vertex Mode", "Enter Vertex editing mode. Automatically swaps to Element level editing.", KeyCode.H, EventModifiers.None), new pb_Shortcut("Edge Mode", "Enter Edge editing mode. Automatically swaps to Element level editing.", KeyCode.J, EventModifiers.None), new pb_Shortcut("Face Mode", "Enter Face editing mode. Automatically swaps to Element level editing.", KeyCode.K, EventModifiers.None) }; } // Token: 0x06000211 RID: 529 RVA: 0x0001CA40 File Offset: 0x0001AE40 public static IEnumerable ParseShortcuts(string str) { if (str == null || str.Length < 3) { return pb_Shortcut.DefaultShortcuts(); } string[] array = str.Split(new char[] { '*' }); pb_Shortcut[] array2 = new pb_Shortcut[array.Length]; for (int i = 0; i < array2.Length; i++) { array2[i] = new pb_Shortcut(array[i]); } return array2; } // Token: 0x06000212 RID: 530 RVA: 0x0001CAA0 File Offset: 0x0001AEA0 public override string ToString() { return string.Format("{0}: {1}, {2} ({3})", new object[] { this.action, this.key.ToString(), this.eventModifiers.ToString(), (int)this.eventModifiers }); } // Token: 0x06000213 RID: 531 RVA: 0x0001CAFC File Offset: 0x0001AEFC public string Serialize() { this.action = this.action.Replace("-", " ").Replace("*", string.Empty); this.description = this.description.Replace("-", " ").Replace("*", string.Empty); return string.Concat(new object[] { this.action, "-", this.description, "-", (int)this.key, "-", (int)this.eventModifiers }); } // Token: 0x06000214 RID: 532 RVA: 0x0001CBB0 File Offset: 0x0001AFB0 public static string ShortcutsToString(pb_Shortcut[] shortcuts) { string text = string.Empty; for (int i = 0; i < shortcuts.Length; i++) { text += shortcuts[i].Serialize(); if (i != shortcuts.Length - 1) { text += "*"; } } return text; } // Token: 0x04000176 RID: 374 public string action; // Token: 0x04000177 RID: 375 public string description; // Token: 0x04000178 RID: 376 public KeyCode key; // Token: 0x04000179 RID: 377 public EventModifiers eventModifiers; } }