DesignPattern/20.ObserverPattern/2.Code/AllyCenter.h

36 lines
620 B
C
Raw Normal View History

2019-11-06 13:36:28 +00:00
#ifndef __ALLYCENTER_H__
#define __ALLYCENTER_H__
#include "common.h"
#include <vector>
// ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
class Observer;
class Player;
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EAA3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
class AllyCenter
{
public:
AllyCenter();
// <20><><EFBFBD><EFBFBD>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>
virtual void notify(INFO_TYPE infoType, std::string name) = 0;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void join(Observer* player);
// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>
void remove(Observer* player);
protected:
// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
std::vector<Observer*>playerList;
};
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>
class AllyCenterController :public AllyCenter
{
public:
AllyCenterController();
// ʵ<><CAB5>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>
void notify(INFO_TYPE infoType, std::string name);
};
#endif //__ALLYCENTER_H__