2024-03-22 17:03:01 +08:00
|
|
|
|
using CDSAE3_Lian_Lian_Kan.Forms;
|
2024-04-18 08:38:59 +08:00
|
|
|
|
using CDSAE3_Lian_Lian_Kan.Properties;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using System.Text.Encodings.Web;
|
|
|
|
|
using System.Text.Unicode;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using CDSAE3_Lian_Lian_Kan.Forms.Interface;
|
2024-04-19 10:00:37 +08:00
|
|
|
|
using System.Runtime.InteropServices;
|
2024-03-22 17:03:01 +08:00
|
|
|
|
|
2024-04-18 08:38:59 +08:00
|
|
|
|
namespace CDSAE3_Lian_Lian_Kan.Forms
|
2024-03-22 17:03:01 +08:00
|
|
|
|
{
|
|
|
|
|
public partial class LianLianKan : Form
|
|
|
|
|
{
|
|
|
|
|
public LianLianKan()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2024-04-18 08:38:59 +08:00
|
|
|
|
Etcs.hunderd_millsecond_timer.Elapsed += StartFunc;
|
2024-04-02 21:57:04 +08:00
|
|
|
|
Etcs.form = this;
|
2024-03-22 17:03:01 +08:00
|
|
|
|
}
|
2024-04-18 08:38:59 +08:00
|
|
|
|
private void StartFunc(object? Sender, EventArgs e)
|
2024-03-22 17:03:01 +08:00
|
|
|
|
{
|
2024-04-18 08:38:59 +08:00
|
|
|
|
Etcs.hunderd_millsecond_timer.Elapsed -= StartFunc;
|
|
|
|
|
Form? menuForm = null;
|
2024-04-19 10:00:37 +08:00
|
|
|
|
Invoke(() => menuForm = new MenuForm());
|
|
|
|
|
Invoke(() => change_form(menuForm!, false, null, null));
|
2024-04-18 08:38:59 +08:00
|
|
|
|
}
|
2024-04-19 10:00:37 +08:00
|
|
|
|
public async Task change_form(Form newForm, bool doAnimation, Color? begin, Color? end)
|
2024-04-18 08:38:59 +08:00
|
|
|
|
{
|
|
|
|
|
if (doAnimation)
|
|
|
|
|
{
|
2024-04-19 10:00:37 +08:00
|
|
|
|
bufferForm.SetEffect(begin!.Value, end!.Value);
|
2024-04-18 08:38:59 +08:00
|
|
|
|
bufferForm.BringToFront();
|
|
|
|
|
bufferForm.Visible = true;
|
|
|
|
|
}
|
2024-03-22 17:03:01 +08:00
|
|
|
|
MainPanel.Controls.Clear();
|
2024-04-18 08:38:59 +08:00
|
|
|
|
newForm.TopLevel = false;
|
|
|
|
|
newForm.Dock = DockStyle.Fill;
|
|
|
|
|
(newForm as IThemeChangeable)?.SetTheme();
|
|
|
|
|
MainPanel.Controls.Add(newForm);
|
|
|
|
|
BeginInvoke(() => newForm.Show());
|
|
|
|
|
MainPanel.SendToBack();
|
2024-04-19 10:00:37 +08:00
|
|
|
|
ActiveControl = newForm;
|
2024-04-18 08:38:59 +08:00
|
|
|
|
if (doAnimation)
|
|
|
|
|
{
|
|
|
|
|
await bufferForm.EffectAsync();
|
|
|
|
|
bufferForm.Visible = false;
|
|
|
|
|
}
|
2024-04-02 21:57:04 +08:00
|
|
|
|
GC.Collect();
|
2024-03-22 17:03:01 +08:00
|
|
|
|
}
|
2024-04-19 10:00:37 +08:00
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
|
|
|
{
|
|
|
|
|
KeyEventArgs e = new KeyEventArgs(keyData);
|
|
|
|
|
|
|
|
|
|
if (keyData == (Keys.Space))
|
|
|
|
|
{
|
|
|
|
|
Etcs.gameModeForm?.TogglePause();
|
|
|
|
|
//Console.WriteLine(" TogglePause();");
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2024-03-22 17:03:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|