private void OnClickRemove(object sender, EventArgs e) { if (TreeViewMulti.SelectedNode == null) { return; } MultiComponentList multi = (MultiComponentList)TreeViewMulti.SelectedNode.Tag; if (multi == MultiComponentList.Empty) { return; } int id = int.Parse(TreeViewMulti.SelectedNode.Name); DialogResult result = MessageBox.Show(string.Format("Are you sure to remove {0} (0x{0:X})", id), "Remove", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result != DialogResult.Yes) { return; } Ultima.Multis.Remove(id); TreeViewMulti.SelectedNode.Remove(); Options.ChangedUltimaClass["Multis"] = true; ControlEvents.FireMultiChangeEvent(this, id); }
private void OnClickReplace(object sender, EventArgs e) { if (_selected < 0) { return; } using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Multiselect = false; dialog.Title = "Choose image file to replace"; dialog.CheckFileExists = true; dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp"; if (dialog.ShowDialog() != DialogResult.OK) { return; } Bitmap bmp = new Bitmap(dialog.FileName); if (dialog.FileName.Contains(".bmp")) { bmp = Utils.ConvertBmp(bmp); } Textures.Replace(_selected, bmp); ControlEvents.FireTextureChangeEvent(this, _selected); pictureBox.Invalidate(); Options.ChangedUltimaClass["Texture"] = true; } }
private void OnClickReplace(object sender, EventArgs e) { if (listBox.SelectedItems.Count == 1) { using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Multiselect = false; dialog.Title = "Choose image file to replace"; dialog.CheckFileExists = true; dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp"; if (dialog.ShowDialog() == DialogResult.OK) { Bitmap bmp = new Bitmap(dialog.FileName); if (dialog.FileName.Contains(".bmp")) { bmp = Utils.ConvertBmp(bmp); } int i = int.Parse(listBox.Items[listBox.SelectedIndex].ToString()); Gumps.ReplaceGump(i, bmp); ControlEvents.FireGumpChangeEvent(this, i); listBox.Invalidate(); ListBox_SelectedIndexChanged(this, EventArgs.Empty); Options.ChangedUltimaClass["Gumps"] = true; } } } }
public override void Import(bool direct, ref Dictionary <string, bool> changedClasses) { if (!Remove) { Bitmap import = new Bitmap(File); if (File.Contains(".bmp")) { import = Utils.ConvertBmp(import); } Ultima.Art.ReplaceStatic(Index, import); } else { Ultima.Art.RemoveStatic(Index); } if (!direct) { ControlEvents.FireItemChangeEvent(this, Index); Options.ChangedUltimaClass["Art"] = true; } changedClasses["Art"] = true; }
private void CopyAddOnly_Click(object sender, EventArgs e) { for (int i = 0; i < 0x4000; i++) { if (!SecondTexture.IsValidTexture(i)) { continue; } if (Textures.TestTexture(i)) { continue; } Bitmap copy = new Bitmap(SecondTexture.GetTexture(i)); Textures.Replace(i, copy); ControlEvents.FireTextureChangeEvent(this, i); } _mCompare.Clear(); listBoxOrg.BeginUpdate(); listBoxOrg.Items.Clear(); List <object> cache = new List <object>(); for (int i = 0; i < 0x4000; i++) { cache.Add(i); } listBoxOrg.Items.AddRange(cache.ToArray()); listBoxOrg.EndUpdate(); }
public override void Import(bool direct, ref Dictionary <string, bool> changedClasses) { if (!Remove) { Ultima.Hues.List[Index].Import(File); } else { Ultima.Hues.List[Index].Name = ""; for (int i = 0; i < Ultima.Hues.List[Index].Colors.Length; ++i) { Ultima.Hues.List[Index].Colors[i] = -32767; } Ultima.Hues.List[Index].TableStart = -32768; Ultima.Hues.List[Index].TableEnd = -32768; } if (!direct) { ControlEvents.FireHueChangeEvent(); Options.ChangedUltimaClass["Hues"] = true; } changedClasses["Hues"] = true; }
private void OnClickReplace(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 1) { using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Multiselect = false; dialog.Title = "Choose image file to replace"; dialog.CheckFileExists = true; dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp"; if (dialog.ShowDialog() == DialogResult.OK) { Bitmap bmp = new Bitmap(dialog.FileName); if (dialog.FileName.Contains(".bmp")) { bmp = Utils.ConvertBmp(bmp); } int id = (int)listView1.SelectedItems[0].Tag; if (id == -1) { listView1.SelectedItems[0].Tag = id = listView1.SelectedItems[0].Index; } Art.ReplaceStatic(id, bmp); ControlEvents.FireItemChangeEvent(this, id); listView1.Invalidate(); UpdateDetail(id); Options.ChangedUltimaClass["Art"] = true; } } } }
private void OnClickRemove(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { return; } int i = (int)listView1.SelectedItems[0].Tag; DialogResult result = MessageBox.Show($"Are you sure to remove 0x{i:X}", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result != DialogResult.Yes) { return; } Textures.Remove(i); ControlEvents.FireTextureChangeEvent(this, i); i = listView1.SelectedItems[0].Index; listView1.SelectedItems[0].Selected = false; listView1.Items.RemoveAt(i); listView1.Invalidate(); Options.ChangedUltimaClass["Texture"] = true; }
public void ChangeMulti(int id, MultiComponentList multi) { if (multi == MultiComponentList.Empty) { return; } int index = _refMarker.TreeViewMulti.SelectedNode.Index; if (int.Parse(_refMarker.TreeViewMulti.SelectedNode.Name) != id) { for (int i = 0; i < _refMarker.TreeViewMulti.Nodes.Count; ++i) { if (int.Parse(_refMarker.TreeViewMulti.Nodes[i].Name) != id) { continue; } index = i; break; } } _refMarker.TreeViewMulti.Nodes[index].Tag = multi; _refMarker.TreeViewMulti.Nodes[index].ForeColor = Color.Black; if (index != _refMarker.TreeViewMulti.SelectedNode.Index) { _refMarker.TreeViewMulti.SelectedNode = _refMarker.TreeViewMulti.Nodes[index]; } AfterSelect_Multi(this, null); ControlEvents.FireMultiChangeEvent(this, index); }
private void OnClickRemove(object sender, EventArgs e) { if (_selected < 0) { return; } DialogResult result = MessageBox.Show($"Are you sure to remove 0x{_selected:X}", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result != DialogResult.Yes) { return; } Textures.Remove(_selected); ControlEvents.FireTextureChangeEvent(this, _selected); _textureList.Remove(_selected); --_selected; pictureBox.Invalidate(); Options.ChangedUltimaClass["Texture"] = true; }
/// <summary> /// Updates Map tab /// </summary> public static void ChangeMapSize() { if (Options.LoadedUltimaClass["Map"]) { Ultima.Map.Reload(); } ControlEvents.FireMapSizeChangeEvent(); }
private void OnClickCopy(object sender, EventArgs e) { if (listBoxSec.SelectedIndex == -1) { return; } int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString()); if (!SecondArt.IsValidStatic(i)) { return; } int staticLength = Art.GetMaxItemID() + 1; if (i >= staticLength) { return; } Bitmap copy = new Bitmap(SecondArt.GetStatic(i)); Art.ReplaceStatic(i, copy); Options.ChangedUltimaClass["Art"] = true; ControlEvents.FireItemChangeEvent(this, i); _mCompare[i] = true; listBoxOrg.BeginUpdate(); bool done = false; for (int id = 0; id < staticLength; id++) { if (id > i) { listBoxOrg.Items.Insert(id, i); done = true; break; } if (id == i) { done = true; break; } } if (!done) { listBoxOrg.Items.Add(i); } listBoxOrg.EndUpdate(); listBoxOrg.Invalidate(); listBoxSec.Invalidate(); OnIndexChangedOrg(this, null); }
public override void Import(bool direct, ref Dictionary <string, bool> changedClasses) { Ultima.TileData.LandTable[Index].ReadData(_tiledata); if (!direct) { Options.ChangedUltimaClass["TileData"] = true; ControlEvents.FireTileDataChangeEvent(this, Index); } changedClasses["TileData"] = true; }
private void OnClickCopy(object sender, EventArgs e) { if (listBoxSec.SelectedIndex == -1) { return; } int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString()); if (!SecondTexture.IsValidTexture(i)) { return; } Bitmap copy = new Bitmap(SecondTexture.GetTexture(i)); Textures.Replace(i, copy); Options.ChangedUltimaClass["Texture"] = true; ControlEvents.FireTextureChangeEvent(this, i); _mCompare[i] = true; listBoxOrg.BeginUpdate(); bool done = false; for (int id = 0; id < 0x4000; id++) { if (id > i) { listBoxOrg.Items.Insert(id, i); done = true; break; } if (id == i) { done = true; break; } } if (!done) { listBoxOrg.Items.Add(i); } listBoxOrg.EndUpdate(); listBoxOrg.Invalidate(); listBoxSec.Invalidate(); OnIndexChangedOrg(this, null); }
private void OnClickCopy(object sender, EventArgs e) { if (listBox2.SelectedIndex == -1) { return; } int i = (int)listBox2.Items[listBox2.SelectedIndex]; if (!SecondGump.IsValidIndex(i)) { return; } Bitmap copy = new Bitmap(SecondGump.GetGump(i)); Gumps.ReplaceGump(i, copy); Options.ChangedUltimaClass["Gumps"] = true; ControlEvents.FireGumpChangeEvent(this, i); _mCompare[i] = true; listBox1.BeginUpdate(); bool done = false; for (int id = 0; id < 0x10000; id++) { if (id > i) { listBox1.Items.Insert(id, i); done = true; break; } if (id == i) { done = true; break; } } if (!done) { listBox1.Items.Add(i); } listBox1.EndUpdate(); listBox1.Invalidate(); listBox2.Invalidate(); Listbox_SelectedChange(listBox1, null); }
private void OnClickReplace(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 1) { return; } using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Multiselect = false; dialog.Title = "Choose image file to replace"; dialog.CheckFileExists = true; dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp"; if (dialog.ShowDialog() != DialogResult.OK) { return; } Bitmap bmp = new Bitmap(dialog.FileName); if (bmp.Height != 44 || bmp.Width != 44) { MessageBox.Show("Height or Width Invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } if (dialog.FileName.Contains(".bmp")) { bmp = Utils.ConvertBmp(bmp); } int id = (int)listView1.SelectedItems[0].Tag; if (id == -1) { listView1.SelectedItems[0].Tag = id = listView1.SelectedItems[0].Index; } Art.ReplaceLand(id, bmp); ControlEvents.FireLandTileChangeEvent(this, id); listView1.Invalidate(); Options.ChangedUltimaClass["Art"] = true; } }
private void OnClickApplyHue1to2(object sender, EventArgs e) { if (!_hue2Loaded) { return; } Hue org = Hues.List[_selected]; Hue sec = SecondHue.List[_selected]; sec.Colors.CopyTo(org.Colors, 0); org.Name = sec.Name; org.TableStart = org.Colors[0]; org.TableEnd = org.Colors[org.Colors.Length - 1]; _compare[_selected] = true; PaintBox1(); PaintBox2(); Options.ChangedUltimaClass["Hues"] = true; ControlEvents.FireHueChangeEvent(); }
private void OnClickRemove(object sender, EventArgs e) { int i = int.Parse(listBox.Items[listBox.SelectedIndex].ToString()); DialogResult result = MessageBox.Show($"Are you sure to remove {i}", "Remove", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { Gumps.RemoveGump(i); ControlEvents.FireGumpChangeEvent(this, i); if (!_showFreeSlots) { listBox.Items.RemoveAt(listBox.SelectedIndex); } pictureBox.BackgroundImage = null; listBox.Invalidate(); Options.ChangedUltimaClass["Gumps"] = true; } }
private void OnClickReplace(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 1) { return; } using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Multiselect = false; dialog.Title = "Choose image file to replace"; dialog.CheckFileExists = true; dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp"; if (dialog.ShowDialog() != DialogResult.OK) { return; } Bitmap bmp = new Bitmap(dialog.FileName); if ((bmp.Width == 64 && bmp.Height == 64) || (bmp.Width == 128 && bmp.Height == 128)) { if (dialog.FileName.Contains(".bmp")) { bmp = Utils.ConvertBmp(bmp); } int i = (int)listView1.SelectedItems[0].Tag; Textures.Replace(i, bmp); ControlEvents.FireTextureChangeEvent(this, i); listView1.Invalidate(); ListView_SelectedIndexChanged(this, null); Options.ChangedUltimaClass["Texture"] = true; } else { MessageBox.Show("Height or Width Invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } }
private void OnClickApply(object sender, System.EventArgs e) { Options.RightPanelInSoundsTab = checkBoxPanelSoundsDesign.Checked; Files.CacheData = checkBoxCacheData.Checked; if (checkBoxNewMapSize.Checked != (Map.Felucca.Width == 7168)) { if (checkBoxNewMapSize.Checked) { Map.Felucca.Width = 7168; Map.Trammel.Width = 7168; } else { Map.Felucca.Width = 6144; Map.Trammel.Width = 6144; } MainForm.ChangeMapSize(); } if (checkBoxuseDiff.Checked != Map.UseDiff) { Map.UseDiff = checkBoxuseDiff.Checked; ControlEvents.FireMapDiffChangeEvent(); } if (numericUpDownItemSizeWidth.Value != Options.ArtItemSizeWidth || numericUpDownItemSizeHeight.Value != Options.ArtItemSizeHeight) { Options.ArtItemSizeWidth = (int)numericUpDownItemSizeWidth.Value; Options.ArtItemSizeHeight = (int)numericUpDownItemSizeHeight.Value; MainForm.ReloadItemTab(); } if (checkBoxItemClip.Checked != Options.ArtItemClip) { Options.ArtItemClip = checkBoxItemClip.Checked; MainForm.ReloadItemTab(); } if (map0Nametext.Text != Options.MapNames[0] || map1Nametext.Text != Options.MapNames[1] || map2Nametext.Text != Options.MapNames[2] || map3Nametext.Text != Options.MapNames[3] || map4Nametext.Text != Options.MapNames[4] || map5Nametext.Text != Options.MapNames[5]) { Options.MapNames[0] = map0Nametext.Text; Options.MapNames[1] = map1Nametext.Text; Options.MapNames[2] = map2Nametext.Text; Options.MapNames[3] = map3Nametext.Text; Options.MapNames[4] = map4Nametext.Text; Options.MapNames[5] = map5Nametext.Text; ControlEvents.FireMapNameChangeEvent(); } Options.MapCmd = cmdtext.Text; Options.MapArgs = argstext.Text; if (Directory.Exists(textBoxOutputPath.Text)) { Options.OutputPath = textBoxOutputPath.Text; } }
private void Poll() { while (!_isDisposed) { var state = new XInputApi.XINPUT_STATE(); var result = XInputApi.XInputGetState(0, state); var lastResult = _lastResult; _lastResult = result; if (_isDisposed) { break; } if (result != XInputApi.ERROR_SUCCESS) { if (result != lastResult) { if (result == XInputApi.ERROR_DEVICE_NOT_CONNECTED) { Console.WriteLine("No XInput gamepad connected."); } else { Console.WriteLine("Unexpected error result from XInputGetState: " + result); } } Thread.Sleep(1000); continue; } if (result != lastResult) { Console.WriteLine("XInput gamepad connected."); // Wait a second after connection to give JsPie a chance to initialize so that the queue does not back up Thread.Sleep(1000); continue; } if (_lastPacketNumber == state.dwPacketNumber) { Thread.Sleep(5); continue; } _lastPacketNumber = state.dwPacketNumber; var events = (List <ControlEvent>)null; var gamepad = state.Gamepad; foreach (var button in _controlSet.ButtonControls) { ProcessEvent(button.UpdateValue(gamepad.wButtons), ref events); } ProcessEvent(_controlSet.LeftTriggerControl.UpdateValue(gamepad.bLeftTrigger), ref events); ProcessEvent(_controlSet.RightTriggerControl.UpdateValue(gamepad.bRightTrigger), ref events); ProcessEvent(_controlSet.LeftThumbXControl.UpdateValue(gamepad.sThumbLX), ref events); ProcessEvent(_controlSet.LeftThumbYControl.UpdateValue(gamepad.sThumbLY), ref events); ProcessEvent(_controlSet.RightThumbXControl.UpdateValue(gamepad.sThumbRX), ref events); ProcessEvent(_controlSet.RightThumbYControl.UpdateValue(gamepad.sThumbRY), ref events); if (events != null) { ControlEvents?.Invoke(this, events); } Thread.Sleep(5); } }
private void Restart(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; Ultima.Verdata.Initialize(); if (Options.LoadedUltimaClass["TileData"]) { Ultima.TileData.Initialize(); } if (Options.LoadedUltimaClass["Hues"]) { Ultima.Hues.Initialize(); } if (Options.LoadedUltimaClass["ASCIIFont"]) { Ultima.ASCIIText.Initialize(); } if (Options.LoadedUltimaClass["UnicodeFont"]) { Ultima.UnicodeFonts.Initialize(); } if (Options.LoadedUltimaClass["Animdata"]) { Ultima.Animdata.Initialize(); } if (Options.LoadedUltimaClass["Light"]) { Ultima.Light.Reload(); } if (Options.LoadedUltimaClass["Skills"]) { Ultima.Skills.Reload(); } if (Options.LoadedUltimaClass["Sound"]) { Ultima.Sounds.Initialize(); } if (Options.LoadedUltimaClass["Texture"]) { Ultima.Textures.Reload(); } if (Options.LoadedUltimaClass["Gumps"]) { Ultima.Gumps.Reload(); } if (Options.LoadedUltimaClass["Animations"]) { Ultima.Animations.Reload(); } if (Options.LoadedUltimaClass["Art"]) { Ultima.Art.Reload(); } if (Options.LoadedUltimaClass["RadarColor"]) { Ultima.RadarCol.Initialize(); } if (Options.LoadedUltimaClass["Map"]) { Ultima.Files.CheckForNewMapSize(); Ultima.Map.Reload(); } if (Options.LoadedUltimaClass["Multis"]) { Ultima.Multis.Reload(); } if (Options.LoadedUltimaClass["Speech"]) { Ultima.SpeechList.Initialize(); } if (Options.LoadedUltimaClass["AnimationEdit"]) { Ultima.AnimationEdit.Reload(); } ControlEvents.FireFilePathChangeEvent(); Cursor.Current = Cursors.Default; }
private void OnClickAlwaysTop(object sender, EventArgs e) { TopMost = AlwaysOnTopMenuitem.Checked; ControlEvents.FireAlwaysOnTopChangeEvent(TopMost); }
/// <summary> /// Export to given multi id /// </summary> public void AddToSdkComponentList(int id) { Multis.Add(id, ConvertToSdk()); Options.ChangedUltimaClass["Multis"] = true; ControlEvents.FireMultiChangeEvent(this, id); }