1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Source/Player.h Mon Jul 07 15:47:42 2008 -0700
1.3 @@ -0,0 +1,48 @@
1.4 +//
1.5 +// Player.h
1.6 +// YourMove
1.7 +//
1.8 +// Created by Jens Alfke on 7/3/08.
1.9 +// Copyright 2008 Jens Alfke. All rights reserved.
1.10 +//
1.11 +
1.12 +#import <Foundation/Foundation.h>
1.13 +@class Game;
1.14 +
1.15 +
1.16 +/** A mostly-passive object used to represent a player. */
1.17 +@interface Player : NSObject <NSCoding>
1.18 +{
1.19 + Game *_game;
1.20 + NSString *_name, *_uuid, *_address, *_addressType;
1.21 + BOOL _local;
1.22 +}
1.23 +
1.24 +- (id) initWithGame: (Game*)game;
1.25 +- (id) initWithName: (NSString*)name;
1.26 +
1.27 +- (id) initWithCoder: (NSCoder*)decoder;
1.28 +- (void) encodeWithCoder: (NSCoder*)coder;
1.29 +
1.30 +@property (readonly) Game *game;
1.31 +@property (copy) NSString *name, // Display name
1.32 + *UUID, // Address Book UUID
1.33 + *address, // Contact address
1.34 + *addressType; // Contact address type (an AB property type)
1.35 +@property (readonly) int index; // Player's index in the Game's -players array
1.36 +@property (readwrite,getter=isLocal) BOOL local; // Is the player on this computer? (Defaults to YES)
1.37 +@property (readonly, getter=isCurrent) BOOL current; // Is it this player's turn?
1.38 +@property (readonly, getter=isFriendly) BOOL friendly; // Is this player the current player or an ally?
1.39 +@property (readonly, getter=isUnfriendly) BOOL unfriendly; // Is this player an opponent of the current player?
1.40 +@property (readonly) Player *nextPlayer, *previousPlayer; // The next/previous player in sequence
1.41 +@property (readonly) CGImageRef icon;
1.42 +@end
1.43 +
1.44 +
1.45 +
1.46 +@interface CALayer (Game)
1.47 +
1.48 +/** Called on any CALayer in the game's layer tree, will return the current Game object. */
1.49 +@property (readonly) Game *game;
1.50 +
1.51 +@end