private void OpenEditor(ParamEntry entry, ListViewItem SelectedItem) { EditBox editor = new EditBox(); editor.LoadEntry(entry); editor.ToggleNameEditing(true); if (editor.ShowDialog() == DialogResult.OK) { editor.SaveEntry(); SetListItemParamObject(entry, SelectedItem); } }
private void OpenEditor(object sender, EventArgs e) { MessageBox.Show("Editing v2 AAMP not supported yet. Only v1", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; EditBox editor = new EditBox(); editor.LoadEntry(entry); if (editor.ShowDialog() == DialogResult.OK) { editor.SaveEntry(); switch (entry.ParamType) { case ParamType.Boolean: case ParamType.Float: case ParamType.Int: case ParamType.Uint: case ParamType.String64: case ParamType.String32: case ParamType.String256: case ParamType.StringRef: Text = $"{entry.HashString} {entry.Value}"; break; case ParamType.Vector2F: var vec2 = (Vector2F)entry.Value; Text = $"{entry.HashString} {vec2.X} {vec2.Y}"; break; case ParamType.Vector3F: var vec3 = (Vector3F)entry.Value; Text = $"{entry.HashString} {vec3.X} {vec3.Y} {vec3.Z}"; break; case ParamType.Vector4F: var vec4 = (Vector4F)entry.Value; Text = $"{entry.HashString} {vec4.X} {vec4.Y} {vec4.Z} {vec4.W}"; break; case ParamType.Color4F: var col = (Vector4F)entry.Value; Text = $"{entry.HashString} {col.X} {col.Y} {col.Z} {col.W}"; break; } } }
private void OpenEditor(object sender, EventArgs e) { EditBox editor = new EditBox(); editor.LoadEntry(entry); if (editor.ShowDialog() == DialogResult.OK) { editor.SaveEntry(); switch (entry.ParamType) { case ParamType.Boolean: case ParamType.Float: case ParamType.Int: case ParamType.Uint: case ParamType.String64: case ParamType.String32: case ParamType.String256: case ParamType.StringRef: Text = $"{entry.HashString} {entry.Value}"; break; case ParamType.Vector2F: var vec2 = (Vector2F)entry.Value; Text = $"{entry.HashString} {vec2.X} {vec2.Y}"; break; case ParamType.Vector3F: var vec3 = (Vector3F)entry.Value; Text = $"{entry.HashString} {vec3.X} {vec3.Y} {vec3.Z}"; break; case ParamType.Vector4F: var vec4 = (Vector4F)entry.Value; Text = $"{entry.HashString} {vec4.X} {vec4.Y} {vec4.Z} {vec4.W}"; break; case ParamType.Color4F: var col = (Vector4F)entry.Value; Text = $"{entry.HashString} {col.X} {col.Y} {col.Z} {col.W}"; break; } } }
private void OpenNewParamEditor(ParamEntry entry, ParamObject paramObject, ListViewItem SelectedItem) { EditBox editor = new EditBox(); editor.LoadEntry(entry); editor.ToggleNameEditing(true); if (editor.ShowDialog() == DialogResult.OK) { editor.SaveEntry(); SetListItemParamObject(entry, SelectedItem); listViewCustom1.Items.Add(SelectedItem); var entryList = new List <ParamEntry>(); for (int i = 0; i < paramObject.paramEntries.Length; i++) { entryList.Add(paramObject.paramEntries[i]); } entryList.Add(entry); paramObject.paramEntries = entryList.ToArray(); } }
private void SetListItemParamObject(ParamEntry entry, ListViewItem item) { item.SubItems.Clear(); item.Text = entry.HashString; item.Tag = entry; item.UseItemStyleForSubItems = false; item.SubItems.Add(entry.ParamType.ToString()); string ValueText = ""; System.Drawing.Color color = System.Drawing.Color.Empty; switch (entry.ParamType) { case ParamType.Boolean: case ParamType.Float: case ParamType.Int: case ParamType.Uint: ValueText = $"{entry.Value}"; break; case ParamType.String64: case ParamType.String32: case ParamType.String256: case ParamType.StringRef: ValueText = $"{((AampCommon.StringEntry)entry.Value).ToString()}"; break; case ParamType.Vector2F: var vec2 = (Vector2F)entry.Value; ValueText = $"{vec2.X} {vec2.Y}"; break; case ParamType.Vector3F: var vec3 = (Vector3F)entry.Value; ValueText = $"{vec3.X} {vec3.Y} {vec3.Z}"; break; case ParamType.Vector4F: var vec4 = (Vector4F)entry.Value; ValueText = $"{vec4.X} {vec4.Y} {vec4.Z} {vec4.W}"; break; case ParamType.Color4F: var col = (Vector4F)entry.Value; ValueText = $"{col.X} {col.Y} {col.Z} {col.W}"; int ImageIndex = Images.Count; color = System.Drawing.Color.FromArgb( EditBox.FloatToIntClamp(col.W), EditBox.FloatToIntClamp(col.X), EditBox.FloatToIntClamp(col.Y), EditBox.FloatToIntClamp(col.Z)); break; default: break; } item.SubItems.Add(ValueText); if (color != System.Drawing.Color.Empty) { item.SubItems[2].BackColor = color; } }
void SetObjNode(ParamObject paramObj, TreeNode parentNode) { string name = paramObj.HashString; string groupName = paramObj.GroupHashString; var objNode = new TreeNode(name); parentNode.Nodes.Add(objNode); foreach (var entry in paramObj.paramEntries) { var entryNode = new EditableEntry($"{entry.HashString}"); entryNode.ImageIndex = 0; entryNode.ImageKey = "empty"; entryNode.SelectedImageKey = "empty"; switch (entry.ParamType) { case ParamType.Boolean: case ParamType.Float: case ParamType.Int: case ParamType.Uint: case ParamType.String64: case ParamType.String32: case ParamType.String256: case ParamType.StringRef: entryNode.Text = $"{entry.HashString} {entry.Value}"; break; case ParamType.Vector2F: var vec2 = (Vector2F)entry.Value; entryNode.Text = $"{entry.HashString} {vec2.X} {vec2.Y}"; break; case ParamType.Vector3F: var vec3 = (Vector3F)entry.Value; entryNode.Text = $"{entry.HashString} {vec3.X} {vec3.Y} {vec3.Z}"; break; case ParamType.Vector4F: var vec4 = (Vector4F)entry.Value; entryNode.Text = $"{entry.HashString} {vec4.X} {vec4.Y} {vec4.Z} {vec4.W}"; break; case ParamType.Color4F: var col = (Vector4F)entry.Value; entryNode.Text = $"{entry.HashString} {col.X} {col.Y} {col.Z} {col.W}"; int ImageIndex = Images.Count; entryNode.ImageIndex = ImageIndex; var color = System.Drawing.Color.FromArgb( EditBox.FloatToIntClamp(col.W), EditBox.FloatToIntClamp(col.X), EditBox.FloatToIntClamp(col.Y), EditBox.FloatToIntClamp(col.Z)); Bitmap bmp = new Bitmap(32, 32); Graphics g = Graphics.FromImage(bmp); g.Clear(color); Images.Add(bmp); break; default: break; } entryNode.entry = entry; objNode.Nodes.Add(entryNode); } }