Exemplo n.º 1
0
bool ZTips::Initialize(CCZFileSystem* pfs, const CCLanguage LangID )
{
	CCZFile mzf;
	if(!mzf.Open(FILENAME_TIPS,pfs)) return false;

	char *buffer;
	buffer=new char[mzf.GetLength()+1];
	mzf.Read(buffer,mzf.GetLength());
	buffer[mzf.GetLength()]=0;

//	LANGID LangID = LANG_KOREAN;			/* Korean : 이거 정말 하드코딩 박기 싫었는디... 쩝... -_-;;; */
//#ifdef LOCALE_JAPAN
//	LangID = LANG_JAPANESE;					/* Japanese */
//#elif  LOCALE_US
//	LangID = LANG_ENGLISH;					/* International */
//#elif  LOCALE_BRAZIL
//	LangID = LANG_PORTUGUESE;				/* Brazil */
//#elif  LOCALE_INDIA
//	LangID = LANG_ENGLISH;					/* India */
//#endif

	cclog( "Load XML from memory : %s(0x%04X)", FILENAME_TIPS, LangID);

	CCXmlDocument aXml;
	aXml.Create();
	if(!aXml.LoadFromMemory(buffer, LangID))
	{
		cclog( "- FAIL\n");
		delete buffer;
		return false;
	}
	delete buffer;
	cclog( "- SUCCESS\n");

	int iCount, i;
	CCXmlElement		aParent, aChild;
	aParent = aXml.GetDocumentElement();
	iCount = aParent.GetChildNodeCount();

	char szTagName[256]="";
	
	for (i = 0; i < iCount; i++)
	{
		aChild = aParent.GetChildNode(i);
		aChild.GetTagName(szTagName);
		if(stricmp(szTagName,ZTOK_TIPS)==0)
		{
			if (szTagName[0] == '#') continue;
			ParseTips(&aChild);
		}
	}

	return true;
}
JXTipOfTheDayDialog::JXTipOfTheDayDialog
	(
	const JBoolean showStartupCB,
	const JBoolean showAtStartup
	)
	:
	JXDialogDirector(JXGetPersistentWindowOwner(), kJFalse)
{
	itsTipList = new JPtrArray<JString>(JPtrArrayT::kDeleteAll);
	assert( itsTipList != NULL );

	itsTipIndex = 1;

	BuildWindow(showStartupCB, showAtStartup);
	ParseTips();
}