Skip to content
Permalink
Browse files
Tween verb help UI in and out.
  • Loading branch information
crabmusket committed Nov 10, 2013
1 parent ef9adf4 commit 11c75ecfa50f73560c36e0e3af6931a2d4966284
Showing with 23 additions and 1 deletion.
  1. +7 −0 modules/game/main.cs
  2. +1 −0 modules/game/verbHelp.gui
  3. +15 −1 modules/game/verbs.cs
@@ -3,6 +3,7 @@
// up properly.

// Module dependencies.
include(twillex);
include(stateMachine);
include(trackingCamera);
include(offsetCamera);
@@ -57,6 +58,10 @@
GlobalActionMap.bind(keyboard, "escape", "quit");
GlobalActionMap.bind(keyboard, "alt f4", "quit");

// Global tweening engine.
Twillex::create(Tweens);
Tweens.startUpdates();

// Gameplay modules.
Knights.onStart();
Enemies.onStart();
@@ -74,6 +79,8 @@
Knights.onEnd();
Enemies.onEnd();

Tweens.delete();

// Delete the objects we created.
GameGroup.delete();
}
@@ -9,6 +9,7 @@ new GuiBitmapCtrl(VerbHelpDlg) {
extent = "130 200";
minExtent = "8 8";
tooltipprofile = GuiToolTipProfile;
deployed = true;

new GuiMLTextCtrl(VerbHelpText) {
lineSpacing = 2;
@@ -58,7 +58,7 @@ class = StateMachine;

// Keyboard actions that should be available in any state.
%this.globalMap.bindCmd(keyboard, "ctrl c", "Verbs.onEvent(cancel);");
%this.globalMap.bindCmd(keyboard, "?", "VerbHelpDlg.setVisible(!VerbHelpDlg.isVisible());");
%this.globalMap.bindCmd(keyboard, "?", "Verbs.toggleHelp();");
%this.globalMap.push();

// Direction selection actions.
@@ -101,6 +101,8 @@ class = StateMachine;
%this.directionMap.delete();
}

//-----------------------------------------------------------------------------

function Verbs::updateHelpDlg(%this) {
%len = %this.getDynamicFieldCount();
VerbHelpText.setText("");
@@ -138,6 +140,18 @@ class = StateMachine;
%this.updateHelpDlg();
}

function Verbs::toggleHelp(%this) {
if(VerbHelpDlg.tween) {
VerbHelpDlg.tween.delete();
}
VerbHelpDlg.deployed = !VerbHelpDlg.deployed;

VerbHelpDlg.tween = Tweens.toOnce(200, VerbHelpDlg,
VerbHelpDlg.deployed
? "position: 20 252"
: "position: -200 252");
}

//-----------------------------------------------------------------------------

function Verbs::onFinish(%this) {

0 comments on commit 11c75ec

Please sign in to comment.