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);
74 void onButtonHoveredOver(
const std::string& button);
79 void onViewUpdateStarted();
81 void onControlInterface(
PlayerID playerID);
82 bool onCancel(
const ToyMaker::ActionData& actionData,
const ToyMaker::ActionDefinition& actionDefinition);
84 std::shared_ptr<ToyMaker::SimObject> getLaunchButton(
PieceTypeID pieceTypeID,
PlayerID player);
85 std::shared_ptr<ToyMaker::SceneNode> getPlayerPanel(
PlayerID player);
86 std::shared_ptr<ToyMaker::SimObject> getEndTurnButton();
88 std::weak_ptr<ToyMaker::FixedActionBinding> handleCancel { declareFixedActionBinding(
89 "General",
"Cancel", [
this](
const ToyMaker::ActionData& actionData,
const ToyMaker::ActionDefinition& actionDefinition) {
90 return this->onCancel(actionData, actionDefinition);
94 ToyMaker::SignalObserver<const std::string&> mObserveButtonClicked {
95 *
this,
"ButtonClickedObserved",
96 [
this](
const std::string& button) { this->onButtonClicked(button); }
99 ToyMaker::SignalObserver<const std::string&> mObserveButtonHoveredOver {
100 *
this,
"ButtonHoveredOverObserved",
101 [
this](
const std::string& button) { this->onButtonHoveredOver(button); }
104 ToyMaker::SignalObserver<GamePhaseData> mObservePhaseUpdated {
105 *
this,
"PhaseUpdatedObserved",
106 [
this](
GamePhaseData phaseData) { this->onPhaseUpdated(phaseData); }
108 ToyMaker::SignalObserver<GameScoreData> mObserveScoreUpdated {
109 *
this,
"ScoreUpdatedObserved",
110 [
this](
GameScoreData scoreData) { this->onScoreUpdated(scoreData); }
112 ToyMaker::SignalObserver<PlayerData> mObservePlayerUpdated {
113 *
this,
"PlayerUpdatedObserved",
114 [
this](
PlayerData playerData) { this->onPlayerUpdated(playerData); }
116 ToyMaker::SignalObserver<DiceData> mObserveDiceUpdated {
117 *
this,
"DiceUpdatedObserved",
118 [
this](
DiceData diceData) { this->onDiceUpdated(diceData); }
120 ToyMaker::SignalObserver<MoveResultData> mObserveMoveMade {
121 *
this,
"MoveMadeObserved",
125 ToyMaker::SignalObserver<PlayerID> mObserveControlInterface {
126 *
this,
"ControlInterfaceObserved",
127 [
this](
PlayerID playerID) { this->onControlInterface(playerID); }
130 ToyMaker::Signal<> mSigDiceRollAttempted { *
this,
"DiceRollAttempted" };
131 ToyMaker::Signal<> mSigNextTurnAttempted { *
this,
"NextTurnAttempted" };
132 ToyMaker::Signal<PieceTypeID> mSigLaunchPieceInitiated { *
this,
"LaunchPieceInitiated" };
133 ToyMaker::Signal<PieceTypeID> mSigLaunchPieceHovered { *
this,
"LaunchPieceHovered" };
134 ToyMaker::Signal<> mSigLaunchPieceCanceled { *
this,
"LaunchPieceCanceled" };
136 ToyMaker::SignalObserver<> mObserveControllerReady {
137 *
this,
"ControllerReadyObserved",
138 [
this]() {this->onControllerReady();}
140 ToyMaker::Signal<std::string> mSigViewSubscribed {*
this,
"ViewSubscribed"};
142 ToyMaker::SignalObserver<> mObserveViewUpdateStarted {
143 *
this,
"ViewUpdateStartedObserved",
144 [
this](){ this->onViewUpdateStarted(); }
146 ToyMaker::Signal<std::string> mSigViewUpdateCompleted {
147 *
this,
"ViewUpdateCompleted"