void GameScene::start(float dt) { bool autoPlay = true; // apply loaded image for(auto it = mImageDictionary.begin(); it != mImageDictionary.end(); it++) { CCTexture2D* texture = new CCTexture2D(); if(false == texture->initWithImage(it->second)) { delete texture; continue; } mBgaDictionary[it->first] = texture; } for(auto it = mBmsDocument.channel().begin(); it != mBmsDocument.channel().end(); it++) { const std::string& channel = it->first; if(channel.find("01") != std::string::npos) { mChannelPlayers[channel] = new WaveChannelPlayer(it->second, mWavDictionary); } else if(channel.find("02") != std::string::npos) { //mChannelPlayers[channel] = new BarScaleChannelPlayer(it->second); } else if(channel.find("03") != std::string::npos) { mChannelPlayers[channel] = new BpmChannelPlayer(it->second); } else { int iChannel = base36ToInt(channel.c_str()); if(base36ToInt("10") < iChannel && iChannel < base36ToInt("70") && channel[1] != '0'/*exclude 20, 30, 40, ...*/) { int mappedKey = -1; for(int i=0; i<sizeof(keyChannelMap)/sizeof(keyChannelMap[0]); i++) { if(channel == keyChannelMap[i]) { mappedKey = i; break; } } if(mappedKey < 0) { mChannelPlayers[channel] = new WaveChannelPlayer(it->second, mWavDictionary); } else { mChannelPlayers[channel] = new PlayChannelPlayer(it->second, mWavDictionary, Key::MappedKey(mappedKey), autoPlay); } } else if( base36ToInt(ChannelType::BGA_BASE) == iChannel || base36ToInt(ChannelType::BGA_LAYER) == iChannel || base36ToInt(ChannelType::BGA_LAYER2) == iChannel ) { BgaChannelPlayer* bgaPlayer = new BgaChannelPlayer(it->second, mBgaDictionary, base36ToInt(ChannelType::BGA_POOR) == iChannel); mChannelPlayers[channel] = bgaPlayer; bgaPlayer->getSprite()->setContentSize(Size(640, 480)); bgaPlayer->getSprite()->setPosition(Point(640, 480)); addChild(bgaPlayer->getSprite()); } } } {//panel // load skin CCTexture2D* skinTexture = CCTextureCache::sharedTextureCache()->addImage(Panel::SKIN_PATH); // no antialias skinTexture->setAliasTexParameters(); CCNode* panel = CCNode::create(); addChild(panel); Panel* frontPanel = new FrontPanel; Panel* backPanel = new BackPanel(mChannelPlayers); Panel* controlPanel = new ControlPanel; panel->addChild(backPanel); panel->addChild(frontPanel); panel->addChild(controlPanel); // fit panel to screen panel->setScale(CCDirector::sharedDirector()->getOpenGLView()->getDesignResolutionSize().height / 480); } mCurrentBpm = mBmsDocument.header().getBpm(); //끝낼 마디 설정 mEndPosition = 0; for(auto it = mBmsDocument.channel().begin(); it != mBmsDocument.channel().end(); it++) { if(it->second->endPosition() > mEndPosition) mEndPosition = it->second->endPosition(); } mEndPosition += 1; // 시간 관련 초기화 mLastBpmTime = mStartTime = currentTime(); mLastBpmMeter = 0; origTime = mStartTime;// - 60000; origMadi = origPosit = 0; mBarScale = 1.0f; nowMadi = -1; // TODO 플레이노트 초기화(시간, 키 수 등) bMiss = false; bAuto = true; mScore = 0; mCombo = 0; // emit reset Event::GameConfigEvent configEvent(*mSong, 1, autoPlay, mStartTime); Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(Event::GameConfigEvent::RESET, &configEvent); }
bool Node::processEvent( const Event& event ) { ConfigEvent configEvent( event ); getConfig()->sendEvent( configEvent ); return true; }
void ForwardRules::buildDefaultRules(const char* domain, const char* hostname, const char* ipAddress, const char* fqhn, int localPort, TiXmlDocument& xmlDoc) { // Note: fqhn == fully qualified host name UtlString hostnamePort(hostname ? hostname : "localhost"); UtlString domainPort(domain ? domain : ""); UtlString ipAddressPort(ipAddress ? ipAddress : "127.0.0.1"); UtlString fqhnPort(fqhn ? fqhn : "localhost"); if(localPort == 5060) localPort = PORT_NONE; if(portIsValid(localPort)) { char portString[40]; sprintf(portString,":%d", localPort); hostnamePort.append(portString); domainPort.append(portString); ipAddressPort.append(portString); fqhnPort.append(portString); } UtlString sdsAddress(fqhn); sdsAddress.append(":5090"); UtlString statusAddress(fqhn); statusAddress.append(":5110"); UtlString regAddress(fqhn); regAddress.append(":5070"); UtlString configAddress("sipuaconfig"); UtlString configFqhnAddress(configAddress); configFqhnAddress.append("."); configFqhnAddress.append(domain); TiXmlElement routes("routes"); TiXmlElement route("route"); route.SetAttribute("mappingType", "local"); TiXmlElement routeFromDomain("routeFrom"); TiXmlText domainText(domainPort.data()); TiXmlElement routeFromFqhn("routeFrom"); TiXmlText fqhnText(fqhnPort.data()); TiXmlElement routeFromHost("routeFrom"); TiXmlText hostText(hostnamePort.data()); TiXmlElement routeFromIp("routeFrom"); TiXmlText ipText(ipAddressPort.data()); TiXmlElement methodMatch("methodMatch"); TiXmlElement methodPattern("methodPattern"); TiXmlText subscribe("SUBSCRIBE"); TiXmlElement fieldMatchConfig("fieldMatch"); fieldMatchConfig.SetAttribute("fieldName", "Event"); TiXmlElement fieldPatternConfig("fieldPattern"); TiXmlText configEvent("sip-config"); TiXmlElement routeToSds("routeTo"); TiXmlText sdsText(sdsAddress.data()); TiXmlElement fieldMatchStatus("fieldMatch"); fieldMatchStatus.SetAttribute("fieldName", "Event"); TiXmlElement fieldPatternStatus("fieldPattern"); TiXmlText mwiEvent("message-summary*"); TiXmlElement routeToStatus("routeTo"); TiXmlText statusText(statusAddress.data()); TiXmlElement routeToReg("routeTo"); TiXmlText regText(regAddress.data()); TiXmlElement routeConfig("route"); TiXmlElement routeFromFqhnConfig("routeFrom"); TiXmlText fqhnConfigText(configFqhnAddress.data()); TiXmlElement routeFromConfig("routeFrom"); TiXmlText configText(configAddress.data()); // Link everything up in reverse order as it TinyXml // makes copies routeFromDomain.InsertEndChild(domainText); route.InsertEndChild(routeFromDomain); routeFromHost.InsertEndChild(hostText); route.InsertEndChild(routeFromHost); routeFromFqhn.InsertEndChild(fqhnText); route.InsertEndChild(routeFromFqhn); routeFromIp.InsertEndChild(ipText); route.InsertEndChild(routeFromIp); methodPattern.InsertEndChild(subscribe); methodMatch.InsertEndChild(methodPattern); fieldPatternStatus.InsertEndChild(mwiEvent); fieldMatchStatus.InsertEndChild(fieldPatternStatus); routeToStatus.InsertEndChild(statusText); fieldMatchStatus.InsertEndChild(routeToStatus); methodMatch.InsertEndChild(fieldMatchStatus); fieldPatternConfig.InsertEndChild(configEvent); fieldMatchConfig.InsertEndChild(fieldPatternConfig); routeToSds.InsertEndChild(sdsText); fieldMatchConfig.InsertEndChild(routeToSds); methodMatch.InsertEndChild(fieldMatchConfig); routeToReg.InsertEndChild(regText); methodMatch.InsertEndChild(routeToReg); route.InsertEndChild(methodMatch); route.InsertEndChild(routeToReg); routeFromFqhnConfig.InsertEndChild(fqhnConfigText); routeConfig.InsertEndChild(routeFromFqhnConfig); routeFromConfig.InsertEndChild(configText); routeConfig.InsertEndChild(routeFromConfig); routeConfig.InsertEndChild(routeToReg); routes.InsertEndChild(route); routes.InsertEndChild(routeConfig); xmlDoc.InsertEndChild(routes); }