I'm still planning on a more ambitious navigation mod, but this is a simple interim change to the existing navigation model that allows you to use the up/down keys to navigate directly to an avatar. This means that if you open your card hand & need to cast a spell that targets the enemy avatar, you can simply hit the up key a couple of times instead of navigating left (through potentially a huge number of cards if you're in a long, drawn out match).
This commit is contained in:
@@ -33,6 +33,7 @@ public:
|
||||
ActionLayer * actionLayer();
|
||||
ActionStack * stackLayer();
|
||||
GuiCombat * combatLayer();
|
||||
GuiAvatars * GetAvatars();
|
||||
void init();
|
||||
virtual void Update(float dt, Player * player);
|
||||
void CheckUserInput(int isAI);
|
||||
|
||||
@@ -20,9 +20,11 @@ class GuiAvatars : public GuiLayer
|
||||
|
||||
|
||||
public:
|
||||
GuiAvatars(CardSelector*);
|
||||
GuiAvatars(CardSelector*);
|
||||
~GuiAvatars();
|
||||
// virtual void Render();
|
||||
|
||||
GuiAvatar* GetSelf();
|
||||
GuiAvatar* GetOpponent();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void Activate(PlayGuiObject* c);
|
||||
|
||||
@@ -158,6 +158,23 @@ bool CardSelector::CheckUserInput(JButton key)
|
||||
lasts[oldowner] = SelectorMemory(oldactive);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// active card hasn't changed - that means we're probably at an edge of the battlefield.
|
||||
// check if we're not already a selected avatar - if not, select one depending whether we're going up/down.
|
||||
GuiAvatar* avatar = dynamic_cast<GuiAvatar*>(active);
|
||||
if (!avatar)
|
||||
{
|
||||
if (key == JGE_BTN_DOWN)
|
||||
{
|
||||
active = duel->GetAvatars()->GetSelf();
|
||||
}
|
||||
else if (key == JGE_BTN_UP)
|
||||
{
|
||||
active = duel->GetAvatars()->GetOpponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (active != oldactive) {
|
||||
{ CardView* c = dynamic_cast<CardView*>(oldactive); if (c) c->zoom = 1.0f; }
|
||||
{ CardView* c = dynamic_cast<CardView*>(active); if (c) c->zoom = 1.4f; }
|
||||
|
||||
@@ -104,6 +104,11 @@ ActionLayer * DuelLayers::actionLayer(){
|
||||
return action;
|
||||
}
|
||||
|
||||
GuiAvatars * DuelLayers::GetAvatars()
|
||||
{
|
||||
return avatars;
|
||||
}
|
||||
|
||||
DuelLayers::DuelLayers() : nbitems(0) {}
|
||||
|
||||
DuelLayers::~DuelLayers(){
|
||||
|
||||
@@ -115,3 +115,13 @@ void GuiAvatars::Render()
|
||||
GuiLayer::Render();
|
||||
|
||||
}
|
||||
|
||||
GuiAvatar* GuiAvatars::GetSelf()
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
GuiAvatar* GuiAvatars::GetOpponent()
|
||||
{
|
||||
return opponent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user