当前位置: 首页>>代码示例>>C++>>正文


C++ UIManager::RegisterMenuHandler方法代码示例

本文整理汇总了C++中UIManager::RegisterMenuHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ UIManager::RegisterMenuHandler方法的具体用法?C++ UIManager::RegisterMenuHandler怎么用?C++ UIManager::RegisterMenuHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIManager的用法示例。


在下文中一共展示了UIManager::RegisterMenuHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

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

示例2: 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);

	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:niuzb,项目名称:hellopetclient,代码行数:40,代码来源:TaskChatLayer.cpp


注:本文中的UIManager::RegisterMenuHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。