public static void CreateControls() { Control_Deselect = KeyboardControlOptionCreate("ObjectSelectTool", new Keys[] { Keys.Escape }); Control_PreviousTool = KeyboardControlOptionCreate("PreviousTool", new Keys[] { Keys.Oem3 }); Control_Unit_Move = KeyboardControlOptionCreate("MoveObjects", new Keys[] { Keys.M }); Control_Unit_Delete = KeyboardControlOptionCreate("DeleteObjects", new Keys[] { Keys.Delete }); Control_Unit_Multiselect = KeyboardControlOptionCreate("Multiselect", new Keys[] { Keys.ShiftKey }); Control_Slow = KeyboardControlOptionCreate("ViewSlow", new Keys[] { Keys.R }); Control_Fast = KeyboardControlOptionCreate("ViewFast", new Keys[] { Keys.F }); Control_Picker = KeyboardControlOptionCreate("Picker", new Keys[] { Keys.ControlKey }); Control_View_Textures = KeyboardControlOptionCreate("ShowTextures", new Keys[] { Keys.F5 }); Control_View_Lighting = KeyboardControlOptionCreate("ShowLighting", new Keys[] { Keys.F8 }); Control_View_Wireframe = KeyboardControlOptionCreate("ShowWireframe", new Keys[] { Keys.F6 }); Control_View_Units = KeyboardControlOptionCreate("ShowObjects", new Keys[] { Keys.F7 }); Control_View_ScriptMarkers = KeyboardControlOptionCreate("ShowLabels", new Keys[] { Keys.F4 }); Control_View_Move_Type = KeyboardControlOptionCreate("ViewMoveMode", new Keys[] { Keys.F1 }); Control_View_Rotate_Type = KeyboardControlOptionCreate("ViewRotateMode", new Keys[] { Keys.F2 }); Control_View_Move_Left = KeyboardControlOptionCreate("ViewMoveLeft", new Keys[] { Keys.A }); Control_View_Move_Right = KeyboardControlOptionCreate("ViewMoveRight", new Keys[] { Keys.D }); Control_View_Move_Forward = KeyboardControlOptionCreate("ViewMoveForwards", new Keys[] { Keys.W }); Control_View_Move_Backward = KeyboardControlOptionCreate("ViewMoveBackwards", new Keys[] { Keys.S }); Control_View_Move_Up = KeyboardControlOptionCreate("ViewMoveUp", new Keys[] { Keys.E }); Control_View_Move_Down = KeyboardControlOptionCreate("ViewMoveDown", new Keys[] { Keys.C }); Control_View_Zoom_In = KeyboardControlOptionCreate("ViewZoomIn", new Keys[] { Keys.Home }); Control_View_Zoom_Out = KeyboardControlOptionCreate("ViewZoomOut", new Keys[] { Keys.End }); Control_View_Left = KeyboardControlOptionCreate("ViewRotateLeft", new Keys[] { Keys.Left }); Control_View_Right = KeyboardControlOptionCreate("ViewRotateRight", new Keys[] { Keys.Right }); Control_View_Forward = KeyboardControlOptionCreate("ViewRotateForwards", new Keys[] { Keys.Up }); Control_View_Backward = KeyboardControlOptionCreate("ViewRotateBackwards", new Keys[] { Keys.Down }); Control_View_Up = KeyboardControlOptionCreate("ViewRotateUp", new Keys[] { Keys.PageUp }); Control_View_Down = KeyboardControlOptionCreate("ViewRotateDown", new Keys[] { Keys.Next }); Control_View_Roll_Left = KeyboardControlOptionCreate("ViewRollLeft", new Keys[] { Keys.Oem4 }); Control_View_Roll_Right = KeyboardControlOptionCreate("ViewRollRight", new Keys[] { Keys.Oem6 }); Control_View_Reset = KeyboardControlOptionCreate("ViewReset", new Keys[] { Keys.Back }); Control_CounterClockwise = KeyboardControlOptionCreate("CounterClockwise", new Keys[] { Keys.Oemcomma }); Control_Clockwise = KeyboardControlOptionCreate("Clockwise", new Keys[] { Keys.OemPeriod }); Control_Texture_Flip = KeyboardControlOptionCreate("TextureFlip", new Keys[] { Keys.Oem2 }); Control_Tri_Flip = KeyboardControlOptionCreate("TriangleFlip", new Keys[] { Keys.Oem5 }); Control_Gateway_Delete = KeyboardControlOptionCreate("GatewayDelete", new Keys[] { Keys.ShiftKey }); Control_Undo = KeyboardControlOptionCreate("Undo", new Keys[] { Keys.ControlKey, Keys.Z }); Control_Redo = KeyboardControlOptionCreate("Redo", new Keys[] { Keys.ControlKey, Keys.Y }); Control_ScriptPosition = KeyboardControlOptionCreate("PositionLabel", new Keys[] { Keys.P }); KeyboardProfile = new clsKeyboardProfile(Options_KeyboardControls); }
public bool Active(clsOption<clsKeyboardControl> control) { return ((clsKeyboardControl) this.get_Value(control)).Active; }
public static clsOption<clsKeyboardControl> KeyboardControlOptionCreate(string saveKey, Keys[] keys, Keys[] unlessKeys) { clsOption<clsKeyboardControl> option2 = new clsOption<clsKeyboardControl>(saveKey, new clsKeyboardControl(keys, unlessKeys)); Options_KeyboardControls.Options.Add(option2.GroupLink); return option2; }
public static clsOption<clsKeyboardControl> KeyboardControlOptionCreate(string saveKey, clsKeyboardControl defaultValue) { clsOption<clsKeyboardControl> option2 = new clsOption<clsKeyboardControl>(saveKey, defaultValue); Options_KeyboardControls.Options.Add(option2.GroupLink); return option2; }
private void UpdateKeyboardControls(int selectedIndex) { this.lstKeyboardControls.Hide(); this.lstKeyboardControls.Items.Clear(); this.lstKeyboardControls_Items = new clsOption<clsKeyboardControl>[(modControls.Options_KeyboardControls.Options.Count - 1) + 1]; int num2 = modControls.Options_KeyboardControls.Options.Count - 1; for (int i = 0; i <= num2; i++) { clsOption<clsKeyboardControl> item = (clsOption<clsKeyboardControl>) modControls.Options_KeyboardControls.Options[i]; string keyControlText = this.GetKeyControlText(item); this.lstKeyboardControls_Items[this.lstKeyboardControls.Items.Add(keyControlText)] = item; } this.lstKeyboardControls.SelectedIndex = selectedIndex; this.lstKeyboardControls.Show(); }
public frmOptions() { base.FormClosing += new FormClosingEventHandler(this.frmOptions_FormClosing); this.ObjectDataPathSet = new ctrlPathSet("Object Data Directories"); this.TilesetsPathSet = new ctrlPathSet("Tilesets Directories"); this.lstKeyboardControls_Items = new clsOption<clsKeyboardControl>[0]; this.AllowClose = false; this.InitializeComponent(); this.Icon = modProgram.ProgramIcon; this.TilesetsPathSet.Dock = DockStyle.Fill; this.ObjectDataPathSet.Dock = DockStyle.Fill; this.TableLayoutPanel1.Controls.Add(this.TilesetsPathSet, 0, 0); this.TableLayoutPanel1.Controls.Add(this.ObjectDataPathSet, 0, 1); this.ChangedKeyControls = (modControls.clsKeyboardProfile) modControls.KeyboardProfile.GetCopy(new modControls.clsKeyboardProfileCreator()); this.txtAutosaveChanges.Text = modIO.InvariantToString_uint(modSettings.Settings.AutoSaveMinChanges); this.txtAutosaveInterval.Text = modIO.InvariantToString_uint(modSettings.Settings.AutoSaveMinInterval_s); this.cbxAutosaveCompression.Checked = modSettings.Settings.AutoSaveCompress; this.cbxAutosaveEnabled.Checked = modSettings.Settings.AutoSaveEnabled; this.cbxAskDirectories.Checked = modSettings.Settings.DirectoriesPrompt; this.cbxPointerDirect.Checked = modSettings.Settings.DirectPointer; this.DisplayFont = modSettings.Settings.MakeFont(); this.UpdateDisplayFontLabel(); this.txtFOV.Text = modIO.InvariantToString_dbl(modSettings.Settings.FOVDefault); this.MinimapCliffColour = new clsRGBA_sng(modSettings.Settings.MinimapCliffColour); this.clrMinimapCliffs = new ctrlColour(this.MinimapCliffColour); this.pnlMinimapCliffColour.Controls.Add(this.clrMinimapCliffs); this.MinimapSelectedObjectColour = new clsRGBA_sng(modSettings.Settings.MinimapSelectedObjectsColour); this.clrMinimapSelectedObjects = new ctrlColour(this.MinimapSelectedObjectColour); this.pnlMinimapSelectedObjectColour.Controls.Add(this.clrMinimapSelectedObjects); this.txtMinimapSize.Text = modIO.InvariantToString_int(modSettings.Settings.MinimapSize); this.cbxMinimapObjectColours.Checked = modSettings.Settings.MinimapTeamColours; this.cbxMinimapTeamColourFeatures.Checked = modSettings.Settings.MinimapTeamColoursExceptFeatures; this.cbxMipmaps.Checked = modSettings.Settings.Mipmaps; this.cbxMipmapsHardware.Checked = modSettings.Settings.MipmapsHardware; this.txtUndoSteps.Text = modIO.InvariantToString_uint(modSettings.Settings.UndoLimit); this.TilesetsPathSet.SetPaths(modSettings.Settings.TilesetDirectories); this.ObjectDataPathSet.SetPaths(modSettings.Settings.ObjectDataDirectories); this.TilesetsPathSet.SelectedNum = modMath.Clamp_int(Conversions.ToInteger(modSettings.Settings.get_Value(modSettings.Setting_DefaultTilesetsPathNum)), -1, modSettings.Settings.TilesetDirectories.Count - 1); this.ObjectDataPathSet.SelectedNum = modMath.Clamp_int(Conversions.ToInteger(modSettings.Settings.get_Value(modSettings.Setting_DefaultObjectDataPathNum)), -1, modSettings.Settings.ObjectDataDirectories.Count - 1); this.txtMapBPP.Text = modIO.InvariantToString_int(modSettings.Settings.MapViewBPP); this.txtMapDepth.Text = modIO.InvariantToString_int(modSettings.Settings.MapViewDepth); this.txtTexturesBPP.Text = modIO.InvariantToString_int(modSettings.Settings.TextureViewBPP); this.txtTexturesDepth.Text = modIO.InvariantToString_int(modSettings.Settings.TextureViewDepth); this.cbxPickerOrientation.Checked = modSettings.Settings.PickOrientation; this.UpdateKeyboardControls(-1); }
private string GetKeyControlText(clsOption<clsKeyboardControl> item) { string str2 = item.SaveKey + " = "; clsKeyboardControl control = (clsKeyboardControl) this.ChangedKeyControls.get_Value(item); int upperBound = control.Keys.GetUpperBound(0); for (int i = 0; i <= upperBound; i++) { Keys keys = control.Keys[i]; string name = Enum.GetName(typeof(Keys), keys); if (name == null) { str2 = str2 + modIO.InvariantToString_int((int) keys); } else { str2 = str2 + name; } if (i < control.Keys.GetUpperBound(0)) { str2 = str2 + " + "; } } if (control.UnlessKeys.GetUpperBound(0) >= 0) { str2 = str2 + " unless "; int num4 = control.UnlessKeys.GetUpperBound(0); for (int j = 0; j <= num4; j++) { Keys keys2 = control.UnlessKeys[j]; string str4 = Enum.GetName(typeof(Keys), keys2); if (str4 == null) { str2 = str2 + modIO.InvariantToString_int((int) keys2); } else { str2 = str2 + str4; } if (j < control.UnlessKeys.GetUpperBound(0)) { str2 = str2 + ", "; } } } if (control != item.DefaultValue) { str2 = str2 + " (modified)"; } return str2; }