Пример #1
0
void GameEndBuy::init(void *data){
    m_tips = CCUIHELPER->createWidgetFromJsonFile("GameEndBuy.json");
    UIWidget* mCoin = m_tips->getChildByName("mCoin");
    UILabelBMFont* coin_num = (UILabelBMFont*)mCoin->getChildByName("num");
    IntToString(_coin, G::G_getCoin());
    coin_num->setText(_coin);
    UILabelBMFont* title = (UILabelBMFont*)m_tips->getChildByName("titile");
    UILabelBMFont* des = (UILabelBMFont*)m_tips->getChildByName("des");
    UILabelBMFont* price = (UILabelBMFont*)m_tips->getChildByName("price");
    UIImageView* icon = (UIImageView*)m_tips->getChildByName("icon");
    CCDictionary* _dic = CCDictionary::createWithContentsOfFile("data/normaltips.plist");
    
    if (G::g_game_lose_conditions[LOSE_CONDITION_TIME]>0) {
        CCString* _title_str = (CCString*)_dic->objectForKey("game_end_des_time");
        CCString* _des_str = (CCString*)_dic->objectForKey("game_end_tool_time");
        IntToString(_price, tool_prices[TOOL_TYPE_TIME]*15/10);
        icon->setTexture("tools/icon_0.png");
        title->setText(_title_str->getCString());
        des->setText(_des_str->getCString());
        price ->setText(_price);
    }else{
        CCString* _title_str = (CCString*)_dic->objectForKey("game_end_des_step");
        CCString* _des_str = (CCString*)_dic->objectForKey("game_end_tool_step");
        IntToString(_price, tool_prices[TOOL_TYPE_STEP]*15/10);
        icon->setTexture("tools/icon_1.png");
        title->setText(_title_str->getCString());
        des->setText(_des_str->getCString());
        price ->setText(_price);
    }
    _dic->release();
}
Пример #2
0
void PlayScene::ShowTips(bool visible, int type) {
  UILabelBMFont *tips = (UILabelBMFont *)ui_layer_->getWidgetByName("Tips");
  if(tips == NULL)
    return;
  UIImageView *imgs = (UIImageView *)ui_layer_->getWidgetByName("ImgTips");
  if(imgs == NULL)
    return;
  imgs->setVisible(visible);
  TipsInfo& config = ConfigInfo::Instence().tips_info();
  if(visible) {
    switch(type) {
    case TIPS_TYPE_ACTION_BEGIN:
      {
        char name[32];
        snprintf(name, 32, "%s", config.sub_stage_begin_);
        tips->setText(name);
        break;
      }
    case TIPS_TYPE_RESULT_END:
      {
        char name[32];
        snprintf(name, 32, "%s", config.sub_stage_end_);
        tips->setText(name);
        break;
      }
    default:
      break;
    }
  }
}
Пример #3
0
void SelectMenuView::noticeShowLock(int beautyIndex, int needHeart)
{
	_panelUnlock->setVisible(true);
	_panelUnlock->setTouchEnabled(true);

	// setting head 
	UIImageView* head = (UIImageView*)_panelUnlock->getChildByName("panelLock_head");
	char tmp[32];
	sprintf(tmp,"head_%d.png",beautyIndex);
	head->loadTexture(tmp,UI_TEX_TYPE_PLIST);

	// setting heart number
	for(int i=0; i<MAX_HEART; i++)
	{
		sprintf(tmp,"panelLock_heart_%d",i+1);
		if(i<needHeart)
		{
			_panelUnlock->getChildByName(tmp)->setVisible(true);
		}
		else
		{
			_panelUnlock->getChildByName(tmp)->setVisible(false);
		}
	}

	// setting beauty name
	UILabelBMFont* labelName = (UILabelBMFont*) _panelUnlock->getChildByName("panelLock_txt_name");
	labelName->setText(BeautyStaticData::getInstance()->getName(beautyIndex));

	// setting unlock price
	UILabelBMFont* labelPrice = (UILabelBMFont*) _panelUnlock->getChildByName("panelLock_txt_price");
	sprintf(tmp,"$%d",BeautyStaticData::getInstance()->getRequiement(beautyIndex+1));
	labelPrice->setText(tmp);

	// animation
	UIWidget* bg = _panelUnlock->getChildByName("panelLock_bg");
	bg->setScale(0.1f);
	bg->runAction(CCScaleTo::create(0.3f,1));

	UIButton* button = (UIButton*)_panelUnlock->getChildByName("panelLock_btn_back");
	button->setTouchEnabled(true);
	button->setPressedActionEnabled(true);
	button->addTouchEventListener(this,toucheventselector(SelectMenuView::onTouchUnlock));
	button = (UIButton*)_panelUnlock->getChildByName("panelLock_btn_unlock");
	button->setTouchEnabled(true);
	button->setPressedActionEnabled(true);
	button->addTouchEventListener(this,toucheventselector(SelectMenuView::onTouchUnlock));

	this->addWidget(_panelUnlock);
}
Пример #4
0
bool LayerGameChan_KetQua::init(){
	if (!CCLayer::init())
	{
		return false;
	}

	this->setAnchorPoint(ccp(0,0));
	this->setPosition(ccp(0,0));

	resuiltKQ = UILayer::create();
	resuiltKQ->setAnchorPoint(ccp(0,0));
	resuiltKQ->setPosition(ccp(0,0));
	this->addChild(resuiltKQ);

	img = UIImageView::create();
	img->loadTexture("frame_thongbao.png");
	img->setPosition(ccp(WIDTH_DESIGN / 2, HEIGHT_DESIGN / 2));
	resuiltKQ->addWidget(img);

	btnClose = UIButton::create();
	btnClose->loadTextures("btnChanClose.png","btnChanClose_press.png","");
	btnClose->setPosition(ccp(WIDTH_DESIGN / 2, img->getPositionY() - img->getContentSize().height / 2));

	UILabelBMFont *title = UILabelBMFont::create();
	title->setFntFile("tttt.fnt");
	title->setText("Đóng");
	title->setColor(ccWHITE);
	title->setScale(0.7);
	title->setPositionY(5.0);
	btnClose->addChild(title);

	btnClose->setEnabled(true);
	btnClose->addTouchEventListener(this, toucheventselector(LayerGameChan_KetQua::btnClose_LayerResuilt));
	resuiltKQ->addWidget(btnClose);

	return true;
}
Пример #5
0
void SelectMenuView::noticeView(SelectMenuModel* model)
{
#pragma region RESET_SCROLL_RECT
	char tmp[32];
	UIPageView* scrollView = static_cast<UIPageView*>(this->getWidgetByName("scrollView"));
	for( int i = 0; i < MAX_BEAUTY_NUM; i++ )
	{
		UIWidget* widget = scrollView->getChildByTag( i + CARD_TAG );
		widget->addTouchEventListener(this , toucheventselector(SelectMenuView::onTouchBeautyCard));
		//UIImageView* card_bg = static_cast<UIImageView*>(widget->getChildByName("card_bg"));
		//card_bg->setTouchEnabled(true);
		//card_bg->addTouchEventListener(this , toucheventselector(SelectMenuView::touchBeautyCard));

		UILabelBMFont* nameTxt = static_cast<UILabelBMFont*>(widget->getChildByName("txt_name"));
		UILabelBMFont* timeTxt = static_cast<UILabelBMFont*>(widget->getChildByName("txt_time"));
		UIImageView* beautyHead = static_cast<UIImageView*>(widget->getChildByName("head"));
		UIImageView* beContinue = static_cast<UIImageView*>(widget->getChildByName("moreLevel"));
		UIImageView* passRibbon = static_cast<UIImageView*>(widget->getChildByName("lock"));
		UIImageView* hearts[MAX_HEART];
		UIImageView* stars[MAX_STAR];
		for( int n = 0; n < MAX_HEART; n++ )
		{
			sprintf( tmp, "heart%d",n+1 );
			hearts[n] = static_cast<UIImageView*>(widget->getChildByName(tmp));
			hearts[n]->setVisible(false);
			sprintf( tmp, "star%d",n+1 );
			stars[n] = static_cast<UIImageView*>(widget->getChildByName(tmp));
			stars[n]->setVisible(false);
		}

		if( i < REAL_BEAUTY_NUM )
		{
			BeautyData data = model->getBeautyData(i);
			// --------------------------- Setting ---------------------------
			//if( i < REAL_BEAUTY_NUM )
			//{
				sprintf( tmp , "head_%d.png" , i);
				beautyHead->loadTexture(tmp ,UI_TEX_TYPE_PLIST);
			//}
			nameTxt->setText( data.name );
			if(data.time>9) sprintf( tmp,"%d:00", data.time );
			else sprintf( tmp,"0%d:00", data.time );
			timeTxt->setVisible(true);
			timeTxt->setText(tmp);
			for ( int n = 0; n < MAX_STAR; n++ )
			{
				if( n < data.difficult ) stars[n]->setVisible(true);
				else stars[n]->setVisible(false);
			}
			int heartNum = model->getUserGainHeartNum(i);
			for ( int n = 0; n < MAX_HEART; n++ )
			{
				if( n < heartNum ) hearts[n]->setVisible(true);
				else hearts[n]->setVisible(false);
			}
			beContinue->setVisible(false);
			if(heartNum < 0)
			{// not pass && close
				passRibbon->setVisible(true);
			}
			else
			{// pass || open
				passRibbon->setVisible(false);
			}
		}
		/////////////
		else
		{
			if(i == MAX_BEAUTY_NUM - 1 )
			{
				beContinue->setVisible(true);
				beautyHead->loadTexture("head_9.png" ,UI_TEX_TYPE_PLIST);
			}
			else
			{
				sprintf( tmp , "head_%d.png" , i);
				beautyHead->loadTexture(tmp ,UI_TEX_TYPE_PLIST);
			}
			nameTxt->setText( "???????????" );
			timeTxt->setText("--:--");
			passRibbon->setVisible(false);
		}
	}
#pragma endregion
}