void WindBar::initWindThings() { { auto node = PlanePixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1); node->setPosition3D({0,0,0}); auto pixelData = loadScatPixelFile("hunters/sopx/wind_pillar.png.sopx"); node->configBatch(PlanePixelBatchTuple{Vec3{0,0,0}, 1, &pixelData}, true); _hubNode->addChild(node); _pxBg = node; } { auto node = PlanePixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.8); node->setPosition3D({0,2,0}); auto pixelData = loadScatPixelFile("hunters/sopx/wind_strenth.png.sopx"); node->configBatch(PlanePixelBatchTuple{Vec3{0,0,0}, 1, &pixelData}, false); _hubNode->addChild(node); _pxStrenth = node; _pxStrenth->setVisible(false); } { auto node = PlanePixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.8); node->setPosition3D({0,0.5,0}); auto pixelData = loadScatPixelFile("hunters/sopx/wind_direction.png.sopx"); node->configBatch(PlanePixelBatchTuple{Vec3{0,0,0}, 1, &pixelData}, false); _hubNode->addChild(node); _pxDirection = node; _pxDirection->setVisible(false); } { auto node = PixelTextNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.6f,0.9f); node->setPosition3D({1.5,25,0.5}); node->configText("wind",1); node->configMixColor({49.f/255.f, 36.f/255.f, 33.f/255.f,1.f}); _hubNode->addChild(node); _ptWind = node; } { auto node = PixelTextNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.8f,0.9f); node->setPosition3D({2,20,0.5}); node->configText("0",1); node->configMixColor({49.f/255.f, 36.f/255.f, 33.f/255.f,1.f}); _hubNode->addChild(node); _ptStrenth = node; } }
void CreditsScene::initCreditsThings() { { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setPosition3D({30.2,-26,0}); node->configSopx("sopx/welco/back.png.sopx"); _hub->addChild(node); node->setScale(0.4); _pxBack = node; } { auto node = PixelTextNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.27); node->setPosition3D({30.4,-26,0}); node->configText("back",1); node->configMixColor({1.f, 200.f/255.f, 51.f/255.f,1.f}); _hub->addChild(node); } { auto _image = RoadPlane::create(); _image->configImage("images/credits.png"); _image->configBlend(true); _image->setScale(0.1); _image->setCameraMask(_mainCamera->getCameraMask()); _image->runAction(MoveBy::create(30, Vec3{0,40,0})); _hub->addChild(_image); } }
void PowerBar::initPowerThings() { { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1.2,1); node->setPosition3D({0,0,0}); node->configSopx("hunters/sopx/strenth_rect.png.sopx"); node->configBlend(true); _hubNode->addChild(node); _pxRect = node; } { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1.2,1); node->setPosition3D({0,0,0}); node->configSopx("hunters/sopx/strenth_content.png.sopx"); node->configBlend(true); _hubNode->addChild(node); _pxContent = node; } { auto node = PixelTextNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1.1f,2.f); node->setPosition3D({-12,8,0}); node->configText("00#",2.0); node->configMixColor({0.f/255.f, 183.f/255.f, 233.f/255.f,1.f}); _hubNode->addChild(node); _ptAngle = node; } { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.15); node->setPosition3D({0,0,-10}); node->configSopx("hunters/sopx/power_arrow.png.sopx"); node->configBlend(true); _mainCamera->addChild(node); _pxArrow = node; node->setVisible(false); } }
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); }
void TopIcons::initGoldThings() { { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1); node->setPosition3D({60,0,0}); node->configSopx("hunters/sopx/icon-gold-bg.png.sopx"); _hubNode->addChild(node); _pxGoldBg = node; } { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.8); node->setPosition3D({45,0,0.5}); node->configSopx("hunters/sopx/icon-gold.png.sopx"); _hubNode->addChild(node); _pxGoldIcon = node; } { auto node = PixelTextNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.8f,1.f); node->setPosition3D({68,0.5,0.5}); node->configText("00000",1); node->configMixColor({1.f, 200.f/255.f, 51.f/255.f,1.f}); _hubNode->addChild(node); _pxGoldNumber = node; } const float heart_pos = -15; { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1.0); node->setPosition3D({-70+heart_pos,0,0}); node->configSopx("hunters/sopx/heart_bg.png.sopx"); _hubNode->addChild(node); } { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1.0); node->setPosition3D({-70+heart_pos,0,0.5}); node->configSopx("hunters/sopx/heart_icon.png.sopx"); _hubNode->addChild(node); _pxHeart = node; } { auto node = PixelTextNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1.f,1.2f); node->setPosition3D({-62+heart_pos,0.5,0.5}); node->configText("20",1); node->configMixColor({0.f/255.f, 0.f/255.f, 0.f/255.f,1.f}); _hubNode->addChild(node); _ptxHeartNumber = node; } }
void TopIcons::initPauseThings() { { auto node = PixelNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(0.7); node->setPosition3D({94,-1,0}); node->configSopx("hunters/sopx/icon-pause.png.sopx"); _hubNode->addChild(node); _pxPauseIcon = node; } auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [this](Touch* touch, Event* event) { return true; }; listener->onTouchMoved = [this](Touch* touch, Event* event) { }; listener->onTouchEnded = [this](Touch* touch, Event* event) { if (_pxPauseIcon->fetchScreenRect(5, _mainCamera).containsPoint(touch->getLocation())) { _pauseGameOverProtocal->op_pause(); ACSoundManage::s()->play(ACSoundManage::SN_CLICK); } else if (_pxGoldBg->fetchScreenRect(0, _mainCamera).containsPoint(touch->getLocation())) { //点击 gold 面板10次,加1000G _cnt++; if (_cnt == 10) { MoneyManager::s()->add(10000); } } }; listener->onTouchCancelled = [this](Touch* touch, Event* event) { }; _mainLayer->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, _mainLayer); { auto node = PixelTextNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1.2f,1.2f); node->setPosition3D({89,-14,0}); node->configText("wave",1); node->configMixColor({1.f, 200.f/255.f, 51.f/255.f,1.f}); _hubNode->addChild(node); _ptxWaveTitle = node; } { auto node = PixelTextNode::create(); node->setCameraMask(_mainCamera->getCameraMask()); node->setScale(1.2f,1.2f); node->setPosition3D({96,-22,0}); node->configText("0",1); node->configMixColor({1.f, 200.f/255.f, 51.f/255.f,1.f}); _hubNode->addChild(node); _ptxWaveNumber = node; } }