2019-09-26 20:44:45 +02:00
|
|
|
|
using LaptopSimulator2015;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Base;
|
|
|
|
|
|
|
|
|
|
namespace LevelTest
|
|
|
|
|
{
|
|
|
|
|
public partial class MainForm : Form
|
|
|
|
|
{
|
|
|
|
|
Minigame level;
|
|
|
|
|
public MainForm(Minigame game)
|
|
|
|
|
{
|
2019-09-26 22:24:45 +02:00
|
|
|
|
Misc.closeGameWindow = () => { level.initGame(minigamePanel, minigameClockT); };
|
2019-09-26 20:44:45 +02:00
|
|
|
|
level = game;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
minigameClockT.Interval = level.gameClock;
|
|
|
|
|
Text = level.name;
|
2019-09-26 22:24:45 +02:00
|
|
|
|
Misc.closeGameWindow.Invoke();
|
2019-09-26 20:44:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint minigameTime;
|
|
|
|
|
uint minigamePrevTime;
|
|
|
|
|
private void MinigameClockT_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
minigameTime++;
|
|
|
|
|
minigamePanel.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MinigamePanel_Paint(object sender, PaintEventArgs e)
|
|
|
|
|
{
|
2019-09-26 22:24:45 +02:00
|
|
|
|
using (GraphicsWrapper w = new GraphicsWrapper(e.Graphics, level.backColor, new Rectangle(Point.Empty, minigamePanel.Size)))
|
2019-09-26 20:44:45 +02:00
|
|
|
|
{
|
2019-09-26 22:24:45 +02:00
|
|
|
|
w.Clear();
|
2019-09-26 20:44:45 +02:00
|
|
|
|
level.draw(w, minigamePanel, minigameClockT, minigameTime);
|
|
|
|
|
if (minigameTime != minigamePrevTime)
|
|
|
|
|
{
|
|
|
|
|
level.gameTick(w, minigamePanel, minigameClockT, minigameTime);
|
|
|
|
|
minigamePrevTime = minigameTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-06 17:13:10 +02:00
|
|
|
|
|
|
|
|
|
bool isFClose = true;
|
|
|
|
|
private void MainForm_Resize(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (WindowState == FormWindowState.Minimized)
|
|
|
|
|
{
|
|
|
|
|
isFClose = false;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (isFClose)
|
|
|
|
|
Environment.Exit(0);
|
|
|
|
|
}
|
2019-09-26 20:44:45 +02:00
|
|
|
|
}
|
|
|
|
|
}
|