Пример #1
0
void ShowProposalWaitFrame(bool bVisible, const char* szTitle, const char* szMessage)
{
	ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource();
	MWidget* pWidget = pResource->FindWidget("ProposalAgreementWait");
	if(pWidget!=NULL)
	{
		if (bVisible)
		{
			pWidget->SetText(szTitle);

			MTextArea* pTextArea = (MTextArea*)pResource->FindWidget("ProposalAgreementWait_Textarea");
			if (pTextArea) 
			{
				pTextArea->SetText(szMessage);
			}



			static ZCOUNTDOWN countDown = {PROPOSAL_AGREEMENT_TIMEOUT_SEC,
				                           "ProposalAgreementWait_Remain",
                                           "ProposalAgreementWait",
										   ShowProposalWaitFrame_OnExpire};

			countDown.nSeconds=PROPOSAL_AGREEMENT_TIMEOUT_SEC;	// static 이므로 재설정
			ZApplication::GetTimer()->SetTimerEvent(0, &OnTimer_CountDown, &countDown, true);

			pWidget->Show(true, true);
		}
		else
		{
            pWidget->Show(false);
		}
	}
}
Пример #2
0
void SetCountdown(const ZCOUNTDOWN& Countdown)
{
	auto Callback = [Countdown = Countdown]() mutable
	{
		ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource();
		MWidget* pTargetWidget = pResource->FindWidget(Countdown.szTargetWidget);
		if (!pTargetWidget || !pTargetWidget->IsVisible()) return true;

		if (Countdown.nSeconds > 0) {

			if (Countdown.szLabelWidget != NULL)
			{
				ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource();
				MWidget* pWidget = pResource->FindWidget(Countdown.szLabelWidget);
				if (pWidget)
				{
					char buffer[256];
					sprintf_safe(buffer, "%d", Countdown.nSeconds);
					pWidget->SetText(buffer);
				}
			}

			Countdown.nSeconds--;
			return false;
		}

		pTargetWidget->Show(false);

		if (Countdown.pCallBack)
			Countdown.pCallBack();

		return true;
	};

	ZApplication::GetTimer()->SetTimerEvent(1000, Callback);
}