Add new Views system
This commit is contained in:
39
CoopSweeper/View/Position.cs
Normal file
39
CoopSweeper/View/Position.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CoopSweeper.View
|
||||
{
|
||||
public struct Position
|
||||
{
|
||||
public Position(int x, int y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is Position))
|
||||
return false;
|
||||
|
||||
var position = (Position)obj;
|
||||
return X == position.X &&
|
||||
Y == position.Y;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
var hashCode = 1861411795;
|
||||
hashCode = hashCode * -1521134295 + X.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + Y.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public static bool operator ==(Position a, Position b) => a.X == b.X && a.Y == b.Y;
|
||||
public static bool operator !=(Position a, Position b) => a.X != b.X || a.Y != b.Y;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user