mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-28 00:13:36 +00:00
refactor: extract ITutorial interface and move TutorialEnum to minecraft
This commit is contained in:
parent
6fd9148e17
commit
557dd7430b
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/UI/All Platforms/UIEnums.h"
|
||||
#include "minecraft/GameEnums.h"
|
||||
#include "minecraft/GameTypes.h"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "app/common/SaveManager.h"
|
||||
#include "app/common/SkinManager.h"
|
||||
#include "app/common/TerrainFeatureManager.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/UI/All Platforms/ArchiveFile.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "minecraft/client/model/SkinBox.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "app/common/Tutorial/Constraints/TutorialConstraint.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
#include "minecraft/client/multiplayer/ClientConnection.h"
|
||||
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <cstddef>
|
||||
|
||||
#include "TutorialConstraint.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/phys/AABB.h"
|
||||
|
||||
class AABB;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
#define FULL_TUTORIAL_PROGRESS_2_X_2_Crafting 1
|
||||
#define FULL_TUTORIAL_PROGRESS_3_X_3_Crafting 2
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "app/common/Tutorial/Hints/TutorialHint.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
|
||||
#include "minecraft/world/phys/AABB.h"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "TutorialHint.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/phys/AABB.h"
|
||||
|
||||
class AABB;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "TutorialHint.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class DiggerItem;
|
||||
class Level;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "app/common/Tutorial/Hints/TutorialHint.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
LookAtEntityHint::LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial,
|
||||
int descriptionId, int titleId,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// using namespace std;
|
||||
|
||||
#include "TutorialHint.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "java/Class.h"
|
||||
|
||||
class ItemInstance;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "app/common/Tutorial/Hints/TutorialHint.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/item/Item.h"
|
||||
|
||||
LookAtTileHint::LookAtTileHint(eTutorial_Hint id, Tutorial* tutorial,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// using namespace std;
|
||||
|
||||
#include "TutorialHint.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class ItemInstance;
|
||||
class Tutorial;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "app/common/Tutorial/Hints/TutorialHint.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/item/ItemInstance.h"
|
||||
|
||||
TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[],
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// using namespace std;
|
||||
|
||||
#include "TutorialHint.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class ItemInstance;
|
||||
class Tutorial;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "TutorialHint.h"
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
|
||||
#include "minecraft/world/level/material/Material.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "java/Class.h"
|
||||
|
||||
class Entity;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "app/common/Tutorial/Constraints/TutorialConstraint.h"
|
||||
#include "app/common/Tutorial/Tasks/TutorialTask.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
AreaTask::AreaTask(eTutorial_State state, Tutorial* tutorial,
|
||||
std::vector<TutorialConstraint*>* inConstraints,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "TutorialTask.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class Tutorial;
|
||||
class TutorialConstraint;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "app/common/Tutorial/Constraints/InputConstraint.h"
|
||||
#include "app/common/Tutorial/Tasks/TutorialTask.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/linux/Linux_UIController.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// using namespace std;
|
||||
|
||||
#include "TutorialTask.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class Tutorial;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "app/common/Tutorial/Tasks/TutorialTask.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
FullTutorialActiveTask::FullTutorialActiveTask(
|
||||
Tutorial* tutorial,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// using namespace std;
|
||||
|
||||
#include "TutorialTask.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class Tutorial;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tasks/ChoiceTask.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "java/Class.h"
|
||||
#include "minecraft/world/entity/Entity.h"
|
||||
#include "minecraft/world/entity/animal/EntityHorse.h"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "ChoiceTask.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class Tutorial;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tasks/TutorialTask.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
ProcedureCompoundTask::~ProcedureCompoundTask() {
|
||||
for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "TutorialTask.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class Tutorial;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <vector>
|
||||
|
||||
// using namespace std;
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class Level;
|
||||
class Tutorial;
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "TutorialEnum.h"
|
||||
#include "TutorialMessage.h"
|
||||
#include "app/common/Tutorial/Constraints/TutorialConstraint.h"
|
||||
#include "app/common/Tutorial/Hints/TutorialHint.h"
|
||||
#include "app/common/Tutorial/Tasks/TutorialTask.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/ITutorial.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "util/Timer.h"
|
||||
|
||||
class Entity;
|
||||
|
|
@ -39,7 +39,7 @@ class Level;
|
|||
class CXuiScene;
|
||||
class Player;
|
||||
|
||||
class Tutorial {
|
||||
class Tutorial : public ITutorial {
|
||||
public:
|
||||
class PopupMessageDetails {
|
||||
public:
|
||||
|
|
@ -144,7 +144,7 @@ public:
|
|||
|
||||
int getPad() { return m_iPad; }
|
||||
|
||||
virtual bool isStateCompleted(eTutorial_State state);
|
||||
bool isStateCompleted(eTutorial_State state) override;
|
||||
virtual void setStateCompleted(eTutorial_State state);
|
||||
bool isHintCompleted(eTutorial_Hint hint);
|
||||
void setHintCompleted(eTutorial_Hint hint);
|
||||
|
|
@ -154,15 +154,18 @@ public:
|
|||
void setCompleted(int completableId);
|
||||
bool getCompleted(int completableId);
|
||||
|
||||
void changeTutorialState(eTutorial_State newState,
|
||||
UIScene* scene = nullptr);
|
||||
void changeTutorialState(eTutorial_State newState, UIScene* scene);
|
||||
void changeTutorialState(eTutorial_State newState) override {
|
||||
changeTutorialState(newState, nullptr);
|
||||
}
|
||||
bool isSelectedItemState();
|
||||
|
||||
bool setMessage(PopupMessageDetails* message);
|
||||
bool setMessage(TutorialHint* hint, PopupMessageDetails* message);
|
||||
bool setMessage(const std::string& message, int icon, int auxValue);
|
||||
bool setMessage(const std::string& message, int icon,
|
||||
int auxValue) override;
|
||||
|
||||
void showTutorialPopup(bool show);
|
||||
void showTutorialPopup(bool show) override;
|
||||
|
||||
void useItemOn(Level* level, std::shared_ptr<ItemInstance> item, int x,
|
||||
int y, int z, bool bTestUseOnly = false);
|
||||
|
|
@ -176,18 +179,18 @@ public:
|
|||
|
||||
void handleUIInput(int iAction);
|
||||
void createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake);
|
||||
void onCrafted(std::shared_ptr<ItemInstance> item);
|
||||
void onCrafted(std::shared_ptr<ItemInstance> item) override;
|
||||
void onTake(std::shared_ptr<ItemInstance> item,
|
||||
unsigned int invItemCountAnyAux,
|
||||
unsigned int invItemCountThisAux);
|
||||
void onSelectedItemChanged(std::shared_ptr<ItemInstance> item);
|
||||
void onLookAt(int id, int iData = 0);
|
||||
void onLookAtEntity(std::shared_ptr<Entity> entity);
|
||||
void onRideEntity(std::shared_ptr<Entity> entity);
|
||||
unsigned int invItemCountThisAux) override;
|
||||
void onSelectedItemChanged(std::shared_ptr<ItemInstance> item) override;
|
||||
void onLookAt(int id, int iData = 0) override;
|
||||
void onLookAtEntity(std::shared_ptr<Entity> entity) override;
|
||||
void onRideEntity(std::shared_ptr<Entity> entity) override;
|
||||
void onEffectChanged(MobEffect* effect, bool bRemoved = false);
|
||||
|
||||
bool canMoveToPosition(double xo, double yo, double zo, double xt,
|
||||
double yt, double zt);
|
||||
double yt, double zt) override;
|
||||
bool isInputAllowed(int mapping);
|
||||
|
||||
void AddGlobalConstraint(TutorialConstraint* c);
|
||||
|
|
|
|||
|
|
@ -20,18 +20,17 @@ public:
|
|||
TutorialMode(int iPad, Minecraft* minecraft, ClientConnection* connection);
|
||||
virtual ~TutorialMode();
|
||||
|
||||
virtual void startDestroyBlock(int x, int y, int z, int face);
|
||||
virtual bool destroyBlock(int x, int y, int z, int face);
|
||||
virtual void tick();
|
||||
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
||||
std::shared_ptr<ItemInstance> item, int x, int y,
|
||||
int z, int face, Vec3* hit,
|
||||
bool bTestUseOnly = false,
|
||||
bool* pbUsedItem = nullptr);
|
||||
virtual void attack(std::shared_ptr<Player> player,
|
||||
std::shared_ptr<Entity> entity);
|
||||
void startDestroyBlock(int x, int y, int z, int face) override;
|
||||
bool destroyBlock(int x, int y, int z, int face) override;
|
||||
void tick() override;
|
||||
bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
||||
std::shared_ptr<ItemInstance> item, int x, int y, int z,
|
||||
int face, Vec3* hit, bool bTestUseOnly = false,
|
||||
bool* pbUsedItem = nullptr) override;
|
||||
void attack(std::shared_ptr<Player> player,
|
||||
std::shared_ptr<Entity> entity) override;
|
||||
|
||||
virtual bool isInputAllowed(int mapping);
|
||||
bool isInputAllowed(int mapping) override;
|
||||
|
||||
Tutorial* getTutorial() { return tutorial; }
|
||||
Tutorial* getTutorial() override { return tutorial; }
|
||||
};
|
||||
|
|
@ -234,8 +234,8 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips() {
|
|||
void IUIScene_AbstractContainerMenu::onMouseTick() {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[getPad()] != nullptr) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||
Tutorial* tutorial = static_cast<Tutorial*>(
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial());
|
||||
if (tutorial != nullptr) {
|
||||
if (ui.IsTutorialVisible(getPad()) &&
|
||||
!tutorial->isInputAllowed(ACTION_MENU_UP)) {
|
||||
|
|
@ -1096,8 +1096,8 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction,
|
|||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[getPad()] != nullptr) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||
Tutorial* tutorial = static_cast<Tutorial*>(
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial());
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->handleUIInput(iAction);
|
||||
if (ui.IsTutorialVisible(getPad()) &&
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "UIStructs.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/UI/All Platforms/UIEnums.h"
|
||||
|
||||
class HtmlString;
|
||||
|
|
|
|||
|
|
@ -153,8 +153,8 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
|
|||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
if (pMinecraft->localgameModes[getPad()] != nullptr) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||
Tutorial* tutorial = static_cast<Tutorial*>(
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial());
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->handleUIInput(iAction);
|
||||
if (ui.IsTutorialVisible(getPad()) &&
|
||||
|
|
@ -211,8 +211,9 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
|
|||
// iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
||||
|
||||
if (pMinecraft->localgameModes[iPad] != nullptr) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[iPad]->getTutorial();
|
||||
Tutorial* tutorial = static_cast<Tutorial*>(
|
||||
pMinecraft->localgameModes[iPad]
|
||||
->getTutorial());
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->onCrafted(pTempItemInst);
|
||||
}
|
||||
|
|
@ -246,8 +247,8 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
|
|||
// iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
||||
|
||||
if (pMinecraft->localgameModes[iPad] != nullptr) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[iPad]->getTutorial();
|
||||
Tutorial* tutorial = static_cast<Tutorial*>(
|
||||
pMinecraft->localgameModes[iPad]->getTutorial());
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->createItemSelected(
|
||||
pTempItemInst,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/client/multiplayer/MultiPlayerGameMode.h"
|
||||
#include "minecraft/world/item/Item.h"
|
||||
#include "minecraft/world/item/crafting/Recipy.h"
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
|
|||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
if (pMinecraft->localgameModes[getPad()] != nullptr) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||
Tutorial* tutorial = static_cast<Tutorial*>(
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial());
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->handleUIInput(iAction);
|
||||
if (ui.IsTutorialVisible(getPad()) &&
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "minecraft/util/HtmlString.h"
|
||||
#include "minecraft/world/inventory/MerchantMenu.h"
|
||||
#include "minecraft/world/item/Rarity.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
#include "app/common/UI/UILayer.h"
|
||||
#include "app/common/UI/UIScene.h"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include <utility>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
#include "app/common/UI/Controls/UIControl_SlotList.h"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/Controls/UIControl_BeaconEffectButton.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Controls/UIControl_Base.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/Controls/UIControl_EnchantmentBook.h"
|
||||
#include "app/common/UI/Controls/UIControl_EnchantmentButton.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
#include "app/common/UI/Controls/UIControl_SlotList.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
#include "app/common/UI/Controls/UIControl_Progress.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/Controls/UIControl_MinecraftPlayer.h"
|
||||
#include "app/common/UI/Controls/UIControl_SlotList.h"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Controls/UIControl_Label.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "platform/game/game.h"
|
||||
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialEnum.h"
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Controls/UIControl_HTMLLabel.h"
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
#include "minecraft/client/skins/ISkinAssetData.h"
|
||||
#include "app/common/Network/Socket.h"
|
||||
#include "app/common/Tutorial/FullTutorialMode.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "minecraft/world/tutorial/ITutorial.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h"
|
||||
#include "app/linux/Linux_UIController.h"
|
||||
|
|
@ -2525,9 +2524,11 @@ void ClientConnection::handleRespawn(std::shared_ptr<RespawnPacket> packet) {
|
|||
// minecraft->addPendingLocalConnection(m_userIndex, this);
|
||||
|
||||
if (minecraft->localgameModes[m_userIndex] != nullptr) {
|
||||
TutorialMode* gameMode =
|
||||
(TutorialMode*)minecraft->localgameModes[m_userIndex];
|
||||
gameMode->getTutorial()->showTutorialPopup(false);
|
||||
ITutorial* tutorial =
|
||||
minecraft->localgameModes[m_userIndex]->getTutorial();
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->showTutorialPopup(false);
|
||||
}
|
||||
}
|
||||
|
||||
// 4J-JEV: Fix for Durango #156334 - Content: UI: Rich Presence 'In the
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Entity;
|
|||
class Level;
|
||||
class Minecraft;
|
||||
class Player;
|
||||
class Tutorial;
|
||||
class ITutorial;
|
||||
|
||||
class MultiPlayerGameMode {
|
||||
private:
|
||||
|
|
@ -91,5 +91,5 @@ public:
|
|||
// 4J Stu - Added for tutorial checks
|
||||
virtual bool isInputAllowed(int mapping) { return true; }
|
||||
virtual bool isTutorial() { return false; }
|
||||
virtual Tutorial* getTutorial() { return nullptr; }
|
||||
virtual ITutorial* getTutorial() { return nullptr; }
|
||||
};
|
||||
|
|
@ -32,8 +32,7 @@
|
|||
#include "Pos.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "platform/profile/ProfileConstants.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "minecraft/world/tutorial/ITutorial.h"
|
||||
#include "app/linux/Linux_UIController.h"
|
||||
#include "minecraft/SharedConstants.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
|
|
@ -1221,9 +1220,11 @@ bool LocalPlayer::hasPermission(EGameCommand command) {
|
|||
|
||||
void LocalPlayer::onCrafted(std::shared_ptr<ItemInstance> item) {
|
||||
if (minecraft->localgameModes[m_iPad] != nullptr) {
|
||||
TutorialMode* gameMode =
|
||||
(TutorialMode*)minecraft->localgameModes[m_iPad];
|
||||
gameMode->getTutorial()->onCrafted(item);
|
||||
ITutorial* tutorial =
|
||||
minecraft->localgameModes[m_iPad]->getTutorial();
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->onCrafted(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1646,10 +1647,11 @@ void LocalPlayer::handleCollectItem(std::shared_ptr<ItemInstance> item) {
|
|||
}
|
||||
}
|
||||
}
|
||||
TutorialMode* gameMode =
|
||||
(TutorialMode*)minecraft->localgameModes[m_iPad];
|
||||
gameMode->getTutorial()->onTake(item, itemCountAnyAux,
|
||||
itemCountThisAux);
|
||||
ITutorial* tutorial =
|
||||
minecraft->localgameModes[m_iPad]->getTutorial();
|
||||
if (tutorial != nullptr) {
|
||||
tutorial->onTake(item, itemCountAnyAux, itemCountThisAux);
|
||||
}
|
||||
}
|
||||
|
||||
if (ui.IsContainerMenuDisplayed(m_iPad)) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "MinecraftServer.h"
|
||||
#include "Settings.h"
|
||||
#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "minecraft/world/tutorial/ITutorial.h"
|
||||
#include "java/Class.h"
|
||||
#include "java/JavaMath.h"
|
||||
#include "minecraft/GameEnums.h"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class Player;
|
|||
class ItemInstance;
|
||||
class Entity;
|
||||
|
||||
class Tutorial;
|
||||
class ITutorial;
|
||||
|
||||
class GameMode {
|
||||
protected:
|
||||
|
|
@ -70,5 +70,5 @@ public:
|
|||
// 4J Stu - Added for tutorial checks
|
||||
virtual bool isInputAllowed(int mapping) { return true; }
|
||||
virtual bool isTutorial() { return false; }
|
||||
virtual Tutorial* getTutorial() { return nullptr; }
|
||||
virtual ITutorial* getTutorial() { return nullptr; }
|
||||
};
|
||||
|
|
|
|||
46
targets/minecraft/world/tutorial/ITutorial.h
Normal file
46
targets/minecraft/world/tutorial/ITutorial.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "minecraft/world/tutorial/TutorialEnum.h"
|
||||
|
||||
class Entity;
|
||||
class ItemInstance;
|
||||
|
||||
// Domain interface for the player tutorial.
|
||||
//
|
||||
// minecraft/ consumers (Player, GameMode, ClientConnection, the player
|
||||
// list) need to forward gameplay events into the tutorial system but
|
||||
// they should not depend on the heavyweight Tutorial implementation
|
||||
// in app/common/Tutorial/. The concrete Tutorial in app/ inherits
|
||||
// from this interface; minecraft/ only sees ITutorial*.
|
||||
//
|
||||
// Tutorial state and hint enums (eTutorial_State, eTutorial_Hint)
|
||||
// remain in minecraft/world/tutorial/TutorialEnum.h, which is itself a
|
||||
// content-only header that minecraft/ can safely include.
|
||||
class ITutorial {
|
||||
public:
|
||||
virtual ~ITutorial() = default;
|
||||
|
||||
[[nodiscard]] virtual bool isStateCompleted(eTutorial_State state) = 0;
|
||||
virtual void changeTutorialState(eTutorial_State newState) = 0;
|
||||
|
||||
virtual bool setMessage(const std::string& message, int icon,
|
||||
int auxValue) = 0;
|
||||
|
||||
virtual void showTutorialPopup(bool show) = 0;
|
||||
|
||||
virtual void onCrafted(std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void onTake(std::shared_ptr<ItemInstance> item,
|
||||
unsigned int invItemCountAnyAux,
|
||||
unsigned int invItemCountThisAux) = 0;
|
||||
virtual void onSelectedItemChanged(std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void onLookAt(int id, int iData = 0) = 0;
|
||||
virtual void onLookAtEntity(std::shared_ptr<Entity> entity) = 0;
|
||||
virtual void onRideEntity(std::shared_ptr<Entity> entity) = 0;
|
||||
|
||||
[[nodiscard]] virtual bool canMoveToPosition(double xo, double yo,
|
||||
double zo, double xt,
|
||||
double yt, double zt) = 0;
|
||||
};
|
||||
Loading…
Reference in a new issue