Esempio n. 1
0
 private void notifyMove(Location from, Location to, ChessKind chessName)
 {
     foreach (IStateChange listener in this.listenersList)
     {
         listener.Move(from, to, chessName);
     }
 }
Esempio n. 2
0
    public Sprite getChessSprite(ChessKind kind, ChessPlayer belongTo)
    {
        int flag;

        switch (belongTo)
        {
        case ChessPlayer.Red:
            flag = 0;
            break;

        case ChessPlayer.Black:
            flag = 1;
            break;

        default:
            return(null);
        }
        int baseIndex = flag * (sprites.Length / 2);

        if (kind != ChessKind.Unkown)
        {
            return(sprites[baseIndex + (int)kind]);
        }
        return(null);
    }
        public static Chess make(ChessPlayer player, ChessKind kind, Location loc)
        {
            switch (kind)
            {
            case ChessKind.Ju:
                return(new Ju(player, kind, loc));

            case ChessKind.Ma:
                return(new Ma(player, kind, loc));

            case ChessKind.Pao:
                return(new Pao(player, kind, loc));

            case ChessKind.Xiang:
                return(new Xiang(player, kind, loc));

            case ChessKind.Shi:
                return(new Shi(player, kind, loc));

            case ChessKind.King:
                return(new King(player, kind, loc));

            case ChessKind.Soldier:
                return(new Soldier(player, kind, loc));

            default:
                return(new Chess(player, kind, loc));
            }
        }
Esempio n. 4
0
 void IStateChange.Move(Location from, Location to, ChessKind chessName)
 {
 }
Esempio n. 5
0
 public Xiang(ChessPlayer player, ChessKind kind, Location loc) : base(player, kind, loc)
 {
 }
Esempio n. 6
0
 public Soldier(ChessPlayer player, ChessKind kind, Location loc) : base(player, kind, loc)
 {
 }
 public Chess(ChessPlayer player, ChessKind kind, Location loc)
 {
     this.belongTo = player;
     this.kind     = kind;
     this.location = loc;
 }