you can actually see the achievement box

This commit is contained in:
lempamo 2017-08-06 19:10:09 -04:00
parent 39283c570e
commit cb0ebed291
4 changed files with 21 additions and 6 deletions

View file

@ -588,7 +588,7 @@ public static bool LoadSave()
public static byte[] GetAchievements()
{
byte[] byt = new byte[] { 0, 0 };
byte[] byt = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
if (DevMode) File.WriteAllBytes(Path.Combine(DataDirectory, "achieved.thack"), byt);
if (File.Exists(Path.Combine(DataDirectory, "achieved.thack"))) byt = File.ReadAllBytes(Path.Combine(DataDirectory, "achieved.thack"));
@ -599,6 +599,8 @@ public static byte[] GetAchievements()
public static void SaveAchievement(int achievementID)
{
if (!File.Exists(Path.Combine(DataDirectory, "achieved.thack"))) File.WriteAllBytes(Path.Combine(DataDirectory, "achieved.thack"), new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
byte[] byt = File.ReadAllBytes(Path.Combine(DataDirectory, "achieved.thack"));
byt[achievementID] = 1;
File.WriteAllBytes(Path.Combine(DataDirectory, "achieved.thack"), byt);

View file

@ -56,6 +56,7 @@ private void InitializeComponent()
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "AchievementBox";
this.Text = "Form1";
this.TopMost = true;
this.ResumeLayout(false);
}

View file

@ -19,6 +19,8 @@ public partial class AchievementBox : Form
public AchievementBox(int type)
{
InitializeComponent();
this.BringToFront();
this.Show();
switch (type)
{
case 0: //Piracy Ending
@ -27,20 +29,21 @@ public AchievementBox(int type)
break;
case 20:
BackgroundImage = Properties.Resources.AchievementMines;
button1.Hide();
break;
}
Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - 202, -102);
while (this.Location.Y != 0)
{
Thread.Sleep(25);
Thread.Sleep(5);
Location = new Point(Location.X, Location.Y + 1);
}
if (!stayOnScreen)
{
Thread.Sleep(5000);
Thread.Sleep(3000);
while (this.Location.Y != -102)
{
Thread.Sleep(25);
Thread.Sleep(5);
Location = new Point(Location.X, Location.Y - 1);
}
this.Close();

View file

@ -9,6 +9,7 @@
using System.Windows.Forms;
using TimeHACK.OS.Win95.Win95Apps.MineSweeper;
using TimeHACK.Engine;
using System.Threading;
namespace TimeHACK.OS.Win95.Win95Apps
{
@ -109,8 +110,8 @@ private void timer1_Tick(object sender, EventArgs e)
break;
case ("hard"):
if (SaveSystem.CurrentSave.mineSweepH > _game.Time) SaveSystem.CurrentSave.mineSweepH = _game.Time;
SaveSystem.SaveAchievement(20);
AchievementBox ab = new AchievementBox(20);
Thread t = new Thread(Achieve);
t.Start();
break;
}
@ -118,8 +119,16 @@ private void timer1_Tick(object sender, EventArgs e)
}
}
private void Achieve()
{
SaveSystem.SaveAchievement(20);
new AchievementBox(20);
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Thread t = new Thread(Achieve);
t.Start();
this.ParentForm.Close();
}
}