diff options
| author | lempamo <[email protected]> | 2017-03-03 15:22:23 -0500 |
|---|---|---|
| committer | lempamo <[email protected]> | 2017-03-03 15:22:23 -0500 |
| commit | 753422b7bb7d0e4f68ae4aab91871529cb187c2a (patch) | |
| tree | ae11bf3942fde952e23b35ab6b706dbee63d9301 /ShiftOS.WinForms/Applications | |
| parent | 9b138708b979ca70730a34b56baa47b22299eb92 (diff) | |
| download | shiftos_thereturn-753422b7bb7d0e4f68ae4aab91871529cb187c2a.tar.gz shiftos_thereturn-753422b7bb7d0e4f68ae4aab91871529cb187c2a.tar.bz2 shiftos_thereturn-753422b7bb7d0e4f68ae4aab91871529cb187c2a.zip | |
removed snakey for the time being
Diffstat (limited to 'ShiftOS.WinForms/Applications')
| -rw-r--r-- | ShiftOS.WinForms/Applications/Snakey.Designer.cs | 106 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Snakey.cs | 363 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Snakey.resx | 120 |
3 files changed, 0 insertions, 589 deletions
diff --git a/ShiftOS.WinForms/Applications/Snakey.Designer.cs b/ShiftOS.WinForms/Applications/Snakey.Designer.cs deleted file mode 100644 index d500a94..0000000 --- a/ShiftOS.WinForms/Applications/Snakey.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -namespace ShiftOS.WinForms.Applications -{ - partial class Snakey - { - /// <summary> - /// Required designer variable. - /// </summary> - private System.ComponentModel.IContainer components = null; - - /// <summary> - /// Clean up any resources being used. - /// </summary> - /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - private void InitializeComponent() - { - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.button1 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 10; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 10; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(260, 260); - this.tableLayoutPanel1.TabIndex = 2; - this.tableLayoutPanel1.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.OnKeyDown); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(4, 270); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 3; - this.button1.Text = "Play"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - this.button1.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.OnKeyDown); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(85, 275); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(44, 13); - this.label1.TabIndex = 4; - this.label1.Text = "Fruits: 0"; - // - // Snakey - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.label1); - this.Controls.Add(this.button1); - this.Controls.Add(this.tableLayoutPanel1); - this.Name = "Snakey"; - this.Size = new System.Drawing.Size(306, 329); - this.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.OnKeyDown); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Label label1; - } -} diff --git a/ShiftOS.WinForms/Applications/Snakey.cs b/ShiftOS.WinForms/Applications/Snakey.cs deleted file mode 100644 index f3b52fe..0000000 --- a/ShiftOS.WinForms/Applications/Snakey.cs +++ /dev/null @@ -1,363 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ShiftOS.Engine; -using System.Diagnostics; - -namespace ShiftOS.WinForms.Applications -{ - [Launcher("Snakey", true, "al_snakey", "Games")] - [RequiresUpgrade("snakey")] - [WinOpen("snakey")] - [DefaultIcon("iconSnakey")] - public partial class Snakey : UserControl, IShiftOSWindow - { - private int[,] snakemap = null; // 0 - Nothing, 1 - Body, 2 - Head, 3 - Tail - private int[,] snakepartlist = null; - private int snakedirection = 0; // 0 - Left, 1 - Down, 2 - Right, 3 - Up - private Timer snakeupdater = new Timer(); - private int snakelength = 0; - private bool extending = false; - - public Snakey() - { - InitializeComponent(); - } - - public void OnLoad() - { - snakeupdater.Interval = 250; - snakeupdater.Tick += updateSnake; - makeGrid(); - } - - private void updateSnake(object sender, EventArgs e) - { - PictureBox head = null; - PictureBox tail = null; - - for (int x = 0; x < 10; x++) - { - if (head != null) break; - for (int y = 0; y < 10; y++) - { - if (head != null) break; - if (snakemap[x, y] == 2) - { - head = (PictureBox)tableLayoutPanel1.GetControlFromPosition(x, y); - break; - } - } - } - - for (int x = 0; x < 10; x++) - { - if (tail != null) break; - for (int y = 0; y < 10; y++) - { - if (tail != null) break; - if (snakemap[x, y] == 3) - { - tail = (PictureBox)tableLayoutPanel1.GetControlFromPosition(x, y); - break; - } - } - } - - int headX = int.Parse(head.Name.Split('b')[1]); - int headY = int.Parse(head.Name.Split('b')[2]); - int newHeadX = headX; - int newHeadY = headY; - - int tailX = int.Parse(tail.Name.Split('b')[1]); - int tailY = int.Parse(tail.Name.Split('b')[2]); - int newTailX = tailX; - int newTailY = tailY; - - Image headImg = null; - switch (snakedirection) - { - case 0: - newHeadX = headX - 1; - headImg = Properties.Resources.SnakeyHeadL; - break; - - case 1: - newHeadY = headY + 1; - headImg = Properties.Resources.SnakeyHeadD; - break; - - case 2: - newHeadX = headX + 1; - headImg = Properties.Resources.SnakeyHeadR; - break; - - case 3: - newHeadY = headY - 1; - headImg = Properties.Resources.SnakeyHeadU; - break; - - default: - break; - } - - if (newHeadX > 9 || newHeadX < 0 || newHeadY > 9 || newHeadY < 0) return; - - int newheadlocation = snakemap[newHeadX, newHeadY]; - snakemap[newHeadX, newHeadY] = 2; - ((PictureBox)tableLayoutPanel1.GetControlFromPosition(newHeadX, newHeadY)).Image = headImg; - snakemap[headX, headY] = 1; - ((PictureBox)tableLayoutPanel1.GetControlFromPosition(headX, headY)).Image = Properties.Resources.SnakeyBody; - if (!extending) - { - tail.Image = Properties.Resources.SnakeyBG; //mikey its here - snakemap[tailX, tailY] = 0; - tableLayoutPanel1.Refresh(); - snakepartlist[newHeadX, newHeadY] = snakelength; - bool[,] exemptlist = new bool[10, 10]; - bool splassigned = false; - for (int s = snakelength; s > 0; s--) - { - splassigned = false; - for (int x = 0; x < 10; x++) - { - if (splassigned) break; - for (int y = 0; y < 10; y++) - { - if (splassigned) break; - if (exemptlist[x, y]) continue; - if (x == newHeadX && y == newHeadY) continue; - if (snakepartlist[x, y] == snakelength) - { - snakepartlist[x, y]--; - exemptlist[x, y] = true; - splassigned = true; - break; - } - } - } - } - Image tailImg = null; - switch (tailDirection()) - { - case 0: - newTailX = tailX - 1; - break; - - case 1: - newTailY = tailY + 1; - break; - - case 2: - newTailX = tailX + 1; - break; - - case 3: - newTailY = tailY - 1; - break; - - default: - break; - } - switch (nextTailDirection(newTailX, newTailY)) - { - case 0: - tailImg = Properties.Resources.SnakeyTailL; - break; - - case 1: - tailImg = Properties.Resources.SnakeyTailD; - break; - - case 2: - tailImg = Properties.Resources.SnakeyTailR; - break; - - case 3: - tailImg = Properties.Resources.SnakeyTailU; - break; - - default: - break; - } - ((PictureBox)tableLayoutPanel1.GetControlFromPosition(newTailX, newTailY)).Image = tailImg; - snakemap[newTailX, newTailY] = 3; - } - if (extending) - { - snakepartlist[newHeadX, newHeadY] = snakelength; - extending = false; - } - if (newheadlocation == 1) - { - gameover(); - } - if (newheadlocation == 4) - { - extending = true; - snakelength++; - placefruit(); - } - } - - private int nextTailDirection(int x, int y) - { - if (snakepartlist[x - 1, y] == 2) return 0; - if (snakepartlist[x, y + 1] == 2) return 1; - if (snakepartlist[x + 1, y] == 2) return 2; - if (snakepartlist[x, y - 1] == 2) return 3; - return -1; - } - - private void gameover() - { - throw new NotImplementedException(); - } - - private void OnKeyDown(object sender, PreviewKeyDownEventArgs e) - { - switch (e.KeyCode) - { - case Keys.Up: - snakedirection = 3; - break; - - case Keys.Down: - snakedirection = 1; - break; - - case Keys.Left: - snakedirection = 0; - break; - - case Keys.Right: - snakedirection = 2; - break; - - default: - break; - } - Debug.Print("Snake Direction Value: " + snakedirection.ToString()); - } - - private void makeGrid() - { - for (int x = 0; x < 10; x++) - { - for (int y = 0; y < 10; y++) - { - tableLayoutPanel1.Controls.Add(newPicBox(x, y), x, y); - } - } - } - - private PictureBox newPicBox(int x, int y) - { - PictureBox picBox = new PictureBox(); - - picBox.Size = new System.Drawing.Size(20, 20); - picBox.Image = Properties.Resources.SnakeyBG; - picBox.Name = "pb" + x.ToString() + "b" + y.ToString(); - picBox.Margin = new Padding(0); - - return picBox; - } - - public void OnSkinLoad() { } - - public bool OnUnload() - { - snakeupdater.Stop(); - return true; - } - - public void OnUpgrade() { } - - private void button1_Click(object sender, EventArgs e) - { - if (snakemap != null) - { - clearGame(); - makeGrid(); - } - snakemap = new int[10, 10]; - snakepartlist = new int[10, 10]; - snakemap[5, 5] = 2; - snakepartlist[5, 5] = 4; - ((PictureBox)tableLayoutPanel1.GetControlFromPosition(5, 5)).Image = Properties.Resources.SnakeyHeadL; - snakemap[6, 5] = 1; - snakepartlist[6, 5] = 3; - ((PictureBox)tableLayoutPanel1.GetControlFromPosition(6, 5)).Image = Properties.Resources.SnakeyBody; - snakemap[7, 5] = 1; - snakepartlist[7, 5] = 2; - ((PictureBox)tableLayoutPanel1.GetControlFromPosition(7, 5)).Image = Properties.Resources.SnakeyBody; - snakemap[8, 5] = 3; - snakepartlist[8, 5] = 1; - ((PictureBox)tableLayoutPanel1.GetControlFromPosition(8, 5)).Image = Properties.Resources.SnakeyTailL; - snakelength = 4; - placefruit(); - snakeupdater.Start(); - } - - private void placefruit() - { - Random rnd1 = new Random(); - - while (true) - { - int fruitX = rnd1.Next(10); - int fruitY = rnd1.Next(10); - - if (snakemap[fruitX, fruitY] == 0) - { - snakemap[fruitX, fruitY] = 4; - ((PictureBox)tableLayoutPanel1.GetControlFromPosition(fruitX, fruitY)).Image = Properties.Resources.SnakeyFruit; - break; - } - } - } - - private void clearGame() - { - snakemap = null; - for (int x = 0; x < 10; x++) - { - for (int y = 0; y < 10; y++) - { - tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(x, y)); - } - } - } - - private int tailDirection() - { - PictureBox tail = null; - - for (int x = 0; x < 10; x++) - { - if (tail != null) break; - for (int y = 0; y < 10; y++) - { - if (snakemap[x, y] == 3) - { - tail = (PictureBox)tableLayoutPanel1.GetControlFromPosition(x, y); - break; - } - } - } - if (tail.Image == Properties.Resources.SnakeyTailL) return 0; - if (tail.Image == Properties.Resources.SnakeyTailD) return 1; - if (tail.Image == Properties.Resources.SnakeyTailR) return 2; - if (tail.Image == Properties.Resources.SnakeyTailU) return 3; - - return -1; - } - - } -} diff --git a/ShiftOS.WinForms/Applications/Snakey.resx b/ShiftOS.WinForms/Applications/Snakey.resx deleted file mode 100644 index 1af7de1..0000000 --- a/ShiftOS.WinForms/Applications/Snakey.resx +++ /dev/null @@ -1,120 +0,0 @@ -<?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>
\ No newline at end of file |
