mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-12-15 10:11:35 +08:00
Update Command text box to ComboBox
Update ru translate Update Modifier keys function
This commit is contained in:
@@ -445,13 +445,13 @@ namespace GrasscutterTools.Forms
|
||||
MessageBox.Show(Resources.CommandTagCannotBeEmpty, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(TxtCommand.Text))
|
||||
if (string.IsNullOrWhiteSpace(CmbCommand.Text))
|
||||
{
|
||||
MessageBox.Show(Resources.CommandContentCannotBeEmpty, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var name = TxtCustomName.Text.Trim();
|
||||
var command = TxtCommand.Text.Trim();
|
||||
var command = CmbCommand.Text.Trim();
|
||||
|
||||
foreach (LinkLabel lnk in FLPCustomCommands.Controls)
|
||||
{
|
||||
@@ -959,7 +959,7 @@ namespace GrasscutterTools.Forms
|
||||
{
|
||||
if (GenGiveItemCommand())
|
||||
{
|
||||
var cmd = new GameCommand($"{ListGameItems.SelectedItem} x{NUDGameItemAmout.Value}", TxtCommand.Text);
|
||||
var cmd = new GameCommand($"{ListGameItems.SelectedItem} x{NUDGameItemAmout.Value}", CmbCommand.Text);
|
||||
GiveItemCommands.Add(cmd);
|
||||
ListGiveItemLogs.Items.Add(cmd.Name);
|
||||
SaveGiveItemRecord();
|
||||
@@ -1353,7 +1353,7 @@ namespace GrasscutterTools.Forms
|
||||
// 不再重新生成,直接记录当前命令行的内容
|
||||
//if (GenSpawnEntityCommand())
|
||||
{
|
||||
var cmd = new GameCommand($"{ListEntity.SelectedItem} | {TxtCommand.Text}", TxtCommand.Text);
|
||||
var cmd = new GameCommand($"{ListEntity.SelectedItem} | {CmbCommand.Text}", CmbCommand.Text);
|
||||
SpawnCommands.Add(cmd);
|
||||
ListSpawnLogs.Items.Add(cmd.Name);
|
||||
SaveSpawnRecord();
|
||||
@@ -1946,18 +1946,35 @@ namespace GrasscutterTools.Forms
|
||||
/// <param name="command">命令</param>
|
||||
private void SetCommand(string command)
|
||||
{
|
||||
var oldCommand = TxtCommand.Text;
|
||||
TxtCommand.Text = command;
|
||||
var oldCommand = CmbCommand.Text;
|
||||
CmbCommand.Text = (ModifierKeys == Keys.Shift) ? $"{oldCommand} | {command}" : command;
|
||||
if (ChkAutoCopy.Checked)
|
||||
CopyCommand();
|
||||
if (ModifierKeys == Keys.Shift)
|
||||
AddCommandToList(command);
|
||||
|
||||
if (ModifierKeys == Keys.Control)
|
||||
{
|
||||
OnOpenCommandInvoke();
|
||||
TxtCommand.Text = oldCommand;
|
||||
}
|
||||
else if (ModifierKeys == Keys.Control)
|
||||
else if (ModifierKeys == Keys.Alt)
|
||||
{
|
||||
OnOpenCommandInvoke();
|
||||
CmbCommand.Text = oldCommand;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加命令到执行记录
|
||||
/// </summary>
|
||||
private void AddCommandToList(string command = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(command))
|
||||
command = CmbCommand.Text;
|
||||
if (!string.IsNullOrEmpty(command))
|
||||
{
|
||||
if (CmbCommand.Items.Count > 19)
|
||||
CmbCommand.Items.RemoveAt(0);
|
||||
CmbCommand.Items.Add(command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1988,8 +2005,8 @@ namespace GrasscutterTools.Forms
|
||||
/// </summary>
|
||||
private void CopyCommand()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(TxtCommand.Text))
|
||||
Clipboard.SetText(TxtCommand.Text);
|
||||
if (!string.IsNullOrEmpty(CmbCommand.Text))
|
||||
Clipboard.SetText(CmbCommand.Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2014,10 +2031,10 @@ namespace GrasscutterTools.Forms
|
||||
private async void BtnInvokeOpenCommand_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!BtnInvokeOpenCommand.Enabled) return;
|
||||
var cmd = TxtCommand.Text;
|
||||
var cmd = CmbCommand.Text;
|
||||
if (cmd.Length < 2)
|
||||
{
|
||||
ShowTip(Resources.CommandContentCannotBeEmpty, TxtCommand);
|
||||
ShowTip(Resources.CommandContentCannotBeEmpty, CmbCommand);
|
||||
return;
|
||||
}
|
||||
if (cmd.IndexOf('|') == -1)
|
||||
|
||||
Reference in New Issue
Block a user