Changed ClientItemManager to delegate to a certain ItemController

This commit is contained in:
Collin Smith 2020-05-31 03:22:39 -07:00
parent 206875d2a0
commit 921fdfd2e2
2 changed files with 17 additions and 15 deletions

View File

@ -1,7 +1,5 @@
package com.riiablo.engine.client;
import com.riiablo.Riiablo;
import com.riiablo.engine.server.ItemManager;
import com.riiablo.item.BodyLoc;
import com.riiablo.item.Item;
import com.riiablo.item.StoreLoc;
@ -14,60 +12,64 @@ import net.mostlyoriginal.api.system.core.PassiveSystem;
public class ClientItemManager extends PassiveSystem implements ItemController {
private static final String TAG = "ClientItemManager";
protected ItemManager items;
final ItemController delegate;
public ClientItemManager(ItemController delegate) {
this.delegate = delegate;
}
@Override
public void groundToCursor(Item item) {
Riiablo.charData.groundToCursor(item);
delegate.groundToCursor(item);
}
@Override
public void cursorToGround() {
Riiablo.charData.cursorToGround();
delegate.cursorToGround();
}
@Override
public void storeToCursor(int i) {
Riiablo.charData.storeToCursor(i);
delegate.storeToCursor(i);
}
@Override
public void cursorToStore(StoreLoc storeLoc, int x, int y) {
Riiablo.charData.cursorToStore(storeLoc, x, y);
delegate.cursorToStore(storeLoc, x, y);
}
@Override
public void swapStoreItem(int i, StoreLoc storeLoc, int x, int y) {
Riiablo.charData.swapStoreItem(i, storeLoc, x, y);
delegate.swapStoreItem(i, storeLoc, x, y);
}
@Override
public void bodyToCursor(BodyLoc bodyLoc, boolean merc) {
Riiablo.charData.bodyToCursor(bodyLoc, merc);
delegate.bodyToCursor(bodyLoc, merc);
}
@Override
public void cursorToBody(BodyLoc bodyLoc, boolean merc) {
Riiablo.charData.cursorToBody(bodyLoc, merc);
delegate.cursorToBody(bodyLoc, merc);
}
@Override
public void swapBodyItem(BodyLoc bodyLoc, boolean merc) {
Riiablo.charData.swapBodyItem(bodyLoc, merc);
delegate.swapBodyItem(bodyLoc, merc);
}
@Override
public void beltToCursor(int i) {
Riiablo.charData.beltToCursor(i);
delegate.beltToCursor(i);
}
@Override
public void cursorToBelt(int x, int y) {
Riiablo.charData.cursorToBelt(x, y);
delegate.cursorToBelt(x, y);
}
@Override
public void swapBeltItem(int i) {
Riiablo.charData.swapBeltItem(i);
delegate.swapBeltItem(i);
}
}

View File

@ -487,7 +487,7 @@ public class GameScreen extends ScreenAdapter implements GameLoadingScreen.Loada
iso = renderer.iso();
scaledStage = new Stage(new ScreenViewport(iso), Riiablo.batch);
factory = new ClientEntityFactory();
itemController = new ClientItemManager();
itemController = new ClientItemManager(Riiablo.charData);
WorldConfiguration config = getWorldConfiguration();
config