?? oandxcontroller.h
字號:
// OandxController.h
//
// Copyright (c) 2006 Symbian Ltd. All rights reserved.
//
#ifndef OANDXCONTROLLER_H
#define OANDXCONTROLLER_H
#include <coecntrl.h>
#include <coemain.h>
#include <eikappui.h>
#include <eikapp.h>
#include <eikdoc.h>
#include <eikenv.h>
#include <eikon.hrh>
#include <aknglobalnote.h>
#include <aknwaitdialog.h>
#include <aknquerydialog.h>
#include <transportinterface.h>
#include "oandx.hrh"
#include <oandx.rsg>
class COandXEngine;
class MOandXGameObserver;
class COandXController : public CBase, public MTransportObserver
/**
This controller uses instructions from the users to update the
engine (board.)
*/
{
public:
static COandXController* NewL(MOandXGameObserver* aObserver);
virtual ~COandXController();
void OfferGameL(TUid aTransportUid, TBool aRequireAddress);
void JoinGameL(TUid aTransportUid, TBool aRequireAddress);
TBool DrawableGame() const;
void HitSquareL(TInt aIndex);
TBool IsCrossTurn() const;
void SendIndexL();
private:
COandXController(MOandXGameObserver* aObserver);
void ConstructL();
void ResetCurrentGame();
void AllocTransportL(TUid aTransportUid, TBool aRequireAddress, TBool aInitListen);
static TInt ConnectionCloserCallBack(TAny* aPtr);
void DeleteTransport();
void SendMove(TInt aIndex);
void TerminateGame(const TDesC& aMsg);
// implement MTransportObserver
virtual void SentPayload();
virtual void ReceivedPayload(const TDesC& aPayload);
virtual void LostConnection(TInt aError);
virtual TInt StartedLookingForServiceL();
virtual void StoppedLookingForService();
virtual TInt StartedConnectingToServiceL();
virtual void StoppedConnectingToService();
virtual TInt StartedWaitingForClientL();
virtual void StoppedWaitingForClient();
TInt RunWaitDialogL(const TDesC& aMessage);
void CancelWaitDialog();
#ifdef _DEBUG
enum TPanic
/** Invalid states for this object. */
{
EAtAlreadyExists = 0x10,
ERpBadState = 0x20,
ESpBadState = 0x30,
ESmBadState = 0x40
};
static void Panic(TPanic aPanic);
#endif
private:
/** Observer to notify when game events occur. */
MOandXGameObserver*const iObserver;
/** Engine represents the board. */
COandXEngine* iEngine;
/** Tears down the transport outside of the current AO. */
CAsyncCallBack* iConnectionCloser;
/** Transport used to communicate with remote device. */
CTransportInterface* iTransportInterface;
enum TState
/** This object's state identifies which event it is waiting for. */
{
EStBlank, ///< No game is in progress.
EStWaitRemoteJoin, ///< Waiting for a remote player to connect.
EStWaitLocalMove, ///< Waiting for local user to move.
EStWaitSendingLocalMove, ///< Sending local move to remote player.
EStWaitRemoteMove, ///< Waiting for remote player to move.
EStWaitOffer, ///< Waiting to connect to remote host
EStFinished ///< Game has been won.
};
/** This object's current state. */
TState iState;
void CheckForGameOver(TState aNotOverState);
/** The local user's symbol, ETileNought or ETileCross. */
TInt iLocalUserSymbol;
/** Points to waiting dialog, e.g. when connection to remote device. */
CAknWaitDialog* iWaitDialog;
};
#endif // #ifndef OANDXCONTROLLER_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -