diff --git a/registration-system/view/js/api.js b/registration-system/view/js/api.js index c4a0e26b9044628d715df086c3c644baebf7a4ad..e8d38df7bbe786282c382331ad3bdf2992b4d76d 100644 --- a/registration-system/view/js/api.js +++ b/registration-system/view/js/api.js @@ -42,6 +42,7 @@ function Bachelor() { 'mehl': null, 'essen': null, 'public': null, + 'virgin': null, 'studityp':null, 'comment': null }; diff --git a/registration-system/view/signups/game1/MAP_HOWTO.md b/registration-system/view/signups/game1/MAP_HOWTO.md index 0d8cc28eb2bdc009d2e4bf8e4ea3d40067e0ddda..e2a73e587ca8cf75f010389b1956aef8561894a7 100644 --- a/registration-system/view/signups/game1/MAP_HOWTO.md +++ b/registration-system/view/signups/game1/MAP_HOWTO.md @@ -38,6 +38,7 @@ Folgende Attribute sollten gesetzt werden: - destination (optional, target map für mapchange) - id - action (optional, action to call as defined in Events.actions) +- directAction (optional, set true to fire action before walkTo point is reached) - walkTo (optional, before calling action, walk to point with this ID) - condition (optional, expression with vars as defined in Environment.progress, parenthesis allowed, i.e.: `(!someVar||otherVar)&&moreVar`) diff --git a/registration-system/view/signups/game1/js/environment.js b/registration-system/view/signups/game1/js/environment.js index 0d3309ed036c59868f9ff51039c6c390e10f6345..b6e5e64c42be237d438638b68b506b7920e2417e 100644 --- a/registration-system/view/signups/game1/js/environment.js +++ b/registration-system/view/signups/game1/js/environment.js @@ -15,6 +15,8 @@ Environment.progress = { // landing map related landing_askedNickname: false, landing_killedGoat: false, + landing_dorfEntranceApproach: false, + landing_ageChosen: false, // ----------------------------- diff --git a/registration-system/view/signups/game1/js/events.js b/registration-system/view/signups/game1/js/events.js index d62e074f7913ff691917a173e8a16709956a8a41..af503f0619fb44cdbcf6e77d2fac630741b3e904 100644 --- a/registration-system/view/signups/game1/js/events.js +++ b/registration-system/view/signups/game1/js/events.js @@ -24,6 +24,7 @@ function EventHandler(svg) { destination: this.getAttribute('destination'), stopsWalk: this.getAttribute('stopsWalk') === 'true', action: this.getAttribute('action'), + directAction: this.getAttribute('directAction'), walkTo: this.getAttribute('walkTo'), condition: this.getAttribute('condition') }); @@ -113,13 +114,20 @@ EventHandler.handleAction = function (event) { var bbox = spawn[0][0].getBBox(); var xy = Vec.add(getTranslation(spawn[0][0], Game.char.svg[0][0]), [bbox.x, bbox.y]); + // trigger action, then walk to target + if (event.directAction && event.directAction === 'true') { + Story.actions[event.action].action(event); + Game.char.setMoveTarget(xy[0], xy[1]); + } // walk to the action point, start action on callback - Game.char.setMoveTarget(xy[0], xy[1], Story.actions[event.action].action); + else { + Game.char.setMoveTarget(xy[0], xy[1], Story.actions[event.action].action); + } } } // otherwise start action directly else { - Story.actions[event.action].action(); + Story.actions[event.action].action(event); } } return isPossible; diff --git a/registration-system/view/signups/game1/js/story.js b/registration-system/view/signups/game1/js/story.js index f8fcaf544445707a71fee579ff73d4e7952779f1..fca4ed2819533e6ef8f3a35151af3fbda410634c 100644 --- a/registration-system/view/signups/game1/js/story.js +++ b/registration-system/view/signups/game1/js/story.js @@ -348,15 +348,66 @@ Story.actions = { function rotate(deg) { return 'rotate(' + deg + ',' + goatPos.xCenter + ',' + goatPos.yCenter + ')'; } + + function helper_endAll(transition, callback) { + var n = 0; + transition.each(function () { + ++n; + }).each('end', function () { + if (!--n && callback) callback.apply(this, arguments); + }); + } } + } + }, - function helper_endAll(transition, callback) { - var n = 0; - transition.each(function () { - ++n; - }).each('end', function () { - if (!--n && callback) callback.apply(this, arguments); - }); + 'landing_dorfEntranceApproach': { + possible: function () { + return !Environment.progress.landing_dorfEntranceApproach; + }, + action: function () { + Environment.progress.landing_dorfEntranceApproach = true; + Game.char.svg.select('#dorfritter') + .transition().attr('transform', 'translate(0,15)'); + + Story.dialogueHelper([{ + bubble: '#dorfritter_speech', + message: 'Wie ich sehe, willst du in das Dorf.', + action: function () { + Game.char.svg.select('#dorfritter') + .transition().duration(400).attr('transform', 'translate(30,5)'); + } + }, { + bubble: '#dorfritter_speech', + message: 'Wenn du über 18 bist, nutze das rechte Tor.', + action: function () { + Game.char.svg.select('#dorfritter') + .transition().duration(800).attr('transform', 'translate(-30,5)'); + } + }, { + bubble: '#dorfritter_speech', + message: 'Wenn nicht, dann das Linke!', + action: function () { + Game.char.svg.select('#dorfritter') + .transition().duration(200).attr('transform', 'translate(0,0)'); + } + }], null, function() { + Game.log('Gehe ins Dorf.'); + Game.log('18+ rechtes Tor, sonst das linke'); + }); + } + }, + + 'landing_ageChoice': { + possible: function () { + return Environment.progress.landing_dorfEntranceApproach && !Environment.progress.landing_ageChosen; + }, + action: function (event) { + Environment.progress.landing_ageChosen = true; + if (event.id === '18plusEntrance') { + Environment.fapi.data.setValue('virgin', 'Ja'); + } else { + Environment.fapi.data.setValue('virgin', 'Nein'); } } } @@ -365,8 +416,8 @@ Story.actions = { Story.dialogueHelper = function (dialogue, context, done) { var speed = { - talk: UrlComponents.isSet('fastTalk') ? 1 : 45, - pause: UrlComponents.isSet('fastTalk') ? 50 : 1500 + talk: UrlComponents.isSet('fastTalk') ? 1 : 50, + pause: UrlComponents.isSet('fastTalk') ? 50 : 2000 }; Game.actionsBlocked = true; diff --git a/registration-system/view/signups/game1/maps/map_landing.svg b/registration-system/view/signups/game1/maps/map_landing.svg index d81e9c54971307d3e00406d6db0c6afc346fcfd8..8af9084ebbda29901e0533257062e757e6be4ae2 100644 Binary files a/registration-system/view/signups/game1/maps/map_landing.svg and b/registration-system/view/signups/game1/maps/map_landing.svg differ