private void editOverheadMessage_Click(object sender, EventArgs e) { if (cliLocOverheadView.SelectedItems.Count == 0) { return; } ListViewItem selectedItem = cliLocOverheadView.SelectedItems[0]; string oldMessage = selectedItem.SubItems[1].Text; //ListViewItem item = new ListViewItem(newItemText); if (InputBox.Show(this, "Enter Overhead Text", "Enter text to display overhead", oldMessage)) { string newMessage = InputBox.GetString(); if (string.IsNullOrEmpty(newMessage)) { return; } selectedItem.SubItems[1].Text = newMessage; foreach (Core.OverheadMessages.OverheadMessage list in Core.OverheadMessages.OverheadMessageList) { if (list.MessageOverhead.Equals(oldMessage)) { list.MessageOverhead = newMessage; break; } } } }
private void setAlias_Click(object sender, EventArgs e) { if (containerView.SelectedItems.Count > 0) { ListViewItem selectedItem = containerView.Items[containerView.SelectedIndices[0]]; if (InputBox.Show(this, Language.GetString(LocString.SetContainerLabel), Language.GetString(LocString.EnterAName))) { string name = InputBox.GetString(); selectedItem.SubItems[3].Text = name; foreach (Core.ContainerLabels.ContainerLabel list in Core.ContainerLabels.ContainerLabelList) { if (list.Id.Equals(selectedItem.Text)) { list.Alias = name; break; } } foreach (Core.ContainerLabels.ContainerLabel list in NewContainerEntries) { if (list.Id.Equals(selectedItem.Text)) { list.Alias = name; break; } } } } }
/// //////////////////////////////////////////////// private void SaveAsNewListe(object sender, EventArgs e) { string strNom = ""; bool bBoucle = true; while (bBoucle) { bBoucle = InputBox.GetString(ref strNom, I.T("List name|30123")); if (bBoucle) { bBoucle = false; CListeEntites liste = new CListeEntites(CSc2iWin32DataClient.ContexteCourant); liste.CreateNew(); liste.Libelle = strNom; liste.ElementsLies = ElementSelectionnes; CResultAErreur result = liste.VerifieDonnees(true); if (result) { result = liste.CommitEdit(); } if (!result) { CFormAlerte.Afficher(result.Erreur); bBoucle = true; } else { CFormAlerte.Afficher(I.T("List saved as '@1'|30124", strNom)); } } } }
private void closeFrame() { if (game.IsOver()) { String topLine = Files.getTop(); int score = game.getScore(); if (topLine == "") { String name = InputBox.GetString(); Files.changeTop(score, name); } else { if (int.Parse(topLine.Split(' ')[0]) < score) { String name = InputBox.GetString(); Files.changeTop(score, name); } else { MessageBox.Show("Ваш результат: " + score + "\r\nЛучший результат: " + int.Parse(topLine.Split(' ')[0]), "Игра окончена", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } Dispose(); }
private void setOverheadMessage_Click(object sender, EventArgs e) { int hueIdx = Config.GetInt("SysColor"); string newItemText = string.Empty; if (string.IsNullOrEmpty(cliLocTextSearch.Text)) { return; } if (cliLocSearchView.SelectedItems.Count > 0) { ListViewItem selectedItem = cliLocSearchView.SelectedItems[0]; newItemText = selectedItem.SubItems[1].Text; } else { newItemText = cliLocTextSearch.Text; } ListViewItem item = new ListViewItem(newItemText); if (InputBox.Show(this, "Enter text to display overhead", newItemText)) { string overheadMessage = InputBox.GetString(); item.SubItems.Add(new ListViewItem.ListViewSubItem(item, overheadMessage)); if (hueIdx > 0 && hueIdx < 3000) { item.SubItems[1].BackColor = Hues.GetHue(hueIdx - 1).GetColor(HueEntry.TextHueIDX); } else { item.SubItems[1].BackColor = SystemColors.Control; } item.SubItems[1].ForeColor = (item.SubItems[1].BackColor.GetBrightness() < 0.35 ? Color.White : Color.Black); item.UseItemStyleForSubItems = false; cliLocOverheadView.SafeAction(s => s.Items.Add(item)); NewOverheadEntries.Add(new Core.OverheadMessages.OverheadMessage { SearchMessage = newItemText, Hue = hueIdx, MessageOverhead = overheadMessage }); } }
private void AddFilter_Click(object sender, EventArgs e) { if (InputBox.Show(this, "Filter Buff/Debuff", "Enter part or the whole name of the buff to filter it from showing overhead")) { string name = InputBox.GetString(); if (!string.IsNullOrEmpty(name)) { buffDebuffFilters.Items.Add(name); } } SaveFilter(); }
private void OnContainerLabelAddTarget(bool ground, Serial serial, Point3D pt, ushort gfx) { TargetInfo t = new TargetInfo { Gfx = gfx, Serial = serial, Type = (byte)(ground ? 1 : 0), X = pt.X, Y = pt.Y, Z = pt.Z }; if (t != null && t.Serial.IsItem) { Item item = World.FindItem(t.Serial); if (!item.IsContainer) { // must be a container World.Player.SendMessage(MsgLevel.Force, "You must select a container"); } else { // add it World.Player.SendMessage(MsgLevel.Force, "Container selected, add label text in Razor"); if (InputBox.Show(this, Language.GetString(LocString.SetContainerLabel), Language.GetString(LocString.EnterAName))) { string name = InputBox.GetString(); ListViewItem lvItem = new ListViewItem($"{t.Serial.Value}"); lvItem.SubItems.Add(new ListViewItem.ListViewSubItem(lvItem, item.Name)); lvItem.SubItems.Add(new ListViewItem.ListViewSubItem(lvItem, name)); lvItem.SubItems.Add(new ListViewItem.ListViewSubItem(lvItem, string.Empty)); int hueIdx = Config.GetInt("ContainerLabelColor"); if (hueIdx > 0 && hueIdx < 3000) { lvItem.SubItems[2].BackColor = Ultima.Hues.GetHue(hueIdx - 1).GetColor(HueEntry.TextHueIDX); } else { lvItem.SubItems[2].BackColor = SystemColors.Control; } lvItem.SubItems[2].ForeColor = (lvItem.SubItems[2].BackColor.GetBrightness() < 0.35 ? Color.White : Color.Black); lvItem.UseItemStyleForSubItems = false; containerView.SafeAction(s => s.Items.Add(lvItem)); NewContainerEntries.Add(new Core.ContainerLabels.ContainerLabel { Hue = hueIdx, Id = $"{t.Serial.Value}", Label = name, Type = item.Name }); World.Player.SendMessage(MsgLevel.Force, $"Container {item} labeled as '{name}'"); Show(); } } } else if (t != null && t.Serial.IsMobile) { World.Player.SendMessage(MsgLevel.Force, "You shouldn't label other people"); } }
public override void OnButtonPress(int num) { ConfigItem item = listBox.SelectedItem as ConfigItem; if (item == null) { return; } if (item.Value is string) { if (InputBox.Show("Input string") && !string.IsNullOrEmpty(InputBox.GetString())) { item.Value = InputBox.GetString(); } } else if (item.Value is bool) { item.Value = !(bool)item.Value; } else if (item.Value is uint) { Targeting.OneTimeTarget((l, s, p, g) => { item.Value = s == World.Player.Serial ? 0 : s.Value; listBox.Items[listBox.SelectedIndex] = item; }); } else if (item.Value is byte) { if (InputBox.Show("Input value") && (InputBox.GetInt(-1) >= 0 || InputBox.GetInt(-1) <= 100)) { item.Value = (byte)InputBox.GetInt(-1); } } else if (item.Value is ushort) { HueEntry hueEntry = new HueEntry((ushort)item.Value); if (hueEntry.ShowDialog(Engine.MainWindow) == DialogResult.OK) { item.Value = (ushort)hueEntry.Hue; } } else if (item.Value.GetType().IsEnum) { Type type = item.Value.GetType(); int value = (int)item.Value; while (!Enum.IsDefined(type, ++value)) { if (value >= Enum.GetValues(type).Length) { value = -1; } } item.Value = Enum.ToObject(type, value); } else { throw new NotImplementedException(); } listBox.Items[listBox.SelectedIndex] = item; }