本文整理汇总了C++中UIManager类的典型用法代码示例。如果您正苦于以下问题:C++ UIManager类的具体用法?C++ UIManager怎么用?C++ UIManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UIManager类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
/**
* @brief Filters message.
* @param[in,out] msg message.
* @return false to skip this message. true to dispatch this message.
*/
bool WinSkinWindow::FilterMessage(MSG* msg)
{
if (msg->hwnd != m_hWnd)
return true;
if (WM_KEYDOWN == msg->message || WM_SYSKEYDOWN == msg->message)
{
// マウスボタン、修飾キーは無視
switch (msg->wParam)
{
case VK_LBUTTON:
case VK_RBUTTON:
case VK_MBUTTON:
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
return true;
}
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
KeyEventParameter parameter;
UInt32 modifiers = 0;
modifiers |= ((::GetKeyState(VK_SHIFT) & 0x8000) ? KeyEventParameter::ModifierMask_Shift : 0);
modifiers |= ((::GetKeyState(VK_CONTROL) & 0x8000) ? KeyEventParameter::ModifierMask_Ctrl : 0);
modifiers |= ((::GetKeyState(VK_MENU) & 0x8000) ? KeyEventParameter::ModifierMask_Alt : 0);
parameter.SetKeyCode(static_cast<DWORD>(msg->wParam));
parameter.SetModifiers(modifiers);
return uiManager->KeyDown(parameter);
}
}
return true;
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:40,代码来源:WinSkinWindow.cpp
示例2: getUIManager
// ---------------------------------------------------------------------
//! Called when user releases a mouse button.
// ---------------------------------------------------------------------
void BeSkinView::MouseUp(
BPoint where //!< location of the cursor
)
{
if (0 == lastPressedMouseButton)
{
return;
}
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
if (1 == lastPressedMouseButton)
{
uiManager->Button1Up();
}
else if (2 == lastPressedMouseButton)
{
uiManager->Button2Up();
}
}
lastPressedMouseButton = 0;
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:28,代码来源:BeSkinView.cpp
示例3: CloseMenu
void MenuManager::CloseMenu(const BSFixedString &menuName)
{
UIManager *ui = UIManager::GetSingleton();
if (ui)
{
ui->AddMessage(menuName, UIMessage::kMessage_Close, nullptr);
}
}
开发者ID:himika,项目名称:libSkyrim,代码行数:8,代码来源:MenuManager.cpp
示例4: getUIManager
// ---------------------------------------------------------------------
//! Cancels this task.
// ---------------------------------------------------------------------
void MouseHoverUITask::CancelTask()
{
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
uiManager->GetUIController()->EndTimer(UIController::TimerID_MouseHover);
uiManager->EndTask(this);
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:11,代码来源:MouseHoverUITask.cpp
示例5: timerCommandToTimerId
/**
* @brief timer command handler.
*/
void BeSkinView::timerCommandReceived(uint32 timerCommand)
{
UIController::TimerID timerId = timerCommandToTimerId(timerCommand);
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
uiManager->TimerEvent(timerId);
}
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:13,代码来源:BeSkinView.cpp
示例6: getUIManager
// ---------------------------------------------------------------------
LRESULT WinSkinWindow::onUMActivated(
HWND /*hWnd*/, //!< ウィンドウハンドル
UINT /*uMsg*/, //!< UM_ACTIVATED
WPARAM /*wParam*/, //!< 利用しないパラメータ
LPARAM /*lParam*/ //!< 利用しないパラメータ
)
{
UIManager* uiManager = getUIManager();
if (NULL != uiManager)
{
uiManager->UIActivated();
}
return 0;
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:16,代码来源:WinSkinWindow.cpp
示例7: Send
bool Send()
{
UIManager * uiManager = UIManager::GetSingleton();
if (!invokeDelegate_ || hasRun_ || !uiManager)
{
_WARNING("Failed to run PapyrusUICallback.");
return false;
}
// UI manager is now responsible for disposing
uiManager->QueueCommand(invokeDelegate_);
hasRun_ = true;
return true;
}
开发者ID:NecroReindeer,项目名称:comp140-api-hacking,代码行数:16,代码来源:PapyrusUICallback.cpp
示例8: Window
// ---------------------------------------------------------------------
//! Called when user presses a mouse button.
// ---------------------------------------------------------------------
void BeSkinView::MouseDown(
BPoint where //!< location of the cursor
)
{
uint32 buttons = 0;
BMessage* message = Window()->CurrentMessage();
if (NULL != message)
{
int32 value = 0;
if (B_OK == message->FindInt32("buttons", &value))
{
buttons = value;
}
}
if (0 == (buttons & (B_PRIMARY_MOUSE_BUTTON | B_SECONDARY_MOUSE_BUTTON)))
{
return;
}
BWindow* window = Window();
if (!window->IsActive())
{
window->Activate();
}
// deactivate tool tip
BMessage deactivateMessage(BeToolTipWindow::MSG_DEACTIVATE);
toolTipMessenger->SendMessage(&deactivateMessage, static_cast<BHandler*>(NULL), 1000000);
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
if (buttons & B_PRIMARY_MOUSE_BUTTON)
{
uiManager->Button1Down();
lastPressedMouseButton = 1;
}
else if (buttons & B_SECONDARY_MOUSE_BUTTON)
{
uiManager->Button2Down();
lastPressedMouseButton = 2;
}
}
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:48,代码来源:BeSkinView.cpp
示例9: parse
void CommandHandler::parse(int argc, char** argv)
{
if (argc == 0)
{
UIManager ui;
ui.setController(_gameController);
ui.start();
return;
}
std::string command(*argv);
if (command == "add") parseAdd(argc, argv);
if (command == "remove" || command == "rm") parseRemove(argc, argv);
if (command == "list" || command == "ls") parseList(argc, argv);
if (command == "lsp") parseListPlatform(argc, argv);
if (command == "lsc") parseListCategory(argc, argv);
if (command == "run") parseRun(argc, argv);
}
开发者ID:Sektor527,项目名称:bootcamp,代码行数:19,代码来源:commandhandler.cpp
示例10: main
int main(int argc, char** argv)
{
QApplication app(argc, argv);
new UIManager;
new DBManager;
DBManager* db = DBManager::instance();
UIManager* ui = UIManager::instance();
//char* fn = "vega.udb";
char* fn = "geometryprocess.udb";
//char* fn = "vega.udb";
//char* fn = "vega.udb";
char* fileName = argc > 1 ? argv[1] : fn;
printf(fileName);
db->openDB(fileName);
ui->lockAll();
db->parse();
ui->unlockAll();
ui->updateScene();
ui->addMainUI();
//ui->addMainUI();
ui->showAllUI();
app.exec();
DBManager::instance()->closeDB();
return 0;
}
开发者ID:league1991,项目名称:CodeView,代码行数:34,代码来源:main.cpp
示例11: menu_selector
bool EquipmentUpgradeUILayer::init()
{
if(!CCLayer::init())
{
return false;
}
UIManager *manager = UIManager::sharedManager();
m_equipmentLayout = manager->CreateUILayoutFromFile("UIplist/equipmentUpgrade.plist", this, "equipmentUpgradeLayout");
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::closeEquipUpgradeBt",
menu_selector(EquipmentUpgradeUILayer::closeEquipUpgradeBt), this);
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::chooseOneEquipmentBt",
menu_selector(EquipmentUpgradeUILayer::chooseOneEquipmentBt), this);
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::onClickHeroEquip",
menu_selector(EquipmentUpgradeUILayer::onClickHeroEquip), this);
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::onClickFairyEquip",
menu_selector(EquipmentUpgradeUILayer::onClickFairyEquip), this);
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::onClickStrength",
menu_selector(EquipmentUpgradeUILayer::onClickStrength), this);
m_equipmentHelmetPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeHelmetIcon");
m_equipmentNecklacePic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeNicklaceIcon");
m_equipmentWeaponPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeWeaponIcon");
m_equipmentArmorPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeArmorIcon");
m_equipmentRingPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeRingIcon");
m_equipmentShoePic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeShoeIcon");
m_choosedEquipmentPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradechoosedIcon");
m_heroEquipToggle = m_equipmentLayout->FindChildObjectByName<UIButtonToggle>("heroEquipButtonToggle");
m_fairyEquipToggle = m_equipmentLayout->FindChildObjectByName<UIButtonToggle>("fairyEquipButtonToggle");
m_levelUpCostLabel = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedCostNumber");
m_levelLabel = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedLevel");
m_coldTimeLabel = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeCDText");
showPlayerEquipment();
if(m_heroEquipToggle)
{
m_heroEquipToggle->selected();
}
schedule(schedule_selector(EquipmentUpgradeUILayer::updateColdTime),1);
m_upTimesBar = (CCSprite*)m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeBarTime")->getCurrentNode();
if(m_upTimesBar)
{
m_upTimesBar->setAnchorPoint(ccp(0,0.5f));
CCPoint oldPos = m_upTimesBar->getPosition();
float scale = UIManager::sharedManager()->getScaleFactor();
m_upTimesBar->setPosition(ccp(oldPos.x-scale * m_upTimesBar->getContentSize().width/2,oldPos.y));
}
showLvUpRemainTimes();
setDefaultSelectedEquip();
updateBottomCoinLabel();
updateBottomDiamondLabel();
NotificationCenter::defaultCenter()->registerAllMsgObserver(this);
return true;
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:55,代码来源:EquipmentUpgradeUILayer.cpp
示例12: GET_X_LPARAM
// ---------------------------------------------------------------------
LRESULT WinSkinWindow::onRButtonUp(
HWND hWnd, //!< ウィンドウハンドル
UINT uMsg, //!< WM_RBUTTONUP
WPARAM wParam, //!< 様々な仮想キーが押されているかどうのフラグ
LPARAM lParam //!< 下位ワードがマウスカーソルの X 座標、上位ワードが Y 座標
)
{
base::wndProc(hWnd, uMsg, wParam, lParam);
mousePosition.x = GET_X_LPARAM(lParam);
mousePosition.y = GET_Y_LPARAM(lParam);
mousePositionAvailable = true;
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
uiManager->Button2Up();
}
return 0;
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:23,代码来源:WinSkinWindow.cpp
示例13: init
bool TaskChatLayer::init()
{
if(!CCLayer::init())
{
return false;
}
UIManager *manager = UIManager::sharedManager();
taskChatLayout = manager->CreateUILayoutFromFile("UIplist/taskChat.plist", this, "TaskChatPanel");
m_taskChatContainer = taskChatLayout->FindChildObjectByName<UIContainer>("taskChatContainer");
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::closeBtnClick",
menu_selector(TaskChatLayer::closeBtnClick), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskItemClickEvent_01",
menu_selector(TaskChatLayer::OnTaskItemClickEvent_01), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskItemClickEvent_02",
menu_selector(TaskChatLayer::OnTaskItemClickEvent_02), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskItemClickEvent_03",
menu_selector(TaskChatLayer::OnTaskItemClickEvent_03), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskshopExchangeBtnClick",
menu_selector(TaskChatLayer::OnTaskshopExchangeBtnClick), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskCityDefendBtnClick",
menu_selector(TaskChatLayer::OnTaskCityDefendBtnClick), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskItemExchangeBtnClick",
menu_selector(TaskChatLayer::OnTaskItemExchangeBtnClick), this);
m_leftHeroLogoPic = taskChatLayout->FindChildObjectByName<UIPicture>("npcLogoIcon");
m_taskNameLabel = taskChatLayout->FindChildObjectByName<UILabel>("TaskNameLable");
m_npcTaskTalkLabel = taskChatLayout->FindChildObjectByName<UILabel>("NpcTaskTalkLabel");
// Note: find container
m_taskRewardContainer = taskChatLayout->FindChildObjectByName<UIContainer>("RewardContainer");
m_taskContainerItem[0] = taskChatLayout->FindChildObjectByName<UIContainer>("taskItemContainer_01");
m_taskContainerItem[1] = taskChatLayout->FindChildObjectByName<UIContainer>("taskItemContainer_02");
m_taskContainerItem[2] = taskChatLayout->FindChildObjectByName<UIContainer>("taskItemContainer_03");
m_rewardMoneyLabel = taskChatLayout->FindChildObjectByName<UILabel>("TaskRewardMoneyLabel");
m_rewardExpLabel = taskChatLayout->FindChildObjectByName<UILabel>("TaskRewardExpLabel");
//setTouchEnabled(true);
return true;
}
开发者ID:JamShan,项目名称:xcode_jifengyongzhezhuan,代码行数:44,代码来源:TaskChatLayer.cpp
示例14: TEST
// This one is a little more involved, as we will be simulating an entire editor session, including level testing
TEST(ObjectCleanupTests, TestEditorObjectManagement)
{
GameSettingsPtr settings = GameSettingsPtr(new GameSettings());
settings->setSetting(IniKey::Nickname, string("Alfonso")); // Set this to bypass startup screen
settings->getFolderManager()->setLevelDir("levels"); // Need something for hosting to work
settings->updatePlayerName("Alfonso");
Address addr;
ClientGame *clientGame = new ClientGame(addr, settings, new UIManager()); // ClientGame destructor will clean up UIManager
GameManager::addClientGame(clientGame);
UIManager *uiMgr = clientGame->getUIManager();
uiMgr->activate<MainMenuUserInterface>();
ASSERT_TRUE(uiMgr->isCurrentUI<MainMenuUserInterface>());
// Cheat a little; go directly to editor
uiMgr->getUI<EditorUserInterface>()->setLevelFileName("xyzzy"); // Reset this so we get the level entry screen
uiMgr->activate<EditorUserInterface>();
ASSERT_TRUE(uiMgr->isCurrentUI<EditorUserInterface>());
EditorUserInterface *editor = uiMgr->getUI<EditorUserInterface>();
///// Test basic object deletion, undo system not activated
SafePtr<TestItem> testItem = new TestItem(); // To track deletion... see "Basics" test above
ASSERT_FALSE(testItem.isNull()) << "Just created this!";
editor->addToEditor(testItem.getPointer());
editor->deleteItem(0, false); // Low level method doesn't save undo state; object should be deleted
ASSERT_TRUE(testItem.isNull()) << "Obj should be gone!";
///// Check deleting object with undo system -- do things get deleted as expected?
testItem = new TestItem();
ASSERT_FALSE(testItem.isNull()) << "Just created this -- shouldn't be gone yet!";
editor->addToEditor(testItem.getPointer());
testItem->setSelected(true);
ASSERT_EQ(1, editor->getLevel()->findObjects_fast()->size()) << "Started with one object";
editor->handleKeyPress(KEY_Z, "Del"); // Triggers deleteSelection(false)
ASSERT_TRUE(testItem.isNull()) << "Obj should be gone!";
ASSERT_EQ(0, editor->getLevel()->findObjects_fast()->size()) << "All objects deleted... none should be present";
editor->handleKeyPress(KEY_Z, editor->getEditorBindingString(BINDING_UNDO_ACTION)); // Undo
ASSERT_EQ(1, editor->getLevel()->findObjects_fast()->size()) << "Undeleted one object";
ASSERT_FALSE(testItem.isValid());
testItem = dynamic_cast<TestItem *>(editor->getLevel()->findObjects_fast()->get(0));
ASSERT_TRUE(testItem.isValid());
editor->handleKeyPress(KEY_Z, editor->getEditorBindingString(BINDING_REDO_ACTION));
ASSERT_EQ(0, editor->getLevel()->findObjects_fast()->size()) << "Redid delete... none should be present";
ASSERT_FALSE(testItem.isValid());
///// Test level
Level *level = editor->getLevel(); // Keep track of the level we were editing
editor->testLevelStart();
ASSERT_TRUE(uiMgr->isCurrentUI<EditorUserInterface>()) << "Still in editor";
ASSERT_TRUE(editor->getLevel()->getGameType()) << "Have valid GameType";
GameType *gt = editor->getLevel()->getGameType();
GameManager::getServerGame()->loadNextLevelInfo();
ASSERT_EQ(GameManager::DoneLoadingLevels, GameManager::getHostingModePhase()) << "Only loading one level here...";
ASSERT_TRUE(GameManager::hostGame()) << "Failure to host game!";
ASSERT_TRUE(uiMgr->isCurrentUI<GameUserInterface>()) << "In game UI";
GameManager::localClientQuits(GameManager::getClientGames()->get(0));
ASSERT_TRUE(uiMgr->isCurrentUI<EditorUserInterface>()) << "Back to the editor";
ASSERT_EQ(editor, uiMgr->getCurrentUI()) << "Expect same object";
ASSERT_EQ(level, editor->getLevel()) << "Level should not have changed";
ASSERT_TRUE(editor->getLevel()->getGameType()) << "Expect valid GameType";
ASSERT_EQ(gt, editor->getLevel()->getGameType()) << "GameType should not have changed";
}
开发者ID:AnsonX10,项目名称:bitfighter,代码行数:66,代码来源:TestObjectCleanup.cpp
示例15: initCityList
bool CityListLayer::init()
{
if(!CCLayer::init())
{
return false;
}
//读取城市列表
initCityList();
UIManager *manager = UIManager::sharedManager();
cityListLayout = manager->CreateUILayoutFromFile("UIplist/cityListUI.plist", this, "CityList");
//添加背景图片
CCSprite * bgImg = CCSprite::create("game.png");
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCSize bgSize = bgImg->getContentSize();
float scaleX = visibleSize.width / bgSize.width;
float scaleY = visibleSize.height / bgSize.height;
bgImg->setScaleX(scaleX);
bgImg->setScaleY(scaleY);
bgImg->setPosition(ccp(visibleSize.width/2, visibleSize.height/2));
this->addChild(bgImg, -1);
//添加主城
for (size_t i = 0; i < cityInfoList.size(); i++)
{
addCityBtn(i+1);
}
//添加关闭按钮
UIButton *btn = cityListLayout->FindChildObjectByName<UIButton>("cityListCloseBtn");
CCPoint closePoint = btn->getPosition();
closePoint = ccpAdd(ccp(visibleSize.width / 2, visibleSize.height / 2), closePoint);
CCPoint pt1;
ASprite * as1 = AspriteManager::getInstance()->getAsprite(KUI_BIN);
int normalCloseId = getResourceIDByName("map_ui_FRAME_INSTANCE_CLOSE");
int selectCloseId = getResourceIDByName("map_ui_FRAME_INSTANCE_CLOSE_CLICKED");
CCSprite * normalCloseBtn = as1->getSpriteFromFrame_Middle(normalCloseId, 0, pt1);
CCSprite * selectCloseBtn = as1->getSpriteFromFrame_Middle(selectCloseId, 0, pt1);
IconButton * closeBtn = new IconButton(normalCloseBtn, NULL, selectCloseBtn, this,
menu_selector(CityListLayer::closeCityList));
closeBtn->setPosition(closePoint);
this->addChild(closeBtn);
//初始化玩家头像资源
CCPoint pt;
ASprite * as = AspriteManager::getInstance()->getAsprite(KICON_BIN);
int playerType = UserData::Get()->GetUserType();
stringstream playerResStream;
playerResStream << "map_ui_system_icon_FRAME_ICON_ROLEONMAP_" << playerType;
string playerResName = playerResStream.str();
int playerResourceId = getResourceIDByName(playerResName.c_str());
playerImg = as->getSpriteFromFrame_Middle(playerResourceId, 0, pt);
playerImg->setVisible(false);
this->addChild(playerImg);
playerMoving = false;
return true;
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:77,代码来源:CityListLayer.cpp
示例16: min
void PvAIManager::refreshPvAILayer()
{
UIManager *manager = UIManager::sharedManager();
pvaiLayout = manager->getUILayout("PvAILayout");
if (pvaiLayout)
{
//玩家昵称
UILabel *heroNameLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcName");
if (heroNameLabel)
{
string heroName = UserData::getUserName();
heroNameLabel->setString(heroName.c_str());
}
//玩家排名
UILabel *heroRankLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcRank");
if (heroRankLabel)
{
stringstream heroRankStream;
heroRankStream << heroRank;
string heroRankStr = heroRankStream.str();
string heroRankText = Localizatioin::getLocalization("M_PVAI_RANK");
heroRankText += heroRankStr;
heroRankLabel->setString(heroRankText.c_str());
}
//玩家声望
UILabel *heroReputationLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcReputation");
if (heroReputationLabel)
{
int heroReputation = UserData::GetUserInfo().m_reputation;
stringstream heroReputationStream;
heroReputationStream << heroReputation;
string heroReputationStr = heroReputationStream.str();
string heroReputationText = Localizatioin::getLocalization("M_PVAI_REPUTATION");
heroReputationText += heroReputationStr;
heroReputationLabel->setString(heroReputationText.c_str());
}
////剩余挑战次数
//UILabel *lastTimeLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiTodayLastTime");
//if (lastTimeLabel)
//{
// stringstream herolastTimeStream;
// herolastTimeStream << basicInfo.remainCount;
// string herolastTimeStr = herolastTimeStream.str();
// lastTimeLabel->setString(herolastTimeStr.c_str());
//}
////奖励金币数
//UILabel *rewardCoinLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiRewardCoin");
//if (rewardCoinLabel)
//{
// stringstream herolastTimeStream;
// herolastTimeStream << basicInfo.rewardCoin;
// string herolastTimeStr = herolastTimeStream.str();
// rewardCoinLabel->setString(herolastTimeStr.c_str());
//}
////奖励声望
//UILabel *rewardReputationLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiRewardReputation");
//if (rewardReputationLabel)
//{
// stringstream herolastTimeStream;
// herolastTimeStream << basicInfo.rewardReputation;
// string herolastTimeStr = herolastTimeStream.str();
// rewardReputationLabel->setString(herolastTimeStr.c_str());
//}
////奖励领取时间
//TimeManager::Get()->renewTimer(TIMER_PVAI_REWARD, TimeManager::Get()->getCurServerTime() + basicInfo.rewardGetTime);
////冷却时间
//TimeManager::Get()->renewTimer(TIMER_PVAI_COOLDOWN, TimeManager::Get()->getCurServerTime() + basicInfo.coolDownTime);
//挑战玩家列表
int playerCount = aiPlayerVec.size();
int minPlayerCount = min(playerCount, 5);
for (int i = minPlayerCount; i < 5; i++)
{
stringstream iconOtherStream;
iconOtherStream << "iconOther" << i+1;
string iconOtherStr = iconOtherStream.str();
UIPicture *iconOtherPic= pvaiLayout->FindChildObjectByName<UIPicture>(iconOtherStr);
iconOtherPic->setVisible(false);
iconOtherStream.str("");
iconOtherStream << "gridOther" << i+1;
iconOtherStr = iconOtherStream.str();
iconOtherPic= pvaiLayout->FindChildObjectByName<UIPicture>(iconOtherStr);
iconOtherPic->setVisible(false);
iconOtherStream.str("");
iconOtherStream << "pvaiOtherPlayerName" << i+1;
iconOtherStr = iconOtherStream.str();
UILabel * iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr);
//.........这里部分代码省略.........
开发者ID:niuzb,项目名称:hellopetclient,代码行数:101,代码来源:PvAIManager.cpp
示例17: main
int main() {
sf::RenderWindow window(sf::VideoMode(1920, 1080), "Corgi Movement Simulator");
/*sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);*/
/*sf::Texture texture;
texture.loadFromFile("Sprites/Scene10x10.png");
texture.setSmooth(true);
sf::Sprite* sprite = (new sf::Sprite(texture));*/
//(*sprite).setColor(sf::Color(128, 128, 128));
//testlvlManager
sf::Texture shibe;
if (!shibe.loadFromFile("Sprites/Units/shibe_spread.png"))
{
std::cout << "Failed to load player spritesheet!" << std::endl;
return 1;
}
Animation shibe_idle;
shibe_idle.setSpriteSheet(shibe);
shibe_idle.addFrame(sf::IntRect(0, 0, 128, 128));
shibe_idle.addFrame(sf::IntRect(128, 0, 128, 128));
shibe_idle.addFrame(sf::IntRect(256, 0, 128, 128));
shibe_idle.addFrame(sf::IntRect(384, 0, 128, 128));
AnimatedSprite animatedShibe(sf::seconds(0.2), false, true);
animatedShibe.setPosition(0,0);
animatedShibe.play(shibe_idle);
TextureManager texMng;
texMng.getFiles();
texMng.createTextures();
lvlManager lvl;
Block b = lvl.generateTiles(lvl.buildKey(&texMng), &texMng);
lvl.genMap(b, 0, 15);
for (int i = 0; i < 50; i++){
Block b = lvl.generateTiles(lvl.buildKey(&texMng), &texMng);
sf::Vector2<int> v = lvl.findNextSpot(b.x, b.y);
if (v.x != -1)
lvl.genMap(b, v.x, v.y);
}
SoundManager sM;
sM.getFiles();
sM.createSounds();
Player p(&texMng, &(sM.soundTable.at("bark")), sf::Sprite());
//Unit test_unit(10, 10, *sprite);
//Tile test(sprite, &test_unit);
sf::Sprite output;
lvl.genDrawable(&output);
UIManager uimanager;
uimanager.setTerrain(output);
//uimanager.setTerrain(lvl.genDrawable());
int mousex=0, mousey=0;
//lvl.testTileGen(&texMng, &window);
//testTextureManager(&window);
UnitManager uM(&lvl, &texMng, &p, &sM);
uM.spawnUnit(doge, p.playerUnit->x + 1, p.playerUnit->y);
uM.spawnUnit(turtle, p.playerUnit->x, p.playerUnit->y + 1);
std::cout << p.playerUnit->x + 1 << p.playerUnit->y + 1 << std::endl;
uM.gatherActions();
sf::Clock frameClock;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
window.close();
if (event.type == sf::Event::MouseButtonPressed)
{
mousex = sf::Mouse::getPosition(window).x;
mousey = sf::Mouse::getPosition(window).y;
}
if (sf::Mouse::isButtonPressed(sf::Mouse::Left) && event.type == sf::Event::MouseMoved)
{
uimanager.x += event.mouseMove.x-mousex;
uimanager.y += event.mouseMove.y-mousey;
mousex = event.mouseMove.x;
mousey = event.mouseMove.y;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::P))
{
uM.gatherActions();
}
if (event.type == sf::Event::MouseButtonReleased && event.mouseButton.button == sf::Mouse::Button::Right)
{
std::cout << "clicked at " << sf::Mouse::getPosition(window).x-uimanager.x << " " << sf::Mouse::getPosition(window).y-uimanager.y << std::endl;
//std::cout << "is accessible: " << lvl.isAccessible(sf::Mouse::getPosition(window).x - uimanager.x, sf::Mouse::getPosition(window).y - uimanager.y) << std::endl;
int xPos = sf::Mouse::getPosition(window).x - uimanager.x;
//.........这里部分代码省略.........
开发者ID:PhilWimmer,项目名称:MagicFunGame,代码行数:101,代码来源:Quelle.cpp
注:本文中的UIManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论