Ejemplo n.º 1
0
void Bag::initEquips()
{
	UIPanel* equipPanel = dynamic_cast<UIPanel*>(uiLayer->getWidgetByName("equippanel"));
	CCArray* equips = equipPanel->getChildren();
	CCObject* object = NULL;

	int bagGridCount = 1;

	int equipType = EQUIP_TYPE_HELMET;		//the first type of equip

	CCARRAY_FOREACH(equips,object)
	{
		UIPanel* equipChildPanel = (UIPanel*)object;
		CCArray* equips = equipChildPanel->getChildren();

		int equipStartNum = 1;

		CCARRAY_FOREACH_REVERSE(equips, object)
		{
			UIWidget* equip = dynamic_cast<UIWidget*>(object);
			equip->addTouchEventListener(this,toucheventselector(Bag::touchEvent));
			initEquipID(equip,equipType,equipStartNum);
			
			UIWidget* bagGrid = getBagGrid(bagGridCount++);
			changeParent(bagGrid,equip);

			equipStartNum++;
		}