Skip to content

Commit

Permalink
Add nextPointer.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyBond committed Apr 22, 2018
1 parent 524d878 commit 07f371b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions android/assets/commons.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"classes": {
"nextPointer": {
"components": {
"np": {},
"tag": {
"tag": "next_pointer"
}
}
},
"camera": {
"components": {
"camera": {
Expand Down
7 changes: 7 additions & 0 deletions android/assets/level0.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@
"properties": {
"position": ["100", "100"]
}
},

{
"inherit": ["nextPointer"],
"properties": {
"nextLevel": ["level1.json"]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.github.oldnpluslusteam.old41_game.components;

import com.github.alexeybond.partly_solid_bicycle.game.Component;
import com.github.alexeybond.partly_solid_bicycle.game.Entity;
import com.github.alexeybond.partly_solid_bicycle.game.Game;
import com.github.alexeybond.partly_solid_bicycle.game.declarative.ComponentDeclaration;
import com.github.alexeybond.partly_solid_bicycle.game.declarative.GameDeclaration;
import com.github.alexeybond.partly_solid_bicycle.util.event.props.ObjectProperty;

public class NextPointer implements Component {
@Override
public void onConnect(Entity entity) {
entity.events().event("nextLevel", ObjectProperty.<String>make()).use(ObjectProperty.STRING_LOADER);
}

@Override
public void onDisconnect(Entity entity) {
}

public static class Decl implements ComponentDeclaration {

@Override
public Component create(GameDeclaration gameDeclaration, Game game) {
return new NextPointer();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.alexeybond.partly_solid_bicycle.ioc.IoC;
import com.github.alexeybond.partly_solid_bicycle.ioc.IoCStrategy;
import com.github.alexeybond.partly_solid_bicycle.ioc.modules.Module;
import com.github.oldnpluslusteam.old41_game.components.NextPointer;
import com.github.oldnpluslusteam.old41_game.components.mechanic.MountPointComponent;
import com.github.oldnpluslusteam.old41_game.components.mechanic.MountableComponent;
import com.github.oldnpluslusteam.old41_game.components.mechanic.MouseController;
Expand Down Expand Up @@ -32,6 +33,8 @@ public Object resolve(Object... args) {
map.put("mmc", MouseController.Decl.class);
map.put("mmount", MountableComponent.Decl.class);
map.put("mmp", MountPointComponent.Decl.class);

map.put("np", NextPointer.Decl.class);
}

@Override
Expand Down

0 comments on commit 07f371b

Please sign in to comment.