Exemplo n.º 1
0
LTBOOL CFolderIntel::Build()
{

	LTIntPt header = g_pLayoutMgr->GetFolderCustomPoint((eFolderID)m_nFolderID,"HeaderPos");
	CLTGUITextItemCtrl *pCtrl = CreateTextItem(IDS_INTEL_ITEMS,0,0,LTTRUE,GetMediumFont());
	AddFixedControl(pCtrl,header,LTFALSE);

    UseArrows(LTTRUE);
	UseBack(LTTRUE,LTFALSE,LTTRUE);

	return CBaseSelectionFolder::Build();
}
void CFolderJoin::AskForPassword()
{
	m_bAskingForPassword = LTTRUE;
	m_szPassword[0] = LTNULL;
	m_pPassLabel = CreateTextItem(IDS_PASSWORD, CMD_EDIT_PASS, IDS_HELP_ENTER_PASSWORD);

	m_pPassEdit = CreateEditCtrl(" ", CMD_EDIT_PASS, IDS_HELP_ENTER_PASSWORD, m_szPassword, sizeof(m_szPassword), 25, LTTRUE);
	m_pPassEdit->EnableCursor();
    m_pPassEdit->Enable(LTFALSE);
	m_pPassEdit->SetAlignment(LTF_JUSTIFY_CENTER);

	char szBack[128] = "";
	g_pLayoutMgr->GetMessageBoxBackground(szBack,sizeof(szBack));

	m_pPassBack = debug_new(CBitmapCtrl);
    m_pPassBack->Create(g_pLTClient,szBack);

	LTIntPt pos(0,0);

	pos.x = 320 - m_pPassBack->GetWidth() / 2;
	pos.y = 240 - m_pPassBack->GetHeight() / 2;
	AddFixedControl(m_pPassBack,pos,LTFALSE);

	pos.x += 16;
	pos.y = 244 + m_pPassEdit->GetHeight();
	AddFixedControl(m_pPassEdit,pos,LTTRUE);

	pos.x = 320 - m_pPassLabel->GetWidth() / 2;
	pos.y = 236 - m_pPassLabel->GetHeight();
	AddFixedControl(m_pPassLabel,pos,LTFALSE);



	SetCapture(m_pPassEdit);
	m_pPassEdit->SetColor(m_hSelectedColor,m_hSelectedColor,m_hSelectedColor);
    m_pPassEdit->Select(LTTRUE);
    m_pPassLabel->Select(LTFALSE);


}
Exemplo n.º 3
0
void CFolderSave::NameSaveGame(uint32 slot, int index)
{
	sprintf(m_szSaveName,"%s", g_pGameClientShell->GetCurrentWorldName());

	if (!g_pGameClientShell->IsCustomLevel())
	{
		int missionNum = g_pGameClientShell->GetCurrentMission();
		int sceneNum = g_pGameClientShell->GetCurrentLevel();
		MISSION* pMission = g_pMissionMgr->GetMission(missionNum);
		if (pMission)
		{
			int missionId = pMission->nNameId;
			HSTRING hTxt=g_pLTClient->FormatString(missionId);
			if (sceneNum <= 0)
			{
				sprintf(m_szSaveName,"%s",g_pLTClient->GetStringData(hTxt));
			}
			else
			{
				HSTRING hTxt2=g_pLTClient->FormatString(IDS_SCENENUMBER,sceneNum + 1);
				sprintf(m_szSaveName,"%s, %s",g_pLTClient->GetStringData(hTxt),g_pLTClient->GetStringData(hTxt2));
				g_pLTClient->FreeString(hTxt2);
			}
			g_pLTClient->FreeString(hTxt);

		}
	}

	g_pColCtrl = (CLTGUIColumnTextCtrl*)GetControl(index);
	if (!g_pColCtrl)
		return;
	LTIntPt pos = g_pColCtrl->GetPos();

	g_hOldName = g_pColCtrl->GetString(0);
	g_hOldTime = g_pColCtrl->GetString(2);
	HSTRING hTxt = g_pLTClient->CreateString("  ");
	g_pColCtrl->SetString(0, hTxt);
	g_pColCtrl->SetString(2, hTxt);
	g_pLTClient->FreeString(hTxt);

	
	AddFixedControl(m_pEdit,pos);
	m_pEdit->SetText(m_szSaveName);

	m_pEdit->UpdateData(LTFALSE);
	SetCapture(m_pEdit);
	m_pEdit->SetColor(m_hSelectedColor,m_hSelectedColor,m_hSelectedColor);
    m_pEdit->Select(LTTRUE);

}
// Build the folder
LTBOOL CFolderHostLevels::Build()
{
	if (!g_vtNetGameType.IsInitted())
	{
        g_vtNetGameType.Init(g_pLTClient,"NetGameType",LTNULL,(float)m_nGameType);
	}

	rcAvailRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"AvailLevelsRect");
	rcSelRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"SelLevelsRect");
	rcCommandRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"CommandRect");
	nIndent = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"TextIndent");
	nArrowWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ArrowWidth");

	CreateTitle(IDS_TITLE_HOST_LEVELS);

	//Add Avail Levels List
    LTIntPt pos(rcAvailRect.left + nIndent,rcAvailRect.top);
	CLTGUIFont *pFont = GetLargeFont();
	nBarHeight = pFont->GetHeight();

    CStaticTextCtrl *pCtrl = CreateStaticTextItem(IDS_HOST_AVAIL_LEVELS, LTNULL, LTNULL,0,0, LTTRUE, pFont);
    AddFixedControl(pCtrl,pos,LTFALSE);
    pCtrl->Enable(LTFALSE);

	pFont = GetSmallFont();
	pos.x = rcAvailRect.left + nIndent;
	pos.y = rcAvailRect.top + nBarHeight;
	int nListHeight = (rcAvailRect.bottom - rcAvailRect.top) - nBarHeight;
	int nListWidth = (rcAvailRect.right - rcAvailRect.left) - nArrowWidth;

	m_pAvailLevels = debug_new(CListCtrl);
    m_pAvailLevels->Create(nListHeight, LTTRUE, nListWidth);
	m_pAvailLevels->SetParam1(nListWidth);
	m_pAvailLevels->SetItemSpacing(0);
    m_pAvailLevels->EnableMouseMoveSelect(LTTRUE);
	m_pAvailLevels->SetHelpID(IDS_HELP_AVAIL_LEVELS);
    AddFixedControl(m_pAvailLevels,pos,LTTRUE);

	//Add Selected Levels List
    pos = LTIntPt(rcSelRect.left + nIndent,rcSelRect.top);
	pFont = GetLargeFont();

    pCtrl = CreateStaticTextItem(IDS_HOST_SELECTED_LEVELS, LTNULL, LTNULL,0,0,LTTRUE, pFont);
    AddFixedControl(pCtrl,pos,LTFALSE);
    pCtrl->Enable(LTFALSE);

	pFont = GetSmallFont();
	pos.x = rcSelRect.left + nIndent;
	pos.y = rcSelRect.top + nBarHeight;
	nListHeight = (rcSelRect.bottom - rcSelRect.top) - nBarHeight;
	nListWidth = (rcSelRect.right - rcSelRect.left) - nArrowWidth;

	m_pSelLevels = debug_new(CListCtrl);
    m_pSelLevels->Create(nListHeight, LTTRUE, nListWidth);
	m_pSelLevels->SetParam1(nListWidth);
	m_pSelLevels->SetItemSpacing(0);
    m_pSelLevels->EnableMouseMoveSelect(LTTRUE);
	m_pSelLevels->SetHelpID(IDS_HELP_SEL_LEVELS);
    AddFixedControl(m_pSelLevels,pos,LTTRUE);

	//Add Commands
    pos = LTIntPt(rcCommandRect.left + nIndent,rcCommandRect.top);
	nListWidth = rcCommandRect.right - rcCommandRect.left;
	pFont = GetLargeFont();


	m_pAddAll = CreateStaticTextItem(IDS_HOST_ADD_ALL, CMD_ADD_ALL, IDS_HELP_ADD_ALL, nListWidth);
    AddFixedControl(m_pAddAll,pos,LTTRUE);
	pos.y += (m_nItemSpacing + pFont->GetHeight());

	m_pAddLevel = CreateStaticTextItem(IDS_HOST_ADD_LEVEL, CMD_ADD_LEVEL, IDS_HELP_ADD_LEVEL, nListWidth);
    AddFixedControl(m_pAddLevel,pos,LTTRUE);
	pos.y += (m_nItemSpacing + pFont->GetHeight());

	m_pRemoveLevel = CreateStaticTextItem(IDS_HOST_REMOVE_LEVEL, CMD_REMOVE_LEVEL, IDS_HELP_REM_LEVEL, nListWidth);
    AddFixedControl(m_pRemoveLevel,pos,LTTRUE);
	pos.y += (m_nItemSpacing + pFont->GetHeight());

	m_pRemoveAll = CreateStaticTextItem(IDS_HOST_REMOVE_ALL, CMD_REMOVE_ALL, IDS_HELP_REM_ALL, nListWidth);
    AddFixedControl(m_pRemoveAll,pos,LTTRUE);
	pos.y += (m_nItemSpacing + pFont->GetHeight());



 	// Make sure to call the base class
	if (!CBaseFolder::Build()) return LTFALSE;

	UseBack(LTTRUE,LTTRUE);

	return LTTRUE;

}
// Build the folder
LTBOOL CFolderJoin::Build()
{
	rcServerRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"ServerRect");
	rcPlayerRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"PlayerRect");
	rcOptionRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"OptionRect");
	rcStatusRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"StatusRect");
	rcCommandRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"CommandRect");

	nGap = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ColumnGap");
	nIndent = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"TextIndent");

	nGameWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"GameWidth");
	nPlayerWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"PlayerWidth");
	nPingWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"PingWidth");
	nTypeWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"TypeWidth");
	nMapWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"MapWidth");
	nNameWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"NameWidth");
	nScoreWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ScoreWidth");
	nOptionWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"OptionWidth");

	nArrowWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ArrowWidth");

	CreateTitle(IDS_TITLE_JOIN);

	//Add Server Header
    LTIntPt pos(rcServerRect.left + nIndent,rcServerRect.top);
	CLTGUIFont *pFont = GetMediumFont();
	nBarHeight = pFont->GetHeight();


	CStaticTextCtrl *pCtrl = CreateStaticTextItem(IDS_SERVER_NAME,CMD_SORT_SERV_NAME,IDS_HELP_SERVER_NAME,nGameWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pServerNameCtrl = pCtrl;
	pos.x += nGameWidth+nGap;

	pCtrl = CreateStaticTextItem(IDS_SERVER_PLAYERS,CMD_SORT_SERV_PLAYERS,IDS_HELP_SERVER_PLAYERS,nPlayerWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pServerPlayersCtrl = pCtrl;
	pos.x += nPlayerWidth+nGap;

	pCtrl = CreateStaticTextItem(IDS_SERVER_PING,CMD_SORT_SERV_PING,IDS_HELP_SERVER_PING,nPingWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pServerPingCtrl = pCtrl;
	pos.x += nPingWidth+nGap;

	pFont = GetMediumFont();
    pCtrl = CreateStaticTextItem(IDS_SERVER_GAME,CMD_SORT_SERV_GAME,LTNULL,nTypeWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTFALSE);
	pServerGameCtrl = pCtrl;
	pos.x += nTypeWidth+nGap;

    pCtrl = CreateStaticTextItem(IDS_SERVER_MAP,CMD_SORT_SERV_MAP,LTNULL,nMapWidth,pFont->GetHeight(),LTFALSE,pFont);
	pServerMapCtrl = pCtrl;
    AddFixedControl(pCtrl,pos,LTFALSE);

	//Add Server List
	pos.x = rcServerRect.left + nIndent;
	pos.y = rcServerRect.top + nBarHeight;
	int nListHeight = (rcServerRect.bottom - rcServerRect.top) - nBarHeight;
	nListHeight += 19;	// [blg] tweak

	nServerGroupWidth = (rcServerRect.right - rcServerRect.left) - nArrowWidth;
	m_pServerList = debug_new(CListCtrl);
    m_pServerList->Create(nListHeight, LTTRUE, nServerGroupWidth);
	m_pServerList->SetItemSpacing(0);
    m_pServerList->EnableMouseClickSelect(LTTRUE);
    AddFixedControl(m_pServerList,pos,LTTRUE);

	//Add Player Header
	pFont = GetMediumFont();
    pos = LTIntPt(rcPlayerRect.left + nIndent,rcPlayerRect.top);

	pCtrl = CreateStaticTextItem(IDS_JOIN_PLAYER_NAME,CMD_SORT_PLYR_NAME,IDS_HELP_SORT_PLYR_NAME,nNameWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pPlayerNameCtrl = pCtrl;
	pos.x += nNameWidth+nGap;

	pCtrl = CreateStaticTextItem(IDS_JOIN_PLAYER_SCORE,CMD_SORT_PLYR_SCORE,IDS_HELP_SORT_PLYR_SCORE,nScoreWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pPlayerFragCtrl = pCtrl;
	pos.x += nScoreWidth+nGap;

	pCtrl = CreateStaticTextItem(IDS_SERVER_PING,CMD_SORT_PLYR_PING,IDS_HELP_SORT_PLYR_PING,nPingWidth,pFont->GetHeight(),LTFALSE,pFont);
	pPlayerPingCtrl = pCtrl;
    AddFixedControl(pCtrl,pos,LTTRUE);

	//Add PlayerList Here
	pos.x = rcPlayerRect.left + nIndent;
	pos.y = rcPlayerRect.top + nBarHeight;
	nListHeight = (rcPlayerRect.bottom - rcPlayerRect.top) - nBarHeight;
	nListHeight += 24;	// [blg] tweak
	nPlayerGroupWidth = (rcPlayerRect.right - rcPlayerRect.left) - nArrowWidth;
	m_pPlayerList = debug_new(CListCtrl);
    m_pPlayerList->Create(nListHeight, LTTRUE, nPlayerGroupWidth);
	m_pPlayerList->SetItemSpacing(0);
//    m_pPlayerList->Enable(LTFALSE);
    AddFixedControl(m_pPlayerList,pos,LTTRUE);


	//Add Commands
	pFont = GetMediumFont();
	pos.x = rcCommandRect.left;
	pos.y = rcCommandRect.top;
	m_pRefresh = CreateTextItem(IDS_SERVER_REFRESH,CMD_REFRESH_SERVERS,IDS_HELP_REFRESH,LTFALSE,pFont);
    AddFixedControl(m_pRefresh,pos,LTTRUE);
	pos.y += pFont->GetHeight();

	// [blg] re-ping is not support in the GameSpy SDK
	//m_pRePing = CreateTextItem(IDS_SERVER_REPING,CMD_REPING_SERVERS,IDS_HELP_REPING,LTFALSE,pFont);
    //AddFixedControl(m_pRePing,pos,LTTRUE);
	//pos.y += pFont->GetHeight();

	m_pVersionFilter = CreateTextItem(IDS_ALL_VERSIONS,CMD_VERSION_FILTER,IDS_HELP_VERSION_FILTER,LTFALSE,pFont,&m_nVersionFilter);
	m_pVersionFilter->AddString(IDS_CURRENT_VERSION);
    AddFixedControl(m_pVersionFilter,pos,LTTRUE);
	pos.y += pFont->GetHeight();

	m_pGameFilter = CreateTextItem(anGameFilterID[0],CMD_GAME_FILTER,IDS_HELP_GAME_FILTER,LTFALSE,pFont,&m_nGameFilter);
	m_pGameFilter->AddString(anGameFilterID[1]);
	m_pGameFilter->AddString(anGameFilterID[2]);
    AddFixedControl(m_pGameFilter,pos,LTTRUE);
	pos.y += pFont->GetHeight();

	m_pPopFilter = CreateTextItem(anPopFilterID[0],CMD_POP_FILTER,IDS_HELP_POP_FILTER,LTFALSE,pFont,&m_nPopFilter);
	m_pPopFilter->AddString(anPopFilterID[1]);
	m_pPopFilter->AddString(anPopFilterID[2]);
	m_pPopFilter->AddString(anPopFilterID[3]);
    AddFixedControl(m_pPopFilter,pos,LTTRUE);
	pos.y += pFont->GetHeight();

	m_pJoin = CreateTextItem(IDS_JOIN_GAME,CMD_JOIN,IDS_HELP_JOIN_GAME,LTFALSE,pFont);
    m_pJoin->Enable(LTFALSE);
    AddFixedControl(m_pJoin,pos,LTFALSE);
	pos.y += pFont->GetHeight();


	//Add Option Header
	pFont = GetMediumFont();
    pos = LTIntPt(rcOptionRect.left + nIndent,rcOptionRect.top);

    pCtrl = CreateStaticTextItem(IDS_OPTION_NAME,LTNULL,LTNULL,nNameWidth,pFont->GetHeight(),LTTRUE,pFont);
    pCtrl->Enable(LTFALSE);
    AddFixedControl(pCtrl,pos,LTFALSE);
	pos.x += nOptionWidth+nGap;

    pCtrl = CreateStaticTextItem(IDS_OPTION_VALUE,LTNULL,LTNULL,nScoreWidth,pFont->GetHeight(),LTTRUE,pFont);
    pCtrl->Enable(LTFALSE);
    AddFixedControl(pCtrl,pos,LTFALSE);

	//Add OptionList Here
	pos.x = rcOptionRect.left + nIndent;
	pos.y = rcOptionRect.top + nBarHeight;
	nListHeight = (rcOptionRect.bottom - rcOptionRect.top) - nBarHeight;
	nOptionGroupWidth = (rcOptionRect.right - rcOptionRect.left) - nArrowWidth;
	m_pOptionList = debug_new(CListCtrl);
    m_pOptionList->Create(nListHeight, LTTRUE, nOptionGroupWidth);
	m_pOptionList->SetItemSpacing(0);
//    m_pOptionList->Enable(LTFALSE);
    AddFixedControl(m_pOptionList,pos,LTFALSE);

	rcStatusRect.top = rcStatusRect.bottom - nBarHeight;

    bFrameDelay = LTTRUE;

	// Make sure to call the base class
	return CBaseFolder::Build();
}
void CFolderObjectives::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		m_pMissionCtrl->RemoveAll();
		UseContinue(FOLDER_ID_NONE);

		int missionNum = g_pInterfaceMgr->GetMissionData()->GetMissionNum();

		MISSION* pMission = g_pMissionMgr->GetMission(missionNum);
		if (!pMission) return;

		int missionId = pMission->nNameId;

        HSTRING hTxt=g_pLTClient->FormatString(missionId);
		m_pMissionCtrl->AddString(hTxt);
        g_pLTClient->FreeString(hTxt);

		//add objectives
		BuildObjectivesList();

		//add spacer
		AddFreeControl(m_pSpacerCtrl);


		UseBack(LTFALSE);
	    int nHelp = LTNULL;
		m_eNextFolder = GetNextSelectionFolder(FOLDER_ID_OBJECTIVES,&nHelp);
		UseContinue(FOLDER_ID_NONE);

		
		if (m_eNextFolder == FOLDER_ID_INVENTORY)
		{
			m_pSelectCtrl = CreateTextItem( IDS_START_MISSION, CMD_START, IDS_HELP_START, LTFALSE, GetMediumFont());
			LTIntPt pos = g_pLayoutMgr->GetFolderCustomPoint(FOLDER_ID_OBJECTIVES,"StartPos");
			AddFixedControl(m_pSelectCtrl,pos);
			SetSelection(GetIndex(m_pSelectCtrl));
		}
		else
		{
			LTIntPt pos = g_pLayoutMgr->GetFolderCustomPoint(FOLDER_ID_OBJECTIVES,"SkipPos");

			m_pSkipCtrl = CreateTextItem( IDS_SKIP_OUTFITTING,CMD_SKIP, IDS_HELP_SKIP_OUTFITTING, LTFALSE, GetMediumFont());
			AddFixedControl(m_pSkipCtrl,pos);
			SetSelection(GetIndex(m_pSkipCtrl));

			pos = g_pLayoutMgr->GetFolderCustomPoint(FOLDER_ID_OBJECTIVES,"SelectPos");
			
			m_pSelectCtrl =  CreateTextItem( IDS_DO_OUTFITTING, FOLDER_CMD_CONTINUE, IDS_HELP_DO_OUTFITTING, LTFALSE, GetMediumFont());
			AddFixedControl(m_pSelectCtrl,pos);
		}

		UseBack();
	}
	else
	{
		SetSelection(kNoSelection);
		while (m_controlArray.GetSize() > dwNumStaticControls)
		{
			CLTGUICtrl* pCtrl = m_controlArray[dwNumStaticControls];
			m_controlArray.Remove(dwNumStaticControls);

			if (pCtrl != m_pSpacerCtrl)
				debug_delete(pCtrl);


		}
		if (m_pSkipCtrl)
		{
			RemoveFixedControl(m_pSkipCtrl);
			debug_delete(m_pSkipCtrl);
			m_pSkipCtrl = LTNULL;
 
		}

		if (m_pSelectCtrl)
		{
			RemoveFixedControl(m_pSelectCtrl);
			debug_delete(m_pSelectCtrl);
			m_pSelectCtrl = LTNULL;
 
		}


	}
	CBaseFolder::OnFocus(bFocus);

}