就这样吧 还有一些bug 不改了
This commit is contained in:
parent
b0efa940c1
commit
f006b58fa1
|
@ -276,7 +276,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards
|
|||
int k = random.Next(0, boardIndex.Count);
|
||||
for (int i = 0; i < boardIndex.Count(); i++)
|
||||
{
|
||||
if (boardIndex[k + i].Count != 0)
|
||||
if (boardIndex.ContainsKey(k) && boardIndex[k + i].Count != 0)
|
||||
return boardIndex[k + i][random.Next(0, boardIndex[k + i].Count)];
|
||||
}
|
||||
return (-1, -1);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace CDSAE3_Lian_Lian_Kan
|
|||
{
|
||||
public IList<ThemeInfo>? Themes { get; set; }
|
||||
}
|
||||
public class ThemeInfo
|
||||
public class ThemeInfo: ICloneable
|
||||
{
|
||||
public string Name { get; set; } = "";
|
||||
public bool AnimationUseImage { get; set; }
|
||||
|
@ -44,6 +44,11 @@ namespace CDSAE3_Lian_Lian_Kan
|
|||
public IList<int>? FontColor { get; set; }
|
||||
public string? Font { get; set; }
|
||||
public string? FontSize { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return (ThemeInfo)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
public class ScoreRecord
|
||||
{
|
||||
|
@ -142,6 +147,7 @@ namespace CDSAE3_Lian_Lian_Kan
|
|||
public static IGameControl? gameForm { get; set; }//gameBoard
|
||||
public static IGameMode? gameModeForm { get; set; }//entireGame
|
||||
public static IMenuForm? gameMenuForm { get; set; }//MenuForm
|
||||
public static IBack? escapableForm { get; set; }
|
||||
public static Board board { get; set; } = new Board();
|
||||
public static Color def_Color { get; set; } = Color.FromArgb(0, 0, 0, 0);
|
||||
public static Color sel_Color { get; set; } = Color.FromArgb(0, 122, 204);
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
继续游戏 = new Label();
|
||||
游戏暂停 = new Label();
|
||||
timeLine = new TimeLine();
|
||||
scoreLabel = new Label();
|
||||
scoreChangeLabel = new Label();
|
||||
PausePanel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
|
@ -55,7 +57,7 @@
|
|||
//
|
||||
// PausePanel
|
||||
//
|
||||
PausePanel.BackColor = Color.FromArgb(0, 0, 0);
|
||||
PausePanel.BackColor = Color.Black;
|
||||
PausePanel.Controls.Add(返回主菜单);
|
||||
PausePanel.Controls.Add(继续游戏);
|
||||
PausePanel.Controls.Add(游戏暂停);
|
||||
|
@ -118,12 +120,39 @@
|
|||
timeLine.Size = new Size(1440, 10);
|
||||
timeLine.TabIndex = 6;
|
||||
//
|
||||
// scoreLabel
|
||||
//
|
||||
scoreLabel.AutoSize = true;
|
||||
scoreLabel.BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
scoreLabel.Font = new Font("Microsoft YaHei UI", 20F);
|
||||
scoreLabel.ForeColor = Color.White;
|
||||
scoreLabel.Location = new Point(1106, 23);
|
||||
scoreLabel.Name = "scoreLabel";
|
||||
scoreLabel.Size = new Size(160, 52);
|
||||
scoreLabel.TabIndex = 0;
|
||||
scoreLabel.Text = "000000";
|
||||
//
|
||||
// scoreChangeLabel
|
||||
//
|
||||
scoreChangeLabel.AutoSize = true;
|
||||
scoreChangeLabel.BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
scoreChangeLabel.Font = new Font("Microsoft YaHei UI", 20F);
|
||||
scoreChangeLabel.ForeColor = Color.White;
|
||||
scoreChangeLabel.Location = new Point(1287, 23);
|
||||
scoreChangeLabel.Name = "scoreChangeLabel";
|
||||
scoreChangeLabel.Size = new Size(144, 52);
|
||||
scoreChangeLabel.TabIndex = 7;
|
||||
scoreChangeLabel.Text = "+1000";
|
||||
scoreChangeLabel.Visible = false;
|
||||
//
|
||||
// Challenge_Mode
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.Black;
|
||||
ClientSize = new Size(1440, 960);
|
||||
Controls.Add(scoreChangeLabel);
|
||||
Controls.Add(scoreLabel);
|
||||
Controls.Add(timeLine);
|
||||
Controls.Add(game_Panel);
|
||||
Controls.Add(AudioVisualizerPanel);
|
||||
|
@ -135,6 +164,7 @@
|
|||
PausePanel.ResumeLayout(false);
|
||||
PausePanel.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -146,5 +176,7 @@
|
|||
private Label 返回主菜单;
|
||||
private Label 继续游戏;
|
||||
private TimeLine timeLine;
|
||||
private Label scoreLabel;
|
||||
private Label scoreChangeLabel;
|
||||
}
|
||||
}
|
|
@ -1,22 +1,10 @@
|
|||
using CDSAE3_Lian_Lian_Kan.Forms.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows.Forms;
|
||||
using CDSAE3_Lian_Lian_Kan.Extensions;
|
||||
using Timer = System.Timers.Timer;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using CDSAE3_Lian_Lian_Kan.Extensions;
|
||||
using CDSAE3_Lian_Lian_Kan.Forms.Interface;
|
||||
using CDSAE3_Lian_Lian_Kan.Sound;
|
||||
using CDSAE3_Lian_Lian_Kan;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Text;
|
||||
using System.Timers;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
|
@ -26,24 +14,85 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
public Challenge_Mode()
|
||||
{
|
||||
InitializeComponent();
|
||||
timer = new Timer { Interval = 500, AutoReset = true, Enabled = false };
|
||||
timer = new Timer { Interval = 100, AutoReset = true, Enabled = false };
|
||||
timer.Elapsed += TimerTick;
|
||||
Etcs.current_difficulty = Etcs.Difficulty.challenge;
|
||||
Etcs.loadFinished = false;
|
||||
gameControl = new GameControl((t) => Challenge_Mode_LoadAsync(this,new EventArgs()));
|
||||
gameControl = new GameControl((t) => Challenge_Mode_LoadAsync(this, new EventArgs()));
|
||||
game_Panel.Controls.Add(gameControl);
|
||||
gameControl.Dock = DockStyle.Fill;
|
||||
|
||||
}
|
||||
|
||||
//这里是行动的起源
|
||||
Timer timer;
|
||||
double curTime = 0;
|
||||
int score = 0;
|
||||
private int Score
|
||||
{
|
||||
get
|
||||
{
|
||||
return score;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > score)
|
||||
AddScoreLabel(value - score);
|
||||
else
|
||||
SubScoreLabel(score - value);
|
||||
score = value;
|
||||
SetScoreLabel();
|
||||
}
|
||||
}
|
||||
Thread? scoreSetThread;
|
||||
private void SetScoreLabel()
|
||||
{
|
||||
if (scoreSetThread != null && scoreSetThread.IsAlive)
|
||||
scoreSetThread.Interrupt();
|
||||
scoreSetThread = new Thread(() =>
|
||||
{
|
||||
StringBuilder target = new StringBuilder(score.ToString().PadLeft(6, '0'));
|
||||
StringBuilder src = new StringBuilder(scoreLabel.Text);
|
||||
List<string> duration = new();
|
||||
while (src.ToString() != target.ToString())
|
||||
{
|
||||
for (int i = 0; i < src.Length; i++)
|
||||
{
|
||||
if (src[i] != target[i])
|
||||
{
|
||||
if (target[i] > src[i])
|
||||
{
|
||||
if (target[i] - src[i] <= 5)
|
||||
src[i]++;
|
||||
else
|
||||
src[i] = (char)((Convert.ToInt32(src[i] + 9)) % 10 + '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (src[i] - target[i] <= 5)
|
||||
src[i]--;
|
||||
else
|
||||
src[i] = (char)((Convert.ToInt32(src[i] + 11)) % 10 + '0');
|
||||
}
|
||||
}
|
||||
}
|
||||
duration.Add(src.ToString());
|
||||
}
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < duration.Count; i++)
|
||||
{
|
||||
BeginInvoke(() => scoreLabel.Text = duration[i]);
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
}
|
||||
catch (ThreadInterruptedException) { }
|
||||
});
|
||||
scoreSetThread.Start();
|
||||
}
|
||||
|
||||
private int score = 0;
|
||||
private void TimerTick(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
curTime += 0.1;
|
||||
timeLine.set_progress(curTime / 140);
|
||||
timeLine.set_progress(curTime / 136);
|
||||
}
|
||||
|
||||
private async void Challenge_Mode_LoadAsync(object sender, EventArgs e)
|
||||
|
@ -89,6 +138,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
Etcs.song_Audio_Processer.pause_song();
|
||||
Etcs.song_Audio_Processer.set_albums("Tatsh");
|
||||
Etcs.song_Audio_Processer.set_song(Etcs.song_Audio_Processer.get_next_song());
|
||||
timer.Enabled = true;
|
||||
Thread thread = new Thread(async () =>
|
||||
{
|
||||
for (int n = 0; n < 8; n++)
|
||||
|
@ -108,22 +158,23 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
_pauseAllow = true;
|
||||
label.SendToBack();
|
||||
label.Visible = false;
|
||||
|
||||
label.Dispose();
|
||||
}
|
||||
PausePanel.Visible = false;
|
||||
Etcs.song_Audio_Processer.SongFinished += Song_Audio_Processer_SongFinished;
|
||||
ShowAudioVisualizer();
|
||||
Etcs.hunderd_millsecond_timer.Elapsed += TimerTick;
|
||||
}
|
||||
|
||||
private async void Song_Audio_Processer_SongFinished(Sound.Song_Audio_processer s, Sound.SongFinishedEventArgs e)
|
||||
{
|
||||
timer.Stop();
|
||||
if (finished)
|
||||
return;
|
||||
foreach (var item in new Label[] { 返回主菜单, 继续游戏, 游戏暂停 })
|
||||
item.Visible = false;
|
||||
PausePanel.Visible = true;
|
||||
PausePanel.BackgroundImage = Properties.Resources.trans;
|
||||
for(int i=0;i<200;i+=10)
|
||||
for (int i = 0; i < 200; i += 10)
|
||||
{
|
||||
Color animRed = Color.FromArgb(i, 0, 0);
|
||||
game_Panel.BackColor = animRed;
|
||||
|
@ -131,7 +182,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
await Task.Delay(10);
|
||||
}
|
||||
PausePanel.BringToFront();
|
||||
for(int i= 200;i<260;i+=10)
|
||||
for (int i = 200; i < 255; i += 10)
|
||||
{
|
||||
Color animRed = Color.FromArgb(i, 0, 0);
|
||||
PausePanel.BackColor = animRed;
|
||||
|
@ -141,15 +192,55 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
Finished_Handler(this, new FinishArgs { finishType = FinishArgs.FinishType.Time_out });
|
||||
}
|
||||
int cur_score = 0;
|
||||
bool finished = false;
|
||||
public void Finished_Handler(object sender, FinishArgs e)
|
||||
{
|
||||
BeginInvoke(() =>
|
||||
BeginInvoke(async () =>
|
||||
{
|
||||
finished = true;
|
||||
switch (e.finishType)
|
||||
{
|
||||
case FinishArgs.FinishType.All_done:
|
||||
DoPause();
|
||||
Form form = new FinishedMessageBox(cur_score, (int)curTime);
|
||||
timer.Stop();
|
||||
new Thread(() =>
|
||||
{
|
||||
while (Etcs.Song_Volume != 0)
|
||||
{
|
||||
Etcs.Song_Volume = Math.Max(Etcs.Song_Volume - 7, 0);
|
||||
Etcs.song_Audio_Processer.volume_change(Etcs.Song_Volume);
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
Etcs.song_Audio_Processer.pause_song();
|
||||
}).Start();
|
||||
foreach (var item in new Label[] { 返回主菜单, 继续游戏, 游戏暂停 })
|
||||
item.Visible = false;
|
||||
PausePanel.Visible = true;
|
||||
PausePanel.BackgroundImage = Properties.Resources.trans;
|
||||
for (int i = 0; i < 200; i += 10)
|
||||
{
|
||||
Color animRed = Color.FromArgb(i, i, i);
|
||||
game_Panel.BackColor = animRed;
|
||||
PausePanel.BackColor = animRed;
|
||||
await Task.Delay(10);
|
||||
}
|
||||
PausePanel.BringToFront();
|
||||
for (int i = 200; i < 260; i += 10)
|
||||
{
|
||||
Color animRed = Color.FromArgb(i, i, i);
|
||||
PausePanel.BackColor = animRed;
|
||||
await Task.Delay(10);
|
||||
}
|
||||
|
||||
Label label = new Label { TextAlign = ContentAlignment.MiddleCenter, Font = new Font("Microsoft YaHei UI", 20F), ForeColor = Color.White, BackColor = Color.FromArgb(0, 0, 0, 0), AutoSize = false, Size = new Size(1220, 55), Location = new Point(110, 330) };
|
||||
string[] strings = { "Mission Accomplish", "下次再见", "The End" };
|
||||
for (int i = 0; i < strings.Length; i++)
|
||||
{
|
||||
label.Text = strings[i];
|
||||
Etcs.info_Audio_Processer.playMusicClip("Message", 60);
|
||||
}
|
||||
label.Visible = false;
|
||||
label.Dispose();
|
||||
Form form = new FinishedMessageBox(score, (int)curTime);
|
||||
form.FormClosed += ((sender, args) =>
|
||||
{
|
||||
Dispose();
|
||||
|
@ -182,10 +273,10 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
Bitmap bit = new Bitmap(Width, Height);
|
||||
Graphics g = Graphics.FromImage(bit);
|
||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||
g.CopyFromScreen(Etcs.form!.Left+5, Etcs.form!.Top+43, 0, 0, new Size(Width, Height));
|
||||
g.CopyFromScreen(Etcs.form!.Left + 5, Etcs.form!.Top + 43, 0, 0, new Size(Width, Height));
|
||||
PausePanel.BringToFront();
|
||||
Rectangle rectangle = new Rectangle(0, 0, bit.Width,bit.Height);
|
||||
PausePanel.BackgroundImage= bit.GaussianBlur();
|
||||
Rectangle rectangle = new Rectangle(0, 0, bit.Width, bit.Height);
|
||||
PausePanel.BackgroundImage = bit.GaussianBlur();
|
||||
PausePanel.Visible = true;
|
||||
GC.Collect();
|
||||
}
|
||||
|
@ -238,16 +329,15 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
}
|
||||
|
||||
public void De_pause(object sender, EventArgs e) { }
|
||||
|
||||
public void Score_Change(object sender, ChangeScoreArgs e)
|
||||
{
|
||||
if (e.add)
|
||||
{
|
||||
score += e.score;
|
||||
if(search_mode)
|
||||
new Thread(() => Score += e.score).Start();
|
||||
if (search_mode)
|
||||
{
|
||||
search_left_use_time--;
|
||||
if(search_left_use_time==0)
|
||||
if (search_left_use_time == 0)
|
||||
{
|
||||
search_mode = false;
|
||||
gameControl.Search_Handler(this, new SearchEventArgs { set_search = false });
|
||||
|
@ -255,10 +345,55 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
}
|
||||
}
|
||||
else
|
||||
score = Math.Min(0, score - e.score);
|
||||
new Thread(() => Score = Math.Max(0, Score - e.score)).Start();
|
||||
}
|
||||
|
||||
public void SetTheme() {
|
||||
Thread? ScoreChange;
|
||||
public void AddScoreLabel(int score)
|
||||
{
|
||||
if (ScoreChange != null && ScoreChange.IsAlive)
|
||||
ScoreChange.Interrupt();
|
||||
ScoreChange = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
BeginInvoke(() => scoreChangeLabel.Text = "+" + score);
|
||||
BeginInvoke(() => scoreChangeLabel.ForeColor = Color.FromArgb(0, 255, 0));
|
||||
BeginInvoke(() => scoreChangeLabel.Visible = true);
|
||||
for (int i = 255; i > 0; i -= 20)
|
||||
{
|
||||
BeginInvoke(() => scoreChangeLabel.ForeColor = Color.FromArgb(0, i, 0));
|
||||
Thread.Sleep(80);
|
||||
}
|
||||
BeginInvoke(() => scoreChangeLabel.Visible = false);
|
||||
}
|
||||
catch (ThreadInterruptedException) { return; }
|
||||
});
|
||||
ScoreChange.Start();
|
||||
}
|
||||
public void SubScoreLabel(int score)
|
||||
{
|
||||
if (ScoreChange != null && ScoreChange.IsAlive)
|
||||
ScoreChange.Interrupt();
|
||||
ScoreChange = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
BeginInvoke(() => scoreChangeLabel.Text = "-" + score);
|
||||
BeginInvoke(() => scoreChangeLabel.ForeColor = Color.FromArgb(255, 0, 0));
|
||||
BeginInvoke(() => scoreChangeLabel.Visible = true);
|
||||
for (int i = 255; i > 0; i -= 20)
|
||||
{
|
||||
BeginInvoke(() => scoreChangeLabel.ForeColor = Color.FromArgb(i, 0, 0));
|
||||
Thread.Sleep(80);
|
||||
}
|
||||
BeginInvoke(() => scoreChangeLabel.Visible = false);
|
||||
}
|
||||
catch (ThreadInterruptedException) { return; }
|
||||
});
|
||||
ScoreChange.Start();
|
||||
}
|
||||
public void SetTheme()
|
||||
{
|
||||
Etcs.current_block_theme = Etcs.Theme.code;
|
||||
Etcs.gameModeForm = this;
|
||||
}
|
||||
|
@ -287,5 +422,10 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
public void Back()
|
||||
{
|
||||
TogglePause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,23 +62,6 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
strings.Add(lt[i - 1].Score.ToString()!);
|
||||
strings.Add(lt[i - 1].Difficulty!);
|
||||
Invoke(() => LabelsMaker(strings.ToArray(), 60, null, Font = new Font("Microsoft YaHei UI", 18F)));
|
||||
//Invoke(() => table.RowStyles.Add(new RowStyle(SizeType.Absolute, 60)));
|
||||
//var x = new Label { Text = lt[i - 1].Name, Font = new Font("Microsoft YaHei UI", 18F) };
|
||||
//x.Dock = DockStyle.Fill;
|
||||
//Invoke(() => table.Controls.Add(x, 0, i));
|
||||
//x = new Label { Text = string.Format("{0:yyyy}-" + "{0:MM}-" + "{0:dd}" + " {0:HH}:{0:mm}", lt[i - 1].Time), Font = new Font("Microsoft YaHei UI", 18F) };
|
||||
//x.Dock = DockStyle.Fill;
|
||||
//Invoke(() => table.Controls.Add(x, 1, i));
|
||||
//int t = lt[i - 1].CostTime!.Value;
|
||||
//x = new Label { Text = $"{t / 60}:{((t % 60) < 10 ? ("0" + (t % 60).ToString()) : (t % 60).ToString())}", Font = new Font("Microsoft YaHei UI", 18F) };
|
||||
//x.Dock = DockStyle.Fill;
|
||||
//Invoke(() => table.Controls.Add(x, 2, i));
|
||||
//x = new Label { Text = lt[i - 1].Score.ToString(), Font = new Font("Microsoft YaHei UI", 18F) };
|
||||
//x.Dock = DockStyle.Fill;
|
||||
//Invoke(() => table.Controls.Add(x, 3, i));
|
||||
//x = new Label { Text = lt[i - 1].Difficulty, Font = new Font("Microsoft YaHei UI", 18F) };
|
||||
//x.Dock = DockStyle.Fill;
|
||||
//Invoke(() => table.Controls.Add(x, 4, i));
|
||||
}
|
||||
Console.WriteLine("Charts Fill done");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,273 @@
|
|||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
partial class CreateNewTheme
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
DesignPanel = new Panel();
|
||||
to_table_of_scores = new Button();
|
||||
to_settings = new Button();
|
||||
to_Challenge_mode = new Button();
|
||||
start_Game = new Button();
|
||||
mainLabel = new Label();
|
||||
主题色 = new Label();
|
||||
insertImage = new Button();
|
||||
UseImageInGame = new CheckBox();
|
||||
themeSelector = new ComboBox();
|
||||
themeColorTextBox = new TextBox();
|
||||
saveTheme = new Button();
|
||||
themeNameTextBox = new TextBox();
|
||||
主题名 = new Label();
|
||||
findPicture = new OpenFileDialog();
|
||||
tranaportWord = new CheckBox();
|
||||
DesignPanel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// DesignPanel
|
||||
//
|
||||
DesignPanel.BackColor = SystemColors.ActiveBorder;
|
||||
DesignPanel.Controls.Add(to_table_of_scores);
|
||||
DesignPanel.Controls.Add(to_settings);
|
||||
DesignPanel.Controls.Add(to_Challenge_mode);
|
||||
DesignPanel.Controls.Add(start_Game);
|
||||
DesignPanel.Controls.Add(mainLabel);
|
||||
DesignPanel.Location = new Point(12, 12);
|
||||
DesignPanel.Name = "DesignPanel";
|
||||
DesignPanel.Size = new Size(1280, 800);
|
||||
DesignPanel.TabIndex = 0;
|
||||
//
|
||||
// to_table_of_scores
|
||||
//
|
||||
to_table_of_scores.BackColor = Color.White;
|
||||
to_table_of_scores.Cursor = Cursors.SizeAll;
|
||||
to_table_of_scores.Font = new Font("Microsoft YaHei UI", 18F);
|
||||
to_table_of_scores.Location = new Point(1040, 69);
|
||||
to_table_of_scores.Name = "to_table_of_scores";
|
||||
to_table_of_scores.Size = new Size(172, 65);
|
||||
to_table_of_scores.TabIndex = 9;
|
||||
to_table_of_scores.Text = "分数榜";
|
||||
to_table_of_scores.UseVisualStyleBackColor = false;
|
||||
to_table_of_scores.MouseDown += MoveableControl_MouseDown;
|
||||
to_table_of_scores.MouseMove += MoveableControl_MouseMove;
|
||||
to_table_of_scores.MouseUp += MoveableControl_MouseUp;
|
||||
//
|
||||
// to_settings
|
||||
//
|
||||
to_settings.BackColor = Color.White;
|
||||
to_settings.Cursor = Cursors.SizeAll;
|
||||
to_settings.Font = new Font("Microsoft YaHei UI", 18F);
|
||||
to_settings.Location = new Point(626, 69);
|
||||
to_settings.Name = "to_settings";
|
||||
to_settings.Size = new Size(172, 65);
|
||||
to_settings.TabIndex = 8;
|
||||
to_settings.Text = "设置";
|
||||
to_settings.UseVisualStyleBackColor = false;
|
||||
to_settings.MouseDown += MoveableControl_MouseDown;
|
||||
to_settings.MouseMove += MoveableControl_MouseMove;
|
||||
//
|
||||
// to_Challenge_mode
|
||||
//
|
||||
to_Challenge_mode.BackColor = Color.White;
|
||||
to_Challenge_mode.Cursor = Cursors.SizeAll;
|
||||
to_Challenge_mode.Font = new Font("Microsoft YaHei UI", 18F);
|
||||
to_Challenge_mode.Location = new Point(832, 69);
|
||||
to_Challenge_mode.Name = "to_Challenge_mode";
|
||||
to_Challenge_mode.Size = new Size(172, 65);
|
||||
to_Challenge_mode.TabIndex = 7;
|
||||
to_Challenge_mode.Text = "挑战模式";
|
||||
to_Challenge_mode.UseVisualStyleBackColor = false;
|
||||
to_Challenge_mode.MouseDown += MoveableControl_MouseDown;
|
||||
to_Challenge_mode.MouseMove += MoveableControl_MouseMove;
|
||||
//
|
||||
// start_Game
|
||||
//
|
||||
start_Game.BackColor = Color.White;
|
||||
start_Game.Cursor = Cursors.SizeAll;
|
||||
start_Game.Font = new Font("Microsoft YaHei UI", 18F);
|
||||
start_Game.Location = new Point(418, 69);
|
||||
start_Game.Name = "start_Game";
|
||||
start_Game.Size = new Size(172, 65);
|
||||
start_Game.TabIndex = 6;
|
||||
start_Game.Text = "开始游戏";
|
||||
start_Game.UseVisualStyleBackColor = false;
|
||||
start_Game.MouseDown += MoveableControl_MouseDown;
|
||||
start_Game.MouseMove += MoveableControl_MouseMove;
|
||||
//
|
||||
// mainLabel
|
||||
//
|
||||
mainLabel.BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
mainLabel.Cursor = Cursors.SizeAll;
|
||||
mainLabel.Font = new Font("Microsoft YaHei UI", 50F);
|
||||
mainLabel.ForeColor = Color.FromArgb(255, 192, 128);
|
||||
mainLabel.Location = new Point(22, 27);
|
||||
mainLabel.Name = "mainLabel";
|
||||
mainLabel.Size = new Size(373, 151);
|
||||
mainLabel.TabIndex = 5;
|
||||
mainLabel.Text = "连连看";
|
||||
mainLabel.MouseDown += MoveableControl_MouseDown;
|
||||
mainLabel.MouseMove += MoveableControl_MouseMove;
|
||||
//
|
||||
// 主题色
|
||||
//
|
||||
主题色.AutoSize = true;
|
||||
主题色.Font = new Font("Microsoft YaHei UI", 15F);
|
||||
主题色.Location = new Point(719, 837);
|
||||
主题色.Name = "主题色";
|
||||
主题色.Size = new Size(107, 39);
|
||||
主题色.TabIndex = 35;
|
||||
主题色.Text = "主题色";
|
||||
//
|
||||
// insertImage
|
||||
//
|
||||
insertImage.Font = new Font("Microsoft YaHei UI", 15F);
|
||||
insertImage.Location = new Point(34, 835);
|
||||
insertImage.Name = "insertImage";
|
||||
insertImage.Size = new Size(152, 45);
|
||||
insertImage.TabIndex = 36;
|
||||
insertImage.Text = "载入图片";
|
||||
insertImage.UseVisualStyleBackColor = true;
|
||||
insertImage.Click += insertImage_Click;
|
||||
//
|
||||
// UseImageInGame
|
||||
//
|
||||
UseImageInGame.AutoSize = true;
|
||||
UseImageInGame.Font = new Font("Microsoft YaHei UI", 15F);
|
||||
UseImageInGame.Location = new Point(210, 838);
|
||||
UseImageInGame.Name = "UseImageInGame";
|
||||
UseImageInGame.Size = new Size(253, 43);
|
||||
UseImageInGame.TabIndex = 37;
|
||||
UseImageInGame.Text = "游戏内使用图片";
|
||||
UseImageInGame.UseVisualStyleBackColor = true;
|
||||
UseImageInGame.CheckedChanged += UseImageInGame_CheckedChanged;
|
||||
//
|
||||
// themeSelector
|
||||
//
|
||||
themeSelector.FormattingEnabled = true;
|
||||
themeSelector.Location = new Point(490, 842);
|
||||
themeSelector.Name = "themeSelector";
|
||||
themeSelector.Size = new Size(182, 32);
|
||||
themeSelector.TabIndex = 33;
|
||||
themeSelector.SelectedIndexChanged += themeSelector_SelectedIndexChanged;
|
||||
//
|
||||
// themeColorTextBox
|
||||
//
|
||||
themeColorTextBox.Location = new Point(843, 843);
|
||||
themeColorTextBox.Name = "themeColorTextBox";
|
||||
themeColorTextBox.Size = new Size(150, 30);
|
||||
themeColorTextBox.TabIndex = 38;
|
||||
themeColorTextBox.TextChanged += themeColorTextBox_TextChanged;
|
||||
//
|
||||
// saveTheme
|
||||
//
|
||||
saveTheme.Font = new Font("Microsoft YaHei UI", 15F);
|
||||
saveTheme.Location = new Point(1083, 838);
|
||||
saveTheme.Name = "saveTheme";
|
||||
saveTheme.Size = new Size(209, 45);
|
||||
saveTheme.TabIndex = 39;
|
||||
saveTheme.Text = "保存为新主题";
|
||||
saveTheme.UseVisualStyleBackColor = true;
|
||||
saveTheme.Click += saveTheme_Click;
|
||||
//
|
||||
// themeNameTextBox
|
||||
//
|
||||
themeNameTextBox.Location = new Point(843, 893);
|
||||
themeNameTextBox.Name = "themeNameTextBox";
|
||||
themeNameTextBox.Size = new Size(150, 30);
|
||||
themeNameTextBox.TabIndex = 41;
|
||||
themeNameTextBox.TextChanged += themeNameTextBox_TextChanged;
|
||||
//
|
||||
// 主题名
|
||||
//
|
||||
主题名.AutoSize = true;
|
||||
主题名.Font = new Font("Microsoft YaHei UI", 15F);
|
||||
主题名.Location = new Point(718, 887);
|
||||
主题名.Name = "主题名";
|
||||
主题名.Size = new Size(107, 39);
|
||||
主题名.TabIndex = 40;
|
||||
主题名.Text = "主题名";
|
||||
//
|
||||
// findPicture
|
||||
//
|
||||
findPicture.FileName = "openFileDialog1";
|
||||
findPicture.FileOk += findPicture_FileOk;
|
||||
//
|
||||
// tranaportWord
|
||||
//
|
||||
tranaportWord.AutoSize = true;
|
||||
tranaportWord.Font = new Font("Microsoft YaHei UI", 15F);
|
||||
tranaportWord.Location = new Point(210, 893);
|
||||
tranaportWord.Name = "tranaportWord";
|
||||
tranaportWord.Size = new Size(223, 43);
|
||||
tranaportWord.TabIndex = 42;
|
||||
tranaportWord.Text = "文字底色透明";
|
||||
tranaportWord.UseVisualStyleBackColor = true;
|
||||
tranaportWord.CheckedChanged += tranaportWord_CheckedChanged;
|
||||
//
|
||||
// CreateNewTheme
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1440, 960);
|
||||
Controls.Add(tranaportWord);
|
||||
Controls.Add(themeNameTextBox);
|
||||
Controls.Add(主题名);
|
||||
Controls.Add(saveTheme);
|
||||
Controls.Add(themeColorTextBox);
|
||||
Controls.Add(UseImageInGame);
|
||||
Controls.Add(insertImage);
|
||||
Controls.Add(主题色);
|
||||
Controls.Add(themeSelector);
|
||||
Controls.Add(DesignPanel);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "CreateNewTheme";
|
||||
Text = "CreateNewTheme";
|
||||
Load += CreateNewTheme_Load;
|
||||
DesignPanel.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel DesignPanel;
|
||||
private Label mainLabel;
|
||||
private Button start_Game;
|
||||
private Button to_Challenge_mode;
|
||||
private Button to_settings;
|
||||
private Button to_table_of_scores;
|
||||
private Label 主题色;
|
||||
private Button insertImage;
|
||||
private CheckBox UseImageInGame;
|
||||
private ComboBox themeSelector;
|
||||
private TextBox themeColorTextBox;
|
||||
private Button saveTheme;
|
||||
private TextBox themeNameTextBox;
|
||||
private Label 主题名;
|
||||
private OpenFileDialog findPicture;
|
||||
private CheckBox tranaportWord;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,275 @@
|
|||
using CDSAE3_Lian_Lian_Kan.Forms.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static CDSAE3_Lian_Lian_Kan.Etcs;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
public partial class CreateNewTheme : Form, IBack
|
||||
{
|
||||
public CreateNewTheme()
|
||||
{
|
||||
InitializeComponent();
|
||||
MessageBox.Show("按esc键退出");
|
||||
Etcs.escapableForm = this;
|
||||
}
|
||||
Point currentOperControlLocation;
|
||||
private void MoveableControl_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
Control send = (sender as Control)!;
|
||||
Point MousePoint = Control.MousePosition; // 获取鼠标相对屏幕的坐标
|
||||
currentOperControlLocation = send.PointToClient(MousePoint); // 获取坐标相对于控件的相对坐标并赋值给MouseFirstLocation
|
||||
}
|
||||
|
||||
private void MoveableControl_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
Control send = (sender as Control)!;
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
Point MousePoint = Control.MousePosition; // 获取鼠标相对屏幕的坐标
|
||||
Point MousePointToContainer = send.Parent!.PointToClient(MousePoint); // 获取鼠标相对控件父容器的坐标
|
||||
Point ControlNewLocation = new Point(MousePointToContainer.X - currentOperControlLocation.X, MousePointToContainer.Y - currentOperControlLocation.Y); // 计算控件应处于的, 新的坐标
|
||||
send.Location = ControlNewLocation; // 移动控件
|
||||
}
|
||||
}
|
||||
|
||||
//private void ExempleButton_MouseUp(object sender, MouseEventArgs e)
|
||||
//{
|
||||
//}
|
||||
private void MoveableControl_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
changed = true;
|
||||
switch ((sender as Control)!.Name)
|
||||
{
|
||||
case "mainLabel":
|
||||
theme!.FontBlockPos = new List<int> { mainLabel.Location.X, mainLabel.Location.Y };
|
||||
break;
|
||||
case "start_Game":
|
||||
theme!.StartGamePos = new List<int> { start_Game.Location.X, start_Game.Location.Y };
|
||||
break;
|
||||
case "to_settings":
|
||||
theme!.SettingsPos = new List<int> { to_settings.Location.X, to_settings.Location.Y };
|
||||
break;
|
||||
case "to_Challenge_mode":
|
||||
theme!.ChallengeModePos = new List<int> { to_Challenge_mode.Location.X, to_Challenge_mode.Location.Y };
|
||||
break;
|
||||
case "to_table_of_scores":
|
||||
theme!.ScoreBoardPos = new List<int> { to_table_of_scores.Location.X, to_table_of_scores.Location.Y };
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool AnimationUseImage = false;
|
||||
bool IsOutPicture = false;
|
||||
Image? playPanelImage;
|
||||
Color menuThemeColor, playThemeColor;
|
||||
private IList<int> toShow(IList<int> src)
|
||||
{
|
||||
return new List<int> { (int)((double)src[0] * 1280 / 1440), (int)((double)src[1] * 800 / 960) };
|
||||
}
|
||||
private IList<int> toFile(IList<int> src)
|
||||
{
|
||||
return new List<int> { (int)((double)src[0] * 1440 / 1280), (int)((double)src[1] * 960 / 800) };
|
||||
}
|
||||
Etcs.ThemeInfo? theme;
|
||||
private bool changed = false;
|
||||
|
||||
private void toShow()
|
||||
{
|
||||
theme = (Etcs.ThemeInfo)Etcs.currentThemeInfo.Clone();
|
||||
theme.StartGamePos = toShow(theme.StartGamePos!);
|
||||
theme.ChallengeModePos = toShow(theme.ChallengeModePos!);
|
||||
theme.ScoreBoardPos = toShow(theme.ScoreBoardPos!);
|
||||
theme.SettingsPos = toShow(theme.SettingsPos!);
|
||||
theme.ButtonSize = toShow(theme.ButtonSize!);
|
||||
theme.FontBlockPos = toShow(theme.FontBlockPos!);
|
||||
theme.FontBlockSize = toShow(theme.FontBlockSize!);
|
||||
}
|
||||
private void toFile()
|
||||
{
|
||||
theme!.StartGamePos = toFile(theme.StartGamePos!);
|
||||
theme.ChallengeModePos = toFile(theme.ChallengeModePos!);
|
||||
theme.ScoreBoardPos = toFile(theme.ScoreBoardPos!);
|
||||
theme.SettingsPos = toFile(theme.SettingsPos!);
|
||||
theme.ButtonSize = toFile(theme.ButtonSize!);
|
||||
theme.FontBlockPos = toFile(theme.FontBlockPos!);
|
||||
theme.FontBlockSize = toFile(theme.FontBlockSize!);
|
||||
}
|
||||
private void AddRecord()
|
||||
{
|
||||
toFile();
|
||||
Etcs.themes.Add(theme!.Name, theme);
|
||||
using StreamWriter fileWriter = new StreamWriter("Resources\\sources.json");
|
||||
ThemeInfos themeInfos = new ThemeInfos { Themes = Etcs.themes.Values.ToList() };
|
||||
fileWriter.Write(JsonSerializer.Serialize(themeInfos, new JsonSerializerOptions { WriteIndented = true }));
|
||||
LoadComboBox();
|
||||
changed = false;
|
||||
}
|
||||
public void SetTheme()
|
||||
{
|
||||
themeNameTextBox.Text = theme!.Name;
|
||||
AnimationUseImage = theme!.AnimationUseImage;
|
||||
IsOutPicture = theme.IsOutPicture;
|
||||
if (IsOutPicture)
|
||||
DesignPanel.BackgroundImage = new Bitmap(theme.PictureName!);
|
||||
else
|
||||
DesignPanel.BackgroundImage = (Image)Etcs.res_Manager.GetObject(theme.PictureName!, Etcs.res_Culture)!;
|
||||
DesignPanel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
if (theme.PlayPanelUsePicture)
|
||||
if (theme.PlayPanelPictureIsOutPicture)
|
||||
playPanelImage = new Bitmap(theme.PlayPanelPictureName!);
|
||||
else
|
||||
playPanelImage = (Image)Etcs.res_Manager.GetObject(theme.PlayPanelPictureName!, Etcs.res_Culture)!;
|
||||
start_Game.Location = new Point(theme.StartGamePos![0], theme.StartGamePos[1]);
|
||||
to_Challenge_mode.Location = new Point(theme.ChallengeModePos![0], theme.ChallengeModePos[1]);
|
||||
to_table_of_scores.Location = new Point(theme.ScoreBoardPos![0], theme.ScoreBoardPos[1]);
|
||||
to_settings.Location = new Point(theme.SettingsPos![0], theme.SettingsPos[1]);
|
||||
menuThemeColor = Color.FromArgb(theme.ThemeColor![0], theme.ThemeColor[1], theme.ThemeColor[2]);
|
||||
themeColorTextBox.Text = "0x" + theme.ThemeColor![0].ToString("X") + theme.ThemeColor[1].ToString("X") + theme.ThemeColor[2].ToString("X");
|
||||
Color buttonColor = theme.ButtonColor!.Count == 3 ? Color.FromArgb(theme.ButtonColor![0], theme.ButtonColor![1], theme.ButtonColor![2]) :
|
||||
Color.FromArgb(theme.ButtonColor![0], theme.ButtonColor![1], theme.ButtonColor![2], theme.ButtonColor![3]);
|
||||
playThemeColor = Color.FromArgb(theme.PlayAreaThemeColor![0], theme.PlayAreaThemeColor[1], theme.PlayAreaThemeColor[2]);
|
||||
start_Game.BackColor = buttonColor;
|
||||
to_Challenge_mode.BackColor = buttonColor;
|
||||
to_table_of_scores.BackColor = buttonColor;
|
||||
to_settings.BackColor = buttonColor;
|
||||
start_Game.Size = new Size(theme.ButtonSize![0], theme.ButtonSize[1]);
|
||||
to_Challenge_mode.Size = new Size(theme.ButtonSize[0], theme.ButtonSize[1]);
|
||||
to_table_of_scores.Size = new Size(theme.ButtonSize[0], theme.ButtonSize[1]);
|
||||
to_settings.Size = new Size(theme.ButtonSize[0], theme.ButtonSize[1]);
|
||||
mainLabel.Font = new Font(theme.Font!, float.Parse(theme.FontSize!));
|
||||
mainLabel.BackColor = buttonColor;
|
||||
mainLabel.ForeColor = Color.FromArgb(theme.FontColor![0], theme.FontColor[1], theme.FontColor[2]);
|
||||
mainLabel.Location = new Point(theme.FontBlockPos![0], theme.FontBlockPos[1]);
|
||||
mainLabel.Size = new Size(theme.FontBlockSize![0], theme.FontBlockSize[1]);
|
||||
}
|
||||
|
||||
private void UseImageInGame_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
changed = true;
|
||||
if ((sender as CheckBox)!.Checked)
|
||||
theme!.PlayPanelUsePicture = true;
|
||||
else
|
||||
theme!.PlayPanelUsePicture = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Back()
|
||||
{
|
||||
if (changed)
|
||||
{
|
||||
var result = MessageBox.Show("没有保存,是否退出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (result.Equals(DialogResult.Yes))
|
||||
{
|
||||
_ = Etcs.form!.change_form(Etcs.setting, false, null, null);
|
||||
}
|
||||
}
|
||||
_ = Etcs.form!.change_form(Etcs.setting, false, null, null);
|
||||
}
|
||||
|
||||
private void themeColorTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Regex.IsMatch(themeColorTextBox.Text, @"^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$"))
|
||||
theme!.ThemeColor = HexToRgb(themeColorTextBox.Text).ToList();
|
||||
}
|
||||
|
||||
private int[] HexToRgb(string hexColor)
|
||||
{
|
||||
hexColor = hexColor.TrimStart('#');
|
||||
|
||||
if (hexColor.Length == 3)
|
||||
{
|
||||
hexColor = string.Concat(hexColor[0], hexColor[0], hexColor[1], hexColor[1], hexColor[2], hexColor[2]);
|
||||
}
|
||||
|
||||
int rgb = Int32.Parse(hexColor, System.Globalization.NumberStyles.HexNumber);
|
||||
int red = (rgb >> 16) & 0xFF;
|
||||
int green = (rgb >> 8) & 0xFF;
|
||||
int blue = rgb & 0xFF;
|
||||
|
||||
return new int[] { red, green, blue };
|
||||
}
|
||||
private void themeSelector_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
changed = false;
|
||||
var s = themeSelector.SelectedItem?.ToString();
|
||||
if (s == null || s.Length == 0)
|
||||
return;
|
||||
Etcs.currentThemeInfo = Etcs.themes[s!];
|
||||
toShow();
|
||||
SetTheme();
|
||||
}
|
||||
|
||||
private void CreateNewTheme_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
findPicture.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
findPicture.Filter = "(*.jpg)|*.jpg|(*.png)|*.png";
|
||||
toShow();
|
||||
LoadComboBox();
|
||||
}
|
||||
private void LoadComboBox()
|
||||
{
|
||||
themeSelector.Items.Clear();
|
||||
themeSelector.Items.AddRange(Etcs.themes.Keys.ToList().ToArray());
|
||||
}
|
||||
|
||||
private void themeNameTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
changed = true;
|
||||
theme!.Name = themeNameTextBox.Text;
|
||||
}
|
||||
|
||||
|
||||
private void saveTheme_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<string> names = Etcs.themes.Values.Select(x => x.Name).ToList();
|
||||
if (names.Contains(theme!.Name))
|
||||
{
|
||||
MessageBox.Show("已存在该主题");
|
||||
return;
|
||||
}
|
||||
AddRecord();
|
||||
}
|
||||
|
||||
private void findPicture_FileOk(object sender, CancelEventArgs e)
|
||||
{
|
||||
var send = (sender as OpenFileDialog)!;
|
||||
theme!.IsOutPicture = true;
|
||||
theme.PictureName = send.FileName;
|
||||
DesignPanel.BackgroundImage = new Bitmap(theme.PictureName!);
|
||||
}
|
||||
|
||||
private void insertImage_Click(object sender, EventArgs e)
|
||||
{
|
||||
findPicture.ShowDialog();
|
||||
}
|
||||
|
||||
private void tranaportWord_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
changed = true;
|
||||
if (tranaportWord.Checked)
|
||||
{
|
||||
theme!.ButtonColor = new List<int> { 0, 0, 0, 0 };
|
||||
mainLabel.BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
theme!.ButtonColor = new List<int> { theme.ThemeColor![0], theme.ThemeColor![1], theme.ThemeColor![2] };
|
||||
mainLabel.BackColor = Color.FromArgb(theme.ThemeColor![0], theme.ThemeColor![1], theme.ThemeColor![2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="findPicture.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -21,6 +21,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
public FinishedMessageBox(int score,int costTime)
|
||||
{
|
||||
InitializeComponent();
|
||||
Location = new Point(Etcs.form!.Left + Etcs.form.Width - Width / 2, Etcs.form.Top + Etcs.form.Height + Height / 2);
|
||||
this.score = score;
|
||||
this.costTime = costTime;
|
||||
scoreLabel.Text = "分数:" + score.ToString();
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
{
|
||||
|
||||
}
|
||||
public GameControl(Action<int>loadFinished)
|
||||
public GameControl(Action<int> loadFinished)
|
||||
{
|
||||
InitializeComponent();
|
||||
DoubleBuffered = true;
|
||||
|
@ -100,12 +100,11 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
}
|
||||
private void AddItem(Single_Block x, int i, int j)
|
||||
{
|
||||
Invoke(() =>
|
||||
{
|
||||
|
||||
x.Size = new Size((int)single_width, (int)single_height);
|
||||
x.Location = new Point((int)(j * single_width), (int)(i * single_height));
|
||||
Controls.Add(x);
|
||||
});
|
||||
Invoke(() => Controls.Add(x));
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 由form和to两个点获取方向
|
||||
|
@ -300,11 +299,11 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
result.Item2.Visible = false;
|
||||
result.Item2.SendToBack();
|
||||
result.Item2.Dispose();
|
||||
giftBlock.Remove(item);
|
||||
});
|
||||
giftBlock.Remove(item);
|
||||
}
|
||||
|
||||
private void SetGiftPicture((int, int)pos , GiftArgs.GiftType type)
|
||||
private void SetGiftPicture((int, int) pos, GiftArgs.GiftType type)
|
||||
{
|
||||
var (picWidth, picHeight) = (single_width / 3, single_height / 3);
|
||||
PictureBox picture = new PictureBox
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CDSAE3_Lian_Lian_Kan.Forms.Interface
|
||||
{
|
||||
public interface IBack
|
||||
{
|
||||
public void Back();
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms.Interface
|
|||
}
|
||||
public FinishType finishType { get; set; }
|
||||
}
|
||||
public interface IGameMode : IThemeChangeable
|
||||
public interface IGameMode : IThemeChangeable,IBack
|
||||
{
|
||||
public void TogglePause();
|
||||
public void De_pause(object sender, EventArgs e);
|
||||
|
|
|
@ -203,5 +203,10 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
{
|
||||
Sp_button_Click(this, new EventArgs());
|
||||
}
|
||||
|
||||
public void Back()
|
||||
{
|
||||
back_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,14 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
if (keyData == (Keys.Space))
|
||||
{
|
||||
Etcs.gameModeForm?.TogglePause();
|
||||
//Console.WriteLine(" TogglePause();");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (keyData == (Keys.Escape))
|
||||
{
|
||||
Etcs.escapableForm?.Back();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
{
|
||||
InitializeComponent();
|
||||
Etcs.gameMenuForm = this;
|
||||
SetTheme();
|
||||
}
|
||||
Color menuThemeColor, playThemeColor;
|
||||
bool IsOutPicture = false;
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
back = new PictureBox();
|
||||
设置 = new Label();
|
||||
contextPanel = new Panel();
|
||||
groupAlgorithm = new GroupBox();
|
||||
GraphAlgorithm = new RadioButton();
|
||||
ArrayAlgorithm = new RadioButton();
|
||||
button1 = new Button();
|
||||
当前主题 = new Label();
|
||||
themeSelector = new ComboBox();
|
||||
|
@ -68,18 +71,15 @@
|
|||
hard = new RadioButton();
|
||||
normal = new RadioButton();
|
||||
easy = new RadioButton();
|
||||
groupAlgorithm = new GroupBox();
|
||||
ArrayAlgorithm = new RadioButton();
|
||||
GraphAlgorithm = new RadioButton();
|
||||
((System.ComponentModel.ISupportInitialize)back).BeginInit();
|
||||
contextPanel.SuspendLayout();
|
||||
groupAlgorithm.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)psButton).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)nextSong).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)lastSong).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)soundScapeVolume).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)musicVolume).BeginInit();
|
||||
groupDifficulty.SuspendLayout();
|
||||
groupAlgorithm.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// back
|
||||
|
@ -131,9 +131,46 @@
|
|||
contextPanel.Controls.Add(groupDifficulty);
|
||||
contextPanel.Location = new Point(71, 103);
|
||||
contextPanel.Name = "contextPanel";
|
||||
contextPanel.Size = new Size(1193, 1209);
|
||||
contextPanel.Size = new Size(1167, 1209);
|
||||
contextPanel.TabIndex = 21;
|
||||
//
|
||||
// groupAlgorithm
|
||||
//
|
||||
groupAlgorithm.BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
groupAlgorithm.Controls.Add(GraphAlgorithm);
|
||||
groupAlgorithm.Controls.Add(ArrayAlgorithm);
|
||||
groupAlgorithm.Font = new Font("Microsoft YaHei UI", 15F);
|
||||
groupAlgorithm.Location = new Point(61, 886);
|
||||
groupAlgorithm.Name = "groupAlgorithm";
|
||||
groupAlgorithm.Size = new Size(327, 208);
|
||||
groupAlgorithm.TabIndex = 35;
|
||||
groupAlgorithm.TabStop = false;
|
||||
groupAlgorithm.Text = " 内部算法";
|
||||
//
|
||||
// GraphAlgorithm
|
||||
//
|
||||
GraphAlgorithm.AutoSize = true;
|
||||
GraphAlgorithm.Location = new Point(25, 105);
|
||||
GraphAlgorithm.Name = "GraphAlgorithm";
|
||||
GraphAlgorithm.Size = new Size(72, 43);
|
||||
GraphAlgorithm.TabIndex = 1;
|
||||
GraphAlgorithm.Text = "图";
|
||||
GraphAlgorithm.UseVisualStyleBackColor = true;
|
||||
GraphAlgorithm.CheckedChanged += Algorithm_CheckedChanged;
|
||||
//
|
||||
// ArrayAlgorithm
|
||||
//
|
||||
ArrayAlgorithm.AutoSize = true;
|
||||
ArrayAlgorithm.Checked = true;
|
||||
ArrayAlgorithm.Location = new Point(25, 45);
|
||||
ArrayAlgorithm.Name = "ArrayAlgorithm";
|
||||
ArrayAlgorithm.Size = new Size(102, 43);
|
||||
ArrayAlgorithm.TabIndex = 0;
|
||||
ArrayAlgorithm.TabStop = true;
|
||||
ArrayAlgorithm.Text = "数组";
|
||||
ArrayAlgorithm.UseVisualStyleBackColor = true;
|
||||
ArrayAlgorithm.CheckedChanged += Algorithm_CheckedChanged;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.AutoSize = true;
|
||||
|
@ -145,6 +182,7 @@
|
|||
button1.TabIndex = 34;
|
||||
button1.Text = "创建新主题";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += button1_Click;
|
||||
//
|
||||
// 当前主题
|
||||
//
|
||||
|
@ -528,43 +566,6 @@
|
|||
easy.UseVisualStyleBackColor = true;
|
||||
easy.CheckedChanged += Difficulty_CheckedChanged;
|
||||
//
|
||||
// groupAlgorithm
|
||||
//
|
||||
groupAlgorithm.BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
groupAlgorithm.Controls.Add(GraphAlgorithm);
|
||||
groupAlgorithm.Controls.Add(ArrayAlgorithm);
|
||||
groupAlgorithm.Font = new Font("Microsoft YaHei UI", 15F);
|
||||
groupAlgorithm.Location = new Point(61, 886);
|
||||
groupAlgorithm.Name = "groupAlgorithm";
|
||||
groupAlgorithm.Size = new Size(327, 208);
|
||||
groupAlgorithm.TabIndex = 35;
|
||||
groupAlgorithm.TabStop = false;
|
||||
groupAlgorithm.Text = " 内部算法";
|
||||
//
|
||||
// ArrayAlgorithm
|
||||
//
|
||||
ArrayAlgorithm.AutoSize = true;
|
||||
ArrayAlgorithm.Checked = true;
|
||||
ArrayAlgorithm.Location = new Point(25, 45);
|
||||
ArrayAlgorithm.Name = "ArrayAlgorithm";
|
||||
ArrayAlgorithm.Size = new Size(102, 43);
|
||||
ArrayAlgorithm.TabIndex = 0;
|
||||
ArrayAlgorithm.TabStop = true;
|
||||
ArrayAlgorithm.Text = "数组";
|
||||
ArrayAlgorithm.UseVisualStyleBackColor = true;
|
||||
ArrayAlgorithm.CheckedChanged += Algorithm_CheckedChanged;
|
||||
//
|
||||
// GraphAlgorithm
|
||||
//
|
||||
GraphAlgorithm.AutoSize = true;
|
||||
GraphAlgorithm.Location = new Point(25, 105);
|
||||
GraphAlgorithm.Name = "GraphAlgorithm";
|
||||
GraphAlgorithm.Size = new Size(72, 43);
|
||||
GraphAlgorithm.TabIndex = 1;
|
||||
GraphAlgorithm.Text = "图";
|
||||
GraphAlgorithm.UseVisualStyleBackColor = true;
|
||||
GraphAlgorithm.CheckedChanged += Algorithm_CheckedChanged;
|
||||
//
|
||||
// Setting
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
|
@ -582,6 +583,8 @@
|
|||
((System.ComponentModel.ISupportInitialize)back).EndInit();
|
||||
contextPanel.ResumeLayout(false);
|
||||
contextPanel.PerformLayout();
|
||||
groupAlgorithm.ResumeLayout(false);
|
||||
groupAlgorithm.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)psButton).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)nextSong).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)lastSong).EndInit();
|
||||
|
@ -589,8 +592,6 @@
|
|||
((System.ComponentModel.ISupportInitialize)musicVolume).EndInit();
|
||||
groupDifficulty.ResumeLayout(false);
|
||||
groupDifficulty.PerformLayout();
|
||||
groupAlgorithm.ResumeLayout(false);
|
||||
groupAlgorithm.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
|
|
@ -271,5 +271,10 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
_ = Etcs.form!.change_form(new CreateNewTheme(), false, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,16 +135,16 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
|||
{
|
||||
Etcs.hunderd_millsecond_timer.Elapsed -= Image_Clear;
|
||||
try
|
||||
{
|
||||
Invoke(() =>
|
||||
{
|
||||
if (picture == null)
|
||||
return;
|
||||
picture.Visible = false;
|
||||
picture.Dispose();
|
||||
Invoke(() =>
|
||||
{
|
||||
picture?.Dispose();
|
||||
if (Controls.Contains(picture))
|
||||
Controls.Remove(picture);
|
||||
picture = null;
|
||||
});
|
||||
picture = null;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
|
Reference in New Issue