Adding in all the old code.
This commit is contained in:
parent
036309f582
commit
76f92171fe
29 changed files with 1581 additions and 0 deletions
27
PingPong.GameEngine/AssemblyInfo.cs
Normal file
27
PingPong.GameEngine/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("PingPong.GameEngine")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("wagesj45")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
26
PingPong.GameEngine/Components/IScorable.cs
Normal file
26
PingPong.GameEngine/Components/IScorable.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
namespace PingPong.GameEngine.Components
|
||||
{
|
||||
public interface IScorable<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the score.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The score.
|
||||
/// </value>
|
||||
Score Score { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the score.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The score.
|
||||
/// </returns>
|
||||
/// <param name='score'>
|
||||
/// Score.
|
||||
/// </param>
|
||||
T SetScore(Score score);
|
||||
}
|
||||
}
|
||||
|
109
PingPong.GameEngine/Components/Player.cs
Normal file
109
PingPong.GameEngine/Components/Player.cs
Normal file
|
@ -0,0 +1,109 @@
|
|||
using System;
|
||||
namespace PingPong.GameEngine.Components
|
||||
{
|
||||
public class Player : IScorable<Player>
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// The name.
|
||||
/// </summary>
|
||||
private Lazy<string> name;
|
||||
/// <summary>
|
||||
/// The score.
|
||||
/// </summary>
|
||||
private Lazy<Score> score;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The name.
|
||||
/// </value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name.Value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingPong.GameEngine.Components.Player"/> class.
|
||||
/// </summary>
|
||||
public Player()
|
||||
{
|
||||
this.name = new Lazy<string>(() => string.Empty);
|
||||
this.score = new Lazy<Score>(() => new Score());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sets the name.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The name.
|
||||
/// </returns>
|
||||
/// <param name='name'>
|
||||
/// Name.
|
||||
/// </param>
|
||||
public Player SetName(string name)
|
||||
{
|
||||
this.name = new Lazy<string>(() => name);
|
||||
return this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IScorable<T>
|
||||
|
||||
/// <summary>
|
||||
/// Gets the score.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The score.
|
||||
/// </value>
|
||||
public Score Score
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.score.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the score.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The score.
|
||||
/// </returns>
|
||||
/// <param name='score'>
|
||||
/// Score.
|
||||
/// </param>
|
||||
public Player SetScore(Score score)
|
||||
{
|
||||
if (score == null)
|
||||
{
|
||||
throw new ArgumentNullException("score");
|
||||
}
|
||||
|
||||
this.score = new Lazy<Score>(() => score);
|
||||
return this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
211
PingPong.GameEngine/Components/Score.cs
Normal file
211
PingPong.GameEngine/Components/Score.cs
Normal file
|
@ -0,0 +1,211 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PingPong.GameEngine.Components
|
||||
{
|
||||
public class Score
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// The score history.
|
||||
/// </summary>
|
||||
private Stack<int> history;
|
||||
|
||||
/// <summary>
|
||||
/// The score value.
|
||||
/// </summary>
|
||||
private Lazy<int> value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the score value.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The value.
|
||||
/// </value>
|
||||
public int Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.value.Value;
|
||||
}
|
||||
private set
|
||||
{
|
||||
history.Push(this.Value);
|
||||
this.value = new Lazy<int>(() => value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the increment expression.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The increment expression.
|
||||
/// </value>
|
||||
public string IncrementExpression { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the decrement expression.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The decrement expression.
|
||||
/// </value>
|
||||
public string DecrementExpression { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingPong.GameEngine.Score"/> class.
|
||||
/// </summary>
|
||||
public Score()
|
||||
{
|
||||
this.history = new Stack<int>();
|
||||
this.value = new Lazy<int>(() => default(int));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sets the increment expression.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The increment expression.
|
||||
/// </returns>
|
||||
/// <param name='expression'>
|
||||
/// Expression.
|
||||
/// </param>
|
||||
public Score SetIncrementExpression(string expression)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(expression))
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
|
||||
this.IncrementExpression = expression;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the decrement expression.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The decrement expression.
|
||||
/// </returns>
|
||||
/// <param name='expression'>
|
||||
/// Expression.
|
||||
/// </param>
|
||||
public Score SetDecrementExpression(string expression)
|
||||
{
|
||||
this.DecrementExpression = expression;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the score.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The score.
|
||||
/// </returns>
|
||||
/// <param name='expression'>
|
||||
/// Expression.
|
||||
/// </param>
|
||||
public Score SetScore(string expression)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(expression))
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
|
||||
Engine.ExpressionParser.Interpret(expression);
|
||||
this.Value = Engine.ExpressionParser.Int;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the score.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The score.
|
||||
/// </returns>
|
||||
/// <param name='score'>
|
||||
/// Score.
|
||||
/// </param>
|
||||
public Score SetScore(int score)
|
||||
{
|
||||
this.Value = score;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Increment this instance.
|
||||
/// </summary>
|
||||
public int Increment()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.IncrementExpression))
|
||||
{
|
||||
throw new NotImplementedException("No increment expression set.");
|
||||
}
|
||||
|
||||
Engine.ExpressionParser.Interpret(this.IncrementExpression);
|
||||
this.Value += Engine.ExpressionParser.Int;
|
||||
return this.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrement this instance.
|
||||
/// </summary>
|
||||
public int Decrement()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.DecrementExpression))
|
||||
{
|
||||
Reverse();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException("No decrement expression set.");
|
||||
}
|
||||
|
||||
Engine.ExpressionParser.Interpret(this.DecrementExpression);
|
||||
this.Value += Engine.ExpressionParser.Int;
|
||||
return this.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reverse the last action.
|
||||
/// </summary>
|
||||
public int Reverse()
|
||||
{
|
||||
if (!this.history.Any())
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("No history found.");
|
||||
}
|
||||
|
||||
this.value = new Lazy<int>(() => this.history.Pop());
|
||||
return this.Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
/// <param name='score'>
|
||||
/// Score.
|
||||
/// </param>
|
||||
public static implicit operator int(Score score)
|
||||
{
|
||||
return score.Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
12
PingPong.GameEngine/Components/ScoringType.cs
Normal file
12
PingPong.GameEngine/Components/ScoringType.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
namespace PingPong.GameEngine.Components
|
||||
{
|
||||
|
||||
public enum ScoringType
|
||||
{
|
||||
None,
|
||||
Team,
|
||||
Individual
|
||||
}
|
||||
}
|
||||
|
410
PingPong.GameEngine/Components/Team.cs
Normal file
410
PingPong.GameEngine/Components/Team.cs
Normal file
|
@ -0,0 +1,410 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PingPong.GameEngine.Components
|
||||
{
|
||||
|
||||
public class Team : IList<Player>, IScorable<Team>
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// The collection.
|
||||
/// </summary>
|
||||
private Lazy<List<Player>> collection;
|
||||
/// <summary>
|
||||
/// The score.
|
||||
/// </summary>
|
||||
private Lazy<Score> score;
|
||||
/// <summary>
|
||||
/// The type of the team rotation.
|
||||
/// </summary>
|
||||
private Lazy<TeamRotationType> teamRotationType;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Collection.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The collection.
|
||||
/// </value>
|
||||
private List<Player> Collection
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.collection.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the team rotation.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The type of the team rotation.
|
||||
/// </value>
|
||||
public TeamRotationType TeamRotationType
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.teamRotationType.Value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingPong.GameEngine.Components.Team"/> class.
|
||||
/// </summary>
|
||||
public Team()
|
||||
{
|
||||
this.collection = new Lazy<List<Player>>(() => new List<Player>());
|
||||
this.score = new Lazy<Score>(() => new Score());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Gets the player.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The player.
|
||||
/// </returns>
|
||||
/// <param name='name'>
|
||||
/// Name.
|
||||
/// </param>
|
||||
public Player GetPlayer(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
|
||||
return this.Where(player => player.Name.Equals(
|
||||
name,
|
||||
StringComparison.OrdinalIgnoreCase
|
||||
)
|
||||
)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the type of the team rotation.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The team rotation type.
|
||||
/// </returns>
|
||||
/// <param name='teamRotationType'>
|
||||
/// Team rotation type.
|
||||
/// </param>
|
||||
public Team SetTeamRotationType(TeamRotationType teamRotationType)
|
||||
{
|
||||
this.teamRotationType = new Lazy<TeamRotationType>(() => teamRotationType);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rotates the team.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The team.
|
||||
/// </returns>
|
||||
public Team RotateTeam()
|
||||
{
|
||||
switch (this.TeamRotationType)
|
||||
{
|
||||
case TeamRotationType.RoundRobin:
|
||||
PerformRoundRobinRotation();
|
||||
break;
|
||||
case TeamRotationType.Random:
|
||||
PerformRandomRotation();
|
||||
break;
|
||||
case TeamRotationType.None:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs the round robin rotation.
|
||||
/// </summary>
|
||||
private void PerformRoundRobinRotation()
|
||||
{
|
||||
if (this.Collection.Any())
|
||||
{
|
||||
var player = this.Collection.LastOrDefault();
|
||||
var lastIndex = this.Collection.Count - 1;
|
||||
this.Collection.RemoveAt(lastIndex);
|
||||
|
||||
this.Collection.Insert(0,player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs the random rotation.
|
||||
/// </summary>
|
||||
private void PerformRandomRotation()
|
||||
{
|
||||
if (this.Collection.Any())
|
||||
{
|
||||
this.collection = new Lazy<List<Player>>(() => this.Collection.Select(player => new { GUID = new Guid(), Player = player })
|
||||
.OrderBy(anon => anon.GUID)
|
||||
.Select(anon => anon.Player)
|
||||
.ToList()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IEnumerable implementation
|
||||
|
||||
/// <summary>
|
||||
/// Gets the enumerator.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The enumerator.
|
||||
/// </returns>
|
||||
public System.Collections.IEnumerator GetEnumerator()
|
||||
{
|
||||
return this.Collection.GetEnumerator();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IEnumerable implementation
|
||||
|
||||
/// <summary>
|
||||
/// Gets the enumerator.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The enumerator.
|
||||
/// </returns>
|
||||
IEnumerator<Player> IEnumerable<Player>.GetEnumerator()
|
||||
{
|
||||
return this.Collection.GetEnumerator();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ICollection implementation
|
||||
|
||||
/// <Docs>
|
||||
/// The item to add to the current collection.
|
||||
/// </Docs>
|
||||
/// <para>
|
||||
/// Adds an item to the current collection.
|
||||
/// </para>
|
||||
/// <remarks>
|
||||
/// To be added.
|
||||
/// </remarks>
|
||||
/// <exception cref='System.NotSupportedException'>
|
||||
/// The current collection is read-only.
|
||||
/// </exception>
|
||||
/// <summary>
|
||||
/// Add the specified item.
|
||||
/// </summary>
|
||||
/// <param name='item'>
|
||||
/// Item.
|
||||
/// </param>
|
||||
public void Add(Player item)
|
||||
{
|
||||
this.Collection.Add(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear this instance.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
this.Collection.Clear();
|
||||
}
|
||||
|
||||
/// <Docs>
|
||||
/// The object to locate in the current collection.
|
||||
/// </Docs>
|
||||
/// <para>
|
||||
/// Determines whether the current collection contains a specific value.
|
||||
/// </para>
|
||||
/// <summary>
|
||||
/// Contains the specified item.
|
||||
/// </summary>
|
||||
/// <param name='item'>
|
||||
/// If set to <c>true</c> item.
|
||||
/// </param>
|
||||
public bool Contains(Player item)
|
||||
{
|
||||
return this.Collection.Contains(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies to.
|
||||
/// </summary>
|
||||
/// <param name='array'>
|
||||
/// Array.
|
||||
/// </param>
|
||||
/// <param name='arrayIndex'>
|
||||
/// Array index.
|
||||
/// </param>
|
||||
public void CopyTo(Player[] array, int arrayIndex)
|
||||
{
|
||||
this.Collection.CopyTo(array,arrayIndex);
|
||||
}
|
||||
|
||||
/// <Docs>
|
||||
/// The item to remove from the current collection.
|
||||
/// </Docs>
|
||||
/// <para>
|
||||
/// Removes the first occurrence of an item from the current collection.
|
||||
/// </para>
|
||||
/// <summary>
|
||||
/// Remove the specified item.
|
||||
/// </summary>
|
||||
/// <param name='item'>
|
||||
/// If set to <c>true</c> item.
|
||||
/// </param>
|
||||
public bool Remove(Player item)
|
||||
{
|
||||
return this.Collection.Remove(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the count.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The count.
|
||||
/// </value>
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Collection.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is read only.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is read only; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IScorable implementation
|
||||
|
||||
/// <summary>
|
||||
/// Gets the score.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The score.
|
||||
/// </value>
|
||||
public Score Score
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.score.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the score.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The score.
|
||||
/// </returns>
|
||||
/// <param name='score'>
|
||||
/// Score.
|
||||
/// </param>
|
||||
public Team SetScore(Score score)
|
||||
{
|
||||
this.score = new Lazy<Score>(() => score);
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList implementation
|
||||
|
||||
/// <Docs>
|
||||
/// To be added.
|
||||
/// </Docs>
|
||||
/// <para>
|
||||
/// Determines the index of a specific item in the current instance.
|
||||
/// </para>
|
||||
/// <summary>
|
||||
/// Indexs the of.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The of.
|
||||
/// </returns>
|
||||
/// <param name='item'>
|
||||
/// Item.
|
||||
/// </param>
|
||||
public int IndexOf(Player item)
|
||||
{
|
||||
return this.Collection.IndexOf(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert the specified index and item.
|
||||
/// </summary>
|
||||
/// <param name='index'>
|
||||
/// Index.
|
||||
/// </param>
|
||||
/// <param name='item'>
|
||||
/// Item.
|
||||
/// </param>
|
||||
public void Insert(int index, Player item)
|
||||
{
|
||||
this.Collection.Insert(index,item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes at index.
|
||||
/// </summary>
|
||||
/// <param name='index'>
|
||||
/// Index.
|
||||
/// </param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
this.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="PingPong.GameEngine.Components.Team"/> at the specified index.
|
||||
/// </summary>
|
||||
/// <param name='index'>
|
||||
/// Index.
|
||||
/// </param>
|
||||
public Player this [int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Collection[index];
|
||||
}
|
||||
set
|
||||
{
|
||||
this.Collection[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
21
PingPong.GameEngine/Components/TeamRotationType.cs
Normal file
21
PingPong.GameEngine/Components/TeamRotationType.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
namespace PingPong.GameEngine.Components
|
||||
{
|
||||
|
||||
public enum TeamRotationType
|
||||
{
|
||||
/// <summary>
|
||||
/// No rotation.
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// Round robin progression.
|
||||
/// </summary>
|
||||
RoundRobin,
|
||||
/// <summary>
|
||||
/// Random reordering.
|
||||
/// </summary>
|
||||
Random
|
||||
}
|
||||
}
|
||||
|
5
PingPong.GameEngine/Components/desktop.ini
Normal file
5
PingPong.GameEngine/Components/desktop.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
43
PingPong.GameEngine/Engine.cs
Normal file
43
PingPong.GameEngine/Engine.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using csmic;
|
||||
using PingPong.Generic;
|
||||
|
||||
namespace PingPong.GameEngine
|
||||
{
|
||||
public class Engine
|
||||
{
|
||||
/// <summary>
|
||||
/// The input interpreter.
|
||||
/// </summary>
|
||||
private static Locked<Lazy<InputInterpreter>> inputInterpreter;
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression parser.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The expression parser.
|
||||
/// </value>
|
||||
public static InputInterpreter ExpressionParser
|
||||
{
|
||||
get
|
||||
{
|
||||
return inputInterpreter.Value.Value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Engine()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
static Engine()
|
||||
{
|
||||
inputInterpreter = new Locked<Lazy<InputInterpreter>>(new Lazy<InputInterpreter>(() => new InputInterpreter()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
78
PingPong.GameEngine/GameCondition.cs
Normal file
78
PingPong.GameEngine/GameCondition.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
namespace PingPong.GameEngine
|
||||
{
|
||||
|
||||
public class GameCondition
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// The expression.
|
||||
/// </summary>
|
||||
private Lazy<string> expression;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The expression.
|
||||
/// </value>
|
||||
public string Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expression.Value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingPong.GameEngine.GameCondition"/> class.
|
||||
/// </summary>
|
||||
public GameCondition()
|
||||
{
|
||||
this.expression = new Lazy<string>(() => string.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Evaluate this instance.
|
||||
/// </summary>
|
||||
public bool Evaluate()
|
||||
{
|
||||
Engine.ExpressionParser.Interpret(this.Expression);
|
||||
return Engine.ExpressionParser.Output.Equals(
|
||||
bool.TrueString,
|
||||
StringComparison.OrdinalIgnoreCase
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the expression.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The expression.
|
||||
/// </returns>
|
||||
/// <param name='expression'>
|
||||
/// Expression.
|
||||
/// </param>
|
||||
public GameCondition SetExpression(string expression)
|
||||
{
|
||||
this.expression = new Lazy<string>(() => expression);
|
||||
return this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
22
PingPong.GameEngine/GameDefinition.cs
Normal file
22
PingPong.GameEngine/GameDefinition.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
namespace PingPong.GameEngine
|
||||
{
|
||||
public class GameDefinition
|
||||
{
|
||||
public GameDefinition ()
|
||||
{
|
||||
#region Members
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
145
PingPong.GameEngine/GameState.cs
Normal file
145
PingPong.GameEngine/GameState.cs
Normal file
|
@ -0,0 +1,145 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using PingPong.GameEngine.Components;
|
||||
|
||||
namespace PingPong.GameEngine
|
||||
{
|
||||
public class GameState
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// The teams.
|
||||
/// </summary>
|
||||
private Lazy<List<Team>> teams;
|
||||
/// <summary>
|
||||
/// The type of the scoring.
|
||||
/// </summary>
|
||||
private Lazy<ScoringType> scoringType;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the teams.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The teams.
|
||||
/// </value>
|
||||
private List<Team> TeamList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.teams.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the teams.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The teams.
|
||||
/// </value>
|
||||
public IEnumerable<Team> Teams
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.TeamList;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the scoring.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The type of the scoring.
|
||||
/// </value>
|
||||
public ScoringType ScoringType
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.scoringType.Value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingPong.GameEngine.GameState"/> class.
|
||||
/// </summary>
|
||||
public GameState()
|
||||
{
|
||||
this.teams = new Lazy<List<Team>>(() => new List<Team>());
|
||||
this.scoringType = new Lazy<ScoringType>(() => ScoringType.None);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the specified gameDefinition.
|
||||
/// </summary>
|
||||
/// <param name='gameDefinition'>
|
||||
/// Game definition.
|
||||
/// </param>
|
||||
public GameState Initialize(GameDefinition gameDefinition)
|
||||
{
|
||||
if (gameDefinition == null)
|
||||
{
|
||||
throw new ArgumentNullException("gameDefinition");
|
||||
}
|
||||
|
||||
//TODO: Add loading logic here.
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the team.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The team.
|
||||
/// </returns>
|
||||
/// <param name='team'>
|
||||
/// Team.
|
||||
/// </param>
|
||||
public GameState AddTeam(Team team)
|
||||
{
|
||||
if(team == null)
|
||||
{
|
||||
throw new ArgumentNullException("team");
|
||||
}
|
||||
|
||||
this.TeamList.Add(team);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the team.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The team.
|
||||
/// </returns>
|
||||
/// <param name='team'>
|
||||
/// Team.
|
||||
/// </param>
|
||||
public GameState RemoveTeam(Team team)
|
||||
{
|
||||
if (team == null)
|
||||
{
|
||||
throw new ArgumentNullException("team");
|
||||
}
|
||||
|
||||
this.TeamList.Remove(team);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
65
PingPong.GameEngine/PingPong.GameEngine.csproj
Normal file
65
PingPong.GameEngine/PingPong.GameEngine.csproj
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{9C0A0C83-B112-4959-BD94-D6A22AD5AC90}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>PingPong.GameEngine</RootNamespace>
|
||||
<AssemblyName>PingPong.GameEngine</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="csmic">
|
||||
<HintPath>..\packages\csmic.1.1.3\lib\csmic.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="GameDefinition.cs" />
|
||||
<Compile Include="GameCondition.cs" />
|
||||
<Compile Include="GameState.cs" />
|
||||
<Compile Include="Engine.cs" />
|
||||
<Compile Include="Components\Team.cs" />
|
||||
<Compile Include="Components\Player.cs" />
|
||||
<Compile Include="Components\Score.cs" />
|
||||
<Compile Include="Components\IScorable.cs" />
|
||||
<Compile Include="Components\TeamRotationType.cs" />
|
||||
<Compile Include="Components\ScoringType.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Components\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="csmic_help.chm" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PingPong.Generic\PingPong.Generic.csproj">
|
||||
<Project>{630BDE02-B1C2-4D9F-8BFB-4FCAF128BE14}</Project>
|
||||
<Name>PingPong.Generic</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
BIN
PingPong.GameEngine/csmic_help.chm
Normal file
BIN
PingPong.GameEngine/csmic_help.chm
Normal file
Binary file not shown.
5
PingPong.GameEngine/desktop.ini
Normal file
5
PingPong.GameEngine/desktop.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
4
PingPong.GameEngine/packages.config
Normal file
4
PingPong.GameEngine/packages.config
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="csmic" version="1.1.3" targetFramework="net40" />
|
||||
</packages>
|
27
PingPong.Generic/AssemblyInfo.cs
Normal file
27
PingPong.Generic/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("PingPong.Generic")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("wagesj45")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
89
PingPong.Generic/Locked.cs
Normal file
89
PingPong.Generic/Locked.cs
Normal file
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
namespace PingPong.Generic
|
||||
{
|
||||
|
||||
public class Locked<T>
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// The lock object.
|
||||
/// </summary>
|
||||
private object lockObject;
|
||||
/// <summary>
|
||||
/// The value.
|
||||
/// </summary>
|
||||
private T value;
|
||||
/// <summary>
|
||||
/// The is locked.
|
||||
/// </summary>
|
||||
private bool isLocked;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The value.
|
||||
/// </value>
|
||||
public T Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (this.lockObject)
|
||||
{
|
||||
this.isLocked = true;
|
||||
this.value = value;
|
||||
this.isLocked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is locked.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is locked; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsLocked
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isLocked;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingPong.Generic.Locked`1"/> class.
|
||||
/// </summary>
|
||||
public Locked()
|
||||
{
|
||||
this.value = default(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingPong.Generic.Locked`1"/> class.
|
||||
/// </summary>
|
||||
/// <param name='value'>
|
||||
/// Value.
|
||||
/// </param>
|
||||
public Locked(T value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
39
PingPong.Generic/PingPong.Generic.csproj
Normal file
39
PingPong.Generic/PingPong.Generic.csproj
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{630BDE02-B1C2-4D9F-8BFB-4FCAF128BE14}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>PingPong.Generic</RootNamespace>
|
||||
<AssemblyName>PingPong.Generic</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Locked.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
5
PingPong.Generic/desktop.ini
Normal file
5
PingPong.Generic/desktop.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
27
PingPong/AssemblyInfo.cs
Normal file
27
PingPong/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("PingPong")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("wagesj45")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
16
PingPong/Main.cs
Normal file
16
PingPong/Main.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using Gtk;
|
||||
|
||||
namespace PingPong
|
||||
{
|
||||
class MainClass
|
||||
{
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
Application.Init ();
|
||||
MainWindow win = new MainWindow ();
|
||||
win.Show ();
|
||||
Application.Run ();
|
||||
}
|
||||
}
|
||||
}
|
16
PingPong/MainWindow.cs
Normal file
16
PingPong/MainWindow.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using Gtk;
|
||||
|
||||
public partial class MainWindow: Gtk.Window
|
||||
{
|
||||
public MainWindow (): base (Gtk.WindowType.Toplevel)
|
||||
{
|
||||
Build ();
|
||||
}
|
||||
|
||||
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
|
||||
{
|
||||
Application.Quit ();
|
||||
a.RetVal = true;
|
||||
}
|
||||
}
|
68
PingPong/PingPong.csproj
Normal file
68
PingPong/PingPong.csproj
Normal file
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D5DF4388-106F-40F7-B54C-72E71376AB43}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>PingPong</RootNamespace>
|
||||
<AssemblyName>PingPong</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Mono.Posix" />
|
||||
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<Package>gtk-sharp-2.0</Package>
|
||||
</Reference>
|
||||
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<Package>gdk-sharp-2.0</Package>
|
||||
</Reference>
|
||||
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<Package>glib-sharp-2.0</Package>
|
||||
</Reference>
|
||||
<Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<Package>glade-sharp-2.0</Package>
|
||||
</Reference>
|
||||
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<Package>pango-sharp-2.0</Package>
|
||||
</Reference>
|
||||
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<Package>atk-sharp-2.0</Package>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="gtk-gui\gui.stetic">
|
||||
<LogicalName>gui.stetic</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="gtk-gui\generated.cs" />
|
||||
<Compile Include="MainWindow.cs" />
|
||||
<Compile Include="gtk-gui\MainWindow.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
5
PingPong/desktop.ini
Normal file
5
PingPong/desktop.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
38
PingPong/gtk-gui/MainWindow.cs
Normal file
38
PingPong/gtk-gui/MainWindow.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
// This file has been generated by the GUI designer. Do not modify.
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
private global::Gtk.Fixed fixed1;
|
||||
private global::Gtk.Label lblScore;
|
||||
|
||||
protected virtual void Build ()
|
||||
{
|
||||
global::Stetic.Gui.Initialize (this);
|
||||
// Widget MainWindow
|
||||
this.Name = "MainWindow";
|
||||
this.Title = global::Mono.Unix.Catalog.GetString ("MainWindow");
|
||||
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
|
||||
// Container child MainWindow.Gtk.Container+ContainerChild
|
||||
this.fixed1 = new global::Gtk.Fixed ();
|
||||
this.fixed1.Name = "fixed1";
|
||||
this.fixed1.HasWindow = false;
|
||||
// Container child fixed1.Gtk.Fixed+FixedChild
|
||||
this.lblScore = new global::Gtk.Label ();
|
||||
this.lblScore.Name = "lblScore";
|
||||
this.lblScore.LabelProp = global::Mono.Unix.Catalog.GetString ("00:00");
|
||||
this.lblScore.UseMarkup = true;
|
||||
this.fixed1.Add (this.lblScore);
|
||||
global::Gtk.Fixed.FixedChild w1 = ((global::Gtk.Fixed.FixedChild)(this.fixed1 [this.lblScore]));
|
||||
w1.X = 128;
|
||||
w1.Y = 65;
|
||||
this.Add (this.fixed1);
|
||||
if ((this.Child != null)) {
|
||||
this.Child.ShowAll ();
|
||||
}
|
||||
this.DefaultWidth = 400;
|
||||
this.DefaultHeight = 300;
|
||||
this.Show ();
|
||||
this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
|
||||
}
|
||||
}
|
5
PingPong/gtk-gui/desktop.ini
Normal file
5
PingPong/gtk-gui/desktop.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
29
PingPong/gtk-gui/generated.cs
Normal file
29
PingPong/gtk-gui/generated.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
// This file has been generated by the GUI designer. Do not modify.
|
||||
namespace Stetic
|
||||
{
|
||||
internal class Gui
|
||||
{
|
||||
private static bool initialized;
|
||||
|
||||
internal static void Initialize (Gtk.Widget iconRenderer)
|
||||
{
|
||||
if ((Stetic.Gui.initialized == false)) {
|
||||
Stetic.Gui.initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class ActionGroups
|
||||
{
|
||||
public static Gtk.ActionGroup GetActionGroup (System.Type type)
|
||||
{
|
||||
return Stetic.ActionGroups.GetActionGroup (type.FullName);
|
||||
}
|
||||
|
||||
public static Gtk.ActionGroup GetActionGroup (string name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
34
PingPong/gtk-gui/gui.stetic
Normal file
34
PingPong/gtk-gui/gui.stetic
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<stetic-interface>
|
||||
<configuration>
|
||||
<images-root-path>../../PingPong</images-root-path>
|
||||
<target-gtk-version>2.12</target-gtk-version>
|
||||
</configuration>
|
||||
<import>
|
||||
<widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<widget-library name="../bin/Debug/PingPong.exe" internal="true" />
|
||||
</import>
|
||||
<widget class="Gtk.Window" id="MainWindow" design-size="400 300">
|
||||
<property name="MemberName" />
|
||||
<property name="Title" translatable="yes">MainWindow</property>
|
||||
<property name="WindowPosition">CenterOnParent</property>
|
||||
<signal name="DeleteEvent" handler="OnDeleteEvent" />
|
||||
<child>
|
||||
<widget class="Gtk.Fixed" id="fixed1">
|
||||
<property name="MemberName" />
|
||||
<property name="HasWindow">False</property>
|
||||
<child>
|
||||
<widget class="Gtk.Label" id="lblScore">
|
||||
<property name="MemberName" />
|
||||
<property name="LabelProp" translatable="yes">00:00</property>
|
||||
<property name="UseMarkup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="X">128</property>
|
||||
<property name="Y">65</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</stetic-interface>
|
Loading…
Reference in a new issue