中间件探索
This commit is contained in:
@@ -16,7 +16,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
public partial class GameControl : UserControl, IGameControl
|
||||
{
|
||||
Board board = new Board();
|
||||
IBoard board = new Graph_Board();
|
||||
IGameMode? iGameMode;
|
||||
Queue<((int, int), Single_Block)> queue = new Queue<((int, int), Single_Block)>();//y,x
|
||||
bool do_search = false;
|
||||
@@ -24,13 +24,14 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
public GameControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DoubleBuffered = true;
|
||||
Etcs.game_form = this;
|
||||
playPanel_set(board.make_board());
|
||||
iGameMode = Etcs.game_mode_form;
|
||||
}
|
||||
void playPanel_set(int[,]bd)
|
||||
void playPanel_set(int[,] bd)
|
||||
{
|
||||
playPanel.SuspendLayout();
|
||||
playPanel_size_change();
|
||||
for (int i = 0; i < playPanel.RowCount; i++)
|
||||
for (int j = 0; j < playPanel.ColumnCount; j++)
|
||||
@@ -48,6 +49,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
playPanel.Controls.Add(x, j, i);
|
||||
}
|
||||
}
|
||||
playPanel.ResumeLayout();
|
||||
}
|
||||
/// <summary>
|
||||
/// 由form和to两个点获取方向
|
||||
@@ -76,7 +78,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
/// <param name="blocks"></param>
|
||||
/// <param name="decrease"></param>
|
||||
/// <returns></returns>
|
||||
async Task set_PathAsync((int, int) point, Etcs.Direction direction, List<Single_Block> blocks, int wait_time,bool is_hint)
|
||||
async Task set_PathAsync((int, int) point, Etcs.Direction direction, List<Single_Block> blocks, int wait_time, bool is_hint)
|
||||
{
|
||||
|
||||
if (wait_time != 0)
|
||||
@@ -98,26 +100,26 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
case Etcs.Direction.up:
|
||||
for (int i = from.Item2 - 1; i != to.Item2; i--)
|
||||
await set_PathAsync((from.Item1, i), Etcs.Direction.up_down, blocks, wait_time,is_hint);
|
||||
await set_PathAsync((from.Item1, i), Etcs.Direction.up_down, blocks, wait_time, is_hint);
|
||||
break;
|
||||
case Etcs.Direction.down:
|
||||
for (int i = from.Item2 + 1; i != to.Item2; i++)
|
||||
await set_PathAsync((from.Item1, i), Etcs.Direction.up_down, blocks, wait_time,is_hint);
|
||||
await set_PathAsync((from.Item1, i), Etcs.Direction.up_down, blocks, wait_time, is_hint);
|
||||
break;
|
||||
case Etcs.Direction.right:
|
||||
for (int i = from.Item1 + 1; i != to.Item1; i++)
|
||||
await set_PathAsync((i, from.Item2), Etcs.Direction.left_right, blocks, wait_time,is_hint);
|
||||
await set_PathAsync((i, from.Item2), Etcs.Direction.left_right, blocks, wait_time, is_hint);
|
||||
break;
|
||||
case Etcs.Direction.left:
|
||||
for (int i = from.Item1 - 1; i != to.Item1; i--)
|
||||
await set_PathAsync((i, from.Item2), Etcs.Direction.left_right, blocks, wait_time,is_hint);
|
||||
await set_PathAsync((i, from.Item2), Etcs.Direction.left_right, blocks, wait_time, is_hint);
|
||||
break;
|
||||
}
|
||||
if (include_end)
|
||||
{
|
||||
direction = ((int)direction & 3) > 0 ? (Etcs.Direction)((int)direction << 2) : (Etcs.Direction)((int)direction >> 2);
|
||||
direction = direction | extra_Direction;
|
||||
await set_PathAsync(to, direction, blocks, wait_time,is_hint);
|
||||
await set_PathAsync(to, direction, blocks, wait_time, is_hint);
|
||||
}
|
||||
}
|
||||
async Task path_drawerAsync(List<(int, int)> path, int wait_time, List<Single_Block> blocks, bool is_hint)
|
||||
@@ -125,18 +127,18 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
switch (path.Count)
|
||||
{
|
||||
case 2:
|
||||
await to_path(path[0], path[1], false, Etcs.Direction.none, blocks, wait_time,is_hint);
|
||||
await to_path(path[0], path[1], false, Etcs.Direction.none, blocks, wait_time, is_hint);
|
||||
break;
|
||||
case 3:
|
||||
var extra_direction = get_Direction(path[1], path[2]);
|
||||
await to_path(path[0], path[1], true, extra_direction, blocks, wait_time,is_hint);
|
||||
await to_path(path[1], path[2], false, Etcs.Direction.none, blocks, wait_time,is_hint);
|
||||
await to_path(path[0], path[1], true, extra_direction, blocks, wait_time, is_hint);
|
||||
await to_path(path[1], path[2], false, Etcs.Direction.none, blocks, wait_time, is_hint);
|
||||
break;
|
||||
case 4:
|
||||
Etcs.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, blocks, wait_time,is_hint);
|
||||
await to_path(path[1], path[2], true, extra_directionB, blocks, wait_time,is_hint);
|
||||
await to_path(path[2], path[3], false, Etcs.Direction.none, blocks, wait_time,is_hint);
|
||||
await to_path(path[0], path[1], true, extra_directionA, blocks, wait_time, is_hint);
|
||||
await to_path(path[1], path[2], true, extra_directionB, blocks, wait_time, is_hint);
|
||||
await to_path(path[2], path[3], false, Etcs.Direction.none, blocks, wait_time, is_hint);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -147,7 +149,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
return;
|
||||
List<List<(int, int)>> paths = board.get_tip(queue.Peek().Item1);
|
||||
foreach (var path in paths)
|
||||
_ = path_drawerAsync(path, 0, hint_blocks,true);
|
||||
_ = path_drawerAsync(path, 0, hint_blocks, true);
|
||||
}
|
||||
internal void de_set_tip()
|
||||
{
|
||||
@@ -169,7 +171,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
if (do_search)
|
||||
{
|
||||
de_set_tip();
|
||||
set_tip();
|
||||
set_tip();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@@ -188,7 +190,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
if (do_search)
|
||||
{
|
||||
de_set_tip();
|
||||
set_tip();
|
||||
set_tip();
|
||||
}
|
||||
queue.Enqueue((e.position, sender));
|
||||
sendera.deselect();
|
||||
@@ -204,7 +206,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
break;
|
||||
case 1:
|
||||
if (queue.Peek().Item1 == e.position)
|
||||
{
|
||||
{
|
||||
queue.Dequeue();
|
||||
if (do_search)
|
||||
de_set_tip();
|
||||
@@ -250,6 +252,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
public void Exchange_Handler(object? sender, EventArgs e)
|
||||
{
|
||||
int[,] bd = board.remake_board();
|
||||
playPanel.SuspendLayout();
|
||||
for (int i = 0; i < bd.GetLength(0); i++)
|
||||
for (int j = 0; j < bd.GetLength(1); j++)
|
||||
if (bd[i, j] == -1)
|
||||
@@ -260,6 +263,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
if (control != null && control is Single_Block single_Block)
|
||||
single_Block.Re_create(bd[i, j], null, null, null);
|
||||
}
|
||||
playPanel.ResumeLayout();
|
||||
}
|
||||
|
||||
public void Search_Handler(object? sender, SearchEventArgs e)
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
partial class Item
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
picture = new PictureBox();
|
||||
Back_Picture = new Label();
|
||||
((System.ComponentModel.ISupportInitialize)picture).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// picture
|
||||
//
|
||||
picture.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
picture.Location = new Point(0, 0);
|
||||
picture.Name = "picture";
|
||||
picture.Size = new Size(70, 70);
|
||||
picture.TabIndex = 1;
|
||||
picture.TabStop = false;
|
||||
//
|
||||
// Back_Picture
|
||||
//
|
||||
Back_Picture.BackColor = Color.Gray;
|
||||
Back_Picture.Location = new Point(0, 0);
|
||||
Back_Picture.Name = "Back_Picture";
|
||||
Back_Picture.Size = new Size(70, 70);
|
||||
Back_Picture.TabIndex = 2;
|
||||
//
|
||||
// Item
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
Controls.Add(picture);
|
||||
Controls.Add(Back_Picture);
|
||||
Name = "Item";
|
||||
Size = new Size(70, 70);
|
||||
((System.ComponentModel.ISupportInitialize)picture).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private PictureBox picture;
|
||||
private Label Back_Picture;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
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 Item : UserControl
|
||||
{
|
||||
(int,int) ori_size;
|
||||
public Item()
|
||||
{
|
||||
InitializeComponent();
|
||||
picture.Parent = Back_Picture;
|
||||
}
|
||||
public void Item_Init(Image image,(int,int) size,Color BackColor)
|
||||
{
|
||||
Back_Picture.BackColor = BackColor;
|
||||
ori_size = size;
|
||||
picture.Image = image;
|
||||
picture.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
picture.BackColor = Color.Transparent;
|
||||
Back_Picture.Size = new Size(Width, Height);
|
||||
picture.Size = new Size(Width, Height);
|
||||
set_progress(0);
|
||||
}
|
||||
public void set_progress(int height)
|
||||
{
|
||||
Size = new Size(ori_size.Item1, height);
|
||||
picture.Location = new Point(0, -(70-height));
|
||||
picture.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?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>
|
||||
</root>
|
||||
+10
-13
@@ -39,7 +39,7 @@
|
||||
sp_button = new PictureBox();
|
||||
search = new PictureBox();
|
||||
exchange = new PictureBox();
|
||||
search_time = new Label();
|
||||
upper_search = new Item();
|
||||
game_Panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)back).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)sp_button).BeginInit();
|
||||
@@ -165,17 +165,13 @@
|
||||
exchange.TabStop = false;
|
||||
exchange.Click += exchange_Click;
|
||||
//
|
||||
// search_time
|
||||
// upper_search
|
||||
//
|
||||
search_time.AutoSize = true;
|
||||
search_time.BackColor = Color.FromArgb(249, 211, 171);
|
||||
search_time.Font = new Font("Microsoft YaHei UI", 10F);
|
||||
search_time.Location = new Point(413, 18);
|
||||
search_time.Name = "search_time";
|
||||
search_time.Size = new Size(36, 27);
|
||||
search_time.TabIndex = 11;
|
||||
search_time.Text = "00";
|
||||
search_time.Visible = false;
|
||||
upper_search.BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
upper_search.Location = new Point(360, 31);
|
||||
upper_search.Name = "upper_search";
|
||||
upper_search.Size = new Size(70, 70);
|
||||
upper_search.TabIndex = 12;
|
||||
//
|
||||
// Leisure_Mode
|
||||
//
|
||||
@@ -183,7 +179,7 @@
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(249, 211, 171);
|
||||
ClientSize = new Size(1439, 960);
|
||||
Controls.Add(search_time);
|
||||
Controls.Add(upper_search);
|
||||
Controls.Add(exchange);
|
||||
Controls.Add(search);
|
||||
Controls.Add(sp_button);
|
||||
@@ -194,6 +190,7 @@
|
||||
Controls.Add(energy_bar);
|
||||
Controls.Add(back);
|
||||
Controls.Add(game_Panel);
|
||||
DoubleBuffered = true;
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "Leisure_Mode";
|
||||
Text = "Leisure_Mode";
|
||||
@@ -219,6 +216,6 @@
|
||||
private PictureBox search;
|
||||
private PictureBox exchange;
|
||||
private GameControl gameControl;
|
||||
private Label search_time;
|
||||
private Item upper_search;
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,10 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows.Forms;
|
||||
using CDSAE3_Lian_Lian_Kan.Boards;
|
||||
using CDSAE3_Lian_Lian_Kan.Properties;
|
||||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
|
||||
@@ -17,13 +19,39 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
Etcs.game_mode_form = this;
|
||||
InitializeComponent();
|
||||
timer = new System.Timers.Timer();
|
||||
timer.Enabled = false;
|
||||
timer.Interval = 1000;
|
||||
timer.Elapsed += Timer_Tick;
|
||||
upper_search.Item_Init(Resources.search, (70, 70),Color.FromArgb(253, 161, 60));
|
||||
//Etcs.hunderd_millsecond_timer.Elapsed += hundred_millsecond_Timer_Tick;
|
||||
time.Text = (left_time / 60).ToString().PadLeft(2, '0') + ":" + (left_time % 60).ToString().PadLeft(2, '0');
|
||||
upper_search_ori_position = upper_search.Location;
|
||||
timer = new System.Timers.Timer(1000);
|
||||
timer.Elapsed += Timer_Tick;
|
||||
timer.Enabled = true;
|
||||
}
|
||||
System.Timers.Timer timer;
|
||||
int hundred_up_timer = 0;
|
||||
//private void hundred_millsecond_Timer_Tick(object? sender, ElapsedEventArgs e)
|
||||
//{
|
||||
// if (_listening_timer)
|
||||
// hundred_up_timer++;
|
||||
// else
|
||||
// return;
|
||||
// //if(search_mode)
|
||||
// //{
|
||||
|
||||
|
||||
// // //down to up
|
||||
// // //BeginInvoke(() => upper_search.Location = new Point(upper_search_ori_position.X, upper_search_ori_position.Y + (int)(70 * (search_left_time - hundred_up_timer * 0.1) / Etcs.search_left_time)));
|
||||
// // //BeginInvoke(() => upper_search.set_progress(70-upper_search.Location.Y+upper_search_ori_position.Y));
|
||||
// //}
|
||||
// if (hundred_up_timer == 10)
|
||||
// {
|
||||
// BeginInvoke(() => upper_search.Location = new Point(upper_search_ori_position.X, upper_search_ori_position.Y + (int)(70 * (1 - ((search_left_time - hundred_up_timer * 0.1) / Etcs.search_left_time)))));
|
||||
// BeginInvoke(() => upper_search.set_progress(70 - upper_search.Location.Y + upper_search_ori_position.Y));
|
||||
// hundred_up_timer = 0;
|
||||
// Timer_Tick(sender, e);
|
||||
// }
|
||||
//}
|
||||
Point upper_search_ori_position;
|
||||
int left_time = Etcs.left_time;
|
||||
bool is_pause = true;
|
||||
int cur_score = 0;
|
||||
@@ -32,7 +60,6 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
int search_left_time = 0;
|
||||
bool search_mode = false;
|
||||
Dictionary<int, double> decrease_per_level = Etcs.decrease_per_level;
|
||||
|
||||
private void Timer_Tick(object? sender, EventArgs e)
|
||||
{
|
||||
left_time--;
|
||||
@@ -42,11 +69,12 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
search_left_time--;
|
||||
if (search_left_time < 0)
|
||||
{
|
||||
BeginInvoke(() => search_time.Visible = false);
|
||||
search_mode = false;
|
||||
gameControl.Search_Handler(this, new SearchEventArgs { set_search = false });
|
||||
BeginInvoke(() => upper_search.set_progress(0));
|
||||
}
|
||||
BeginInvoke(() => search_time.Text = search_left_time.ToString().PadLeft(2, '0'));
|
||||
BeginInvoke(() => upper_search.Location = new Point(upper_search_ori_position.X, upper_search_ori_position.Y + (int)(70 * (1 - ((search_left_time - hundred_up_timer * 0.1) / Etcs.search_left_time)))));
|
||||
BeginInvoke(() => upper_search.set_progress(70 - upper_search.Location.Y + upper_search_ori_position.Y));
|
||||
}
|
||||
if (current_base <= 0)
|
||||
{
|
||||
@@ -133,6 +161,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
Dispose();
|
||||
Close();
|
||||
//Etcs.hunderd_millsecond_timer.Elapsed -= hundred_millsecond_Timer_Tick;
|
||||
timer.Close();
|
||||
Etcs.form?.change_form(new Leisure_Mode_MenuForm());
|
||||
}
|
||||
@@ -147,8 +176,6 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
gameControl.Search_Handler(this, new SearchEventArgs { set_search = true});
|
||||
search_mode = true;
|
||||
search_left_time = Etcs.search_left_time;
|
||||
search_time.Text = search_left_time.ToString().PadLeft(2, '0');
|
||||
search_time.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||
if (Etcs.game_form == null)
|
||||
throw new Exception("game_form is null but try to make a new Single_Block");
|
||||
Selected += Etcs.game_form.Selected_Handler;
|
||||
|
||||
}
|
||||
public Single_Block(int image, Color default_backColor, Color select_Color, (int, int) pos)
|
||||
{
|
||||
@@ -99,22 +100,24 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||
Image_change(Etcs.trans_Image);
|
||||
direction = Etcs.Direction.none;
|
||||
}
|
||||
System.Timers.Timer? timer = null;
|
||||
public void destroyAsync()
|
||||
{
|
||||
Image_change(Etcs.get_disappear_Images(block_id));
|
||||
BackColor = Color.FromArgb(0, 0, 0, 0);
|
||||
can_be_selected = false;
|
||||
timer = new System.Timers.Timer();
|
||||
timer.Interval = 500;
|
||||
var timer = Etcs.hunderd_millsecond_timer;
|
||||
timer_Eplased = 0;
|
||||
timer.Elapsed += Image_Clear;
|
||||
timer.Enabled = true;
|
||||
}
|
||||
object locker = new object();
|
||||
int timer_Eplased = 0;
|
||||
public void Image_Clear(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
timer?.Stop();
|
||||
Image_change(Etcs.trans_Image);
|
||||
if(timer_Eplased++ > 5)
|
||||
{
|
||||
Image_change(Etcs.trans_Image);
|
||||
Etcs.hunderd_millsecond_timer.Elapsed-= Image_Clear;
|
||||
}
|
||||
}
|
||||
ConcurrentQueue<Image>images_queue = new ConcurrentQueue<Image>();
|
||||
Thread? Image_setting_thread;
|
||||
@@ -127,7 +130,17 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||
{
|
||||
while (images_queue.TryDequeue(out Image? image))
|
||||
{
|
||||
Image_set(image);
|
||||
lock (image)
|
||||
{
|
||||
try
|
||||
{
|
||||
Image_set(image);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
images_queue.Enqueue(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Image_setting_thread.Start();
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||
{
|
||||
partial class middle_parent
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
SuspendLayout();
|
||||
//
|
||||
// middle_parent
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.Transparent;
|
||||
Name = "middle_parent";
|
||||
Size = new Size(40, 40);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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 middle_parent : UserControl
|
||||
{
|
||||
public middle_parent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private Color _backColor = Etcs.def_Color;
|
||||
private Color _frontColor = Etcs.mouse_upper_color;
|
||||
public void set_progress(float progress, Color backColor, Color frontColor)
|
||||
{
|
||||
_backColor = backColor;
|
||||
_frontColor = frontColor;
|
||||
set_progress(progress);
|
||||
}
|
||||
public void set_progress(float progress)
|
||||
{
|
||||
SolidBrush upperBrush = new SolidBrush(_backColor);
|
||||
SolidBrush lowerBrush = new SolidBrush(_frontColor);
|
||||
Graphics formGraphics = CreateGraphics();
|
||||
int wire = (int)((1-progress) * 40);
|
||||
formGraphics.FillRectangle(upperBrush, new Rectangle(0, 0, 40, wire));
|
||||
formGraphics.FillRectangle(lowerBrush, new Rectangle(0, wire, 40, 40));
|
||||
upperBrush.Dispose();
|
||||
lowerBrush.Dispose();
|
||||
formGraphics.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?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>
|
||||
</root>
|
||||
Reference in New Issue
Block a user