This commit is contained in:
parent
0558322709
commit
f2f4278932
@ -35,6 +35,7 @@ void ConsoleView::DoKeyPress(int key, Uint16 character, bool shift, bool ctrl, b
|
|||||||
{
|
{
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
|
case KEY_ESCAPE:
|
||||||
case '`':
|
case '`':
|
||||||
c->CloseConsole();
|
c->CloseConsole();
|
||||||
break;
|
break;
|
||||||
|
@ -52,6 +52,7 @@ ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDial
|
|||||||
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||||
cancelButton->SetActionCallback(new CloseAction(this, ResultCancel));
|
cancelButton->SetActionCallback(new CloseAction(this, ResultCancel));
|
||||||
AddComponent(cancelButton);
|
AddComponent(cancelButton);
|
||||||
|
SetCancelButton(cancelButton);
|
||||||
|
|
||||||
ui::Button * okayButton = new ui::Button(ui::Point(Size.X-76, Size.Y-16), ui::Point(76, 16), "Continue");
|
ui::Button * okayButton = new ui::Button(ui::Point(Size.X-76, Size.Y-16), ui::Point(76, 16), "Continue");
|
||||||
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
@ -59,6 +60,7 @@ ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDial
|
|||||||
okayButton->Appearance.TextInactive = style::Colour::WarningTitle;
|
okayButton->Appearance.TextInactive = style::Colour::WarningTitle;
|
||||||
okayButton->SetActionCallback(new CloseAction(this, ResultOkay));
|
okayButton->SetActionCallback(new CloseAction(this, ResultOkay));
|
||||||
AddComponent(okayButton);
|
AddComponent(okayButton);
|
||||||
|
SetOkayButton(okayButton);
|
||||||
|
|
||||||
ui::Engine::Ref().ShowWindow(this);
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,9 @@ ErrorMessage::ErrorMessage(std::string title, std::string message):
|
|||||||
okayButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
okayButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||||
okayButton->SetActionCallback(new DismissAction(this));
|
okayButton->SetActionCallback(new DismissAction(this));
|
||||||
AddComponent(okayButton);
|
AddComponent(okayButton);
|
||||||
|
SetOkayButton(okayButton);
|
||||||
|
SetCancelButton(okayButton);
|
||||||
|
|
||||||
ui::Engine::Ref().ShowWindow(this);
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ TextPrompt::TextPrompt(std::string title, std::string message, bool multiline, T
|
|||||||
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||||
cancelButton->SetActionCallback(new CloseAction(this, ResultCancel));
|
cancelButton->SetActionCallback(new CloseAction(this, ResultCancel));
|
||||||
AddComponent(cancelButton);
|
AddComponent(cancelButton);
|
||||||
|
SetCancelButton(cancelButton);
|
||||||
|
|
||||||
ui::Button * okayButton = new ui::Button(ui::Point(Size.X/2, Size.Y-16), ui::Point(Size.X/2, 16), "Okay");
|
ui::Button * okayButton = new ui::Button(ui::Point(Size.X/2, Size.Y-16), ui::Point(Size.X/2, 16), "Okay");
|
||||||
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignRight;
|
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignRight;
|
||||||
@ -67,6 +68,7 @@ TextPrompt::TextPrompt(std::string title, std::string message, bool multiline, T
|
|||||||
okayButton->Appearance.TextInactive = style::Colour::WarningTitle;
|
okayButton->Appearance.TextInactive = style::Colour::WarningTitle;
|
||||||
okayButton->SetActionCallback(new CloseAction(this, ResultOkay));
|
okayButton->SetActionCallback(new CloseAction(this, ResultOkay));
|
||||||
AddComponent(okayButton);
|
AddComponent(okayButton);
|
||||||
|
SetOkayButton(okayButton);
|
||||||
|
|
||||||
ui::Engine::Ref().ShowWindow(this);
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "interface/Slider.h"
|
#include "interface/Slider.h"
|
||||||
#include "search/Thumbnail.h"
|
#include "search/Thumbnail.h"
|
||||||
#include "simulation/SaveRenderer.h"
|
#include "simulation/SaveRenderer.h"
|
||||||
|
#include "dialogues/ConfirmPrompt.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "QuickOption.h"
|
#include "QuickOption.h"
|
||||||
|
|
||||||
@ -888,6 +889,22 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameView::ExitPrompt()
|
||||||
|
{
|
||||||
|
class ExitConfirmation: public ConfirmDialogueCallback {
|
||||||
|
public:
|
||||||
|
ExitConfirmation() {}
|
||||||
|
virtual void ConfirmCallback(ConfirmPrompt::DialogueResult result) {
|
||||||
|
if (result == ConfirmPrompt::ResultOkay)
|
||||||
|
{
|
||||||
|
ui::Engine::Ref().Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
virtual ~ExitConfirmation() { }
|
||||||
|
};
|
||||||
|
new ConfirmPrompt("You are about to quit", "Are you sure you want to exit the game?", new ExitConfirmation());
|
||||||
|
}
|
||||||
|
|
||||||
void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip)
|
void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip)
|
||||||
{
|
{
|
||||||
this->toolTip = toolTip;
|
this->toolTip = toolTip;
|
||||||
@ -1024,6 +1041,10 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
case 'y':
|
case 'y':
|
||||||
c->SwitchAir();
|
c->SwitchAir();
|
||||||
break;
|
break;
|
||||||
|
case KEY_ESCAPE:
|
||||||
|
case 'q':
|
||||||
|
ExitPrompt();
|
||||||
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
c->ToggleAHeat();
|
c->ToggleAHeat();
|
||||||
break;
|
break;
|
||||||
|
@ -142,6 +142,8 @@ public:
|
|||||||
void NotifyInfoTipChanged(GameModel * sender);
|
void NotifyInfoTipChanged(GameModel * sender);
|
||||||
void NotifyQuickOptionsChanged(GameModel * sender);
|
void NotifyQuickOptionsChanged(GameModel * sender);
|
||||||
|
|
||||||
|
void ExitPrompt();
|
||||||
|
|
||||||
virtual void ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip);
|
virtual void ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip);
|
||||||
|
|
||||||
virtual void OnMouseMove(int x, int y, int dx, int dy);
|
virtual void OnMouseMove(int x, int y, int dx, int dy);
|
||||||
|
@ -84,7 +84,7 @@ void Window::RemoveComponent(Component* c)
|
|||||||
|
|
||||||
void Window::OnTryExit(ExitMethod method)
|
void Window::OnTryExit(ExitMethod method)
|
||||||
{
|
{
|
||||||
if(cancelButton)
|
if(cancelButton && method != MouseOutside)
|
||||||
cancelButton->DoAction();
|
cancelButton->DoAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,11 +48,13 @@ LoginView::LoginView():
|
|||||||
AddComponent(infoLabel);
|
AddComponent(infoLabel);
|
||||||
|
|
||||||
AddComponent(loginButton);
|
AddComponent(loginButton);
|
||||||
|
SetOkayButton(loginButton);
|
||||||
loginButton->Appearance.HorizontalAlign = ui::Appearance::AlignRight;
|
loginButton->Appearance.HorizontalAlign = ui::Appearance::AlignRight;
|
||||||
loginButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
loginButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
loginButton->Appearance.TextInactive = style::Colour::ConfirmButton;
|
loginButton->Appearance.TextInactive = style::Colour::ConfirmButton;
|
||||||
loginButton->SetActionCallback(new LoginAction(this));
|
loginButton->SetActionCallback(new LoginAction(this));
|
||||||
AddComponent(cancelButton);
|
AddComponent(cancelButton);
|
||||||
|
SetCancelButton(cancelButton);
|
||||||
cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
cancelButton->SetActionCallback(new CancelAction(this));
|
cancelButton->SetActionCallback(new CancelAction(this));
|
||||||
@ -78,11 +80,6 @@ void LoginView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, boo
|
|||||||
else
|
else
|
||||||
FocusComponent(usernameField);
|
FocusComponent(usernameField);
|
||||||
break;
|
break;
|
||||||
case KEY_ENTER:
|
|
||||||
case KEY_RETURN:
|
|
||||||
if(IsFocused(passwordField))
|
|
||||||
loginButton->DoAction();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,8 @@ OptionsView::OptionsView():
|
|||||||
ui::Button * tempButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "OK");
|
ui::Button * tempButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "OK");
|
||||||
tempButton->SetActionCallback(new CloseAction(this));
|
tempButton->SetActionCallback(new CloseAction(this));
|
||||||
AddComponent(tempButton);
|
AddComponent(tempButton);
|
||||||
|
SetCancelButton(tempButton);
|
||||||
|
SetOkayButton(tempButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsView::NotifySettingsChanged(OptionsModel * sender)
|
void OptionsView::NotifySettingsChanged(OptionsModel * sender)
|
||||||
|
@ -75,6 +75,7 @@ PreviewView::PreviewView():
|
|||||||
openButton->SetIcon(IconOpen);
|
openButton->SetIcon(IconOpen);
|
||||||
openButton->SetActionCallback(new OpenAction(this));
|
openButton->SetActionCallback(new OpenAction(this));
|
||||||
AddComponent(openButton);
|
AddComponent(openButton);
|
||||||
|
SetOkayButton(openButton);
|
||||||
|
|
||||||
class FavAction: public ui::ButtonAction
|
class FavAction: public ui::ButtonAction
|
||||||
{
|
{
|
||||||
@ -291,10 +292,9 @@ void PreviewView::OnTick(float dt)
|
|||||||
c->Update();
|
c->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewView::OnMouseDown(int x, int y, unsigned button)
|
void PreviewView::OnTryExit(ExitMethod method)
|
||||||
{
|
{
|
||||||
if(!(x > Position.X && y > Position.Y && y < Position.Y+Size.Y && x < Position.X+Size.X)) //Clicked outside window
|
c->Exit();
|
||||||
c->Exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewView::OnMouseWheel(int x, int y, int d)
|
void PreviewView::OnMouseWheel(int x, int y, int d)
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
virtual void OnDraw();
|
virtual void OnDraw();
|
||||||
virtual void DoDraw();
|
virtual void DoDraw();
|
||||||
virtual void OnTick(float dt);
|
virtual void OnTick(float dt);
|
||||||
virtual void OnMouseDown(int x, int y, unsigned button);
|
virtual void OnTryExit(ExitMethod method);
|
||||||
virtual void OnMouseWheel(int x, int y, int d);
|
virtual void OnMouseWheel(int x, int y, int d);
|
||||||
virtual ~PreviewView();
|
virtual ~PreviewView();
|
||||||
};
|
};
|
||||||
|
@ -53,6 +53,7 @@ LocalSaveActivity::LocalSaveActivity(SaveFile save) :
|
|||||||
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||||
cancelButton->SetActionCallback(new CancelAction(this));
|
cancelButton->SetActionCallback(new CancelAction(this));
|
||||||
AddComponent(cancelButton);
|
AddComponent(cancelButton);
|
||||||
|
SetCancelButton(cancelButton);
|
||||||
|
|
||||||
ui::Button * okayButton = new ui::Button(ui::Point(Size.X-76, Size.Y-16), ui::Point(76, 16), "Save");
|
ui::Button * okayButton = new ui::Button(ui::Point(Size.X-76, Size.Y-16), ui::Point(76, 16), "Save");
|
||||||
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
@ -60,6 +61,7 @@ LocalSaveActivity::LocalSaveActivity(SaveFile save) :
|
|||||||
okayButton->Appearance.TextInactive = style::Colour::InformationTitle;
|
okayButton->Appearance.TextInactive = style::Colour::InformationTitle;
|
||||||
okayButton->SetActionCallback(new SaveAction(this));
|
okayButton->SetActionCallback(new SaveAction(this));
|
||||||
AddComponent(okayButton);
|
AddComponent(okayButton);
|
||||||
|
SetOkayButton(okayButton);
|
||||||
|
|
||||||
if(save.GetGameSave())
|
if(save.GetGameSave())
|
||||||
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), Size.X-16, -1, this);
|
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), Size.X-16, -1, this);
|
||||||
|
@ -80,6 +80,7 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
|
|||||||
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||||
cancelButton->SetActionCallback(new CancelAction(this));
|
cancelButton->SetActionCallback(new CancelAction(this));
|
||||||
AddComponent(cancelButton);
|
AddComponent(cancelButton);
|
||||||
|
SetCancelButton(cancelButton);
|
||||||
|
|
||||||
ui::Button * okayButton = new ui::Button(ui::Point((Size.X/2)-76, Size.Y-16), ui::Point(76, 16), "Save");
|
ui::Button * okayButton = new ui::Button(ui::Point((Size.X/2)-76, Size.Y-16), ui::Point(76, 16), "Save");
|
||||||
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
@ -87,6 +88,7 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
|
|||||||
okayButton->Appearance.TextInactive = style::Colour::InformationTitle;
|
okayButton->Appearance.TextInactive = style::Colour::InformationTitle;
|
||||||
okayButton->SetActionCallback(new SaveAction(this));
|
okayButton->SetActionCallback(new SaveAction(this));
|
||||||
AddComponent(okayButton);
|
AddComponent(okayButton);
|
||||||
|
SetOkayButton(okayButton);
|
||||||
|
|
||||||
if(save.GetGameSave())
|
if(save.GetGameSave())
|
||||||
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), (Size.X/2)-16, -1, this);
|
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), (Size.X/2)-16, -1, this);
|
||||||
|
@ -20,8 +20,13 @@ public:
|
|||||||
{
|
{
|
||||||
if(cc->activePreview->GetDoOpen() && cc->activePreview->GetSave())
|
if(cc->activePreview->GetDoOpen() && cc->activePreview->GetSave())
|
||||||
{
|
{
|
||||||
cc->searchModel->SetLoadedSave(new SaveInfo(*(cc->activePreview->GetSave())));
|
cc->searchModel->SetLoadedSave(cc->activePreview->GetSave());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cc->searchModel->SetLoadedSave(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,6 +166,8 @@ void SearchController::Selected(int saveID, bool selected)
|
|||||||
|
|
||||||
void SearchController::OpenSave(int saveID)
|
void SearchController::OpenSave(int saveID)
|
||||||
{
|
{
|
||||||
|
if(activePreview)
|
||||||
|
delete activePreview;
|
||||||
activePreview = new PreviewController(saveID, new OpenCallback(this));
|
activePreview = new PreviewController(saveID, new OpenCallback(this));
|
||||||
ui::Engine::Ref().ShowWindow(activePreview->GetView());
|
ui::Engine::Ref().ShowWindow(activePreview->GetView());
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,16 @@ void SearchModel::UpdateSaveList(int pageNumber, std::string query)
|
|||||||
|
|
||||||
void SearchModel::SetLoadedSave(SaveInfo * save)
|
void SearchModel::SetLoadedSave(SaveInfo * save)
|
||||||
{
|
{
|
||||||
loadedSave = save;
|
if(loadedSave != save && loadedSave)
|
||||||
|
delete loadedSave;
|
||||||
|
if(save)
|
||||||
|
{
|
||||||
|
loadedSave = new SaveInfo(*save);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loadedSave = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveInfo * SearchModel::GetLoadedSave(){
|
SaveInfo * SearchModel::GetLoadedSave(){
|
||||||
|
Loading…
Reference in New Issue
Block a user