5
5
import com .bladecoder .engine .model .Scene ;
6
6
import com .bladecoder .engine .model .World ;
7
7
import com .bladecoder .engine .util .EngineLogger ;
8
- import com .bladecoder .ink .runtime .Story .ExternalFunction ;
8
+ import com .bladecoder .ink .runtime .Story .ExternalFunction1 ;
9
9
10
10
public class ExternalFunctions {
11
11
@@ -18,24 +18,22 @@ public void bindExternalFunctions(final World w, InkManager ink) throws Exceptio
18
18
19
19
this .inkManager = ink ;
20
20
21
- inkManager .getStory ().bindExternalFunction ("inInventory" , new ExternalFunction () {
21
+ inkManager .getStory ().bindExternalFunction ("inInventory" , new ExternalFunction1 < String , Boolean > () {
22
22
23
23
@ Override
24
- public Object call (Object [] args ) throws Exception {
25
- String actor = args [0 ].toString ();
26
-
24
+ public Boolean call (String actor ) throws Exception {
27
25
if (actor .charAt (0 ) == '>' )
28
26
actor = actor .substring (1 );
29
27
30
28
return w .getInventory ().get (actor ) != null ;
31
29
}
32
30
});
33
31
34
- inkManager .getStory ().bindExternalFunction ("getActorState" , new ExternalFunction () {
32
+ inkManager .getStory ().bindExternalFunction ("getActorState" , new ExternalFunction1 < String , String > () {
35
33
36
34
@ Override
37
- public Object call (Object [] args ) throws Exception {
38
- SceneActorRef actor = new SceneActorRef (args [ 0 ]. toString () );
35
+ public String call (String act ) throws Exception {
36
+ SceneActorRef actor = new SceneActorRef (act );
39
37
final Scene s = actor .getScene (w );
40
38
41
39
String actorId = actor .getActorId ();
@@ -51,11 +49,10 @@ public Object call(Object[] args) throws Exception {
51
49
}
52
50
});
53
51
54
- inkManager .getStory ().bindExternalFunction ("getSceneState" , new ExternalFunction () {
52
+ inkManager .getStory ().bindExternalFunction ("getSceneState" , new ExternalFunction1 < String , String > () {
55
53
56
54
@ Override
57
- public Object call (Object [] args ) throws Exception {
58
- String scene = args [0 ].toString ();
55
+ public String call (String scene ) throws Exception {
59
56
final Scene s = w .getScene (scene );
60
57
61
58
if (s == null ) {
0 commit comments