- Extended TutorialMessages into a message system that shows up every time a new game is started.
-- instead of tutorial(my message), use message(my message) for such messages. -- Counting on people to use it, now that it's here ;)
This commit is contained in:
@@ -886,14 +886,15 @@ public:
|
|||||||
JQuad * mBg[9];
|
JQuad * mBg[9];
|
||||||
bool mUserCloseRequest, mDontShow;
|
bool mUserCloseRequest, mDontShow;
|
||||||
bool mIsImage;
|
bool mIsImage;
|
||||||
|
int mLimit;
|
||||||
|
|
||||||
ATutorialMessage(MTGCardInstance * source, string message);
|
ATutorialMessage(MTGCardInstance * source, string message, int limit = 1);
|
||||||
|
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
bool CheckUserInput(JButton key);
|
bool CheckUserInput(JButton key);
|
||||||
void Render();
|
void Render();
|
||||||
string getOptionName();
|
string getOptionName();
|
||||||
bool alreadyShown();
|
int alreadyShown();
|
||||||
|
|
||||||
ATutorialMessage * clone() const;
|
ATutorialMessage * clone() const;
|
||||||
~ATutorialMessage();
|
~ATutorialMessage();
|
||||||
|
|||||||
@@ -3616,7 +3616,7 @@ ABlinkGeneric::~ABlinkGeneric()
|
|||||||
|
|
||||||
ATutorialMessage * ATutorialMessage::Current = NULL;
|
ATutorialMessage * ATutorialMessage::Current = NULL;
|
||||||
|
|
||||||
ATutorialMessage::ATutorialMessage(MTGCardInstance * source, string message) : MTGAbility(0, source), IconButtonsController(0, 0)
|
ATutorialMessage::ATutorialMessage(MTGCardInstance * source, string message, int limit) : MTGAbility(0, source), IconButtonsController(0, 0), mLimit(limit)
|
||||||
{
|
{
|
||||||
mBgTex = NULL;
|
mBgTex = NULL;
|
||||||
|
|
||||||
@@ -3649,7 +3649,7 @@ ATutorialMessage::ATutorialMessage(MTGCardInstance * source, string message) : M
|
|||||||
mX = 0;
|
mX = 0;
|
||||||
mY = -SCREEN_HEIGHT_F - 0.1f; //Offscreen
|
mY = -SCREEN_HEIGHT_F - 0.1f; //Offscreen
|
||||||
}
|
}
|
||||||
mDontShow = mUserCloseRequest = alreadyShown();
|
mDontShow = mUserCloseRequest = (mLimit > 0) && (alreadyShown() >= mLimit);
|
||||||
|
|
||||||
if(mDontShow)
|
if(mDontShow)
|
||||||
forceDestroy = 1;
|
forceDestroy = 1;
|
||||||
@@ -3664,9 +3664,9 @@ string ATutorialMessage::getOptionName()
|
|||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ATutorialMessage::alreadyShown()
|
int ATutorialMessage::alreadyShown()
|
||||||
{
|
{
|
||||||
return options[getOptionName()].number ? true : false;
|
return options[getOptionName()].number;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ATutorialMessage::CheckUserInput(JButton key)
|
bool ATutorialMessage::CheckUserInput(JButton key)
|
||||||
@@ -3726,8 +3726,12 @@ void ATutorialMessage::Update(float dt)
|
|||||||
void ATutorialMessage::ButtonPressed(int controllerId, int controlId)
|
void ATutorialMessage::ButtonPressed(int controllerId, int controlId)
|
||||||
{
|
{
|
||||||
//TODO : cancel ALL tips/tutorials for JGE_BTN_SEC?
|
//TODO : cancel ALL tips/tutorials for JGE_BTN_SEC?
|
||||||
options[getOptionName()].number = 1;
|
if (mLimit)
|
||||||
|
{
|
||||||
|
string optionName = getOptionName();
|
||||||
|
options[optionName].number = options[optionName].number + 1;
|
||||||
options.save(); //TODO: if we experience I/O slowness in tutorials, move this save at the end of a turn, or at the end of the game.
|
options.save(); //TODO: if we experience I/O slowness in tutorials, move this save at the end of a turn, or at the end of the game.
|
||||||
|
}
|
||||||
mElapsed = 0;
|
mElapsed = 0;
|
||||||
mUserCloseRequest = true;
|
mUserCloseRequest = true;
|
||||||
}
|
}
|
||||||
@@ -3876,7 +3880,7 @@ void ATutorialMessage::Render()
|
|||||||
ATutorialMessage * ATutorialMessage::clone() const
|
ATutorialMessage * ATutorialMessage::clone() const
|
||||||
{
|
{
|
||||||
ATutorialMessage * copy = NEW ATutorialMessage(*this);
|
ATutorialMessage * copy = NEW ATutorialMessage(*this);
|
||||||
copy->mUserCloseRequest = copy->alreadyShown();
|
copy->mUserCloseRequest = (copy->alreadyShown() > 0);
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -737,6 +737,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
|
|
||||||
//This one is not a real ability, it displays a message on the screen. We use this for tutorials
|
//This one is not a real ability, it displays a message on the screen. We use this for tutorials
|
||||||
// Triggers need to be checked above this one, as events are usuallly what will trigger (...) these messages
|
// Triggers need to be checked above this one, as events are usuallly what will trigger (...) these messages
|
||||||
|
{
|
||||||
vector<string> splitMsg = parseBetween(s, "tutorial(", ")");
|
vector<string> splitMsg = parseBetween(s, "tutorial(", ")");
|
||||||
if (splitMsg.size())
|
if (splitMsg.size())
|
||||||
{
|
{
|
||||||
@@ -744,6 +745,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return NEW ATutorialMessage(card, msg);
|
return NEW ATutorialMessage(card, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splitMsg = parseBetween(s, "message(", ")");
|
||||||
|
if (splitMsg.size())
|
||||||
|
{
|
||||||
|
string msg = splitMsg[1];
|
||||||
|
return NEW ATutorialMessage(card, msg, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int restrictions = parseRestriction(s);
|
int restrictions = parseRestriction(s);
|
||||||
|
|
||||||
string newName = "";
|
string newName = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user