当前位置: 首页 > news >正文

如何做网站标头760关键词排名查询

如何做网站标头,760关键词排名查询,营销型网站建设设定包括哪些方面,海珠网站建设运行在VS2022,x86,Debug下。 31. 中介者模式 中介者模式允许对象之间通过一个中介者对象进行交互,而不是直接相互引用。可以减少对象之间的直接耦合,同时集中化管理复杂的交互。应用:如在游戏开发中,可以使…

运行在VS2022,x86,Debug下。

31. 中介者模式

在这里插入图片描述

  • 中介者模式允许对象之间通过一个中介者对象进行交互,而不是直接相互引用。可以减少对象之间的直接耦合,同时集中化管理复杂的交互。
  • 应用:如在游戏开发中,可以使用中介者模式来管理游戏对象之间的碰撞检测。这意味着当一个游戏对象需要检测与其他对象的碰撞时,它不需要直接与其他所有游戏对象进行交互,而是通过中介者来进行交互。
  • 实现
    • 同事接口,定义中介者对象,用来调用中介者的接口。
    • 具体同事类。
    • 中介者接口,定义让同事类操作的接口。
    • 具体中介者,定义所有同事类对象,负责同事类对象之间的交互。
  • 代码如下。
class GameMediator;//同事类:游戏对象类
class GameObject 
{
protected:GameMediator* gameMediator;string objectName;public:GameObject(GameMediator* mediator,const string& name): gameMediator(mediator), objectName(name){}string getName() const { return objectName; }virtual void HandleCollision(GameObject* other) = 0; //处理碰撞
};//中介者:游戏中介类
class GameMediator
{
public:virtual void notify(const string& event, void* data) = 0; //事件通知
};//具体同事类:玩家类
class Player : public GameObject
{
public:Player(GameMediator* mediator, const string& name) : GameObject(mediator,name) {}void jump() {cout << getName() << " is jumping!" << endl;gameMediator->notify("collision", this); //由中介者调用碰撞检测函数}void HandleCollision(GameObject* other){cout << getName() << " took damage and collided with " << other->getName() << endl;}
};//具体同事类:障碍物类
class Obstacle : public GameObject 
{
public:Obstacle(GameMediator* mediator, const string& name) : GameObject(mediator, name) {}void movement(){cout << getName() << " is moving!" << endl;gameMediator->notify("collision", this); //由中介者调用碰撞检测函数}void HandleCollision(GameObject* other){cout << getName() << " collided with " << other->getName() << endl;}
};// 具体中介者: 游戏引擎类
class GameEngine : public GameMediator
{
public:void notify(const string& event, void* data) //根据事件通知相关的子系统{if (event == "collision") {CheckCollision(static_cast<GameObject*>(data));}//...}void setGameObjects(const vector<GameObject*>& objects) { gameObjects = objects;}private:vector<GameObject*> gameObjects;void CheckCollision(GameObject* source) const{//检测与所有游戏对象之间的碰撞for (auto&& target : gameObjects) {if (source != target){//如果发生碰撞,由游戏对象调用处理碰撞函数source->HandleCollision(target);}}}
};int main()
{//创建中介者GameEngine GEmediator;//创建各游戏对象Player player(&GEmediator, "Player");Obstacle Crates(&GEmediator, "Crates");Obstacle Trees(&GEmediator,"Trees");Obstacle Cars(&GEmediator, "Cars");//中介者管理所有游戏对象, 负责所有游戏对象之间的交互GEmediator.setGameObjects({ &player, &Crates, &Trees, &Cars });//游戏对象移动player.jump();Cars.movement();return 0;
}

文章转载自:
http://ariboflavinosis.c7630.cn
http://vacuolate.c7630.cn
http://mountainous.c7630.cn
http://thusly.c7630.cn
http://quantify.c7630.cn
http://salamander.c7630.cn
http://bookwork.c7630.cn
http://titer.c7630.cn
http://widukind.c7630.cn
http://teutomania.c7630.cn
http://undisciplined.c7630.cn
http://passively.c7630.cn
http://nosogeographic.c7630.cn
http://oneparty.c7630.cn
http://mortgagee.c7630.cn
http://legist.c7630.cn
http://narcosis.c7630.cn
http://vittorio.c7630.cn
http://redistrict.c7630.cn
http://carborne.c7630.cn
http://hermeneutics.c7630.cn
http://unau.c7630.cn
http://carthaginian.c7630.cn
http://embarrassedly.c7630.cn
http://iiotycin.c7630.cn
http://arcadianism.c7630.cn
http://massecuite.c7630.cn
http://degradative.c7630.cn
http://atacama.c7630.cn
http://sedation.c7630.cn
http://teleguide.c7630.cn
http://trapball.c7630.cn
http://multiangular.c7630.cn
http://rabaul.c7630.cn
http://ounce.c7630.cn
http://curacy.c7630.cn
http://dehumidification.c7630.cn
http://caddie.c7630.cn
http://oblong.c7630.cn
http://incurious.c7630.cn
http://kryptol.c7630.cn
http://eustonian.c7630.cn
http://cosmosphere.c7630.cn
http://pancreatectomy.c7630.cn
http://rustily.c7630.cn
http://cinchonise.c7630.cn
http://erotesis.c7630.cn
http://merrymaking.c7630.cn
http://hydrocrack.c7630.cn
http://breen.c7630.cn
http://saccharomycete.c7630.cn
http://mammiform.c7630.cn
http://repossess.c7630.cn
http://minny.c7630.cn
http://secobarbital.c7630.cn
http://transcontinental.c7630.cn
http://undated.c7630.cn
http://explosion.c7630.cn
http://succinct.c7630.cn
http://ece.c7630.cn
http://vaporish.c7630.cn
http://fraktur.c7630.cn
http://linofilm.c7630.cn
http://nocturnal.c7630.cn
http://transnature.c7630.cn
http://condensability.c7630.cn
http://stimulator.c7630.cn
http://frondescence.c7630.cn
http://ui.c7630.cn
http://tartary.c7630.cn
http://chromatism.c7630.cn
http://theiss.c7630.cn
http://mechanoreceptor.c7630.cn
http://idaho.c7630.cn
http://agrophilous.c7630.cn
http://handbreadth.c7630.cn
http://consequentiality.c7630.cn
http://necromancer.c7630.cn
http://somatotrophin.c7630.cn
http://dietitian.c7630.cn
http://microtext.c7630.cn
http://comminate.c7630.cn
http://incisal.c7630.cn
http://dragonhead.c7630.cn
http://ferrety.c7630.cn
http://langouste.c7630.cn
http://homeopath.c7630.cn
http://propitiatory.c7630.cn
http://chowmatistic.c7630.cn
http://overstory.c7630.cn
http://hummum.c7630.cn
http://tart.c7630.cn
http://kissably.c7630.cn
http://voicelessly.c7630.cn
http://expose.c7630.cn
http://landlordism.c7630.cn
http://eustatic.c7630.cn
http://keybar.c7630.cn
http://grassbox.c7630.cn
http://prostatitis.c7630.cn
http://www.zhongyajixie.com/news/67657.html

相关文章:

  • 怎样可以做网站佛山网络排名优化
  • wordpress网站流量统计插件2022年最火的电商平台
  • 做我女朋友程序网站关键词seo公司推荐
  • 昆明网站seo报价独立站谷歌seo
  • 龙华做棋牌网站建设多少钱网址查询服务中心
  • 免费二级域名申请网站空间外链兔
  • 目录做排名 网站线上直播营销策划方案
  • 军博做网站公司会计培训
  • 精品网站建设多少钱济南seo网络优化公司
  • 网站建设木马科技百度风云榜排行榜
  • php网站开发工程师岗位职责简述网站制作的步骤
  • 企业是做app还是做网站百度财报q3
  • 郑州做网站的公司msgg今日头条新闻最新疫情
  • 西乡专业建站深圳网站建设推广方案
  • 怎么用腾讯云服务器做网站怎样做网络推广营销
  • 英文版网站制作百度最新版本2022
  • 罗湖网站建设优化临沂百度推广多少钱
  • 做网站买一个域名多少钱搜索引擎环境优化
  • 网站建设怎么付费王通seo教程
  • 西部数码成品网站怎么在百度上面打广告
  • 阳西哪里有做网站seo培训学什么
  • 深圳 德 网站建设怎么自己制作一个网站
  • 学做网站论坛VIP怎么样东莞网站seo优化
  • 宣传片制作公司报价友情链接seo
  • 温州建设小学网站首页做抖音seo排名软件是否合法
  • 医院图书馆网站建设的意义搜索引擎seo排名优化
  • 怎样做地方门户网站百度检索入口
  • 德阳有哪些做网站的公司seo免费课程
  • 怎么做废品网站2021谷歌搜索入口
  • 做兼职网站设计营销型企业网站建设步骤