Source/Player.h
author Jens Alfke <jens@mooseyard.com>
Sat Jul 05 17:46:43 2008 -0700 (2008-07-05)
changeset 11 436cbdf56810
child 13 db7bb080c3d5
permissions -rw-r--r--
* Improved drag-and-drop (supports CandyBar)
* Fixed DiscPiece
* Inheritable layer styles
etc.
jens@10
     1
//
jens@10
     2
//  Player.h
jens@10
     3
//  YourMove
jens@10
     4
//
jens@10
     5
//  Created by Jens Alfke on 7/3/08.
jens@10
     6
//  Copyright 2008 Jens Alfke. All rights reserved.
jens@10
     7
//
jens@10
     8
jens@10
     9
#import <Foundation/Foundation.h>
jens@10
    10
@class Game;
jens@10
    11
jens@10
    12
jens@10
    13
/** A mostly-passive object used to represent a player. */
jens@10
    14
@interface Player : NSObject <NSCoding>
jens@10
    15
{
jens@10
    16
    Game *_game;
jens@10
    17
    NSString *_name, *_uuid, *_address, *_addressType;
jens@10
    18
    BOOL _local;
jens@10
    19
}
jens@10
    20
jens@10
    21
- (id) initWithGame: (Game*)game;
jens@10
    22
- (id) initWithName: (NSString*)name;
jens@10
    23
jens@10
    24
- (id) initWithCoder: (NSCoder*)decoder;
jens@10
    25
- (void) encodeWithCoder: (NSCoder*)coder;
jens@10
    26
jens@10
    27
@property (readonly) Game *game;
jens@10
    28
@property (copy) NSString *name,                            // Display name
jens@10
    29
                          *UUID,                            // Address Book UUID
jens@10
    30
                          *address,                         // Contact address
jens@10
    31
                          *addressType;                     // Contact address type (an AB property type)
jens@10
    32
@property (readonly) int index;                             // Player's index in the Game's -players array
jens@10
    33
@property (readwrite,getter=isLocal) BOOL local;            // Is the player on this computer? (Defaults to YES)
jens@10
    34
@property (readonly, getter=isCurrent) BOOL current;        // Is it this player's turn?
jens@10
    35
@property (readonly, getter=isFriendly) BOOL friendly;      // Is this player the current player or an ally?
jens@10
    36
@property (readonly, getter=isUnfriendly) BOOL unfriendly;  // Is this player an opponent of the current player?
jens@10
    37
@property (readonly) Player *nextPlayer, *previousPlayer;   // The next/previous player in sequence
jens@10
    38
@property (readonly) CGImageRef icon;
jens@10
    39
@end
jens@10
    40
jens@10
    41
jens@10
    42
jens@10
    43
@interface CALayer (Game)
jens@10
    44
jens@10
    45
/** Called on any CALayer in the game's layer tree, will return the current Game object. */
jens@10
    46
@property (readonly) Game *game;
jens@10
    47
jens@10
    48
@end