Add project files.
This commit is contained in:
44
WinGreed/ControlExtension.cs
Normal file
44
WinGreed/ControlExtension.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace WinGreed
|
||||
{
|
||||
public static class ControlExtensions
|
||||
{
|
||||
public static T Clone<T>(this T controlToClone)
|
||||
where T : Control
|
||||
{
|
||||
PropertyInfo[] controlProperties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
T instance = Activator.CreateInstance<T>();
|
||||
|
||||
foreach (PropertyInfo propInfo in controlProperties)
|
||||
{
|
||||
if (propInfo.CanWrite)
|
||||
{
|
||||
//Debug.WriteLine($"Can write :{propInfo.CanWrite} Name : {propInfo.Name}");
|
||||
if (propInfo.Name == "Image")
|
||||
{
|
||||
//switch (switch_on)
|
||||
//{
|
||||
// default:
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (propInfo.Name != "WindowTarget")
|
||||
propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
28
WinGreed/Dice.cs
Normal file
28
WinGreed/Dice.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WinGreed
|
||||
{
|
||||
public class Dice
|
||||
{
|
||||
public bool Chosen { get; set; } = false;
|
||||
public int Number { get; set; }
|
||||
public int DiceNumber { get; set; }
|
||||
private Random rnd = null;
|
||||
public Dice(int diceNumber)
|
||||
{
|
||||
rnd = new Random();
|
||||
DiceNumber = diceNumber;
|
||||
}
|
||||
|
||||
|
||||
public int Roll()
|
||||
{
|
||||
Number = rnd.Next(1, 7);
|
||||
return Number;
|
||||
}
|
||||
}
|
||||
}
|
||||
40
WinGreed/HandleThrow.cs
Normal file
40
WinGreed/HandleThrow.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WinGreed
|
||||
{
|
||||
public class HandleThrow
|
||||
{
|
||||
public string Who { get; set; }
|
||||
public int Score { get; set; }
|
||||
|
||||
private List<Dice> _dices = new List<Dice>();
|
||||
int roll;
|
||||
public HandleThrow()
|
||||
{
|
||||
for (int i = 1; i < 7; i++)
|
||||
{
|
||||
_dices.Add(new Dice(i));
|
||||
}
|
||||
roll = 0;
|
||||
}
|
||||
|
||||
public List<Dice> Throw()
|
||||
{
|
||||
var rolled = new List<Dice>();
|
||||
roll += 1;
|
||||
foreach (Dice dice in _dices)
|
||||
{
|
||||
if (!dice.Chosen)
|
||||
{
|
||||
dice.Roll();
|
||||
rolled.Add(dice);
|
||||
}
|
||||
}
|
||||
return rolled;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
WinGreed/Program.cs
Normal file
17
WinGreed/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace WinGreed
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[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 frmStart());
|
||||
}
|
||||
}
|
||||
}
|
||||
63
WinGreed/Properties/Resources.Designer.cs
generated
Normal file
63
WinGreed/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WinGreed.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[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() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[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("WinGreed.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
WinGreed/Properties/Resources.resx
Normal file
120
WinGreed/Properties/Resources.resx
Normal file
@ -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>
|
||||
26
WinGreed/WinGreed.csproj
Normal file
26
WinGreed/WinGreed.csproj
Normal file
@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
172
WinGreed/frmPersonRound.Designer.cs
generated
Normal file
172
WinGreed/frmPersonRound.Designer.cs
generated
Normal file
@ -0,0 +1,172 @@
|
||||
namespace WinGreed
|
||||
{
|
||||
partial class frmPersonRound
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnThrow = new System.Windows.Forms.Button();
|
||||
this.btnDiceTmpl1 = new System.Windows.Forms.Button();
|
||||
this.btnDiceTmpl2 = new System.Windows.Forms.Button();
|
||||
this.btnDiceTmpl4 = new System.Windows.Forms.Button();
|
||||
this.btnDiceTmpl3 = new System.Windows.Forms.Button();
|
||||
this.btnDiceTmpl6 = new System.Windows.Forms.Button();
|
||||
this.btnDiceTmpl5 = new System.Windows.Forms.Button();
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||
this.label1.Location = new System.Drawing.Point(23, 17);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(105, 30);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Nu kör vi";
|
||||
//
|
||||
// btnThrow
|
||||
//
|
||||
this.btnThrow.Location = new System.Drawing.Point(32, 71);
|
||||
this.btnThrow.Name = "btnThrow";
|
||||
this.btnThrow.Size = new System.Drawing.Size(96, 23);
|
||||
this.btnThrow.TabIndex = 1;
|
||||
this.btnThrow.Text = "Kasta Tärningar";
|
||||
this.btnThrow.UseVisualStyleBackColor = true;
|
||||
this.btnThrow.Click += new System.EventHandler(this.btnThrow_Click);
|
||||
//
|
||||
// btnDiceTmpl1
|
||||
//
|
||||
this.btnDiceTmpl1.Location = new System.Drawing.Point(746, 82);
|
||||
this.btnDiceTmpl1.Name = "btnDiceTmpl1";
|
||||
this.btnDiceTmpl1.Size = new System.Drawing.Size(42, 44);
|
||||
this.btnDiceTmpl1.TabIndex = 2;
|
||||
this.btnDiceTmpl1.Text = "1";
|
||||
this.btnDiceTmpl1.UseVisualStyleBackColor = true;
|
||||
this.btnDiceTmpl1.Visible = false;
|
||||
this.btnDiceTmpl1.Click += new System.EventHandler(this.btnDiceTmpl_Click);
|
||||
//
|
||||
// btnDiceTmpl2
|
||||
//
|
||||
this.btnDiceTmpl2.Location = new System.Drawing.Point(746, 126);
|
||||
this.btnDiceTmpl2.Name = "btnDiceTmpl2";
|
||||
this.btnDiceTmpl2.Size = new System.Drawing.Size(42, 44);
|
||||
this.btnDiceTmpl2.TabIndex = 3;
|
||||
this.btnDiceTmpl2.Text = "2";
|
||||
this.btnDiceTmpl2.UseVisualStyleBackColor = true;
|
||||
this.btnDiceTmpl2.Visible = false;
|
||||
this.btnDiceTmpl2.Click += new System.EventHandler(this.btnDiceTmpl_Click);
|
||||
//
|
||||
// btnDiceTmpl4
|
||||
//
|
||||
this.btnDiceTmpl4.Location = new System.Drawing.Point(746, 214);
|
||||
this.btnDiceTmpl4.Name = "btnDiceTmpl4";
|
||||
this.btnDiceTmpl4.Size = new System.Drawing.Size(42, 44);
|
||||
this.btnDiceTmpl4.TabIndex = 5;
|
||||
this.btnDiceTmpl4.Text = "4";
|
||||
this.btnDiceTmpl4.UseVisualStyleBackColor = true;
|
||||
this.btnDiceTmpl4.Visible = false;
|
||||
this.btnDiceTmpl4.Click += new System.EventHandler(this.btnDiceTmpl_Click);
|
||||
//
|
||||
// btnDiceTmpl3
|
||||
//
|
||||
this.btnDiceTmpl3.Location = new System.Drawing.Point(746, 170);
|
||||
this.btnDiceTmpl3.Name = "btnDiceTmpl3";
|
||||
this.btnDiceTmpl3.Size = new System.Drawing.Size(42, 44);
|
||||
this.btnDiceTmpl3.TabIndex = 4;
|
||||
this.btnDiceTmpl3.Text = "3";
|
||||
this.btnDiceTmpl3.UseVisualStyleBackColor = true;
|
||||
this.btnDiceTmpl3.Visible = false;
|
||||
this.btnDiceTmpl3.Click += new System.EventHandler(this.btnDiceTmpl_Click);
|
||||
//
|
||||
// btnDiceTmpl6
|
||||
//
|
||||
this.btnDiceTmpl6.Location = new System.Drawing.Point(746, 302);
|
||||
this.btnDiceTmpl6.Name = "btnDiceTmpl6";
|
||||
this.btnDiceTmpl6.Size = new System.Drawing.Size(42, 44);
|
||||
this.btnDiceTmpl6.TabIndex = 7;
|
||||
this.btnDiceTmpl6.Text = "6";
|
||||
this.btnDiceTmpl6.UseVisualStyleBackColor = true;
|
||||
this.btnDiceTmpl6.Visible = false;
|
||||
this.btnDiceTmpl6.Click += new System.EventHandler(this.btnDiceTmpl_Click);
|
||||
//
|
||||
// btnDiceTmpl5
|
||||
//
|
||||
this.btnDiceTmpl5.Location = new System.Drawing.Point(746, 258);
|
||||
this.btnDiceTmpl5.Name = "btnDiceTmpl5";
|
||||
this.btnDiceTmpl5.Size = new System.Drawing.Size(42, 44);
|
||||
this.btnDiceTmpl5.TabIndex = 6;
|
||||
this.btnDiceTmpl5.Text = "5";
|
||||
this.btnDiceTmpl5.UseVisualStyleBackColor = true;
|
||||
this.btnDiceTmpl5.Visible = false;
|
||||
this.btnDiceTmpl5.Click += new System.EventHandler(this.btnDiceTmpl_Click);
|
||||
//
|
||||
// btnClose
|
||||
//
|
||||
this.btnClose.Location = new System.Drawing.Point(678, 397);
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnClose.TabIndex = 8;
|
||||
this.btnClose.Text = "Stäng";
|
||||
this.btnClose.UseVisualStyleBackColor = true;
|
||||
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||
//
|
||||
// frmPersonRound
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.Controls.Add(this.btnDiceTmpl6);
|
||||
this.Controls.Add(this.btnDiceTmpl5);
|
||||
this.Controls.Add(this.btnDiceTmpl4);
|
||||
this.Controls.Add(this.btnDiceTmpl3);
|
||||
this.Controls.Add(this.btnDiceTmpl2);
|
||||
this.Controls.Add(this.btnDiceTmpl1);
|
||||
this.Controls.Add(this.btnThrow);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "frmPersonRound";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Din tur -";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Button btnThrow;
|
||||
private Button btnDiceTmpl1;
|
||||
private Button btnDiceTmpl2;
|
||||
private Button btnDiceTmpl4;
|
||||
private Button btnDiceTmpl3;
|
||||
private Button btnDiceTmpl6;
|
||||
private Button btnDiceTmpl5;
|
||||
private Button btnClose;
|
||||
}
|
||||
}
|
||||
136
WinGreed/frmPersonRound.cs
Normal file
136
WinGreed/frmPersonRound.cs
Normal file
@ -0,0 +1,136 @@
|
||||
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 WinGreed
|
||||
{
|
||||
public partial class frmPersonRound : Form
|
||||
{
|
||||
int y = 79;
|
||||
int x = 0;
|
||||
int row = 0;
|
||||
private List<Button> _dice = new List<Button>();
|
||||
private HandleThrow _ht;
|
||||
public string Player { get; set; }
|
||||
public int TotPoints { get; set; }
|
||||
List<int> Points = new List<int>();
|
||||
public frmPersonRound(string player)
|
||||
{
|
||||
InitializeComponent();
|
||||
Player = player;
|
||||
this.Text = $"Din tur - {Player}";
|
||||
_ht = new HandleThrow();
|
||||
_ht.Who = Player;
|
||||
///ht.Throw();
|
||||
}
|
||||
|
||||
private void btnThrow_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
x = 0;
|
||||
y = y + btnDiceTmpl1.Height+5;
|
||||
var no = 0;
|
||||
var result = _ht.Throw();
|
||||
Button btn = null;
|
||||
MarkGrayAndDisable(row);
|
||||
row++;
|
||||
|
||||
|
||||
foreach (var item in result)
|
||||
{
|
||||
no++;
|
||||
switch (item.Number)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
btn = btnDiceTmpl1.Clone<Button>();
|
||||
btn.Name = $"btnDice{row}1";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
btn = btnDiceTmpl2.Clone<Button>();
|
||||
btn.Name = $"btnDice{row}2";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
btn = btnDiceTmpl3.Clone<Button>();
|
||||
btn.Name = $"btnDice{row}3";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
btn = btnDiceTmpl4.Clone<Button>();
|
||||
btn.Name = $"btnDice{row}4";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
btn = btnDiceTmpl5.Clone<Button>();
|
||||
btn.Name = $"btnDice{row}5";
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
btn = btnDiceTmpl6.Clone<Button>();
|
||||
btn.Name = $"btnDice{row}6";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_dice.Add(btn);
|
||||
btn.Location = new Point(x + (btn.Width + 5) * no, y);
|
||||
btn.Visible = true;
|
||||
btn.Tag = item;
|
||||
btn.Click += new System.EventHandler(btnDiceTmpl_Click);
|
||||
this.Controls.Add(_dice.Last());
|
||||
this.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void MarkGrayAndDisable(int row)
|
||||
{
|
||||
if (row > 0)
|
||||
{
|
||||
foreach (var item in _dice)
|
||||
{
|
||||
if (item.Name.Contains($"btnDice{row}"))
|
||||
{
|
||||
item.Enabled = false;
|
||||
if (item.BackColor == Color.Red)
|
||||
{
|
||||
item.BackColor = Color.Gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDiceTmpl_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (((Dice)((Button)sender).Tag).Chosen) {
|
||||
((Button)sender).BackColor = Color.Green;
|
||||
((Dice)((Button)sender).Tag).Chosen = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
((Dice)((Button)sender).Tag).Chosen = true;
|
||||
((Button)sender).BackColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
WinGreed/frmPersonRound.resx
Normal file
60
WinGreed/frmPersonRound.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
||||
75
WinGreed/frmStart.Designer.cs
generated
Normal file
75
WinGreed/frmStart.Designer.cs
generated
Normal file
@ -0,0 +1,75 @@
|
||||
namespace WinGreed
|
||||
{
|
||||
partial class frmStart
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnSpela = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||
this.label1.Location = new System.Drawing.Point(25, 26);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(294, 30);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Welcome to World of Greed!";
|
||||
//
|
||||
// btnSpela
|
||||
//
|
||||
this.btnSpela.Location = new System.Drawing.Point(34, 142);
|
||||
this.btnSpela.Name = "btnSpela";
|
||||
this.btnSpela.Size = new System.Drawing.Size(134, 23);
|
||||
this.btnSpela.TabIndex = 1;
|
||||
this.btnSpela.Text = "Spela en omgång";
|
||||
this.btnSpela.UseVisualStyleBackColor = true;
|
||||
this.btnSpela.Click += new System.EventHandler(this.btnSpela_Click);
|
||||
//
|
||||
// frmStart
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.btnSpela);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "frmStart";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "G R E E D";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Button btnSpela;
|
||||
}
|
||||
}
|
||||
18
WinGreed/frmStart.cs
Normal file
18
WinGreed/frmStart.cs
Normal file
@ -0,0 +1,18 @@
|
||||
namespace WinGreed
|
||||
{
|
||||
public partial class frmStart : Form
|
||||
{
|
||||
private frmPersonRound fPR = null;
|
||||
public frmStart()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnSpela_Click(object sender, EventArgs e)
|
||||
{
|
||||
fPR = new frmPersonRound("Tommy");
|
||||
fPR.Show();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
60
WinGreed/frmStart.resx
Normal file
60
WinGreed/frmStart.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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