gamefic-sdk 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/html/core/engine.js +1 -10
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scripts/suggestible.plot.rb +36 -24
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 642000755606d5f202c09b54f2a11c5fb238601e
|
|
4
|
+
data.tar.gz: 9040ce5b78583d05074cd808719ee60f0ddef910
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b4aea3ba1aa82775669c862679de3cbf36b1aa1eb38fa63355ba49f0916d1972f25212f4626b3890fe66168aff5cbd422aea042970f7969abbbcca6c44a10c5
|
|
7
|
+
data.tar.gz: dcbc83828cdba3f965aa1256e42406a0e664b9bc50b3dc31f2e0bbededdfdf4e7af5640544cec5be389c33714cae3990a957a06621d47e2ed82197550c109ad8
|
data/html/core/engine.js
CHANGED
|
@@ -29,12 +29,7 @@ var Gamefic = (function() {
|
|
|
29
29
|
Opal.GameficOpal.$load_scripts();
|
|
30
30
|
Opal.GameficOpal.$static_plot().$introduce(Opal.GameficOpal.$static_character());
|
|
31
31
|
lastPrompt = Opal.GameficOpal.$static_plot().$scenes().$fetch(Opal.GameficOpal.$static_character().$scene()).$prompt_for(Opal.GameficOpal.$static_character());
|
|
32
|
-
|
|
33
|
-
doReady(response);
|
|
34
|
-
handle(response);
|
|
35
|
-
finishCallbacks.forEach(function(callback) {
|
|
36
|
-
callback(response);
|
|
37
|
-
});
|
|
32
|
+
this.update('');
|
|
38
33
|
},
|
|
39
34
|
update: function(input) {
|
|
40
35
|
if (input != null) {
|
|
@@ -58,10 +53,6 @@ var Gamefic = (function() {
|
|
|
58
53
|
finishCallbacks.forEach(function(callback) {
|
|
59
54
|
callback(response);
|
|
60
55
|
});
|
|
61
|
-
/*var testCommand = Opal.GameficOpal.$static_character().$queue().$shift();
|
|
62
|
-
if (typeof testCommand == 'string') {
|
|
63
|
-
setTimeout("Gamefic.update(" + JSON.stringify(testCommand) + ");", 1);
|
|
64
|
-
}*/
|
|
65
56
|
if (Opal.GameficOpal.$static_character().$queue().$length() > 0) {
|
|
66
57
|
setTimeout("Gamefic.update();", 1);
|
|
67
58
|
}
|
data/lib/gamefic-sdk/version.rb
CHANGED
data/scripts/suggestible.plot.rb
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
def
|
|
3
|
-
@
|
|
1
|
+
class Gamefic::Suggestions
|
|
2
|
+
def current
|
|
3
|
+
@current ||= []
|
|
4
4
|
end
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
def future
|
|
7
|
+
@future ||= []
|
|
7
8
|
end
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
|
|
10
|
+
def update
|
|
11
|
+
current.clear
|
|
12
|
+
current.concat future
|
|
13
|
+
puts current.join(',')
|
|
14
|
+
future.clear
|
|
12
15
|
end
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@automatic
|
|
16
|
+
|
|
17
|
+
def clear
|
|
18
|
+
current.clear
|
|
19
|
+
future.clear
|
|
18
20
|
end
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
module Gamefic::Suggestible
|
|
24
|
+
def suggestions
|
|
25
|
+
@suggestions ||= Gamefic::Suggestions.new
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def suggest command
|
|
29
|
+
suggestions.future.push command unless suggestions.future.include? command
|
|
21
30
|
end
|
|
22
31
|
end
|
|
23
32
|
|
|
@@ -26,17 +35,20 @@ class Gamefic::Character
|
|
|
26
35
|
serialize :suggestions
|
|
27
36
|
end
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
on_ready do
|
|
30
39
|
players.each { |player|
|
|
31
|
-
if
|
|
32
|
-
player.suggestions.
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
if player.scene == :active or player.next_scene == :active
|
|
41
|
+
player.suggestions.update
|
|
42
|
+
else
|
|
43
|
+
player.suggestions.clear
|
|
35
44
|
end
|
|
36
|
-
#player.suggestions.clear
|
|
37
45
|
}
|
|
38
46
|
end
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
respond :suggest do |actor|
|
|
49
|
+
actor.stream '<ul>'
|
|
50
|
+
actor.suggestions.current.sort.each { |s|
|
|
51
|
+
actor.stream "<li>#{s}</li>"
|
|
52
|
+
}
|
|
53
|
+
actor.stream '</ul>'
|
|
42
54
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gamefic-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fred Snyder
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-02-
|
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gamefic
|