admin 管理员组

文章数量: 887090


2024年1月12日发(作者:条件语句python)

19 m_nHp = m_nHp < 0 ? 0 : m_nHp;//safe check20 } HeroView类: 1 #pragma once 2 class HeroView 3 { 4 public: 5 HeroView(); 6 ~HeroView(); 7

8 //show hero UI data; 9 void show(string no, string name,int att, int hp);10 //show hero dead UI;11 void dead(string no, string name);12 //show heor winned UI;13 void winned(string no, string name);14 private:15 //Hero* m_hero;16 };HeroView.h 1 #include "stdafx.h" 2 #include "HeroView.h" 3

4

5

6 HeroView::HeroView() 7 { 8 } 9

10 HeroView::~HeroView()11 {12 }13

14 void HeroView::show(string no,string name, int att, int hp)15 {16 cout << "Hero info:"<<"(no:"<

19 void HeroView::dead(string no, string name)20 {21 cout << "Hero Dead:" << "(no:" << no << ",name:"<

24 void HeroView::winned(string no, string name)25 {26 cout << "Hero Winned:" << "(no:" << no << ",name:" << name << ")" << endl;27

28 }

HeroController类: 1 #pragma once 2 class HeroController 3 { 4 public: 5 HeroController(string no, string name); 6 ~HeroController(); 7 void setHeroHp(int hp);//set hero hp 8 void setHeroAtt(int att);//set hero att 9 void show();//show hero info10 void beAttack(int att);//be attacked by hero11 void dead();//dead12 void winned();//winned13 public :14 Hero* getHero() { return m_hero; }//get hero15

16 private:17 Hero * m_hero;//hero18 HeroView * m_heroView;//hero view


本文标签: 语句 条件 作者