//加载数据模型 void HeroBase::loadData(HeroModel* arg1) { memcpy(m_HeroModel,arg1,sizeof(HeroModel)); //加载动作文件 loadActionFile(m_HeroModel->ActionFileModelID); //计算英雄数据 UpgradeSystem::calculationHeroData(m_HeroModel); //计算英雄战力 UpgradeSystem::calculationHeroPower(m_HeroModel, skills); //血条 auto hpPos=PointFromString(m_HeroModel->HpPosition); m_HealthBar=HealthBarCompoment::create("imgs/xuetiao_beijing.png", "imgs/hero_xuetiao.png", "imgs/hero_xuetiao_2.png"); m_HealthBar->setPosition(hpPos); m_HealthBar->setVisible(true); getArmature()->addChild(m_HealthBar,100); //加载阴影 SpriteFrameCache::getInstance()->addSpriteFramesWithFile("guge/anxt_effect_10.plist"); m_Shadow=Sprite::createWithSpriteFrameName("n_shadow_1.png"); m_Shadow->setPosition(Vec2(0,-10)); this->addChild(m_Shadow); auto hpSize=m_HealthBar->getContentSize(); m_HealthBar->setScaleX(m_HeroModel->HpBarWidth / hpSize.width); heroAI->createBevTree(); }
byte *getActionBasePtr() { auto &exeFile = gKeenFiles.exeFile; if(exeFile.isPythonScript()) { if(actionFormatData.empty()) { int episode = exeFile.getEpisode(); const std::string fname = "keen" + itoa(episode) + ".act"; const auto actFilePath = JoinPaths(gKeenFiles.gameDir,fname); const auto actFullFilePath = GetFullFileName(actFilePath); gLogging << "Loading Action file " << actFullFilePath; if(actFullFilePath == "") { gLogging << "Error Loading Action file " << actFullFilePath; return nullptr; } loadActionFile(actFullFilePath); } return actionFormatData.data(); } else { return exeFile.getDSegPtr(); } }