Beispiel #1
0
void GSAvatarMod::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-avatarmod.txt");
  Assert(m_gui);
  
  m_gui->GetElementByName("ok-button")->SetCommand(Amju::OnOkButton);
  m_gui->GetElementByName("cancel-button")->SetCommand(Amju::OnCancelButton);
  m_gui->GetElementByName("type-prev-button")->SetCommand(Amju::OnTypePrevButton);
  m_gui->GetElementByName("type-next-button")->SetCommand(Amju::OnTypeNextButton);
//  m_gui->GetElementByName("colour-prev-button")->SetCommand(Amju::OnColourPrevButton);
//  m_gui->GetElementByName("colour-next-button")->SetCommand(Amju::OnColourNextButton);

  GetGuiSceneGraph()->Clear();
  GetGuiSceneGraph()->SetRootNode(SceneGraph::AMJU_OPAQUE, new SceneNode);

  // TODO Horribly hardcoded here, use constants
  m_currentChar = GetLocalPlayer()->GetVal("avatar");
  if (m_currentChar.empty())
  {
std::cout << "No avatar set for local player ???\n";
    m_currentChar = "marge";
  }
  if (!TheAvatarManager::Instance()->GetIndex(m_currentChar, &m_current))
  {
    std::cout << "Couldn't find name in Avatar Manager: " << m_currentChar << "\n";
    Assert(0);
  }
  CreateChar();
  CheckAvailable();
}
void GSVe3ViewOtherPlayers::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-ve3-viewotherplayers.txt");
  Assert(m_gui);

  GetElementByName(m_gui, "back-button")->SetCommand(OnBack);
  GetElementByName(m_gui, "prev-player-button")->SetCommand(OnPrevPlayer);
  GetElementByName(m_gui, "next-player-button")->SetCommand(OnNextPlayer);

  GetElementByName(m_gui, "make-trade-button")->SetCommand(Amju::OnMakeATrade);
  GetElementByName(m_gui, "see-guestbook-button")->SetCommand(Amju::OnSeeGuestbook);

  // Initialise character
  if (m_player && 
      m_player->GetId() != GetLocalPlayerId()) // could happen if you log out, then in as this player
  {
    ShowPlayer(m_player, m_gui);
  }
  else
  {
    NextPlayer();
  }

  SetHomeButton();
}
Beispiel #3
0
void GSYesNo::OnActive()
{
  GSText::OnActive();

  m_gui = LoadGui("gui-yesno.txt");
  Assert(m_gui);

  GuiButton* yes = (GuiButton*)GetElementByName(m_gui, "yes-button");
  yes->SetCommand(Amju::OnYes);
  yes->SetText(m_yesText);

  GuiButton* no = (GuiButton*)GetElementByName(m_gui, "no-button");
  no->SetCommand(Amju::OnNo);
  no->SetText(m_noText);
  
  IGuiText* q = dynamic_cast<IGuiText*>(GetElementByName(m_gui, "question"));
  q->SetText(m_question);

  // Set safe button (blue, pulsing) and non-undoable (red)
  // TODO Decouple these colour signals from keyboard bindings
  if (m_yesRed)
  {
    no->SetHasFocus(true); // blue, pulsing
    yes->SetIsCancelButton(true);  // red
  }
  else
  {
    yes->SetHasFocus(true); // blue, pulsing
    no->SetIsCancelButton(true);  // red
  }
}
Beispiel #4
0
Lurker::Lurker()
{
  m_gui = LoadGui("gui-lurk.txt");
  Assert(m_gui);

  m_ok = (GuiButton*)GetElementByName(m_gui, "ok-button");
  Assert(m_ok);
  m_ok->SetCommand(Amju::OnLurkOk);

  m_yes = (GuiButton*)GetElementByName(m_gui, "yes-button");
  Assert(m_yes);
  m_yes->SetCommand(Amju::OnLurkYes);

  m_no = (GuiButton*)GetElementByName(m_gui, "no-button");
  Assert(m_no);
  m_no->SetCommand(Amju::OnLurkNo);

/*
  m_button = new GuiButton;
  m_button->OpenAndLoad("lurk-button.txt");
  TheEventPoller::Instance()->AddListener(m_button);
  m_button->SetVisible(false);
  m_button->SetCommand(Amju::OnLurkOk);
*/
}
Beispiel #5
0
void GSCogTestHelp::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-cogtest-help.txt");
  Assert(m_gui);

  // Set focus element, cancel element, command handlers
  GetElementByName(m_gui, "done-button")->SetCommand(OnHelpDone);
}
//////////////////////////////////////////////////////////////////////
// fe_NewMultiplayerGame::OnCreate() //            \author Logan Jones
//////////////////////////////////////                 \date 7/31/2002
//               
//====================================================================
// Return: BOOL - 
//
BOOL fe_NewMultiplayerGame::OnCreate()
{
	// Load the gui file
	if( bFAILED(LoadGui("NewMulti")) )
		return FALSE;

	// Load the background
	if( bFAILED(LoadPanel("CreateNew")) )
		return FALSE;

	return fe_Wnd::OnCreate();
}
void GSVe3ChooseTradeType::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-ve3-choosetradetype.txt");
  Assert(m_gui);

  GetElementByName(m_gui, "back-button")->SetCommand(OnBack);
  GetElementByName(m_gui, "give-treasure-button")->SetCommand(Amju::OnGiveTreasure);
  GetElementByName(m_gui, "give-food-button")->SetCommand(Amju::OnGiveFood);

  Assert(m_player); // the other player
  Player* localPlayer = GetLocalPlayer();
  Assert(localPlayer);
  Player* PLAYER[4] = { localPlayer, m_player, localPlayer, m_player };
  for (int i = 0; i < 4; i++)
  {
    LayerGroups layerGroups; // store settings for each layer
    layerGroups.SetFromSprite(PLAYER[i]->GetSprite());
    layerGroups.SetSprite(&m_spriteNodes[i].GetSprite());

    m_spriteNodes[i].Update();
  }

  SetHomeButton();

  // Set food and treasure counts for both players
  Assert(dynamic_cast<GuiText*>(GetElementByName(m_gui, "food-you-text")));
  Assert(dynamic_cast<GuiText*>(GetElementByName(m_gui, "food-other-text")));
  Assert(dynamic_cast<GuiText*>(GetElementByName(m_gui, "treasure-you-text")));
  Assert(dynamic_cast<GuiText*>(GetElementByName(m_gui, "treasure-other-text")));

  if (localPlayer->Exists(FOOD_STORED_KEY))
  {
    ((GuiText*)GetElementByName(m_gui, "food-you-text"))->SetText(localPlayer->GetVal(FOOD_STORED_KEY));
  }

  if (m_player->Exists(FOOD_STORED_KEY))
  {
    ((GuiText*)GetElementByName(m_gui, "food-other-text"))->SetText(m_player->GetVal(FOOD_STORED_KEY));
  }

  if (localPlayer->Exists(TREASURE_KEY))
  {
    ((GuiText*)GetElementByName(m_gui, "treasure-you-text"))->SetText(localPlayer->GetVal(TREASURE_KEY));
  }

  if (m_player->Exists(TREASURE_KEY))
  {
    ((GuiText*)GetElementByName(m_gui, "treasure-other-text"))->SetText(m_player->GetVal(TREASURE_KEY));
  }
}
void GSDoThoseCogTests::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-dothosecogtests.txt");
  Assert(m_gui);

  GuiButton* ok = (GuiButton*)GetElementByName(m_gui, "ok-button");
  ok->SetCommand(OnDoCogTestsOk);

  GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "quit-button");
  quit->SetCommand(OnDoCogTestsQuit);
}
void GSTrailMakingTest::OnActive()
{
    GSCogTestBase::OnActive();

    TheEventPoller::Instance()->AddListener(m_listener, 100);
    // high number = low priority, so GUI button clicks etc eat the events.

    m_gui = LoadGui("gui-trailmaking.txt");
    Assert(m_gui);
    LoadCommonGui();

    ResetTest();
}
Beispiel #10
0
void GSPauseCogTest::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-pause-cogtest.txt");
  Assert(m_gui);

  m_gui->GetElementByName("resume-button")->SetCommand(Amju::OnResumeButton); // currently hidden -- tests reset when activated
  m_gui->GetElementByName("help-button")->SetCommand(Amju::OnHelp);
  m_gui->GetElementByName("restart-button")->SetCommand(Amju::OnRestartYes); // not OnRestartThisTest -- restarting is not optional
  m_gui->GetElementByName("skip-button")->SetCommand(Amju::OnSkipThisTest);
  m_gui->GetElementByName("quit-button")->SetCommand(Amju::OnQuitTests);
}
Beispiel #11
0
void GSEditLocation::OnActive()
{
  m_locId = ToString(GetLocalPlayerLocation());

  GSGui::OnActive();

  m_gui = LoadGui("gui-newlocation.txt");
  Assert(m_gui);

  m_gui->GetElementByName("ok-button")->SetCommand(OnOKEdit);
  m_gui->GetElementByName("cancel-button")->SetCommand(OnCancelButton);
  // TODO "test" and "commit" buttons

  // Get last path, set path/file browser to it
}
Beispiel #12
0
void GSAdminMenu::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-adminmenu.txt");
  Assert(m_gui);

  // Set focus element, cancel element, command handlers
//  GetElementByName(m_gui, "local-button")->SetCommand(Amju::OnLocalButton);
  GetElementByName(m_gui, "edit-button")->SetCommand(Amju::OnEditButton);
  GetElementByName(m_gui, "cog-button")->SetCommand(Amju::OnCogTestButton);

  GuiButton* cancel = (GuiButton*)GetElementByName(m_gui, "cancel-button");
  cancel->SetCommand(Amju::OnCancelButton);
  cancel->SetIsCancelButton(true);
}
Beispiel #13
0
void GSPaused::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-paused.txt");
  Assert(m_gui);

  m_gui->GetElementByName("resume-button")->SetCommand(Amju::OnResumeButton);
  m_gui->GetElementByName("options-button")->SetCommand(Amju::OnOptionsButton);
  m_gui->GetElementByName("quit-button")->SetCommand(Amju::OnQuitButton);
  m_gui->GetElementByName("avatar-button")->SetCommand(Amju::OnAvatarButton);

  //m_gui->GetElementByName("reset-button")->SetEnabled(false); 
    //SetCommand(Amju::OnResetButton);
//  m_gui->GetElementByName("calendar-button")->SetCommand(Amju::OnCalendarButton);
//  m_gui->GetElementByName("achievements-button")->SetCommand(Amju::OnAchievementsButton);
}
void GSFileUpdateCheck::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-fileupdatecheck.txt");
  Assert(m_gui);

  GetElementByName(m_gui, "skip-button")->SetCommand(Amju::OnSkip);

  // New June 2013: Don't check for updated files. Just skip to next state.
  //TheGame::Instance()->SetCurrentState(TheGSWaitForNewLocation::Instance());

  // Create request
  // Url contains timestamp of last check
  std::string url = TheVe1ReqManager::Instance()->MakeUrl(FILE_UPDATE_CHECK);
  url += "&time=" + m_timestamp;
  TheVe1ReqManager::Instance()->SerialReqManager::AddReq(new FileUpdater(url), 1, false);
}
Beispiel #15
0
void GSQuitGame::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-quitgame.txt");
  Assert(m_gui);

  GuiButton* cancel = (GuiButton*)GetElementByName(m_gui, "cancel-button");
  cancel->SetCommand(Amju::OnCancel);
  cancel->SetHasFocus(true); 

  GuiButton* qsession = (GuiButton*)GetElementByName(m_gui, "quitsession-button");
  qsession->SetCommand(Amju::OnQuitSession);

  GuiButton* qprocess = (GuiButton*)GetElementByName(m_gui, "quitprocess-button");
  qprocess->SetCommand(Amju::OnQuitProcess);

}
//////////////////////////////////////////////////////////////////////
// fe_MultiplayerSetup::OnCreate() //              \author Logan Jones
////////////////////////////////////                   \date 7/31/2002
//               
//====================================================================
// Return: BOOL - 
//
BOOL fe_MultiplayerSetup::OnCreate()
{
	gadget_Button*	pButton;
	gadget_Pic*		pPic;
	BYTE*			pBuf = NULL;
	DWORD			Size;

	// Load the gui file
	if( bFAILED(LoadGui("Lounge2")) )
		return FALSE;

	// Load the background
	if( bFAILED(LoadPanel("BattleRoom")) )
		return FALSE;

	// Load up the custom image gaf file
	Size = theFileTree.DumpFileToBuffer( "anims/Lounge2.gaf", &pBuf );
	if( (pBuf!=NULL) && (Size!=0) ) {
		//if( pButton = (gadget_Button*)GetGadget("SIDEx") )
		//	gfx->CreateSurfacesFromGAF( pBuf, "SIDEx", 1, 5, SideSurfaces ),
		//	pButton->SetButtonImages( SideSurfaces, SideSurfaces[3], SideSurfaces[4] ),
		//	pButton->SetActive( TRUE ), pButton->SetVisible(TRUE);
		if( pPic = (gadget_Pic*)GetGadget("battlestart") )
			gfx->CreateSurfacesFromGAF( pBuf, "battlestart", 1, 9, m_BattleStartAnim ),
			pPic->SetFrames( m_BattleStartAnim, 9 );
		delete [] pBuf;
	}

	// Load up the custom image gaf file
	Size = theFileTree.DumpFileToBuffer( "anims/Logos.gaf", &pBuf );
	if( (pBuf!=NULL) && (Size!=0) ) {
		gfx->CreateSurfacesFromGAF( pBuf, "32xlogos", 1, 10, m_Logos );
		delete [] pBuf;
	}

	gadget_ListBox* pBox = (gadget_ListBox*)GetGadget("Output");
	pBox->SetSort( FALSE );

	pButton = (gadget_Button*)GetGadget("PLAYERx");
	m_FirstPos = pButton->GetWndPos();

	ResetPlayers();
	return TRUE;
}
Beispiel #17
0
void GSYesNo::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-yesno.txt");
  Assert(m_gui);

  GuiButton* yes = (GuiButton*)GetElementByName(m_gui, "yes-button");
  yes->SetCommand(Amju::OnYes);
  yes->SetHasFocus(true);
  yes->SetText(m_yesText);

  GuiButton* no = (GuiButton*)GetElementByName(m_gui, "no-button");
  no->SetCommand(Amju::OnNo);
  no->SetIsCancelButton(true); 
  no->SetText(m_noText);
  
  GuiText* q = (GuiText*)GetElementByName(m_gui, "question");
  q->SetText(m_question);
}
Beispiel #18
0
void GSNetError::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-error.txt");
  Assert(m_gui);

////  m_gui->GetElementByName("error-ok-button")->SetCommand(Amju::OnErrorOk);
////  m_gui->GetElementByName("error-quit-button")->SetCommand(Amju::OnErrorQuit);
  
  GuiButton* ok = (GuiButton*)GetElementByName(m_gui, "error-ok-button");
  ok->SetCommand(Amju::OnErrorOk);
  ok->SetHasFocus(true);

  GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "error-quit-button");
  quit->SetCommand(Amju::OnErrorQuit);
  quit->SetIsCancelButton(true);


  GuiText* t = dynamic_cast<GuiText*>(m_gui->GetElementByName("error"));
  Assert(t);
  t->SetText(m_errorStr);
}
Beispiel #19
0
void GSStartMenu::OnActive()
{
    SetGameMode(AMJU_MODE_NONE);

    GSGui::OnActive();

    m_gui = LoadGui("gui-startmenu.txt");
    Assert(m_gui);

    GuiButton* start = (GuiButton*)GetElementByName(m_gui, "start-button");
    start->SetCommand(Amju::OnStartButton);

    GuiButton* guest = (GuiButton*)GetElementByName(m_gui, "guest-button");
    // not supported currently
    //guest->SetCommand(Amju::OnGuestButton);

    GuiButton* options = (GuiButton*)GetElementByName(m_gui, "options-button");
    options->SetCommand(Amju::OnOptionsButton);

    GuiButton* admin = (GuiButton*)GetElementByName(m_gui, "admin-button");
#ifdef _DEBUG
    admin->SetCommand(Amju::OnAdminButton);
#else
    admin->SetVisible(false);
#endif

    GuiButton* cancel = (GuiButton*)GetElementByName(m_gui, "cancel-button");
    cancel->SetCommand(Amju::OnCancelButton);
    cancel->SetIsCancelButton(true);

    // TODO remember last choice and keep highlighted
    start->SetHasFocus(true);

#ifdef PLAY_MUSIC
    TheSoundManager::Instance()->PlaySong("Sound/piano.it");
#endif
}
Beispiel #20
0
void GSTitle::OnActive()
{
  static bool first = true;
  if (first)
  {
    first = false;

    TheAvatarManager::Instance()->Load();

    // Set default keyboard layout
    KbSetLayout(KB_LAYOUT_REGULAR);

    TheGSOptions::Instance()->LoadFromConfig();
  }

  // Kill off any dummy player object
  TheGame::Instance()->ClearGameObjects();

#ifdef SHOW_FRAME_TIME
  Font* font = (Font*)TheResourceManager::Instance()->GetRes("font2d/arial-font.font");
  TheGame::Instance()->SetFrameTimeFont(font);
#endif

  GSGui::OnActive();

  if (!m_titleImage.OpenAndLoad("title-bgimage.txt"))
  {
std::cout << "Failed to load GUI title bg image!\n";
    Assert(0);
  }

  m_gui = LoadGui("gui-title.txt");
  Assert(m_gui);

  GuiButton* start = (GuiButton*)GetElementByName(m_gui, "start-button");
  start->SetCommand(Amju::OnStartButton);
  start->SetHasFocus(true); 

  GuiButton* options = (GuiButton*)GetElementByName(m_gui, "options-button");
  options->SetCommand(Amju::OnOptionsButton);

  GuiButton* quick = (GuiButton*)GetElementByName(m_gui, "quick-start-button");
  static PlayerInfoManager* pim = ThePlayerInfoManager::Instance();
  if (pim->GetNumPlayerNames() > 0)
  {
    quick->SetVisible(true);
    quick->SetCommand(Amju::OnQuickStartButton);
    quick->SetHasFocus(true);

    // Change button text to player name
    Strings names = pim->GetPlayerNames();
    Assert(!names.empty());
    pim->SetCurrentPlayer(names[0]);
    PlayerInfo* pi = pim->GetPI();
    Assert(pi);
    std::string playername = pi->PIGetString(PI_KEY("playername"));
    quick->SetText(playername);
  }
  else
  {
    quick->SetVisible(false);
  }

  GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "quit-button");
  quit->SetCommand(Amju::OnQuitButton);
  quit->SetIsCancelButton(true);

#ifdef SHOW_VERSION
  GuiText* ver = (GuiText*)GetElementByName(m_gui, "version");
  std::string s = "v." + ToString(VersionMajor) + "." + ToString(VersionMinor);
#ifdef _DEBUG
  s += " DEBUG";
#endif
  ver->SetText(s);
#endif

  //CreateText("my game");

#ifdef PLAY_MUSIC
  TheSoundManager::Instance()->PlaySong(ROConfig()->GetValue("music-title", "Sound/hammers.it"));
#endif
}