MyCharHeaderMsg::MyCharHeaderMsg( ISceneNode* parent,const wchar_t* msg) { irr::core::list<ISceneNode*> msglist=parent->getChildren(); irr::core::list<ISceneNode*>::Iterator oper; for(oper =msglist.begin(); oper !=msglist.end();++oper ) { //又有新msg要显示,把上次的msg都遍历出来,隐藏.. if((*oper)->getID()==33){ (*oper)->setVisible(false); //oper=msglist.erase(oper); } } SColor color; color.setAlpha(255); color.setRed(255); color.setBlue(250); color.setGreen(0); char tmp[512]; GetWindowsDirectory(tmp,511); strcat(tmp,"\\fonts\\SIMSUN.TTC"); //SIMSUN.TTC宋体,新宋体 SIMKAI.TTF楷体 \STXIHEI.TTF Fixedsys IGUIFont* font = getIrrUI()->getFont(tmp,18,true,0); // IGUIFont* font = getIrrUI()->getDXFont("宋体",true,18,0,500); ITextSceneNode* textnode= getIrrSmgr()->addTextSceneNode(font, msg, color, parent, vector3df(0,90,0), //text相对坐标 33); //ID scene::ISceneNodeAnimator* a = 0; //4.5秒删除 a= getIrrSmgr()->createDeleteAnimator(4500); textnode->addAnimator(a);//字体节点删除 a->drop(); }
MyCharacter::MyCharacter( RoleProperty p,bool isMaincharacter,MySceneLoader* sceneloader ) { //场景加载器 此角色用他得到地形高度 this->sceneloader=sceneloader; //网络 cnet=0; ball=0; m_pMagic_Mgr=0; //是否是主角色 isMain=isMaincharacter; //引擎对象 dev=getIrrDevice(); smgr=getIrrSmgr(); //----------------------------------------------------------------------------------------------------- //角色属性 memset((char*)&property,0,sizeof(RoleProperty)); memcpy((char*)&property,(char*)&p,sizeof(RoleProperty)); if(property.charSex==1) printf("====character 是男角色 isDeath:%d sock:%d \n",property.isDeath,property.sock); if(property.charSex==2) printf("====character 是女角色 isDeath:%d sock:%d \n",property.isDeath,property.sock); //----------------------------------------------------------------------------------------------------- //包裹清零 for(int i=0;i<4;i++){ for(int j=0;j<6;j++){ package.itembox[i][j]=0; //空物品 package.itemParam1[i][j]=0; //物品属性1清零 package.itemParam2[i][j]=0; //物品属性2清零 package.itemParam3[i][j]=0; //物品属性3清零 package.itemParam4[i][j]=0; //物品属性4清零 package.itemParam5[i][j]=0; //物品属性5清零 package.itemParam6[i][j]=0; //物品属性6清零 } } //---------------------------------------------------------------------------------------------------------- //角色参数初始化 monster=0; //指向的怪物 isfollow=false; //未有攻击目标 isDieAnimation=false; //非主角色需要的属性 runstate=false; //非主角色需要的属性 lastRunmode=true; //攻击类型 curAttackType = MyCharacter::eAttacktype::MagicAttack; //初始化目的地到达 isArrived=true; //----------------------------------------------------------------------------------------------------- //初始化定时器 timer=dev->getTimer(); lasttime=timer->getRealTime(); //------------------------------------------------------------------------------------------------------------ }