private void b_AddNewDefinitionGroup_Click(object sender, EventArgs e) { var definitionGroupName = tb_DefintionGroupName.Text; if (string.IsNullOrWhiteSpace(definitionGroupName)) { return; } if (!(lb_skillsWithDefinitionGroups.SelectedItem is ISnoPower currentSnoPower)) { MessageBox.Show("Select a skill first!", "No skill selected!", MessageBoxButtons.OK); return; } var currentSkillDefinitionGroups = SnoToDefinitionGroups[currentSnoPower.Sno]; if (currentSkillDefinitionGroups.definitionGroups.Any(group => group.name.Equals(definitionGroupName))) { MessageBox.Show("DefinitionGroup with this name already exists!", "Duplicate name!", MessageBoxButtons.OK); return; } var definitionGroup = new DefinitionGroup(definitionGroupName, currentSnoPower.Sno); currentSkillDefinitionGroups.definitionGroups.Add(definitionGroup); selectedSkillDefinitionGroupsDisplayValues.ResetBindings(); tb_DefintionGroupName.Text = ""; ConfigPersistence.SaveDefinitionGroupsForSkill(currentSkillDefinitionGroups); }
private void Settings_FormClosing(object sender, FormClosingEventArgs e) { ConfigPersistence.SaveDefinitions(SnoToDefinitionGroups); ConfigPersistence.SaveKeybinds(Keybinds); ConfigPersistence.SaveHotkeys(Hotkeys); ConfigPersistence.SaveAutoActions(AutoActions); e.Cancel = true; }
private void updateHotkey(HotkeyPopup.MyKeyEvent keyEvent, AbstractHotkeyAction hotkey) { if (keyEvent is null) { return; } var iKeyEvent = keyEvent.toIKeyEvent(Hud.Input); hotkey.SetKeyEvent(keyEvent, iKeyEvent); ConfigPersistence.SaveHotkeys(Hotkeys); }
private void InitializeKeybinds() { cb_Skill1.DataSource = InputUtil.KeyboardKeys(); cb_Skill1.SelectedItem = Keybinds[(int)ActionKey.Skill1]; cb_Skill1.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Skill1, cb_Skill1); cb_Skill2.DataSource = InputUtil.KeyboardKeys(); cb_Skill2.SelectedItem = Keybinds[(int)ActionKey.Skill2]; cb_Skill2.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Skill2, cb_Skill2); cb_Skill3.DataSource = InputUtil.KeyboardKeys(); cb_Skill3.SelectedItem = Keybinds[(int)ActionKey.Skill3]; cb_Skill3.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Skill3, cb_Skill3); cb_Skill4.DataSource = InputUtil.KeyboardKeys(); cb_Skill4.SelectedItem = Keybinds[(int)ActionKey.Skill4]; cb_Skill4.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Skill4, cb_Skill4); cb_ForceStand.DataSource = InputUtil.KeyboardKeys(); cb_ForceStand.SelectedItem = Keybinds[(int)ActionKey.Unknown]; cb_ForceStand.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Unknown, cb_ForceStand); cb_ForceMove.DataSource = InputUtil.KeyboardKeys().Concat(InputUtil.MouseKeys()).ToList(); cb_ForceMove.SelectedItem = Keybinds[(int)ActionKey.Move]; cb_ForceMove.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Move, cb_ForceMove); cb_CloseWindows.DataSource = InputUtil.KeyboardKeys(); cb_CloseWindows.SelectedItem = Keybinds[(int)ActionKey.Close]; cb_CloseWindows.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Close, cb_CloseWindows); cb_Map.DataSource = InputUtil.KeyboardKeys(); cb_Map.SelectedItem = Keybinds[(int)ActionKey.Map]; cb_Map.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Map, cb_Map); cb_Potion.DataSource = InputUtil.KeyboardKeys(); cb_Potion.SelectedItem = Keybinds[(int)ActionKey.Heal]; cb_Potion.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Heal, cb_Potion); cb_Qol.DataSource = InputUtil.KeyboardKeys().Concat(InputUtil.MouseKeys()).ToList(); cb_Qol.SelectedItem = Keybinds[ConfigPersistence.QOL_KEY_INDEX]; cb_Qol.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig(ConfigPersistence.QOL_KEY_INDEX, cb_Qol); }
private void LoadConfig() { Keybinds = ConfigPersistence.LoadKeybinds(); Hotkeys = ConfigPersistence.LoadHotkeyContainer(); Hotkeys.InitializeIKeyEventsAndSort(Hud.Input); AutoActions = ConfigPersistence.LoadAutoActions(); profileToSkillDefinitionGroups = ConfigPersistence.LoadMasterProfiles(); SnoToDefinitionGroups = profileToSkillDefinitionGroups.FirstOrDefault().Value; SnoToDefinitionGroups.ForEach(def => skillsWithDefinitionGroupsDisplayValues.Add(Hud.Sno.GetSnoPower(def.Key))); }
private void b_EditDefinitionGroup_Click(object sender, EventArgs e) { if (!(lb_DefinitionGroupsForSkill.SelectedItem is DefinitionGroup currentlySelectedDefinitionGroup)) { return; } var modified = DefinitionGroupEditor.ShowDefinitionGroupEditor(currentlySelectedDefinitionGroup, Hud); if (modified) { ConfigPersistence.SaveDefinitionGroupsForSkill(SnoToDefinitionGroups[currentlySelectedDefinitionGroup.sno]); } }
private void b_DeleteSkillFromDefinitionGroups_Click(object sender, EventArgs e) { if (!(lb_skillsWithDefinitionGroups.SelectedItem is ISnoPower currentlySelectedSkill)) { return; } var result = Misc.AreYouSureDialogConfirmed( "Are you sure you want to delete all DefinitionGroups for skill " + currentlySelectedSkill.NameEnglish + "?"); if (!result) { return; } ConfigPersistence.DeleteSkillDefinitionGroups(SnoToDefinitionGroups[currentlySelectedSkill.Sno]); SnoToDefinitionGroups.Remove(currentlySelectedSkill.Sno); skillsWithDefinitionGroupsDisplayValues.Remove(currentlySelectedSkill); }
private void b_DeleteDefinitionGroup_Click(object sender, EventArgs e) { if (!(lb_DefinitionGroupsForSkill.SelectedItem is DefinitionGroup currentlySelectedDefinitionGroup)) { return; } var result = Misc.AreYouSureDialogConfirmed("Are you sure you want to delete the DefinitionGroup " + currentlySelectedDefinitionGroup.name + " and all of it's definitions?"); if (!result) { return; } selectedSkillDefinitionGroupsDisplayValues.Remove(currentlySelectedDefinitionGroup); var parentDefinitionGroups = SnoToDefinitionGroups[currentlySelectedDefinitionGroup.sno]; parentDefinitionGroups.definitionGroups.Remove(currentlySelectedDefinitionGroup); ConfigPersistence.DeleteDefinitionGroup(parentDefinitionGroups, currentlySelectedDefinitionGroup.name); }
private void InitializeAutoActions() { dgv_AutoActions.RowHeadersVisible = false; dgv_AutoActions.AllowUserToAddRows = false; dgv_AutoActions.AllowUserToResizeColumns = false; dgv_AutoActions.AllowUserToResizeRows = false; dgv_AutoActions.DefaultCellStyle.SelectionBackColor = dgv_AutoActions.DefaultCellStyle.BackColor; dgv_AutoActions.DefaultCellStyle.SelectionForeColor = dgv_AutoActions.DefaultCellStyle.ForeColor; var columns = DgvFormUtil.GetAutoActionsColumns(); columns.ForEach(column => dgv_AutoActions.Columns.Add(column)); dgv_AutoActions.CurrentCellDirtyStateChanged += (sender, args) => { if (dgv_AutoActions.IsCurrentCellDirty && dgv_AutoActions.CurrentCell.OwningColumn == dgv_AutoActions.Columns["active"] ) { dgv_AutoActions.CommitEdit(DataGridViewDataErrorContexts.Commit); } }; dgv_AutoActions.CellContentClick += (sender, args) => { if (args.RowIndex < 0 || args.ColumnIndex != dgv_AutoActions.Columns["active"]?.Index) { return; } var val = (DataGridViewCheckBoxCell)dgv_AutoActions.Rows[args.RowIndex].Cells["active"]; var isChecked = Convert.ToBoolean(val.Value); var autoAction = (AbstractAutoAction)dgv_AutoActions.Rows[args.RowIndex].DataBoundItem; autoAction.active = isChecked; ConfigPersistence.SaveAutoActions(AutoActions); }; dgv_AutoActions.CellClick += (sender, args) => { if (args.RowIndex < 0 || args.ColumnIndex != dgv_Hotkeys.Columns["edit"]?.Index) { return; } var autoAction = (AbstractAutoAction)dgv_AutoActions.Rows[args.RowIndex].DataBoundItem; if (string.IsNullOrWhiteSpace(autoAction?.attributes)) { return; } if (AutoActionEditor.EditAutoAction(autoAction)) { ConfigPersistence.SaveAutoActions(AutoActions); } dgv_AutoActions.Refresh(); }; dgv_AutoActions.CellMouseEnter += (sender, args) => { if (args.RowIndex < 0) { return; } var row = dgv_AutoActions.Rows[args.RowIndex]; row.Cells[args.ColumnIndex].ToolTipText = ((AbstractAutoAction)row.DataBoundItem).tooltip; }; autoActionBinding = new BindingSource(AutoActions.autoActions, null); dgv_AutoActions.DataSource = autoActionBinding; DgvFormUtil.AdjustDataGridViewColumns(dgv_AutoActions); }