28class UrUIView:
public ToyMaker::SimObjectAspect<UrUIView> {
30 UrUIView(): ToyMaker::SimObjectAspect<UrUIView>{0} {}
32 inline static std::string getSimObjectAspectTypeName() {
return "UrUIView"; }
33 static std::shared_ptr<BaseSimObjectAspect> create(
const nlohmann::json& jsonAspectProperties);
34 std::shared_ptr<BaseSimObjectAspect> clone()
const override;
36 void onActivated()
override;
37 void variableUpdate(uint32_t timeStep)
override;
42 SWALLOW=PieceTypeID::SWALLOW,
43 STORMBIRD=PieceTypeID::STORMBIRD,
44 RAVEN=PieceTypeID::RAVEN,
45 ROOSTER=PieceTypeID::ROOSTER,
46 EAGLE=PieceTypeID::EAGLE,
57 std::weak_ptr<ToyMaker::SimObject> mGameOfUrController {};
58 std::string mControllerPath {};
60 Mode mMode { Mode::INTERACT };
61 std::vector<std::reference_wrapper<ToyMaker::UIText>> mUpdatedTextElements {};
62 uint32_t mAnimationTimeMillis { 0 };
63 uint32_t mBlinkLengthMillis { 2500 };
64 uint32_t mBlinkPeriodMillis { 400 };
66 static const std::map<std::string, Buttons> kButtonEnumMap;
68 void onControllerReady();
70 void updateText(
const std::string& path,
const std::string& text);
71 void reactivateControls();
73 void onButtonClicked(
const std::string& button);
78 void onViewUpdateStarted();
80 void onControlInterface(
PlayerID playerID);
81 bool onCancel(
const ToyMaker::ActionData& actionData,
const ToyMaker::ActionDefinition& actionDefinition);
83 std::shared_ptr<ToyMaker::SimObject> getLaunchButton(
PieceTypeID pieceTypeID,
PlayerID player);
84 std::shared_ptr<ToyMaker::SceneNode> getPlayerPanel(
PlayerID player);
85 std::shared_ptr<ToyMaker::SimObject> getEndTurnButton();
87 std::weak_ptr<ToyMaker::FixedActionBinding> handleCancel { declareFixedActionBinding(
88 "General",
"Cancel", [
this](
const ToyMaker::ActionData& actionData,
const ToyMaker::ActionDefinition& actionDefinition) {
89 return this->onCancel(actionData, actionDefinition);
93 ToyMaker::SignalObserver<const std::string&> mObserveButtonClicked {
94 *
this,
"ButtonClickedObserved",
95 [
this](
const std::string& button) { this->onButtonClicked(button); }
98 ToyMaker::SignalObserver<GamePhaseData> mObservePhaseUpdated {
99 *
this,
"PhaseUpdatedObserved",
100 [
this](
GamePhaseData phaseData) { this->onPhaseUpdated(phaseData); }
102 ToyMaker::SignalObserver<GameScoreData> mObserveScoreUpdated {
103 *
this,
"ScoreUpdatedObserved",
104 [
this](
GameScoreData scoreData) { this->onScoreUpdated(scoreData); }
106 ToyMaker::SignalObserver<PlayerData> mObservePlayerUpdated {
107 *
this,
"PlayerUpdatedObserved",
108 [
this](
PlayerData playerData) { this->onPlayerUpdated(playerData); }
110 ToyMaker::SignalObserver<DiceData> mObserveDiceUpdated {
111 *
this,
"DiceUpdatedObserved",
112 [
this](
DiceData diceData) { this->onDiceUpdated(diceData); }
114 ToyMaker::SignalObserver<MoveResultData> mObserveMoveMade {
115 *
this,
"MoveMadeObserved",
119 ToyMaker::SignalObserver<PlayerID> mObserveControlInterface {
120 *
this,
"ControlInterfaceObserved",
121 [
this](
PlayerID playerID) { this->onControlInterface(playerID); }
124 ToyMaker::Signal<> mSigDiceRollAttempted { *
this,
"DiceRollAttempted" };
125 ToyMaker::Signal<> mSigNextTurnAttempted { *
this,
"NextTurnAttempted" };
126 ToyMaker::Signal<PieceTypeID> mSigLaunchPieceInitiated { *
this,
"LaunchPieceInitiated" };
127 ToyMaker::Signal<> mSigLaunchPieceCanceled { *
this,
"LaunchPieceCanceled" };
129 ToyMaker::SignalObserver<> mObserveControllerReady {
130 *
this,
"ControllerReadyObserved",
131 [
this]() {this->onControllerReady();}
133 ToyMaker::Signal<std::string> mSigViewSubscribed {*
this,
"ViewSubscribed"};
135 ToyMaker::SignalObserver<> mObserveViewUpdateStarted {
136 *
this,
"ViewUpdateStartedObserved",
137 [
this](){ this->onViewUpdateStarted(); }
139 ToyMaker::Signal<std::string> mSigViewUpdateCompleted {
140 *
this,
"ViewUpdateCompleted"