Allow changing mission after initial selection
This commit is contained in:
parent
d5b65828aa
commit
a6c55d9869
|
@ -28,6 +28,7 @@ public:
|
|||
virtual ~AMIPresenter(){};
|
||||
|
||||
void vehicleStateUpdated() override;
|
||||
void nextScreen() override;
|
||||
|
||||
private:
|
||||
AMIPresenter();
|
||||
|
|
|
@ -17,7 +17,11 @@ public:
|
|||
model.tick();
|
||||
}
|
||||
|
||||
void setBackToMissionSelect(bool backToMissionSelect);
|
||||
bool getBackToMissionSelect() const;
|
||||
|
||||
private:
|
||||
bool backToMissionSelect;
|
||||
};
|
||||
|
||||
#endif // FRONTENDAPPLICATION_HPP
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef MISSIONSELECTPRESENTER_HPP
|
||||
#define MISSIONSELECTPRESENTER_HPP
|
||||
|
||||
#include "stw_defines.h"
|
||||
#include <gui/model/ModelListener.hpp>
|
||||
#include <mvp/Presenter.hpp>
|
||||
|
||||
|
@ -30,10 +31,14 @@ public:
|
|||
|
||||
void vehicleStateUpdated() override;
|
||||
|
||||
void nextScreen() override;
|
||||
|
||||
private:
|
||||
MissionSelectPresenter();
|
||||
|
||||
MissionSelectView &view;
|
||||
|
||||
Mission initialMission;
|
||||
};
|
||||
|
||||
#endif // MISSIONSELECTPRESENTER_HPP
|
||||
|
|
|
@ -33,3 +33,9 @@ void AMIPresenter::vehicleStateUpdated() {
|
|||
}
|
||||
view.setConePositions(vehicle_state.cone_pos, cone_count);
|
||||
}
|
||||
|
||||
void AMIPresenter::nextScreen() {
|
||||
FrontendApplication *app =
|
||||
static_cast<FrontendApplication *>(FrontendApplication::getInstance());
|
||||
app->gotoDebugViewScreenNoTransition();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,14 @@
|
|||
#include "gui/common/NamedField.hpp"
|
||||
|
||||
FrontendApplication::FrontendApplication(Model &m, FrontendHeap &heap)
|
||||
: FrontendApplicationBase(m, heap) {
|
||||
: FrontendApplicationBase(m, heap), backToMissionSelect(false) {
|
||||
namedFieldSort();
|
||||
}
|
||||
|
||||
void FrontendApplication::setBackToMissionSelect(bool backToMissionSelect) {
|
||||
this->backToMissionSelect = backToMissionSelect;
|
||||
}
|
||||
|
||||
bool FrontendApplication::getBackToMissionSelect() const {
|
||||
return backToMissionSelect;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "gui/common/FrontendApplication.hpp"
|
||||
#include <gui/debugview_screen/DebugViewPresenter.hpp>
|
||||
#include <gui/debugview_screen/DebugViewView.hpp>
|
||||
|
||||
|
@ -10,6 +11,8 @@ void DebugViewPresenter::deactivate() {}
|
|||
void DebugViewPresenter::vehicleStateUpdated() { view.updateFieldValues(); }
|
||||
|
||||
void DebugViewPresenter::nextScreen() {
|
||||
static_cast<FrontendApplication *>(Application::getInstance())
|
||||
->gotoDriverViewScreenNoTransition();
|
||||
FrontendApplication *app =
|
||||
static_cast<FrontendApplication *>(Application::getInstance());
|
||||
app->setBackToMissionSelect(true);
|
||||
app->gotoMissionSelectScreenNoTransition();
|
||||
}
|
||||
|
|
|
@ -9,13 +9,19 @@
|
|||
MissionSelectPresenter::MissionSelectPresenter(MissionSelectView &v)
|
||||
: view(v) {}
|
||||
|
||||
void MissionSelectPresenter::activate() {}
|
||||
void MissionSelectPresenter::activate() {
|
||||
initialMission = vehicle_state.active_mission;
|
||||
}
|
||||
|
||||
void MissionSelectPresenter::deactivate() {}
|
||||
|
||||
void MissionSelectPresenter::vehicleStateUpdated() {
|
||||
FrontendApplication *app =
|
||||
static_cast<FrontendApplication *>(FrontendApplication::getInstance());
|
||||
if (app->getBackToMissionSelect() &&
|
||||
vehicle_state.active_mission == initialMission) {
|
||||
return;
|
||||
}
|
||||
switch (vehicle_state.active_mission) {
|
||||
case MISSION_NONE:
|
||||
// Do nothing
|
||||
|
@ -27,3 +33,12 @@ void MissionSelectPresenter::vehicleStateUpdated() {
|
|||
app->gotoAMIScreenNoTransition();
|
||||
}
|
||||
}
|
||||
|
||||
void MissionSelectPresenter::nextScreen() {
|
||||
FrontendApplication *app =
|
||||
static_cast<FrontendApplication *>(FrontendApplication::getInstance());
|
||||
if (app->getBackToMissionSelect()) {
|
||||
app->gotoAMIScreenNoTransition();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue