Skip to content

Commit

Permalink
whoops previous commit msg was for this commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gilmore606 committed Jul 10, 2018
1 parent 808f503 commit cc48301
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/main/java/ure/UCommander.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public class UCommander implements URenderer.KeyListener {

private UModal modal;

public UCommander(UActor theplayer, URenderer theRenderer, UThingCzar thingczar, UActorCzar actorczar, UCartographer carto) {
public UCommander() {
turnCounter = 0;
}
public void registerComponents(UActor theplayer, URenderer theRenderer, UThingCzar thingczar, UActorCzar actorczar, UCartographer carto) {
renderer = theRenderer;
timeListeners = new HashSet<UTimeListener>();
animators = new HashSet<UAnimator>();
Expand All @@ -73,7 +76,6 @@ public UCommander(UActor theplayer, URenderer theRenderer, UThingCzar thingczar,
setPlayer(theplayer);
readKeyBinds();
renderer.setKeyListener(this);
turnCounter = 0;
keyBuffer = new LinkedBlockingQueue<Character>();
}

Expand Down
11 changes: 9 additions & 2 deletions src/main/java/ure/actions/UActionGet.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package ure.actions;

import ure.UCommander;
import ure.actors.UActor;
import ure.things.UThing;

import javax.inject.Inject;

/**
* Actor tries to pick up the thing, from the ground or a container.
*
*/
public class UActionGet extends UAction {

@Inject
UCommander commander;

public static String id = "GET";

public static String nothingToGetMsg = "There's nothing here to get.";
Expand All @@ -30,8 +36,9 @@ void doMe() {
if (thing == null) {
thing = actor.myCell().topThingAt();
if (thing == null) {
if (actor.isPlayer())
actor.camera.area.commander().printScroll(nothingToGetMsg);
if (actor.isPlayer()) {
//commander.printScroll(nothingToGetMsg);
}
}
}
if (!actor.tryGetThing(thing))
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/ure/dagger/AppComponent.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ure.dagger;

import dagger.Component;
import ure.UCommander;
import ure.actors.UActorCzar;
import ure.areas.UCartographer;
import ure.examplegame.ExampleGame;
Expand All @@ -16,5 +17,6 @@ public interface AppComponent {
void inject(UThingCzar czar);
void inject(UActorCzar czar);
void inject(UCartographer cartographer);
void inject(UCommander commander);
void inject(ExampleGame game);
}
8 changes: 8 additions & 0 deletions src/main/java/ure/dagger/AppModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.fasterxml.jackson.databind.module.SimpleModule;
import dagger.Module;
import dagger.Provides;
import ure.UCommander;
import ure.actors.ActorDeserializer;
import ure.actors.UActor;
import ure.actors.UActorCzar;
Expand Down Expand Up @@ -33,6 +34,13 @@ public ObjectMapper providesObjectMapper() {
return objectMapper;
}

@Provides
@Singleton
public UCommander providesCommander() {
UCommander cmdr = new UCommander();
return cmdr;
}

@Provides
@Singleton
public UActorCzar providesActorCzar() {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/ure/examplegame/ExampleGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ public class ExampleGame implements UTimeListener {

static UArea area;
static UCamera camera;
static UCommander commander;
static UActor player;
static UREStatusPanel statusPanel;
static UScrollPanel scrollPanel;
static URenderer renderer;

@Inject
UCommander commander;
@Inject
UTerrainCzar terrainCzar;
@Inject
Expand Down Expand Up @@ -83,11 +84,11 @@ public void startUp() {

player = new UPlayer("Player", '@', UColor.COLOR_WHITE, true, new UColor(0.3f, 0.3f, 0.6f), 3, 4);

commander = new UCommander(player, renderer, thingCzar, actorCzar, cartographer);
commander.registerComponents(player, renderer, thingCzar, actorCzar, cartographer);
cartographer.setCommander(commander);
area = cartographer.getArea("forest");

makeWindow();//.getContentPane().addKeyListener(commander);
makeWindow();

commander.registerScrollPrinter(scrollPanel);
commander.registerTimeListener(this);
Expand Down
Binary file added thumb3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cc48301

Please sign in to comment.