diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/DemoChildGameConfig.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/DemoChildGameConfig.java index 568a743..8ac1331 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/DemoChildGameConfig.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/DemoChildGameConfig.java @@ -5,9 +5,8 @@ import java.util.Map; import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; -import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; +import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.GameArea; -import hundun.gdxgame.idledemo.logic.DemoAchievementId; import hundun.gdxgame.idledemo.logic.ResourceType; import hundun.gdxgame.idledemo.ui.screen.DemoMenuScreen; import hundun.gdxgame.idledemo.ui.screen.CookiePlayScreen; @@ -26,15 +25,15 @@ public DemoChildGameConfig() { Map> areaControlableConstructionVMPrototypeIds = new HashMap<>(); areaControlableConstructionVMPrototypeIds.put(GameArea.AREA_COOKIE, JavaFeatureForGwt.arraysAsList( - ConstructionPrototypeId.COOKIE_CLICK_PROVIDER, - ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, - ConstructionPrototypeId.COOKIE_AUTO_SELLER + DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER, + DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER, + DemoConstructionPrototypeId.COOKIE_AUTO_SELLER )); this.setAreaControlableConstructionVMPrototypeIds(areaControlableConstructionVMPrototypeIds); Map> areaControlableConstructionPrototypeVMPrototypeIds = new HashMap<>(); areaControlableConstructionPrototypeVMPrototypeIds.put(GameArea.AREA_FOREST, JavaFeatureForGwt.listOf( - ConstructionPrototypeId.EMPTY_CELL + DemoConstructionPrototypeId.EMPTY_CELL )); this.setAreaControlableConstructionPrototypeVMPrototypeIds(areaControlableConstructionPrototypeVMPrototypeIds); diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoAchievementLoader.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoAchievementLoader.java index 62ec53a..68dfb09 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoAchievementLoader.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoAchievementLoader.java @@ -52,7 +52,7 @@ public Map getProviderMap(Language language) { DemoAchievementId.STEP_1, textMap, JavaFeatureForGwt.mapOf( - ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, new SimpleEntry<>(1, 2) + DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER, new SimpleEntry<>(1, 2) ), DemoAchievementId.STEP_2, new ResourcePair(ResourceType.COIN, 1000L) @@ -62,7 +62,7 @@ public Map getProviderMap(Language language) { DemoAchievementId.STEP_2, textMap, JavaFeatureForGwt.mapOf( - ConstructionPrototypeId.COOKIE_AUTO_SELLER, new SimpleEntry<>(1, 2) + DemoConstructionPrototypeId.COOKIE_AUTO_SELLER, new SimpleEntry<>(1, 2) ), null, new ResourcePair(ResourceType.COIN, 1000L) diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoBuiltinConstructionsLoader.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoBuiltinConstructionsLoader.java index 43169bb..7f8e343 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoBuiltinConstructionsLoader.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoBuiltinConstructionsLoader.java @@ -21,10 +21,10 @@ public class DemoBuiltinConstructionsLoader implements IBuiltinConstructionsLoad @Override public Map getProviderMap(Language language) { Map result = new HashMap<>(); - result.put(ConstructionPrototypeId.EMPTY_CELL, new DirtPrototype(language)); - result.put(ConstructionPrototypeId.COOKIE_CLICK_PROVIDER, new CookieClickProviderPrototype(language)); - result.put(ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, new CookieAutoProviderPrototype(language)); - result.put(ConstructionPrototypeId.COOKIE_AUTO_SELLER, new CookieAutoSellerPrototype(language)); + result.put(DemoConstructionPrototypeId.EMPTY_CELL, new DirtPrototype(language)); + result.put(DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER, new CookieClickProviderPrototype(language)); + result.put(DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER, new CookieAutoProviderPrototype(language)); + result.put(DemoConstructionPrototypeId.COOKIE_AUTO_SELLER, new CookieAutoSellerPrototype(language)); return result; } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/ConstructionPrototypeId.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoConstructionPrototypeId.java similarity index 89% rename from IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/ConstructionPrototypeId.java rename to IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoConstructionPrototypeId.java index b8259e9..68c504b 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/ConstructionPrototypeId.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoConstructionPrototypeId.java @@ -3,7 +3,7 @@ -public class ConstructionPrototypeId { +public class DemoConstructionPrototypeId { public static final String COOKIE_CLICK_PROVIDER = "ENUM_CSTR@COOKIE_CLICK_PROVIDER"; public static final String COOKIE_AUTO_PROVIDER = "ENUM_CSTR@COOKIE_AUTO_PROVIDER"; diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoGameDictionary.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoGameDictionary.java index efc0584..5e6fd57 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoGameDictionary.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoGameDictionary.java @@ -18,22 +18,22 @@ public String constructionPrototypeIdToShowName(Language language, String constr switch (language) { case CN: switch (constructionId) { - case ConstructionPrototypeId.COOKIE_CLICK_PROVIDER: + case DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER: return "点击器"; - case ConstructionPrototypeId.COOKIE_AUTO_PROVIDER: + case DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER: return "自动点击器"; - case ConstructionPrototypeId.COOKIE_AUTO_SELLER: + case DemoConstructionPrototypeId.COOKIE_AUTO_SELLER: return "自动出售器"; default: return "口口"; } default: switch (constructionId) { - case ConstructionPrototypeId.COOKIE_CLICK_PROVIDER: + case DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER: return "Clicker"; - case ConstructionPrototypeId.COOKIE_AUTO_PROVIDER: + case DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER: return "AutoClicker"; - case ConstructionPrototypeId.COOKIE_AUTO_SELLER: + case DemoConstructionPrototypeId.COOKIE_AUTO_SELLER: return "AutoSeller"; default: return "[dic lost]"; @@ -48,18 +48,18 @@ public String constructionPrototypeIdToDetailDescroptionConstPart(Language langu switch (language) { case CN: switch (constructionId) { - case ConstructionPrototypeId.COOKIE_AUTO_PROVIDER: + case DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER: return "自动获得饼干"; - case ConstructionPrototypeId.EMPTY_CELL: + case DemoConstructionPrototypeId.EMPTY_CELL: return "空位置"; default: return "[dic lost]"; } default: switch (constructionId) { - case ConstructionPrototypeId.COOKIE_AUTO_PROVIDER: + case DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER: return "Auto gain some cookie"; - case ConstructionPrototypeId.EMPTY_CELL: + case DemoConstructionPrototypeId.EMPTY_CELL: return "Empty"; default: return "[dic lost]"; diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoSaveHandler.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoSaveHandler.java index fc1a959..bfa05b6 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoSaveHandler.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoSaveHandler.java @@ -10,7 +10,6 @@ import hundun.gdxgame.idleshare.gamelib.framework.data.GameplaySaveData; import hundun.gdxgame.idleshare.gamelib.framework.data.SystemSettingSaveData; import hundun.gdxgame.idleshare.gamelib.framework.model.grid.GridPosition; -import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager; import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementSaveData; import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementState; import hundun.gdxgame.idleshare.gamelib.framework.util.text.Language; @@ -31,27 +30,27 @@ protected RootSaveData genereateStarterRootSaveData() { Map map = new HashMap<>(); map.put( - ConstructionPrototypeId.COOKIE_CLICK_PROVIDER + "_" + UUID.randomUUID(), + DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER + "_" + UUID.randomUUID(), ConstructionSaveData.builder() - .prototypeId(ConstructionPrototypeId.COOKIE_CLICK_PROVIDER) + .prototypeId(DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER) .level(0) .workingLevel(0) .position( new GridPosition(0, 0)) .build() ); map.put( - ConstructionPrototypeId.COOKIE_AUTO_PROVIDER + "_" + UUID.randomUUID(), + DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER + "_" + UUID.randomUUID(), ConstructionSaveData.builder() - .prototypeId(ConstructionPrototypeId.COOKIE_AUTO_PROVIDER) + .prototypeId(DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER) .level(1) .workingLevel(1) .position( new GridPosition(0, 1)) .build() ); map.put( - ConstructionPrototypeId.COOKIE_AUTO_SELLER + "_" + UUID.randomUUID(), + DemoConstructionPrototypeId.COOKIE_AUTO_SELLER + "_" + UUID.randomUUID(), ConstructionSaveData.builder() - .prototypeId(ConstructionPrototypeId.COOKIE_AUTO_SELLER) + .prototypeId(DemoConstructionPrototypeId.COOKIE_AUTO_SELLER) .level(1) .workingLevel(0) .position( new GridPosition(1, 0)) @@ -64,9 +63,9 @@ protected RootSaveData genereateStarterRootSaveData() { ); dirtGridPositions.forEach(it -> { map.put( - ConstructionPrototypeId.EMPTY_CELL + "_" + UUID.randomUUID(), + DemoConstructionPrototypeId.EMPTY_CELL + "_" + UUID.randomUUID(), ConstructionSaveData.builder() - .prototypeId(ConstructionPrototypeId.EMPTY_CELL) + .prototypeId(DemoConstructionPrototypeId.EMPTY_CELL) .level(0) .workingLevel(0) .position(it) diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoTextureManager.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoTextureManager.java index 43d36ce..212314c 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoTextureManager.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoTextureManager.java @@ -39,7 +39,7 @@ public void lazyInitOnGameCreateStage2() { Texture texture = new Texture(Gdx.files.internal("constructionEntities.png")); TextureRegion[][] regions = TextureRegion.split(texture, 32, 32); //constructionEntityMap.put(ConstructionId.COOKIE_CLICK_PROVIDER, regions[0][0]); - constructionEntityMap.put(ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, regions[0][1]); + constructionEntityMap.put(DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER, regions[0][1]); //constructionEntityMap.put(ConstructionPrototypeId.COOKIE_SELLER, regions[0][2]); //constructionEntityMap.put(ConstructionId.WIN_PROVIDER, regions[0][3]); } @@ -65,10 +65,10 @@ public void lazyInitOnGameCreateStage2() { Texture texture = new Texture(Gdx.files.internal("CellIcons.png")); TextureRegion[][] regions = TextureRegion.split(texture, 128, 128); defaultAreaBack = regions[0][1]; - constructionHexImageMap.put(ConstructionPrototypeId.EMPTY_CELL, regions[0][0]); - constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_CLICK_PROVIDER, regions[0][1]); - constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, regions[0][2]); - constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_AUTO_SELLER, regions[0][3]); + constructionHexImageMap.put(DemoConstructionPrototypeId.EMPTY_CELL, regions[0][0]); + constructionHexImageMap.put(DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER, regions[0][1]); + constructionHexImageMap.put(DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER, regions[0][2]); + constructionHexImageMap.put(DemoConstructionPrototypeId.COOKIE_AUTO_SELLER, regions[0][3]); //gameAreaBackMap.put(GameArea.AREA_WIN, regions[0][3]); } } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieAutoProviderPrototype.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieAutoProviderPrototype.java index cc4d084..01fdd47 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieAutoProviderPrototype.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieAutoProviderPrototype.java @@ -1,7 +1,7 @@ package hundun.gdxgame.idledemo.logic.prototype; import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; -import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; +import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.DemoBuiltinConstructionsLoader; import hundun.gdxgame.idledemo.logic.ResourceType; import hundun.gdxgame.idledemo.logic.construction.BaseIdleDemoConstruction; @@ -39,7 +39,7 @@ public class CookieAutoProviderPrototype extends AbstractConstructionPrototype { public CookieAutoProviderPrototype(Language language) { super( - ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, + DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER, language, DemoBuiltinConstructionsLoader.toPack(JavaFeatureForGwt.mapOf()) ); diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieAutoSellerPrototype.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieAutoSellerPrototype.java index dd0b24f..95eb07f 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieAutoSellerPrototype.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieAutoSellerPrototype.java @@ -1,7 +1,7 @@ package hundun.gdxgame.idledemo.logic.prototype; import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; -import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; +import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.DemoBuiltinConstructionsLoader; import hundun.gdxgame.idledemo.logic.ResourceType; import hundun.gdxgame.idledemo.logic.construction.BaseIdleDemoConstruction; @@ -39,7 +39,7 @@ public class CookieAutoSellerPrototype extends AbstractConstructionPrototype { public CookieAutoSellerPrototype(Language language) { super( - ConstructionPrototypeId.COOKIE_AUTO_SELLER, + DemoConstructionPrototypeId.COOKIE_AUTO_SELLER, language, DemoBuiltinConstructionsLoader.toPack(JavaFeatureForGwt.mapOf()) ); diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieClickProviderPrototype.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieClickProviderPrototype.java index 642db84..e2d4947 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieClickProviderPrototype.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieClickProviderPrototype.java @@ -1,7 +1,7 @@ package hundun.gdxgame.idledemo.logic.prototype; import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; -import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; +import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.DemoBuiltinConstructionsLoader; import hundun.gdxgame.idledemo.logic.ResourceType; import hundun.gdxgame.idledemo.logic.construction.BaseIdleDemoConstruction; @@ -35,7 +35,7 @@ public class CookieClickProviderPrototype extends AbstractConstructionPrototype public CookieClickProviderPrototype(Language language) { super( - ConstructionPrototypeId.COOKIE_CLICK_PROVIDER, + DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER, language, DemoBuiltinConstructionsLoader.toPack(JavaFeatureForGwt.mapOf()) ); diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/DirtPrototype.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/DirtPrototype.java index e62581d..34776d4 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/DirtPrototype.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/DirtPrototype.java @@ -1,7 +1,7 @@ package hundun.gdxgame.idledemo.logic.prototype; import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; -import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; +import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.DemoBuiltinConstructionsLoader; import hundun.gdxgame.idledemo.logic.construction.BaseIdleDemoConstruction; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.AbstractConstructionPrototype; @@ -27,7 +27,7 @@ public class DirtPrototype extends AbstractConstructionPrototype { public DirtPrototype(Language language) { super( - ConstructionPrototypeId.EMPTY_CELL, + DemoConstructionPrototypeId.EMPTY_CELL, language, DemoBuiltinConstructionsLoader.toPack(JavaFeatureForGwt.mapOf()) ); diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/GameEntityFactory.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/GameEntityFactory.java index e9bcd59..b8b7342 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/GameEntityFactory.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/GameEntityFactory.java @@ -1,6 +1,6 @@ package hundun.gdxgame.idledemo.ui.entity; -import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; +import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.ResourceType; import hundun.gdxgame.idledemo.ui.screen.CookiePlayScreen; import hundun.gdxgame.idleshare.core.framework.model.entity.BaseGameEntityFactory; @@ -25,7 +25,7 @@ public GameEntityFactory(PlayScreenLayoutConst layoutConst, CookiePlayScreen par public GameEntity newConstructionEntity(String id, int index) { switch (id) { - case ConstructionPrototypeId.COOKIE_AUTO_PROVIDER: + case DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER: return this.rowStableConstructionEntity(id, index, 1); default: // no need GameEntity diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/WorldPlayScreen.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/WorldPlayScreen.java index 9dcdf2d..7c306fb 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/WorldPlayScreen.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/WorldPlayScreen.java @@ -12,6 +12,7 @@ import hundun.gdxgame.idledemo.ui.world.HexAreaVM; import hundun.gdxgame.idledemo.ui.world.WorldCellDetailBoardVM; import hundun.gdxgame.idleshare.core.framework.model.CameraDataPackage; +import hundun.gdxgame.idleshare.gamelib.framework.callback.IConstructionCollectionListener; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; import java.util.List; @@ -20,7 +21,7 @@ * @author hundun * Created on 2021/11/02 */ -public class WorldPlayScreen extends BaseDemoPlayScreen { +public class WorldPlayScreen extends BaseDemoPlayScreen implements IConstructionCollectionListener { HexAreaVM hexAreaVM; protected OrthographicCamera deskCamera; @@ -102,4 +103,11 @@ protected InputProcessor provideDefaultInputProcessor() { public void onDeskClicked(HexCellVM vm) { worldCellDetailBoardVM.updateDetail(vm != null ? vm.getDeskData() : null); } + + @Override + public void onConstructionCollectionChange() { + List constructions = game.getIdleGameplayExport().getGameplayContext().getConstructionManager() + .getConstructions(); + hexAreaVM.updateDeskDatas(constructions); + } } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/world/WorldCellDetailBoardVM.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/world/WorldCellDetailBoardVM.java index 5ccf50f..6ad7007 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/world/WorldCellDetailBoardVM.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/world/WorldCellDetailBoardVM.java @@ -1,6 +1,6 @@ package hundun.gdxgame.idledemo.ui.world; -import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; +import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId; import hundun.gdxgame.idledemo.ui.screen.WorldPlayScreen; import hundun.gdxgame.idleshare.gamelib.framework.callback.IConstructionCollectionListener; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.AbstractConstructionPrototype; @@ -13,7 +13,7 @@ public class WorldCellDetailBoardVM extends BaseCellDetailBoardVM implements IConstructionCollectionListener { @Getter @Setter - public BaseConstruction data; + public BaseConstruction detailingConstruction; public WorldCellDetailBoardVM(WorldPlayScreen parent) @@ -24,7 +24,7 @@ public WorldCellDetailBoardVM(WorldPlayScreen parent) public void updateDetail(BaseConstruction construction) { - this.data = construction; + this.detailingConstruction = construction; if (construction == null) { updateAsEmpty(); @@ -33,7 +33,7 @@ public void updateDetail(BaseConstruction construction) switch (construction.getPrototypeId()) { - case ConstructionPrototypeId.EMPTY_CELL: + case DemoConstructionPrototypeId.EMPTY_CELL: updateAsConstructionPrototypeDetail(construction); break; default: @@ -81,10 +81,10 @@ private void updateAsConstructionPrototypeDetail(BaseConstruction construction) @Override public void onConstructionCollectionChange() { - if (data != null) + if (detailingConstruction != null) { - data = parent.getGame().getIdleGameplayExport().getGameplayContext().getConstructionManager().getConstructionAt(data.getPosition()); - updateDetail(data); + detailingConstruction = parent.getGame().getIdleGameplayExport().getGameplayContext().getConstructionManager().getConstructionAt(detailingConstruction.getPosition()); + updateDetail(detailingConstruction); } } } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/world/WorldConstructionPrototypeCellDetailNode.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/world/WorldConstructionPrototypeCellDetailNode.java index ca0f05b..a537293 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/world/WorldConstructionPrototypeCellDetailNode.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/world/WorldConstructionPrototypeCellDetailNode.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.ui.Button; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; @@ -11,12 +12,16 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Align; import hundun.gdxgame.corelib.base.util.DrawableFactory; +import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; +import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId; import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen; import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.AbstractConstructionPrototype; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; import hundun.gdxgame.idleshare.gamelib.framework.model.grid.GridPosition; +import java.util.List; + /** * @author hundun @@ -25,9 +30,12 @@ public class WorldConstructionPrototypeCellDetailNode extends BaseCellDetailNodeVM { BaseDemoPlayScreen parent; AbstractConstructionPrototype model; + GridPosition position; Label constructionNameLabel; - + List buyCandidateConstructionPrototypeIds = JavaFeatureForGwt.listOf( + DemoConstructionPrototypeId.COOKIE_CLICK_PROVIDER + ); @@ -47,6 +55,19 @@ public WorldConstructionPrototypeCellDetailNode( // ------ this ------ this.add(constructionNameLabel).size(CHILD_WIDTH, NAME_CHILD_HEIGHT).row(); + + buyCandidateConstructionPrototypeIds.forEach(constructionPrototypeId -> { + Button buyConstructionButton = new TextButton("buy" + constructionPrototypeId,parent.getGame().getMainSkin()); + buyConstructionButton.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + parent.getGame().getIdleGameplayExport().getGameplayContext() + .getConstructionManager() + .buyInstanceOfPrototype(constructionPrototypeId, position); + } + }); + this.add(buyConstructionButton); + }); this.setBackground(DrawableFactory.createBorderBoard(30, 10, 0.8f, 1)); } @@ -88,6 +109,7 @@ public void subLogicFrame() { public void updateAsConstructionPrototype(AbstractConstructionPrototype constructionPrototype, GridPosition position) { this.model = constructionPrototype; + this.position = position; update(); } } diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/manager/ConstructionManager.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/manager/ConstructionManager.java index 5b2211d..52e6a50 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/manager/ConstructionManager.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/manager/ConstructionManager.java @@ -28,8 +28,8 @@ public class ConstructionManager implements ITileNodeMap { */ public Map runningConstructionModelMap = new HashMap<>(); - private List removeQueue = new ArrayList<>(); - private List createQueue = new ArrayList<>(); + private final List removeQueue = new ArrayList<>(); + private final List createQueue = new ArrayList<>(); public ConstructionManager(IdleGameplayContext gameContext) { this.gameContext = gameContext;