diff --git a/CDSAE3_Lian_Lian_Kan.sln b/CDSAE3_Lian_Lian_Kan.sln new file mode 100644 index 0000000..7da4f7e --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34607.119 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CDSAE3_Lian_Lian_Kan", "CDSAE3_Lian_Lian_Kan\CDSAE3_Lian_Lian_Kan.csproj", "{5CA636F6-E4BD-43C2-8FBE-BAC13D7D9A70}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5CA636F6-E4BD-43C2-8FBE-BAC13D7D9A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5CA636F6-E4BD-43C2-8FBE-BAC13D7D9A70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5CA636F6-E4BD-43C2-8FBE-BAC13D7D9A70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5CA636F6-E4BD-43C2-8FBE-BAC13D7D9A70}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {888FB6D7-EB3E-41DB-80E2-57C1CF1C23D8} + EndGlobalSection +EndGlobal diff --git a/CDSAE3_Lian_Lian_Kan/Board_funcs/Board.cs b/CDSAE3_Lian_Lian_Kan/Board_funcs/Board.cs new file mode 100644 index 0000000..9abf9e9 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Board_funcs/Board.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using CDSAE3_Lian_Lian_Kan; +namespace CDSAE3_Lian_Lian_Kan.Board_funcs +{ + public partial class Board + { + public Board() { + } + public int[,]? Bd { get; set; } = null;//y,x + public int[]? vals_per_Image = null; + public int total; + public int Total { get + { + return total; + } + set + { + total = value; + if(total == 0) + Settings.game_mode_form?.Finished_Handler(this, new Forms.FinishArgs { finish_Type = Forms.FinishArgs.Finish_Type.All_done }); + } } + public void make_board() + { + var rand = new Random(); + size = Settings.get_length_width(); + var (width, height) = size; + Bd = new int[height + 2, width + 2]; + for (int i = 0; i < height + 2; i++) + for (int j = 0; j < width + 2; j++) + Bd[i, j] = -1; + int sum = width * height; + if (sum % 2 != 0) + sum--; + total = sum; + int types = Settings.Images_size(); + vals_per_Image = new int[types]; + int single = sum/types; + for(int k = sum; k>0; k-=2) + { + int t = rand.Next(0, types); + if (vals_per_Image[t] >= 1.5*single) + { + k += 2; + continue; + } + vals_per_Image[t]+=2; + } + int cur_width = 1, cur_height = 1; + var temp_val_per_Image = (int[])vals_per_Image.Clone(); + Func getval = () => + { + int t = rand.Next(0, types); + if (temp_val_per_Image[t] == 0) + { + int i = (t + 1)%types; + for (; temp_val_per_Image[i] == 0; i %= types) + i++; + temp_val_per_Image[i]--; + return i; + } + temp_val_per_Image[t]--; + return t; + }; + for (int i=0;i width) + { + cur_height++; + cur_width = 1; + } + } + return; + } + public (bool,List<(int,int)>?) test((int,int) a,(int,int) b)//x,y + { + bool reverse = false; + if (a == b) + return (false,null); + if (Bd?[a.Item2, a.Item1] != Bd?[b.Item2, b.Item1]) + return (false,null); + var (xa, ya) = a; + var (xb, yb) = b; + Func line_test = (bool x,int ct,int from,int to) => + {//ct is x (x==true)left to right ///up to down + if (from > to) + (from, to) = (to, from); + if (x) + { + for (int i = from + 1; i < to; i++) + if (Bd?[ct, i] != -1) + return false; + } + else + for (int i = from + 1; i < to; i++) + if (Bd?[i, ct] != -1) + return false; + return true; + }; + if (xa == xb) + if (line_test(false, xa, ya, yb)) + return (true, new List<(int, int)> { a, b }); + if (ya == yb) + if (line_test(true, ya, xa, xb)) + return (true, new List<(int, int)> { a, b }); + (int, int)[] squareA = new (int, int)[4]; + (int, int)[] squareB = new (int, int)[4];//urdl + {//two line test + HashSet<(int, int)> reachableA = new HashSet<(int, int)>(), reachableB = new HashSet<(int, int)>(); + Func<(int, int), HashSet<(int, int)>, bool> check_insert = ((int, int) pos, HashSet<(int, int)> insert) =>//x,y + { + if (pos.Item1 < 0 || pos.Item2 < 0 || pos.Item1 >= Bd?.GetLength(1) || pos.Item2 >= Bd?.GetLength(0)) + return false; + if (Bd?[pos.Item2, pos.Item1] == -1) + { + insert.Add(pos); + return true; + } + return false; + }; + Func<(int, int), HashSet<(int, int)>, HashSet<(int, int)>, (int, int)[], (bool, int, int)> cross_test = ((int, int) pos, HashSet<(int, int)> insert, HashSet<(int, int)> test, (int, int)[] square) =>//x,y + { + + var (x, y) = pos; + for (x--; ; x--) + if (check_insert((x, y), insert)) + { + if (test.Contains((x, y))) + return (true, x, y); + } + else + { + square[3] = (x + 1, y); + break; + } + (x, y) = pos; + for (x++; ; x++) + if (check_insert((x, y), insert)) + { + if (test.Contains((x, y))) + return (true, x, y); + } + else + { + square[1] = (x - 1, y); + break; + } + (x, y) = pos; + for (y--; ; y--) + if (check_insert((x, y), insert)) + { + if (test.Contains((x, y))) + return (true, x, y); + } + else + { + square[0] = (x, y + 1); + break; + } + (x, y) = pos; + for (y++; ; y++) + if (check_insert((x, y), insert)) + { + if (test.Contains((x, y))) + return (true, x, y); + } + else + { + square[2] = (x, y - 1); + break; + } + return (false, -1, -1); + }; + cross_test(a, reachableA, reachableB, squareA); + var (find_ans, pax, pay) = cross_test(b, reachableB, reachableA, squareB); + if (find_ans) + return (true, new List<(int, int)> { a, (pax, pay), b }); + if (reachableA.Count > reachableB.Count) + { + (a, b) = (b, a); + reverse = true; + } + } + {//three line test + Func<(int, int), (int, int), (bool, (int, int))> intersection = ((int, int) a, (int, int) b) => + { + if (a.Item1 > b.Item1) + (a, b) = (b, a); + if (a.Item2 < b.Item1) + return (false, (-1, -1)); + if (a.Item2 > b.Item2) + return (true,( b.Item1, b.Item2)); + return (true, (b.Item1, a.Item2)); + }; + var (throughx, xrange) = intersection((squareA[3].Item1, squareA[1].Item1), (squareB[3].Item1, squareB[1].Item1)); + var (throughy, yrange) = intersection((squareA[0].Item2, squareA[2].Item2), (squareB[0].Item2, squareB[2].Item2)); + if (throughx) + for (int i = xrange.Item1; i <= xrange.Item2; i++) + if (line_test(false, i, a.Item2, b.Item2)) + if (reverse) + return (true, new List<(int, int)> { b, (i, b.Item2), (i, a.Item2), a }); + else + return (true, new List<(int, int)> { a, (i, a.Item2), (i, b.Item2), b }); + if (throughy) + for (int i = yrange.Item1; i <= yrange.Item2; i++) + if (line_test(true, i, a.Item1, b.Item1)) + if (reverse) + return (true, new List<(int, int)> { b, (b.Item1, i), (a.Item1, i), a }); + else + return (true, new List<(int, int)> { a, (a.Item1, i), (b.Item1, i), b }); + } + return (false, null); + } + public (int, int) size { get; set; }//width,height + public Settings.Mode mode { get; set; } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/CDSAE3_Lian_Lian_Kan.csproj b/CDSAE3_Lian_Lian_Kan/CDSAE3_Lian_Lian_Kan.csproj new file mode 100644 index 0000000..af03d74 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/CDSAE3_Lian_Lian_Kan.csproj @@ -0,0 +1,26 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.Designer.cs new file mode 100644 index 0000000..cdf2836 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.Designer.cs @@ -0,0 +1,39 @@ +namespace CDSAE3_Lian_Lian_Kan +{ + partial class Challenge_Mode_MenuForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "Challenge_Mode_MenuForm"; + } + + #endregion + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.cs b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.cs new file mode 100644 index 0000000..6554bc0 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.cs @@ -0,0 +1,20 @@ +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; + +namespace CDSAE3_Lian_Lian_Kan +{ + public partial class Challenge_Mode_MenuForm : Form + { + public Challenge_Mode_MenuForm() + { + InitializeComponent(); + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.resx b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/GameControl.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.Designer.cs new file mode 100644 index 0000000..256e960 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.Designer.cs @@ -0,0 +1,62 @@ +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + partial class GameControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + playPanel = new TableLayoutPanel(); + SuspendLayout(); + // + // playPanel + // + playPanel.BackColor = Color.FromArgb(0, 0, 0, 0); + playPanel.ColumnCount = 1; + playPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + playPanel.Dock = DockStyle.Fill; + playPanel.Location = new Point(0, 0); + playPanel.Name = "playPanel"; + playPanel.RowCount = 1; + playPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); + playPanel.Size = new Size(1400, 800); + playPanel.TabIndex = 1; + // + // GameControl + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.FromArgb(0, 0, 0, 0); + Controls.Add(playPanel); + Name = "GameControl"; + Size = new Size(1400, 800); + ResumeLayout(false); + } + + #endregion + + private TableLayoutPanel playPanel; + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/GameControl.cs b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.cs new file mode 100644 index 0000000..b4c6ffa --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.cs @@ -0,0 +1,206 @@ +using CDSAE3_Lian_Lian_Kan.Board_funcs; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.Design; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; + +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + public partial class GameControl : UserControl, IBeSelected + { + Board board = new Board(); + IGameMode iGameMode; + public GameControl() + { + InitializeComponent(); + board.make_board(); + Settings.game_form = this; + playPanel_set(); + iGameMode = Settings.game_mode_form; + } + void playPanel_set() + { + int[,] bd; + if (board.Bd == null) + { + board.make_board(); + bd = board.Bd ?? new int[0, 0]; + if (bd.Length == 0) + throw new Exception("bd is null"); + } + else + bd = board.Bd; + playPanel_size_change(); + for (int i = 0; i < playPanel.RowCount; i++) + for (int j = 0; j < playPanel.ColumnCount; j++) + { + if (bd[i, j] == -1) + { + var x = new Single_Block(Settings.trans_Image, (j, i)); + x.Dock = DockStyle.Fill; + playPanel.Controls.Add(x, j, i); + } + else + { + var x = new Single_Block(bd[i, j], Settings.def_Color, Settings.sel_Color, (j, i)); + x.Dock = DockStyle.Fill; + playPanel.Controls.Add(x, j, i); + } + } + } + Queue<((int, int), Single_Block)> queue = new Queue<((int, int), Single_Block)>();//y,x + public void Selected_Handler(Single_Block sender, SelectedEventArgs e) + { + Task.Run(() => + { + iGameMode.De_pause(this, e); + if (e.be_selected) + { + switch (queue.Count) + { + case 0: + queue.Enqueue((e.position, sender)); + break; + case 1: + var (posa, sendera) = queue.Dequeue(); + var posb = e.position; + var (could, path) = board.test(posa, posb); + if (could) + { + _ = Block_ClearAsync(path); + while (queue.Count() > 0) + queue.Dequeue(); + if (board.Bd is null) throw new Exception("No usable board. How come?"); + board.Bd[posa.Item2, posa.Item1] = -1; + board.Bd[posb.Item2, posb.Item1] = -1; + } + else + { + queue.Enqueue((e.position, sender)); + sendera.deselect(); + } + break; + } + } + else + { + switch (queue.Count) + { + case 0: + break; + case 1: + if (queue.Peek().Item1 == e.position) + queue.Dequeue(); + break; + } + } + }); + } + + async Task Block_ClearAsync(List<(int, int)>? path) + { + List paths = new List(); + if (path == null) + return; + Func<(int, int), (int, int), Settings.Direction> get_Direction = ((int, int) from, (int, int) to) =>//x,y + { + if (from.Item1 == to.Item1) + if (from.Item2 > to.Item2) + return Settings.Direction.up; + else + return Settings.Direction.down; + else + if (from.Item1 > to.Item1) + return Settings.Direction.left; + else + return Settings.Direction.right; + }; + Func<(int, int), Settings.Direction, Task> set_Path = async ((int, int) point, Settings.Direction direction) => + { + await Task.Delay(20); + Control? control = playPanel.GetControlFromPosition(point.Item1, point.Item2); + if (control != null && control is Single_Block single_Block) + { + single_Block.to_path(direction); + paths.Add(single_Block); + } + }; + Func<(int, int), (int, int), bool, Settings.Direction, Task> to_path = async ((int, int) from, (int, int) to, bool include_end, Settings.Direction extra_Direction) => + { + var direction = get_Direction(from, to); + switch (direction) + { + case Settings.Direction.up: + for (int i = from.Item2 - 1; i != to.Item2; i--) + await set_Path((from.Item1, i), Settings.Direction.up_down); + break; + case Settings.Direction.down: + for (int i = from.Item2 + 1; i != to.Item2; i++) + await set_Path((from.Item1, i), Settings.Direction.up_down); + break; + case Settings.Direction.right: + for (int i = from.Item1 + 1; i != to.Item1; i++) + await set_Path((i, from.Item2), Settings.Direction.left_right); + break; + case Settings.Direction.left: + for (int i = from.Item1 - 1; i != to.Item1; i--) + await set_Path((i, from.Item2), Settings.Direction.left_right); + break; + } + if (include_end) + { + direction = direction | extra_Direction; + await set_Path(to, direction); + } + }; + switch (path.Count) + { + case 2: + await to_path(path[0], path[1], false, 0); + break; + case 3: + var extra_direction = get_Direction(path[1], path[2]); + await to_path(path[0], path[1], true, extra_direction); + await to_path(path[1], path[2], false, Settings.Direction.none); + break; + case 4: + Settings.Direction extra_directionA = get_Direction(path[1], path[2]), extra_directionB = get_Direction(path[2], path[3]); + await to_path(path[0], path[1], true, extra_directionA); + await to_path(path[1], path[2], true, extra_directionB); + await to_path(path[2], path[3], false, Settings.Direction.none); + break; + } + Control? controlA = playPanel.GetControlFromPosition(path[0].Item1, path[0].Item2), controlB = playPanel.GetControlFromPosition(path.Last().Item1, path.Last().Item2); + if (controlA != null && controlB != null && controlA is Single_Block single_BlockA && controlB is Single_Block single_BlockB) + { + single_BlockA.destroyAsync(); + single_BlockB.destroyAsync(); + } + await Task.Delay(200); + foreach (var control in paths) + control.de_path(); + iGameMode.Score_Add(this, new AddScoreArgs { score = (paths.Count + 2)*10 }); + board.Total -= 2; + } + + void playPanel_size_change() + { + var (width, height) = board.size; + playPanel.RowCount = height + 2; + playPanel.ColumnCount = width + 2; + playPanel.ColumnStyles[0] = new ColumnStyle(SizeType.Percent, 100F); + playPanel.RowStyles[0] = new RowStyle(SizeType.Percent, 100F); + for (int i = 0; i < width + 1; i++) + playPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); + for (int i = 0; i < height + 1; i++) + playPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/GameControl.resx b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/GameForm.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/GameForm.Designer.cs new file mode 100644 index 0000000..e70779a --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/GameForm.Designer.cs @@ -0,0 +1,39 @@ +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + partial class GameForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "GameForm"; + } + + #endregion + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/GameForm.cs b/CDSAE3_Lian_Lian_Kan/Forms/GameForm.cs new file mode 100644 index 0000000..2fabed9 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/GameForm.cs @@ -0,0 +1,20 @@ +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; + +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + public partial class GameForm : Form + { + public GameForm() + { + InitializeComponent(); + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/GameForm.resx b/CDSAE3_Lian_Lian_Kan/Forms/GameForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/GameForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/IBeSelected.cs b/CDSAE3_Lian_Lian_Kan/Forms/IBeSelected.cs new file mode 100644 index 0000000..3e79dad --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/IBeSelected.cs @@ -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 +{ + public interface IBeSelected + { + public void Selected_Handler(Single_Block sender, SelectedEventArgs e); + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/IGameMode.cs b/CDSAE3_Lian_Lian_Kan/Forms/IGameMode.cs new file mode 100644 index 0000000..40be482 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/IGameMode.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + public class AddScoreArgs : EventArgs + { + public int score { get; set; } + } + public class FinishArgs: EventArgs + { + public enum Finish_Type + { + All_done = 0, + Time_out = 1 + } + public Finish_Type finish_Type { get; set; } + } + public interface IGameMode + { + public void De_pause(object sender, EventArgs e); + public void Score_Add(object sender, AddScoreArgs e); + public void Finished_Handler(object sender, FinishArgs e); + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.Designer.cs new file mode 100644 index 0000000..a9e2bb6 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.Designer.cs @@ -0,0 +1,207 @@ +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + partial class Leisure_Mode + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + game_Panel = new Panel(); + gameControl = new GameControl(); + back = new PictureBox(); + energy_bar = new ProgressBar(); + Score_Label = new Label(); + factor = new Label(); + time = new Label(); + score = new Label(); + sp_button = new PictureBox(); + search = new PictureBox(); + exchange = new PictureBox(); + game_Panel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)back).BeginInit(); + ((System.ComponentModel.ISupportInitialize)sp_button).BeginInit(); + ((System.ComponentModel.ISupportInitialize)search).BeginInit(); + ((System.ComponentModel.ISupportInitialize)exchange).BeginInit(); + SuspendLayout(); + // + // game_Panel + // + game_Panel.BackColor = Color.FromArgb(50, 0, 0, 0); + game_Panel.Controls.Add(gameControl); + game_Panel.Location = new Point(20, 143); + game_Panel.Name = "game_Panel"; + game_Panel.Size = new Size(1400, 800); + game_Panel.TabIndex = 0; + // + // gameControl + // + gameControl.BackColor = Color.FromArgb(0, 0, 0, 0); + gameControl.Dock = DockStyle.Fill; + gameControl.Location = new Point(0, 0); + gameControl.Name = "gameControl"; + gameControl.Size = new Size(1400, 800); + gameControl.TabIndex = 0; + // + // back + // + back.BackColor = Color.FromArgb(249, 211, 171); + back.Image = Properties.Resources.left_arrow; + back.Location = new Point(30, 31); + back.Name = "back"; + back.Size = new Size(70, 70); + back.SizeMode = PictureBoxSizeMode.Zoom; + back.TabIndex = 1; + back.TabStop = false; + back.Click += back_Click; + // + // energy_bar + // + energy_bar.Location = new Point(644, 48); + energy_bar.Name = "energy_bar"; + energy_bar.Size = new Size(386, 34); + energy_bar.Step = 1; + energy_bar.TabIndex = 2; + // + // Score_Label + // + Score_Label.AutoSize = true; + Score_Label.BackColor = Color.FromArgb(249, 211, 171); + Score_Label.Font = new Font("Microsoft YaHei UI", 18F); + Score_Label.Location = new Point(1093, 43); + Score_Label.Name = "Score_Label"; + Score_Label.Size = new Size(128, 46); + Score_Label.TabIndex = 3; + Score_Label.Text = "分数:"; + // + // factor + // + factor.AutoSize = true; + factor.BackColor = Color.FromArgb(249, 211, 171); + factor.Font = new Font("Microsoft YaHei UI", 18F); + factor.Location = new Point(578, 42); + factor.Name = "factor"; + factor.Size = new Size(59, 46); + factor.TabIndex = 4; + factor.Text = "x1"; + // + // time + // + time.AutoSize = true; + time.BackColor = Color.FromArgb(249, 211, 171); + time.Font = new Font("Microsoft YaHei UI", 18F); + time.Location = new Point(195, 43); + time.Name = "time"; + time.Size = new Size(113, 46); + time.TabIndex = 6; + time.Text = "00:00"; + // + // score + // + score.AutoSize = true; + score.BackColor = Color.FromArgb(249, 211, 171); + score.Font = new Font("Microsoft YaHei UI", 18F); + score.Location = new Point(1214, 43); + score.Name = "score"; + score.Size = new Size(104, 46); + score.TabIndex = 7; + score.Text = "0000"; + // + // sp_button + // + sp_button.BackColor = Color.FromArgb(249, 211, 171); + sp_button.Image = Properties.Resources.play_buttton; + sp_button.Location = new Point(1350, 31); + sp_button.Name = "sp_button"; + sp_button.Size = new Size(70, 70); + sp_button.SizeMode = PictureBoxSizeMode.Zoom; + sp_button.TabIndex = 8; + sp_button.TabStop = false; + sp_button.Click += Sp_button_Click; + // + // search + // + search.BackColor = Color.FromArgb(249, 211, 171); + search.Image = Properties.Resources.search; + search.Location = new Point(360, 31); + search.Name = "search"; + search.Size = new Size(70, 70); + search.SizeMode = PictureBoxSizeMode.Zoom; + search.TabIndex = 9; + search.TabStop = false; + // + // exchange + // + exchange.BackColor = Color.FromArgb(249, 211, 171); + exchange.Image = Properties.Resources.exchange; + exchange.Location = new Point(455, 31); + exchange.Name = "exchange"; + exchange.Size = new Size(70, 70); + exchange.SizeMode = PictureBoxSizeMode.Zoom; + exchange.TabIndex = 10; + exchange.TabStop = false; + // + // Leisure_Mode + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.FromArgb(249, 211, 171); + ClientSize = new Size(1439, 960); + Controls.Add(exchange); + Controls.Add(search); + Controls.Add(sp_button); + Controls.Add(score); + Controls.Add(time); + Controls.Add(factor); + Controls.Add(Score_Label); + Controls.Add(energy_bar); + Controls.Add(back); + Controls.Add(game_Panel); + FormBorderStyle = FormBorderStyle.None; + Name = "Leisure_Mode"; + Text = "Leisure_Mode"; + game_Panel.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)back).EndInit(); + ((System.ComponentModel.ISupportInitialize)sp_button).EndInit(); + ((System.ComponentModel.ISupportInitialize)search).EndInit(); + ((System.ComponentModel.ISupportInitialize)exchange).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Panel game_Panel; + private PictureBox back; + private ProgressBar energy_bar; + private Label Score_Label; + private Label factor; + private Label time; + private Label score; + private PictureBox sp_button; + private PictureBox search; + private PictureBox exchange; + private GameControl gameControl; + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.cs b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.cs new file mode 100644 index 0000000..1f49264 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.cs @@ -0,0 +1,127 @@ +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 CDSAE3_Lian_Lian_Kan.Board_funcs; +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + + public partial class Leisure_Mode : Form, IGameMode + { + public Leisure_Mode() + { + Settings.game_mode_form = this; + InitializeComponent(); + timer = new System.Timers.Timer(); + timer.Enabled = false; + timer.Interval = 1000; + timer.Elapsed += Timer_Tick; + time.Text = (left_time / 60).ToString().PadLeft(2, '0') + ":" + (left_time % 60).ToString().PadLeft(2, '0'); + } + System.Timers.Timer timer; + int left_time = Settings.left_time; + bool is_pause = true; + int cur_score = 0; + int factor_val = 1; + int current_base = 0; + + Dictionary decrease_per_level = Settings.decrease_per_level; + private void Timer_Tick(object? sender, EventArgs e) + { + left_time--; + BeginInvoke(() => time.Text = (left_time / 60).ToString().PadLeft(2, '0') + ":" + (left_time % 60).ToString().PadLeft(2, '0')); + if (current_base <= 0) + { + if(factor_val>1) + { + current_base = 100; + factor_val--; + BeginInvoke(() => factor.Text = "x" + factor_val.ToString()); + BeginInvoke(() => energy_bar.Value = current_base); + } + } + else + { + current_base -= (int)decrease_per_level[factor_val]; + if (current_base < 0) + current_base = 0; + BeginInvoke(() => energy_bar.Value = current_base); + } + + if (left_time < 0) + { + timer.Enabled = false; + Finished_Handler(this, new FinishArgs { finish_Type = FinishArgs.Finish_Type.Time_out }); + } + if (is_pause) { timer.Enabled = false; } + } + public void De_pause(object sender, EventArgs e) + { + if (is_pause) + Sp_button_Click(sender, e); + } + + public void Score_Add(object sender, AddScoreArgs e) + { + cur_score += e.score * factor_val; + current_base += e.score; + while(current_base>100) + { + if(factor_val>=10) + { + factor_val = 10; + current_base = 100; + } + else + { + current_base -= 100; + factor_val++; + } + } + BeginInvoke(()=>factor.Text = "x" + factor_val.ToString()); + BeginInvoke(() => energy_bar.Value = current_base); + BeginInvoke(() => score.Text = cur_score.ToString()); + } + public void Sp_button_Click(object sender, EventArgs e) + { + if (is_pause) + { + sp_button.Image = Properties.Resources.pause; + is_pause = false; + timer.Enabled = true; + } + else + { + sp_button.Image = Properties.Resources.play_buttton; + is_pause = true; + timer.Enabled = false; + } + } + public void Finished_Handler(object sender, FinishArgs e) + { + //TODO finish form + switch (e.finish_Type) + { + case FinishArgs.Finish_Type.All_done: + MessageBox.Show("Congratulation!"); + break; + case FinishArgs.Finish_Type.Time_out: + MessageBox.Show("Time Out!"); + break; + } + } + + private void back_Click(object sender, EventArgs e) + { + Close(); + Dispose(); + timer.Close(); + Settings.form?.change_form(new Leisure_Mode_MenuForm()); + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.resx b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.Designer.cs new file mode 100644 index 0000000..42de482 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.Designer.cs @@ -0,0 +1,105 @@ +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + partial class Leisure_Mode_MenuForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + to_table_of_scores = new Button(); + to_settings = new Button(); + start_Game = new Button(); + to_Challenge_mode = new Button(); + SuspendLayout(); + // + // to_table_of_scores + // + to_table_of_scores.BackColor = Color.FromArgb(249, 211, 171); + to_table_of_scores.Font = new Font("Microsoft YaHei UI", 18F); + to_table_of_scores.Location = new Point(939, 363); + to_table_of_scores.Name = "to_table_of_scores"; + to_table_of_scores.Size = new Size(172, 65); + to_table_of_scores.TabIndex = 0; + to_table_of_scores.Text = "积分榜"; + to_table_of_scores.UseVisualStyleBackColor = false; + // + // to_settings + // + to_settings.BackColor = Color.FromArgb(249, 211, 171); + to_settings.Font = new Font("Microsoft YaHei UI", 18F); + to_settings.Location = new Point(939, 505); + to_settings.Name = "to_settings"; + to_settings.Size = new Size(172, 65); + to_settings.TabIndex = 1; + to_settings.Text = "设置"; + to_settings.UseVisualStyleBackColor = false; + // + // start_Game + // + start_Game.BackColor = Color.FromArgb(249, 211, 171); + start_Game.Font = new Font("Microsoft YaHei UI", 18F); + start_Game.Location = new Point(354, 363); + start_Game.Name = "start_Game"; + start_Game.Size = new Size(172, 65); + start_Game.TabIndex = 2; + start_Game.Text = "开始游戏"; + start_Game.UseVisualStyleBackColor = false; + start_Game.Click += start_Game_Click; + // + // to_Challenge_mode + // + to_Challenge_mode.BackColor = Color.FromArgb(249, 211, 171); + to_Challenge_mode.Font = new Font("Microsoft YaHei UI", 18F); + to_Challenge_mode.Location = new Point(354, 505); + to_Challenge_mode.Name = "to_Challenge_mode"; + to_Challenge_mode.Size = new Size(172, 65); + to_Challenge_mode.TabIndex = 3; + to_Challenge_mode.Text = "挑战模式"; + to_Challenge_mode.UseVisualStyleBackColor = false; + // + // Leisure_Mode_MenuForm + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources.连连看MainPicture; + ClientSize = new Size(1440, 960); + Controls.Add(to_Challenge_mode); + Controls.Add(start_Game); + Controls.Add(to_settings); + Controls.Add(to_table_of_scores); + FormBorderStyle = FormBorderStyle.None; + Name = "Leisure_Mode_MenuForm"; + Text = "MenuForm"; + ResumeLayout(false); + } + + #endregion + + private Button to_table_of_scores; + private Button to_settings; + private Button start_Game; + private Button to_Challenge_mode; + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.cs b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.cs new file mode 100644 index 0000000..d252e36 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.cs @@ -0,0 +1,25 @@ +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; + +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + public partial class Leisure_Mode_MenuForm : Form + { + public Leisure_Mode_MenuForm() + { + InitializeComponent(); + } + + private void start_Game_Click(object sender, EventArgs e) + { + Settings.form?.change_form(new Leisure_Mode()); + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.resx b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/MainForm.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/MainForm.Designer.cs new file mode 100644 index 0000000..6e3a2c9 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/MainForm.Designer.cs @@ -0,0 +1,60 @@ +namespace CDSAE3_Lian_Lian_Kan +{ + partial class LianLianKan + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + MainPanel = new Panel(); + SuspendLayout(); + // + // MainPanel + // + MainPanel.BackColor = SystemColors.Control; + MainPanel.Dock = DockStyle.Fill; + MainPanel.Location = new Point(0, 0); + MainPanel.Name = "MainPanel"; + MainPanel.Size = new Size(1440, 960); + MainPanel.TabIndex = 0; + // + // LianLianKan + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1440, 960); + Controls.Add(MainPanel); + MaximumSize = new Size(1462, 1016); + MinimumSize = new Size(1462, 1016); + Name = "LianLianKan"; + Text = "连连看"; + ResumeLayout(false); + } + + #endregion + + private Panel MainPanel; + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/MainForm.cs b/CDSAE3_Lian_Lian_Kan/Forms/MainForm.cs new file mode 100644 index 0000000..e9344fe --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/MainForm.cs @@ -0,0 +1,28 @@ +using CDSAE3_Lian_Lian_Kan.Forms; + +namespace CDSAE3_Lian_Lian_Kan +{ + public partial class LianLianKan : Form + { + public LianLianKan() + { + InitializeComponent(); + current_form = this; + change_form(new Leisure_Mode_MenuForm()); + Settings.form = this; + } + Form current_form; + public void change_form(Form form) + { + if (current_form == form) + return; + current_form = form; + MainPanel.Controls.Clear(); + form.TopLevel = false; + form.Dock = DockStyle.Fill; + MainPanel.Controls.Add(form); + GC.Collect(); + form.Show(); + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/MainForm.resx b/CDSAE3_Lian_Lian_Kan/Forms/MainForm.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/MainForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.Designer.cs new file mode 100644 index 0000000..54cbae8 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.Designer.cs @@ -0,0 +1,63 @@ +namespace CDSAE3_Lian_Lian_Kan +{ + partial class Single_Block + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + picture = new PictureBox(); + ((System.ComponentModel.ISupportInitialize)picture).BeginInit(); + SuspendLayout(); + // + // picture + // + picture.BackColor = Color.Transparent; + picture.Dock = DockStyle.Fill; + picture.Location = new Point(3, 3); + picture.Name = "picture"; + picture.Size = new Size(34, 34); + picture.TabIndex = 0; + picture.TabStop = false; + picture.Click += picture_Click; + // + // Single_Block + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.Transparent; + Controls.Add(picture); + Name = "Single_Block"; + Padding = new Padding(3); + Size = new Size(40, 40); + ((System.ComponentModel.ISupportInitialize)picture).EndInit(); + ResumeLayout(false); + } + + #endregion + + private PictureBox picture; + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.cs b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.cs new file mode 100644 index 0000000..02861f1 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.cs @@ -0,0 +1,135 @@ +using CDSAE3_Lian_Lian_Kan.Forms; +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.Timers; +using System.Windows.Forms; + +namespace CDSAE3_Lian_Lian_Kan +{ + public partial class Single_Block : UserControl + { + public Single_Block() + { + InitializeComponent(); + if (Settings.game_form == null) + throw new Exception("game_form is null but try to make a new Single_Block"); + Selected += Settings.game_form.Selected_Handler; + } + public Single_Block(int image, Color default_backColor, Color select_Color, (int, int) pos) + { + block_id = image; + position = pos; + InitializeComponent(); + Image_change(Settings.get_block_Image(image)); + picture.SizeMode = PictureBoxSizeMode.Zoom; + nor_color = default_backColor; + sel_color = select_Color; + BackColor = default_backColor; + picture.BackColor = default_backColor; + if (Settings.game_form == null) + throw new Exception("game_form is null but try to make a new Single_Block"); + Selected += Settings.game_form.Selected_Handler; + + } + public Single_Block(Image image, (int, int) pos) + { + position = pos; + InitializeComponent(); + picture.SizeMode = PictureBoxSizeMode.Zoom; + BackColor = Color.FromArgb(0, 0, 0, 0); + can_be_selected = false; + if (Settings.game_form == null) + throw new Exception("game_form is null but try to make a new Single_Block"); + Selected += Settings.game_form.Selected_Handler; + } + int block_id; + Color nor_color; + Color sel_color; + public bool selected { get; set; } = false; + bool can_be_selected = true; + public (int, int) position { get; set; }//height,width + private void picture_Click(object sender, EventArgs e) + { + if (!can_be_selected) + return; + if (selected) + { + deselect(); + Selected.Invoke(this, new SelectedEventArgs(position, false)); + } + else + { + select(); + Selected.Invoke(this, new SelectedEventArgs(position, true)); + } + } + public void select() + { + selected = true; + BackColor = sel_color; + } + public void deselect() + { + selected = false; + BackColor = nor_color; + } + public void to_path(Settings.Direction direction) + {//TODO tube Image + Image_change(Settings.get_block_Image(0)); + } + public void de_path() + { + Image_change(Settings.trans_Image); + } + System.Timers.Timer? timer = null; + public void destroyAsync() + { + Image_change(Settings.get_disappear_Images(block_id)); + BackColor = Color.FromArgb(0, 0, 0, 0); + can_be_selected = false; + timer = new System.Timers.Timer(); + timer.Interval = 500; + timer.Elapsed += Image_Clear; + timer.Enabled = true; + } + Object locker = new object(); + public void Image_Clear(object? sender, ElapsedEventArgs e) + { + timer?.Stop(); + Image_change(Settings.trans_Image); + } + public void Image_change(Image new_image) + { + try + { + lock (locker) + { + picture.Image = new_image; + } + } + catch(Exception) + { + Image_change(new_image); + //Console.WriteLine("test"); + } + } + public event SelectedEventHandler Selected; + } + public class SelectedEventArgs : EventArgs + { + public SelectedEventArgs((int, int) pos, bool sel)//width,height sel for be_selected + { + position = pos; + be_selected = sel; + } + public (int, int) position { get; set; }//height,width + public bool be_selected { get; set; } + } + public delegate void SelectedEventHandler(Single_Block sender, SelectedEventArgs e); +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.resx b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Program.cs b/CDSAE3_Lian_Lian_Kan/Program.cs new file mode 100644 index 0000000..12684c8 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Program.cs @@ -0,0 +1,17 @@ +namespace CDSAE3_Lian_Lian_Kan +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new LianLianKan()); + } + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Properties/Resources.Designer.cs b/CDSAE3_Lian_Lian_Kan/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0ff9122 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Properties/Resources.Designer.cs @@ -0,0 +1,483 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace CDSAE3_Lian_Lian_Kan.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CDSAE3_Lian_Lian_Kan.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Apple { + get { + object obj = ResourceManager.GetObject("Apple", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Banana { + get { + object obj = ResourceManager.GetObject("Banana", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Beetroot { + get { + object obj = ResourceManager.GetObject("Beetroot", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Cherry { + get { + object obj = ResourceManager.GetObject("Cherry", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Corn { + get { + object obj = ResourceManager.GetObject("Corn", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap d { + get { + object obj = ResourceManager.GetObject("d", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap dl { + get { + object obj = ResourceManager.GetObject("dl", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap dlr { + get { + object obj = ResourceManager.GetObject("dlr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap dr { + get { + object obj = ResourceManager.GetObject("dr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Eggplant { + get { + object obj = ResourceManager.GetObject("Eggplant", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap exchange { + get { + object obj = ResourceManager.GetObject("exchange", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Gapple { + get { + object obj = ResourceManager.GetObject("Gapple", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Gbanana { + get { + object obj = ResourceManager.GetObject("Gbanana", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Gbeetroot { + get { + object obj = ResourceManager.GetObject("Gbeetroot", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Gcherry { + get { + object obj = ResourceManager.GetObject("Gcherry", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Gcorn { + get { + object obj = ResourceManager.GetObject("Gcorn", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Geggplant { + get { + object obj = ResourceManager.GetObject("Geggplant", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Ggrape { + get { + object obj = ResourceManager.GetObject("Ggrape", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Gpear { + get { + object obj = ResourceManager.GetObject("Gpear", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Grape { + get { + object obj = ResourceManager.GetObject("Grape", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Gstrawberry { + get { + object obj = ResourceManager.GetObject("Gstrawberry", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Gwatermelon { + get { + object obj = ResourceManager.GetObject("Gwatermelon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap l { + get { + object obj = ResourceManager.GetObject("l", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap left_arrow { + get { + object obj = ResourceManager.GetObject("left-arrow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap lr { + get { + object obj = ResourceManager.GetObject("lr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap pause { + get { + object obj = ResourceManager.GetObject("pause", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Pear { + get { + object obj = ResourceManager.GetObject("Pear", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap play_buttton { + get { + object obj = ResourceManager.GetObject("play-buttton", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap r { + get { + object obj = ResourceManager.GetObject("r", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap search { + get { + object obj = ResourceManager.GetObject("search", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Strawberry { + get { + object obj = ResourceManager.GetObject("Strawberry", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap trans { + get { + object obj = ResourceManager.GetObject("trans", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap u { + get { + object obj = ResourceManager.GetObject("u", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap ud { + get { + object obj = ResourceManager.GetObject("ud", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap udl { + get { + object obj = ResourceManager.GetObject("udl", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap udr { + get { + object obj = ResourceManager.GetObject("udr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap ul { + get { + object obj = ResourceManager.GetObject("ul", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap ulr { + get { + object obj = ResourceManager.GetObject("ulr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap ur { + get { + object obj = ResourceManager.GetObject("ur", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap urdl { + get { + object obj = ResourceManager.GetObject("urdl", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Watermelon { + get { + object obj = ResourceManager.GetObject("Watermelon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap 连连看MainPicture { + get { + object obj = ResourceManager.GetObject("连连看MainPicture", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Properties/Resources.resx b/CDSAE3_Lian_Lian_Kan/Properties/Resources.resx new file mode 100644 index 0000000..08ffef0 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Properties/Resources.resx @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\Eggplant.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\连连看MainPicture.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Pear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Watermelon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Grape.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\exchange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\play-buttton.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Corn.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Apple.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\trans.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Banana.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\search.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\pause.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Cherry.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Beetroot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Strawberry.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\left-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gapple.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gbanana.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gbeetroot.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gcherry.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gcorn.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Geggplant.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Ggrape.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gpear.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gstrawberry.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gwatermelon.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\d.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dlr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\l.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\lr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\r.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\u.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ud.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\udl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\udr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ul.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ulr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ur.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\urdl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Apple.png b/CDSAE3_Lian_Lian_Kan/Resources/Apple.png new file mode 100644 index 0000000..7b029bb Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Apple.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Banana.png b/CDSAE3_Lian_Lian_Kan/Resources/Banana.png new file mode 100644 index 0000000..e596e47 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Banana.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Beetroot.png b/CDSAE3_Lian_Lian_Kan/Resources/Beetroot.png new file mode 100644 index 0000000..be78ff2 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Beetroot.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Cherry.png b/CDSAE3_Lian_Lian_Kan/Resources/Cherry.png new file mode 100644 index 0000000..d4e8fe0 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Cherry.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Corn.png b/CDSAE3_Lian_Lian_Kan/Resources/Corn.png new file mode 100644 index 0000000..1675e86 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Corn.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Eggplant.png b/CDSAE3_Lian_Lian_Kan/Resources/Eggplant.png new file mode 100644 index 0000000..48a675e Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Eggplant.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gapple.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gapple.gif new file mode 100644 index 0000000..2733ff6 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gapple.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gbanana.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gbanana.gif new file mode 100644 index 0000000..c8104aa Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gbanana.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gbeetroot.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gbeetroot.gif new file mode 100644 index 0000000..7f78668 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gbeetroot.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gcherry.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gcherry.gif new file mode 100644 index 0000000..d80bf13 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gcherry.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gcorn.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gcorn.gif new file mode 100644 index 0000000..5c648ae Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gcorn.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Geggplant.gif b/CDSAE3_Lian_Lian_Kan/Resources/Geggplant.gif new file mode 100644 index 0000000..da389f3 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Geggplant.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Ggrape.gif b/CDSAE3_Lian_Lian_Kan/Resources/Ggrape.gif new file mode 100644 index 0000000..ccff9d8 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Ggrape.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gpear.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gpear.gif new file mode 100644 index 0000000..51e79ce Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gpear.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Grape.png b/CDSAE3_Lian_Lian_Kan/Resources/Grape.png new file mode 100644 index 0000000..afa3ef0 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Grape.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gstrawberry.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gstrawberry.gif new file mode 100644 index 0000000..e8285f4 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gstrawberry.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gwatermelon.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gwatermelon.gif new file mode 100644 index 0000000..2bf3390 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gwatermelon.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Pear.png b/CDSAE3_Lian_Lian_Kan/Resources/Pear.png new file mode 100644 index 0000000..1acdb31 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Pear.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Strawberry.png b/CDSAE3_Lian_Lian_Kan/Resources/Strawberry.png new file mode 100644 index 0000000..b1e5919 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Strawberry.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Watermelon.png b/CDSAE3_Lian_Lian_Kan/Resources/Watermelon.png new file mode 100644 index 0000000..7753ecb Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Watermelon.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/d.png b/CDSAE3_Lian_Lian_Kan/Resources/d.png new file mode 100644 index 0000000..acc4407 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/d.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/dl.png b/CDSAE3_Lian_Lian_Kan/Resources/dl.png new file mode 100644 index 0000000..65be7b6 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/dl.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/dlr.png b/CDSAE3_Lian_Lian_Kan/Resources/dlr.png new file mode 100644 index 0000000..defe223 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/dlr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/dr.png b/CDSAE3_Lian_Lian_Kan/Resources/dr.png new file mode 100644 index 0000000..122aa6d Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/dr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/exchange.png b/CDSAE3_Lian_Lian_Kan/Resources/exchange.png new file mode 100644 index 0000000..b597ee6 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/exchange.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/l.png b/CDSAE3_Lian_Lian_Kan/Resources/l.png new file mode 100644 index 0000000..5f144f7 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/l.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/left-arrow.png b/CDSAE3_Lian_Lian_Kan/Resources/left-arrow.png new file mode 100644 index 0000000..d931587 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/left-arrow.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/lr.png b/CDSAE3_Lian_Lian_Kan/Resources/lr.png new file mode 100644 index 0000000..67aceb4 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/lr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/pause.png b/CDSAE3_Lian_Lian_Kan/Resources/pause.png new file mode 100644 index 0000000..0e3f147 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/pause.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/play-buttton.png b/CDSAE3_Lian_Lian_Kan/Resources/play-buttton.png new file mode 100644 index 0000000..5b95d9f Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/play-buttton.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/r.png b/CDSAE3_Lian_Lian_Kan/Resources/r.png new file mode 100644 index 0000000..fdfae99 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/r.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/search.png b/CDSAE3_Lian_Lian_Kan/Resources/search.png new file mode 100644 index 0000000..4b154a9 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/search.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/trans.png b/CDSAE3_Lian_Lian_Kan/Resources/trans.png new file mode 100644 index 0000000..06c462b Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/trans.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/u.png b/CDSAE3_Lian_Lian_Kan/Resources/u.png new file mode 100644 index 0000000..8297489 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/u.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/ud.png b/CDSAE3_Lian_Lian_Kan/Resources/ud.png new file mode 100644 index 0000000..fc3d033 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/ud.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/udl.png b/CDSAE3_Lian_Lian_Kan/Resources/udl.png new file mode 100644 index 0000000..53ff515 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/udl.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/udr.png b/CDSAE3_Lian_Lian_Kan/Resources/udr.png new file mode 100644 index 0000000..ee7d755 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/udr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/ul.png b/CDSAE3_Lian_Lian_Kan/Resources/ul.png new file mode 100644 index 0000000..41f1127 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/ul.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/ulr.png b/CDSAE3_Lian_Lian_Kan/Resources/ulr.png new file mode 100644 index 0000000..c918968 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/ulr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/ur.png b/CDSAE3_Lian_Lian_Kan/Resources/ur.png new file mode 100644 index 0000000..2affe37 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/ur.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/urdl.png b/CDSAE3_Lian_Lian_Kan/Resources/urdl.png new file mode 100644 index 0000000..f672152 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/urdl.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/连连看MainPicture.png b/CDSAE3_Lian_Lian_Kan/Resources/连连看MainPicture.png new file mode 100644 index 0000000..df2c98c Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/连连看MainPicture.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Settings.cs b/CDSAE3_Lian_Lian_Kan/Settings.cs new file mode 100644 index 0000000..9760574 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Settings.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CDSAE3_Lian_Lian_Kan.Board_funcs; +using CDSAE3_Lian_Lian_Kan.Forms; +using CDSAE3_Lian_Lian_Kan.Properties; +namespace CDSAE3_Lian_Lian_Kan +{ + public class Settings + { + public static int left_time { get; set; } = 180; + public enum Difficulty + { + easy = 0, + normal = 1, + hard = 2, + custom = 3 + } + public enum Mode + { + fruit = 0 + } + public enum Direction + { + none = 0, + up = 1, + right = 2, + down = 4, + left = 8, + up_down = 5, + left_right = 10, + up_right = 3, + up_left = 9, + down_right = 6, + down_left = 12 + } + public static Dictionary decrease_per_level = new Dictionary { + {1,100.0/60 }, + {2,100.0/45 }, + {3,100.0/35 }, + {4,100.0/30 }, + {5,100.0/25 }, + {6,100.0/20 }, + {7,100.0/15 }, + {8,100.0/10 }, + {9,100.0/5 }, + {10,100.0/3 }}; + + static int cus_height = 1, cus_width = 1; + public static Difficulty current_difficulty { get; set; } = Difficulty.easy; + public static Mode current_mode { get; set; } + public static Image trans_Image { get; set; } = Resources.trans; + public static (int, int) get_length_width() => current_difficulty != Difficulty.custom ? (7 * (1 + (int)current_difficulty), 4 * (1 + (int)current_difficulty)) : (cus_width,cus_height); + public static List block_Images { get; set; } = new List { Resources.Apple, Resources.Banana, Resources.Beetroot, Resources.Cherry, Resources.Corn, Resources.Eggplant, Resources.Grape, Resources.Pear, Resources.Strawberry, Resources.Watermelon }; + public static List disappear_Images { get; set; } = new List { Resources.Gapple, Resources.Gbanana, Resources.Gbeetroot, Resources.Gcherry, Resources.Gcorn, Resources.Geggplant, Resources.Ggrape, Resources.Gpear, Resources.Gstrawberry, Resources.Gwatermelon }; + public static Image get_block_Image(int t) => block_Images[t]; + public static Image get_disappear_Images(int t) => disappear_Images[t]; + public static int Images_size() => current_mode switch { Mode.fruit => 10, _ => 0, }; + public static LianLianKan? form { get; set; } + public static IBeSelected? game_form{ get; set; }//gameBoard + public static IGameMode? game_mode_form { get; set; }//entireGame + 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); + } +}