コード例 #1
0
ファイル: Player.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Creates a new player for the specified game, using the specified name and email.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="name">The name.</param>
 /// <param name="email">The email.</param>
 /// <param name="turnJoined">The turn joined.</param>
 /// <returns></returns>
 public static Player CreatePlayer(Game game, string name, string email, int turnJoined)
 {
     Player p = new Player();
      p.Identifier = game.Pool.ConsumeIdentifier();
      p.Name = name;
      p.Email = email;
      p.TurnJoined = turnJoined;
      Hero h = new Hero();
      h.Identifier = game.Pool.ConsumeIdentifier();
      h.Name = "New Hero";
      p.Heroes.Add(h.Identifier, h);
      game.Players.Add(p.Identifier, p);
      return p;
 }
コード例 #2
0
ファイル: Hire.cs プロジェクト: Cappinator/chiiilp-pbem
 /// <summary>
 /// Ends the order for the specified game and hero.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="who">The who.</param>
 /// <returns></returns>
 public string End(Game game, IOrderTaker who)
 {
     // Our start condition checked and who is a Hero
      Hero h = who as Hero;
      if (h == null)
     throw new InvalidOperationException("This cannot happen since the cast was checked at start condition");
      string newheroname = (string)this.Parameters["name"];
      Hero newhero = new Hero();
      newhero.Identifier = game.Pool.ConsumeIdentifier();
      newhero.Name = newheroname;
      h.Owner.Heroes.Add(newhero.Identifier, newhero);
      return h.Name + " hires " + newheroname + "." + Environment.NewLine;
 }