Exemple #1
0
 public override void DrawEditorMenu()
 {
     // Menu Options
     if (ImGui.BeginMenu("Edit"))
     {
         if (ImGui.MenuItem("Undo", "Ctrl+Z", false, EditorActionManager.CanUndo()))
         {
             EditorActionManager.UndoAction();
         }
         if (ImGui.MenuItem("Redo", "Ctrl+Y", false, EditorActionManager.CanRedo()))
         {
             EditorActionManager.RedoAction();
         }
         if (ImGui.MenuItem("Copy", "Ctrl+C", false, _activeView._selection.rowSelectionExists()))
         {
             CopySelectionToClipboard();
         }
         if (ImGui.MenuItem("Paste", "Ctrl+V", false, _clipboardRows.Any()))
         {
             EditorCommandQueue.AddCommand($@"param/menu/ctrlVPopup");
         }
         ImGui.Separator();
         if (ImGui.MenuItem("Mass Edit"))
         {
             EditorCommandQueue.AddCommand($@"param/menu/massEditRegex");
         }
         if (ImGui.BeginMenu("Export CSV", _activeView._selection.rowSelectionExists()))
         {
             if (ImGui.MenuItem("All"))
             {
                 EditorCommandQueue.AddCommand($@"param/menu/massEditCSVExport");
             }
             if (ImGui.MenuItem("Name"))
             {
                 EditorCommandQueue.AddCommand($@"param/menu/massEditSingleCSVExport/Name");
             }
             if (ImGui.BeginMenu("Field"))
             {
                 foreach (PARAMDEF.Field field in ParamBank.Params[_activeView._selection.getActiveParam()].AppliedParamdef.Fields)
                 {
                     if (ImGui.MenuItem(field.InternalName))
                     {
                         EditorCommandQueue.AddCommand($@"param/menu/massEditSingleCSVExport/{field.InternalName}");
                     }
                 }
                 ImGui.EndMenu();
             }
             ImGui.EndMenu();
         }
         if (ImGui.BeginMenu("Import CSV", _activeView._selection.paramSelectionExists()))
         {
             if (ImGui.MenuItem("All"))
             {
                 EditorCommandQueue.AddCommand($@"param/menu/massEditCSVImport");
             }
             if (ImGui.MenuItem("Name"))
             {
                 EditorCommandQueue.AddCommand($@"param/menu/massEditSingleCSVImport/Name");
             }
             if (ImGui.BeginMenu("Field"))
             {
                 foreach (PARAMDEF.Field field in ParamBank.Params[_activeView._selection.getActiveParam()].AppliedParamdef.Fields)
                 {
                     if (ImGui.MenuItem(field.InternalName))
                     {
                         EditorCommandQueue.AddCommand($@"param/menu/massEditSingleCSVImport/{field.InternalName}");
                     }
                 }
                 ImGui.EndMenu();
             }
             ImGui.EndMenu();
         }
         if (ImGui.MenuItem("Sort rows by ID", _activeView._selection.paramSelectionExists()))
         {
             MassParamEditOther.SortRows(_activeView._selection.getActiveParam(), EditorActionManager);
         }
         ImGui.EndMenu();
     }
     if (ImGui.BeginMenu("View"))
     {
         if (ImGui.MenuItem("New View"))
         {
             AddView();
         }
         if (ImGui.MenuItem("Close View", null, false, CountViews() > 1))
         {
             RemoveView(_activeView);
         }
         ImGui.Separator();
         if (ImGui.MenuItem("Check all params for edits (Slow!)", null, false, !ParamBank.IsLoadingVParams))
         {
             ParamBank.refreshParamDirtyCache();
         }
         ImGui.Separator();
         if (ImGui.MenuItem("Show alternate field names", null, ShowAltNamesPreference))
         {
             ShowAltNamesPreference = !ShowAltNamesPreference;
         }
         if (ImGui.MenuItem("Always show original field names", null, AlwaysShowOriginalNamePreference))
         {
             AlwaysShowOriginalNamePreference = !AlwaysShowOriginalNamePreference;
         }
         if (ImGui.MenuItem("Hide field references", null, HideReferenceRowsPreference))
         {
             HideReferenceRowsPreference = !HideReferenceRowsPreference;
         }
         if (ImGui.MenuItem("Hide field enums", null, HideEnumsPreference))
         {
             HideEnumsPreference = !HideEnumsPreference;
         }
         if (ImGui.MenuItem("Allow field reordering", null, AllowFieldReorderPreference))
         {
             AllowFieldReorderPreference = !AllowFieldReorderPreference;
         }
         ImGui.Separator();
         if (!EditorMode && ImGui.MenuItem("Editor Mode", null, EditorMode))
         {
             EditorMode = true;
         }
         if (EditorMode && ImGui.BeginMenu("Editor Mode"))
         {
             if (ImGui.MenuItem("Save Changes"))
             {
                 ParamMetaData.SaveAll();
                 EditorMode = false;
             }
             if (ImGui.MenuItem("Discard Changes"))
             {
                 EditorMode = false;
             }
             ImGui.EndMenu();
         }
         ImGui.EndMenu();
     }
     if (ImGui.BeginMenu("Game"))
     {
         if (ImGui.MenuItem("Hot Reload Params", "F5", false, _projectSettings != null && _projectSettings.GameType == GameType.DarkSoulsIII && ParamBank.IsLoadingParams == false))
         {
             ParamReloader.ReloadMemoryParamsDS3();
         }
         string activeParam = _activeView._selection.getActiveParam();
         if (activeParam != null && _projectSettings.GameType == GameType.DarkSoulsIII)
         {
             ParamReloader.GiveItemMenu(_activeView._selection.getSelectedRows(), _activeView._selection.getActiveParam());
         }
         ImGui.EndMenu();
     }
 }
 public override void DrawEditorMenu()
 {
     // Menu Options
     if (ImGui.BeginMenu("Edit"))
     {
         if (ImGui.MenuItem("Undo", "Ctrl+Z", false, EditorActionManager.CanUndo()))
         {
             EditorActionManager.UndoAction();
         }
         if (ImGui.MenuItem("Redo", "Ctrl+Y", false, EditorActionManager.CanRedo()))
         {
             EditorActionManager.RedoAction();
         }
         if (ImGui.MenuItem("Copy", "Ctrl+C", false, _activeView._selection.rowSelectionExists()))
         {
             _clipboardParam = _activeView._selection.getActiveParam();
             _clipboardRows.Clear();
             long baseValue = long.MaxValue;
             foreach (PARAM.Row r in _activeView._selection.getSelectedRows())
             {
                 _clipboardRows.Add(new PARAM.Row(r));// make a clone
                 if (r.ID < baseValue)
                 {
                     baseValue = r.ID;
                 }
             }
             _clipboardBaseRow  = baseValue;
             _currentCtrlVValue = _clipboardBaseRow.ToString();
         }
         if (ImGui.MenuItem("Paste", "Ctrl+V", false, _clipboardRows.Any()))
         {
             EditorCommandQueue.AddCommand($@"param/menu/ctrlVPopup");
         }
         if (ImGui.MenuItem("Mass Edit", null, false, true))
         {
             EditorCommandQueue.AddCommand($@"param/menu/massEditRegex");
         }
         if (ImGui.BeginMenu("Export CSV", _activeView._selection.paramSelectionExists()))
         {
             if (ImGui.MenuItem("All", null, false, _activeView._selection.paramSelectionExists()))
             {
                 EditorCommandQueue.AddCommand($@"param/menu/massEditCSVExport");
             }
             if (ImGui.MenuItem("Name", null, false, _activeView._selection.paramSelectionExists()))
             {
                 EditorCommandQueue.AddCommand($@"param/menu/massEditSingleCSVExport/Name");
             }
             if (ImGui.BeginMenu("Field"))
             {
                 foreach (PARAMDEF.Field field in ParamBank.Params[_activeView._selection.getActiveParam()].AppliedParamdef.Fields)
                 {
                     if (ImGui.MenuItem(field.DisplayName))
                     {
                         EditorCommandQueue.AddCommand($@"param/menu/massEditSingleCSVExport/{field.InternalName}");
                     }
                 }
                 ImGui.EndMenu();
             }
             ImGui.EndMenu();
         }
         if (ImGui.BeginMenu("Import CSV", _activeView._selection.paramSelectionExists()))
         {
             if (ImGui.MenuItem("All", null, false, _activeView._selection.paramSelectionExists()))
             {
                 EditorCommandQueue.AddCommand($@"param/menu/massEditCSVImport");
             }
             if (ImGui.MenuItem("Name", null, false, _activeView._selection.paramSelectionExists()))
             {
                 EditorCommandQueue.AddCommand($@"param/menu/massEditSingleCSVImport/Name");
             }
             if (ImGui.BeginMenu("Field"))
             {
                 foreach (PARAMDEF.Field field in ParamBank.Params[_activeView._selection.getActiveParam()].AppliedParamdef.Fields)
                 {
                     if (ImGui.MenuItem(field.DisplayName))
                     {
                         EditorCommandQueue.AddCommand($@"param/menu/massEditSingleCSVImport/{field.InternalName}");
                     }
                 }
                 ImGui.EndMenu();
             }
             ImGui.EndMenu();
         }
         ImGui.EndMenu();
     }
     if (ImGui.BeginMenu("View"))
     {
         if (ImGui.MenuItem("New View"))
         {
             AddView();
         }
         if (ImGui.MenuItem("Close View", null, false, CountViews() > 1))
         {
             RemoveView(_activeView);
         }
         if (ImGui.MenuItem("Show alternate field names", null, ShowAltNamesPreference))
         {
             ShowAltNamesPreference = !ShowAltNamesPreference;
         }
         if (ImGui.MenuItem("Always show original field names", null, AlwaysShowOriginalNamePreference))
         {
             AlwaysShowOriginalNamePreference = !AlwaysShowOriginalNamePreference;
         }
         if (ImGui.MenuItem("Hide field references", null, HideReferenceRowsPreference))
         {
             HideReferenceRowsPreference = !HideReferenceRowsPreference;
         }
         if (ImGui.MenuItem("Hide field enums", null, HideEnumsPreference))
         {
             HideEnumsPreference = !HideEnumsPreference;
         }
         if (ImGui.MenuItem("Allow field reordering", null, AllowFieldReorderPreference))
         {
             AllowFieldReorderPreference = !AllowFieldReorderPreference;
         }
         if (!EditorMode && ImGui.MenuItem("Editor Mode", null, EditorMode))
         {
             EditorMode = true;
         }
         if (EditorMode && ImGui.BeginMenu("Editor Mode"))
         {
             if (ImGui.MenuItem("Save Changes"))
             {
                 ParamMetaData.SaveAll();
                 EditorMode = false;
             }
             if (ImGui.MenuItem("Discard Changes"))
             {
                 EditorMode = false;
             }
             ImGui.EndMenu();
         }
         ImGui.EndMenu();
     }
     if (ImGui.BeginMenu("Game"))
     {
         if (ImGui.MenuItem("Hot Reload Params", "F5", false, _projectSettings != null && _projectSettings.GameType == GameType.DarkSoulsIII && ParamBank.IsLoading == false))
         {
             ParamReloader.ReloadMemoryParamsDS3();
         }
         string activeParam = _activeView._selection.getActiveParam();
         if (activeParam != null && _projectSettings.GameType == GameType.DarkSoulsIII)
         {
             if (SoulsMemoryHandler.ItemGibOffsetsDS3.ContainsKey(activeParam))
             {
                 if (ImGui.MenuItem("Spawn Selected Items In Game"))
                 {
                     ParamReloader.GiveItemDS3(_activeView._selection.getSelectedRows(), activeParam, activeParam == "EquipParamGoods" ? (int)numberOfItemsToGive : 1, activeParam == "EquipParamWeapon" ? (int)upgradeLevelItemToGive : 0);
                 }
                 if (activeParam == "EquipParamGoods")
                 {
                     string itemsNum = numberOfItemsToGive.ToString();
                     ImGui.Indent();
                     ImGui.Text("Number of Spawned Items");
                     ImGui.SameLine();
                     if (ImGui.InputText("##Number of Spawned Items", ref itemsNum, (uint)2))
                     {
                         if (uint.TryParse(itemsNum, out uint result) && result != 0)
                         {
                             numberOfItemsToGive = result;
                         }
                     }
                 }
                 else if (activeParam == "EquipParamWeapon")
                 {
                     ImGui.Text("Spawned Weapon Level");
                     ImGui.SameLine();
                     string weaponLevel = upgradeLevelItemToGive.ToString();
                     if (ImGui.InputText("##Spawned Weapon Level", ref weaponLevel, (uint)2))
                     {
                         if (uint.TryParse(weaponLevel, out uint result) && result < 11)
                         {
                             upgradeLevelItemToGive = result;
                         }
                     }
                 }
                 ImGui.Unindent();
             }
         }
         ImGui.EndMenu();
     }
 }