本文整理汇总了C#中IVertex.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IVertex.ToString方法的具体用法?C# IVertex.ToString怎么用?C# IVertex.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVertex
的用法示例。
在下文中一共展示了IVertex.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildEstablishment
public IEstablishment BuildEstablishment(IVertex vertex, IPlayer owner)
{
if (vertex == null)
throw new ArgumentNullException(nameof(vertex));
if (owner == null)
throw new ArgumentNullException(nameof(owner));
if (!Vertices.Contains(vertex))
throw new ArgumentException("Did not find the passed vertex on the board");
if (establishments.Any(e => e.Vertex == vertex))
throw new ArgumentException("Invalid vertex, already an establishment here");
var vertices = Vertices.Where(v => v.IsAdjacentTo(vertex));
var tiles = Tiles.Where(t => t.IsAdjacentTo(vertex));
if (establishments.Any(e => vertices.Contains(e.Vertex)))
throw new ArgumentException("Invalid vertex, establishment can't be placed next to another establishment");
if (tiles.All(t => t.Rawmaterial == MaterialType.Sea))
throw new ArgumentException("Can't place an establishment on sea!");
if (establishments.Count(e => e.Owner == owner) >= 2 &&
roads.Where(r => r.Owner == owner).All(r => !r.Edge.IsAdjacentTo(vertex)))
throw new InvalidOperationException("Each player can only build 2 houses without adjacent roads!");
var establishment = new Establishment(owner, vertex);
establishments.Add(establishment);
logger.Info($"Establisment Build; Player {owner.Name}, {vertex.ToString()}");
return establishment;
}
示例2: OutEdges
/// <summary>
/// Returns an iterable collection over the edge connected to v
/// </summary>
/// <param name="v"></param>
/// <returns></returns>
public EdgeCollection OutEdges(IVertex v)
{
if (v == null)
throw new ArgumentNullException("v");
EdgeCollection ec=VertexOutEdges[v];
if (ec==null)
throw new VertexNotFoundException(v.ToString());
return ec;
}
示例3: OutEdges
public EdgeCollection OutEdges(IVertex v)
{
if (v == null)
{
throw new ArgumentNullException("v");
}
EdgeCollection edges = this.VertexOutEdges.get_Item(v);
if (edges == null)
{
throw new VertexNotFoundException(v.ToString());
}
return edges;
}