Basic Bot - StatusBar and Text title stuff
This commit is contained in:
parent
462ad5547c
commit
811f8c96e6
|
@ -46,6 +46,7 @@
|
|||
this.TurboWhileBottingMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RunBtn = new System.Windows.Forms.Button();
|
||||
this.BotStatusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.BotStatusButton = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.MessageLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.ControlsBox = new System.Windows.Forms.GroupBox();
|
||||
this.ControlProbabilityPanel = new System.Windows.Forms.Panel();
|
||||
|
@ -240,6 +241,7 @@
|
|||
// BotStatusStrip
|
||||
//
|
||||
this.BotStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.BotStatusButton,
|
||||
this.MessageLabel});
|
||||
this.BotStatusStrip.Location = new System.Drawing.Point(0, 565);
|
||||
this.BotStatusStrip.Name = "BotStatusStrip";
|
||||
|
@ -247,6 +249,17 @@
|
|||
this.BotStatusStrip.TabIndex = 2;
|
||||
this.BotStatusStrip.Text = "statusStrip1";
|
||||
//
|
||||
// BotStatusButton
|
||||
//
|
||||
this.BotStatusButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.BotStatusButton.Image = ((System.Drawing.Image)(resources.GetObject("BotStatusButton.Image")));
|
||||
this.BotStatusButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.BotStatusButton.Name = "BotStatusButton";
|
||||
this.BotStatusButton.RightToLeftAutoMirrorImage = true;
|
||||
this.BotStatusButton.Size = new System.Drawing.Size(32, 20);
|
||||
this.BotStatusButton.Text = " ";
|
||||
this.BotStatusButton.ToolTipText = " ";
|
||||
//
|
||||
// MessageLabel
|
||||
//
|
||||
this.MessageLabel.Name = "MessageLabel";
|
||||
|
@ -847,5 +860,6 @@
|
|||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.ContextMenuStrip StatsContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem ClearStatsContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripStatusLabel BotStatusButton;
|
||||
}
|
||||
}
|
|
@ -17,6 +17,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
private const string DialogTitle = "Basic Bot";
|
||||
|
||||
private string _currentFileName = string.Empty;
|
||||
|
||||
private string CurrentFileName
|
||||
{
|
||||
get { return _currentFileName; }
|
||||
set
|
||||
{
|
||||
_currentFileName = value;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_currentFileName))
|
||||
{
|
||||
Text = DialogTitle + " - " + Path.GetFileNameWithoutExtension(_currentFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = DialogTitle;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool _isBotting = false;
|
||||
private long _attempts = 1;
|
||||
private long _frames = 0;
|
||||
|
@ -103,7 +123,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
LoadFileFromRecent(Settings.RecentBotFiles.MostRecent);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateBotStatusIcon();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -356,7 +378,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
SaveMenuItem.Enabled = !string.IsNullOrWhiteSpace(_currentFileName);
|
||||
SaveMenuItem.Enabled = !string.IsNullOrWhiteSpace(CurrentFileName);
|
||||
}
|
||||
|
||||
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
|
@ -368,7 +390,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void NewMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_currentFileName = string.Empty;
|
||||
CurrentFileName = string.Empty;
|
||||
_bestBotAttempt = null;
|
||||
|
||||
ControlProbabilityPanel.Controls
|
||||
|
@ -389,7 +411,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void OpenMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var file = ToolHelpers.OpenFileDialog(
|
||||
_currentFileName,
|
||||
CurrentFileName,
|
||||
PathManager.GetRomsPath(Global.Game.System), // TODO: bot path
|
||||
"Bot files",
|
||||
"bot"
|
||||
|
@ -403,16 +425,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SaveMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_currentFileName))
|
||||
if (!string.IsNullOrWhiteSpace(CurrentFileName))
|
||||
{
|
||||
SaveBotFile(_currentFileName);
|
||||
SaveBotFile(CurrentFileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveAsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var file = ToolHelpers.SaveFileDialog(
|
||||
_currentFileName,
|
||||
CurrentFileName,
|
||||
PathManager.GetRomsPath(Global.Game.System), // TODO: bot path
|
||||
"Bot files",
|
||||
"bot"
|
||||
|
@ -421,7 +443,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (file != null)
|
||||
{
|
||||
SaveBotFile(file.FullName);
|
||||
Text = DialogTitle + Path.GetFileNameWithoutExtension(_currentFileName);
|
||||
_currentFileName = file.FullName;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -479,6 +501,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
_dontUpdateValues = false;
|
||||
_startFrame = Emulator.Frame;
|
||||
SetNormalSpeed();
|
||||
UpdateBotStatusIcon();
|
||||
MessageLabel.Text = "Replaying";
|
||||
GlobalWin.MainForm.UnpauseEmulator();
|
||||
}
|
||||
|
||||
|
@ -579,8 +603,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
PlayBestButton.Enabled = true;
|
||||
}
|
||||
|
||||
_currentFileName = path;
|
||||
Settings.RecentBotFiles.Add(_currentFileName);
|
||||
CurrentFileName = path;
|
||||
Settings.RecentBotFiles.Add(CurrentFileName);
|
||||
MessageLabel.Text = Path.GetFileNameWithoutExtension(path) + " loaded";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -604,9 +629,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
var json = ConfigService.SaveWithType(data);
|
||||
|
||||
File.WriteAllText(path, json);
|
||||
_currentFileName = path;
|
||||
Settings.RecentBotFiles.Add(_currentFileName);
|
||||
MessageLabel.Text = Path.GetFileName(_currentFileName) + " saved";
|
||||
CurrentFileName = path;
|
||||
Settings.RecentBotFiles.Add(CurrentFileName);
|
||||
MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -650,9 +675,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.MainForm.PauseEmulator();
|
||||
_startFrame = 0;
|
||||
_replayMode = false;
|
||||
|
||||
}
|
||||
UpdateBotStatusIcon();
|
||||
MessageLabel.Text = "Replay stopped";
|
||||
}
|
||||
}
|
||||
else if (_isBotting)
|
||||
{
|
||||
if (Global.Emulator.Frame >= _targetFrame)
|
||||
|
@ -798,6 +824,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
SetMaxSpeed();
|
||||
}
|
||||
|
||||
UpdateBotStatusIcon();
|
||||
MessageLabel.Text = "Running...";
|
||||
}
|
||||
|
||||
private bool CanStart()
|
||||
|
@ -839,6 +868,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
GlobalWin.MainForm.PauseEmulator();
|
||||
SetNormalSpeed();
|
||||
UpdateBotStatusIcon();
|
||||
MessageLabel.Text = "Bot stopped";
|
||||
}
|
||||
|
||||
private void UpdateBotStatusIcon()
|
||||
{
|
||||
if (_replayMode)
|
||||
{
|
||||
BotStatusButton.Image = Properties.Resources.Play;
|
||||
BotStatusButton.ToolTipText = "Replaying best result";
|
||||
}
|
||||
else if (_isBotting)
|
||||
{
|
||||
BotStatusButton.Image = Properties.Resources.RecordHS;
|
||||
BotStatusButton.ToolTipText = "Botting in progress";
|
||||
}
|
||||
else
|
||||
{
|
||||
BotStatusButton.Image = Properties.Resources.Pause;
|
||||
BotStatusButton.ToolTipText = "Bot is currently not running";
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMaxSpeed()
|
||||
|
|
|
@ -123,10 +123,25 @@
|
|||
<metadata name="BotStatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>119, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="BotStatusButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
||||
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
||||
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
||||
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
||||
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
||||
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="StatsContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>248, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAMDAAAAEAGACoHAAAFgAAACgAAAAwAAAAYAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
|
|
Loading…
Reference in New Issue