ALERROR CLoginSession::OnCommand (const CString &sCmd, void *pData)

//	OnCommand
//
//	Handle a command

	{
	if (strEquals(sCmd, CMD_ALL_TASKS_DONE))
		{
		StopPerformance(ID_CTRL_WAIT);
		ShowInitialDlg();
		}

	else if (strEquals(sCmd, CMD_CANCEL))
		CmdCancel();

	else if (strEquals(sCmd, CMD_REGISTER))
		CmdRegister();

	else if (strEquals(sCmd, CMD_REGISTER_COMPLETE))
		CmdRegisterComplete((CRegisterUserTask *)pData);

	else if (strEquals(sCmd, CMD_SIGN_IN))
		CmdSignIn();

	else if (strEquals(sCmd, CMD_SIGN_IN_COMPLETE))
		CmdSignInComplete((CSignInUserTask *)pData);

	else if (strEquals(sCmd, CMD_SWITCH_TO_LOGIN))
		{
		StopPerformance(ID_DLG_REGISTER);

		const CVisualPalette &VI = m_HI.GetVisuals();
		IAnimatron *pDlg;

		CreateDlgSignIn(VI, &pDlg);
		m_iCurrent = dlgSignIn;
		StartPerformance(pDlg, ID_DLG_SIGN_IN, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		}

	else if (strEquals(sCmd, CMD_SWITCH_TO_REGISTER))
		{
		StopPerformance(ID_DLG_SIGN_IN);

		const CVisualPalette &VI = m_HI.GetVisuals();
		IAnimatron *pDlg;

		CreateDlgRegister(VI, &pDlg);
		m_iCurrent = dlgRegister;
		StartPerformance(pDlg, ID_DLG_REGISTER, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		}

	else if (strEquals(sCmd, CMD_PASSWORD_RESET))
		CmdPasswordReset();

	else if (strEquals(sCmd, CMD_TOS))
		sysOpenURL(CONSTLIT("http://www.kronosaur.com/legal/TermsofService.html"));

	return NOERROR;
	}
void CProfileSession::CmdReadComplete (CReadProfileTask *pTask)

//	CmdReadComplete
//
//	Done reading the profile

	{
	const CVisualPalette &VI = m_HI.GetVisuals();

	//	Done with wait animation

	StopPerformance(ID_CTRL_WAIT);

	//	Check for error

	CString sError;
	if (pTask->GetResult(&sError) != NOERROR)
		{
		IAnimatron *pMsg;
		VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_TITLE, strPatternSubst(ERR_DESC, sError), m_rcRecords, 0, &pMsg);

		StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		return;
		}

	//	Show the profile

	IAnimatron *pList = pTask->GetListHandoff();
	pList->SetPropertyVector(PROP_POSITION, CVector(m_rcRecords.left, m_rcRecords.top));
	pList->SetPropertyMetric(PROP_VIEWPORT_HEIGHT, (Metric)RectHeight(m_rcRecords));

	StartPerformance(pList, ID_PROFILE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
	}
Example #3
0
void CLoadGameSession::CmdReadComplete (CListSaveFilesTask *pTask)

//	CmdReadComplete
//
//	We've finished loading the list of games

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	RECT rcRect;
	VI.GetWidescreenRect(m_HI.GetScreen(), &rcRect);

	//	Done with wait animation

	StopPerformance(ID_CTRL_WAIT);

	//	Check for error

	CString sError;
	if (pTask->GetResult(&sError) != NOERROR)
		{
		IAnimatron *pMsg;
		VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_TITLE, strPatternSubst(ERR_DESC, sError), rcRect, 0, &pMsg);

		StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		return;
		}

	//	If we have no entries, then show a message

	IAnimatron *pList = pTask->GetListHandoff();
	if (pList->GetPropertyInteger(PROP_COUNT) == 0)
		{
		delete pList;

		IAnimatron *pMsg;
		VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_NO_ENTRIES, ERR_NO_ENTRIES_DESC, rcRect, 0, &pMsg);

		StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		return;
		}

	//	Show the profile

	RECT rcList;
	pList->GetSpacingRect(&rcList);

	pList->SetPropertyVector(PROP_POSITION, CVector(rcRect.left + (RectWidth(rcRect) - RectWidth(rcList)) / 2, rcRect.top));
	pList->SetPropertyVector(PROP_SCALE, CVector(SAVE_ENTRY_WIDTH, RectHeight(rcRect)));
	pList->SetPropertyMetric(PROP_VIEWPORT_HEIGHT, (Metric)RectHeight(rcRect));
	RegisterPerformanceEvent(pList, EVENT_ON_DOUBLE_CLICK, CMD_OK_SESSION);

	StartPerformance(pList, ID_LIST, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
	}
Example #4
0
void CGalacticMapSession::Select (CTopologyNode *pNode)

//  Select
//
//  Selects the given node

    {
    //  If this node is already selected, skip

    if (pNode == m_pPainter->GetSelection())
        return;

    //  Select

	g_pUniverse->PlaySound(NULL, g_pUniverse->FindSound(UNID_DEFAULT_SELECT));
    m_pPainter->SetSelection(pNode);

    //  We always stop the performance, if there is one

    StopPerformance(ID_DETAILS);

    //  If we have a valid node, then show data for it.

    if (pNode)
        {
        RECT rcPane = m_rcView;
        rcPane.right = m_rcView.right - SCREEN_BORDER_X;
        rcPane.left = rcPane.right - DETAIL_PANE_WIDTH;
        rcPane.top = m_rcView.top + (RectHeight(m_rcView) - DETAIL_PANE_HEIGHT) / 2;
        rcPane.bottom = rcPane.top + DETAIL_PANE_HEIGHT;

        CGalacticMapSystemDetails Details(m_HI.GetVisuals(), GetReanimator(), rcPane);

        IAnimatron *pAni;
        Details.CreateDetailsPane(pNode, &pAni);

    	StartPerformance(pAni, ID_DETAILS, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
        }
    }