From 9f541f60ae17f4351bba7093cb051fc6e475f99a Mon Sep 17 00:00:00 2001 From: hundun Date: Sat, 22 Jul 2023 20:12:46 +0800 Subject: [PATCH] fix typo, add COOKIE_CLICK_PROVIDER --- .../gdxgame/idledemo/DemoChildGameConfig.java | 7 +- .../logic/ConstructionPrototypeId.java | 2 +- .../logic/DemoBuiltinConstructionsLoader.java | 2 + .../idledemo/logic/DemoGameDictionary.java | 11 ++- .../idledemo/logic/DemoSaveHandler.java | 7 ++ .../idledemo/logic/DemoTextureManager.java | 12 +-- .../gdxgame/idledemo/logic/GameArea.java | 5 +- ...ion.java => BaseIdleDemoConstruction.java} | 33 ++++--- ...ava => DemoSimpleAutoOutputComponent.java} | 4 +- ...va => DemoSimpleProficiencyComponent.java} | 8 +- .../IdleForestClickOutputComponent.java | 10 --- .../CookieAutoProviderPrototype.java | 16 ++-- .../prototype/CookieAutoSellerPrototype.java | 7 +- .../CookieClickProviderPrototype.java | 66 ++++++++++++++ .../gdxgame/idledemo/ui/entity/ChessVM.java | 76 ++++++++++++++++ .../idledemo/ui/entity/DeskAreaVM.java | 72 ++++++++++++++++ .../idledemo/ui/entity/DeskClickListener.java | 30 +++++++ .../idledemo/ui/entity/GameEntityFactory.java | 4 +- ...layScreen.java => BaseDemoPlayScreen.java} | 56 ++++++------ .../idledemo/ui/screen/CookiePlayScreen.java | 86 +++++++++++++++++++ .../idledemo/ui/screen/DemoMenuScreen.java | 8 +- .../idledemo/ui/screen/DemoScreenContext.java | 12 +-- .../idledemo/ui/screen/ForestPlayScreen.java | 84 ++++++++++++++++++ build.gradle | 2 +- .../framework/model/CameraDataPackage.java | 55 ++++++++++++ .../starter/ui/component/GameImageDrawer.java | 13 ++- .../impl/ConstructionControlNode.java | 28 +++--- .../ui/screen/play/BaseIdlePlayScreen.java | 61 ++++++------- .../ui/screen/play/PlayScreenLayoutConst.java | 2 + .../construction/base/DescriptionPackage.java | 13 +-- .../base/DescriptionPackageFactory.java | 19 ++-- .../construction/base/LevelComponent.java | 2 +- .../base/ProficiencyComponent.java | 2 +- ...ent.java => EmptyAutoOutputComponent.java} | 4 +- 34 files changed, 650 insertions(+), 169 deletions(-) rename IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/{BaseIdleForestConstruction.java => BaseIdleDemoConstruction.java} (55%) rename IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/{IdleForestOutputComponent.java => DemoSimpleAutoOutputComponent.java} (79%) rename IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/{IdleForestProficiencyComponent.java => DemoSimpleProficiencyComponent.java} (77%) delete mode 100644 IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestClickOutputComponent.java create mode 100644 IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieClickProviderPrototype.java create mode 100644 IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/ChessVM.java create mode 100644 IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/DeskAreaVM.java create mode 100644 IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/DeskClickListener.java rename IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/{DemoPlayScreen.java => BaseDemoPlayScreen.java} (51%) create mode 100644 IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/CookiePlayScreen.java create mode 100644 IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/ForestPlayScreen.java create mode 100644 idleshare/core/src/hundun/gdxgame/idleshare/core/framework/model/CameraDataPackage.java rename idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/starter/{EmptyOutputComponent.java => EmptyAutoOutputComponent.java} (82%) 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 c9aac29..00f0426 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 @@ -6,14 +6,12 @@ import java.util.Map; import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; -import hundun.gdxgame.idledemo.logic.BuffId; import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.GameArea; import hundun.gdxgame.idledemo.logic.ResourceType; import hundun.gdxgame.idledemo.ui.screen.DemoMenuScreen; -import hundun.gdxgame.idledemo.ui.screen.DemoPlayScreen; +import hundun.gdxgame.idledemo.ui.screen.CookiePlayScreen; import hundun.gdxgame.idleshare.gamelib.framework.data.ChildGameConfig; -import hundun.gdxgame.idleshare.gamelib.framework.model.AbstractAchievement; /** * @author hundun @@ -28,6 +26,7 @@ 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 )); @@ -54,7 +53,7 @@ public DemoChildGameConfig() { Map screenIdToFilePathMap = JavaFeatureForGwt.mapOf( DemoMenuScreen.class.getSimpleName(), "audio/Loop-Menu.wav", - DemoPlayScreen.class.getSimpleName(), "audio/forest.mp3" + CookiePlayScreen.class.getSimpleName(), "audio/forest.mp3" ); this.setScreenIdToFilePathMap(screenIdToFilePathMap); 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/ConstructionPrototypeId.java index 1cb2ff9..ddc85f0 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/ConstructionPrototypeId.java @@ -5,7 +5,7 @@ public class ConstructionPrototypeId { - + public static final String COOKIE_CLICK_PROVIDER = "ENUM_CSTR@COOKIE_CLICK_PROVIDER"; public static final String COOKIE_AUTO_PROVIDER = "ENUM_CSTR@COOKIE_AUTO_PROVIDER"; public static final String COOKIE_AUTO_SELLER = "ENUM_CSTR@COOKIE_AUTO_SELLER"; } 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 5d84e6b..a3f3a99 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 @@ -8,6 +8,7 @@ import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; import hundun.gdxgame.idledemo.logic.prototype.CookieAutoProviderPrototype; import hundun.gdxgame.idledemo.logic.prototype.CookieAutoSellerPrototype; +import hundun.gdxgame.idledemo.logic.prototype.CookieClickProviderPrototype; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.*; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.DescriptionPackageFactory; @@ -25,6 +26,7 @@ public class DemoBuiltinConstructionsLoader implements IBuiltinConstructionsLoad @Override public Map getProviderMap(Language language) { Map result = new HashMap<>(); + 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)); return result; 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 bfd0138..406d9d4 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,16 +18,23 @@ public String constructionPrototypeIdToShowName(Language language, String constr switch (language) { case CN: switch (constructionId) { - + case ConstructionPrototypeId.COOKIE_CLICK_PROVIDER: + return "点击器"; case ConstructionPrototypeId.COOKIE_AUTO_PROVIDER: return "自动点击器"; + case ConstructionPrototypeId.COOKIE_AUTO_SELLER: + return "自动出售器"; default: return "口口"; } default: switch (constructionId) { + case ConstructionPrototypeId.COOKIE_CLICK_PROVIDER: + return "Clicker"; case ConstructionPrototypeId.COOKIE_AUTO_PROVIDER: - return "cliker"; + return "AutoClicker"; + case ConstructionPrototypeId.COOKIE_AUTO_SELLER: + return "AutoSeller"; 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 bb6abf8..1a51bd3 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 @@ -33,6 +33,13 @@ protected RootSaveData genereateStarterRootSaveData() { .gameplaySave(GameplaySaveData.builder() .constructionSaveDataMap( JavaFeatureForGwt.mapOf( + ConstructionPrototypeId.COOKIE_CLICK_PROVIDER, + ConstructionSaveData.builder() + .prototypeId(ConstructionPrototypeId.COOKIE_CLICK_PROVIDER) + .level(0) + .workingLevel(0) + .position(USELESS_POSITON) + .build(), ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, ConstructionSaveData.builder() .prototypeId(ConstructionPrototypeId.COOKIE_AUTO_PROVIDER) 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 f594920..456dc46 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 @@ -47,19 +47,19 @@ public void lazyInitOnGameCreateStage2() { Texture texture = new Texture(Gdx.files.internal("gameAreaIcons.png")); TextureRegion[][] regions = TextureRegion.split(texture, 100, 50); gameAreaLeftPartRegionMap.put(GameArea.AREA_COOKIE, regions[0][0]); - gameAreaLeftPartRegionMap.put(GameArea.AREA_BUILDING, regions[1][0]); - gameAreaLeftPartRegionMap.put(GameArea.AREA_WIN, regions[2][0]); + gameAreaLeftPartRegionMap.put(GameArea.AREA_FOREST, regions[1][0]); + //gameAreaLeftPartRegionMap.put(GameArea.AREA_WIN, regions[2][0]); gameAreaRightPartRegionMap.put(GameArea.AREA_COOKIE, regions[0][1]); - gameAreaRightPartRegionMap.put(GameArea.AREA_BUILDING, regions[1][1]); - gameAreaRightPartRegionMap.put(GameArea.AREA_WIN, regions[2][1]); + gameAreaRightPartRegionMap.put(GameArea.AREA_FOREST, regions[1][1]); + //gameAreaRightPartRegionMap.put(GameArea.AREA_WIN, regions[2][1]); } { Texture texture = new Texture(Gdx.files.internal("areas.png")); TextureRegion[][] regions = TextureRegion.split(texture, 640, 480); defaultAreaBack = regions[0][0]; gameAreaBackMap.put(GameArea.AREA_COOKIE, regions[0][1]); - gameAreaBackMap.put(GameArea.AREA_BUILDING, regions[0][2]); - gameAreaBackMap.put(GameArea.AREA_WIN, regions[0][3]); + gameAreaBackMap.put(GameArea.AREA_FOREST, regions[0][2]); + //gameAreaBackMap.put(GameArea.AREA_WIN, regions[0][3]); } } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/GameArea.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/GameArea.java index 20eec2e..4f74f6e 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/GameArea.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/GameArea.java @@ -6,8 +6,7 @@ public class GameArea { public static final String AREA_COOKIE = "ENUM_AREA@AREA_COOKIE"; - public static final String AREA_BUILDING = "ENUM_AREA@AREA_BUILDING"; - public static final String AREA_WIN = "ENUM_AREA@AREA_WIN"; + public static final String AREA_FOREST = "ENUM_AREA@AREA_FOREST"; - public static final List values = Arrays.asList(AREA_COOKIE, AREA_BUILDING, AREA_WIN); + public static final List values = Arrays.asList(AREA_COOKIE, AREA_FOREST); } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/BaseIdleForestConstruction.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/BaseIdleDemoConstruction.java similarity index 55% rename from IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/BaseIdleForestConstruction.java rename to IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/BaseIdleDemoConstruction.java index 702cefa..df26897 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/BaseIdleForestConstruction.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/BaseIdleDemoConstruction.java @@ -2,11 +2,12 @@ import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.*; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.starter.ConstProficiencyComponent; +import hundun.gdxgame.idleshare.gamelib.framework.model.construction.starter.EmptyAutoOutputComponent; import hundun.gdxgame.idleshare.gamelib.framework.model.grid.GridPosition; -public class BaseIdleForestConstruction extends BaseConstruction { +public class BaseIdleDemoConstruction extends BaseConstruction { - public BaseIdleForestConstruction( + public BaseIdleDemoConstruction( String prototypeId, String id, GridPosition position, @@ -31,30 +32,34 @@ public BaseIdleForestConstruction( this.saveData.setProficiency(0); } - public static BaseIdleForestConstruction typeAutoConstProficienc(String prototypeId, - String id, - GridPosition position, - DescriptionPackage descriptionPackage) + public static BaseIdleDemoConstruction typeAutoConstProficienc(String prototypeId, + String id, + GridPosition position, + DescriptionPackage descriptionPackage) { - BaseIdleForestConstruction thiz = new BaseIdleForestConstruction(prototypeId, id, position, descriptionPackage); + BaseIdleDemoConstruction thiz = new BaseIdleDemoConstruction(prototypeId, id, position, descriptionPackage); ConstProficiencyComponent proficiencyComponent = new ConstProficiencyComponent(thiz); thiz.proficiencyComponent = proficiencyComponent; - IdleForestOutputComponent outputComponent = new IdleForestOutputComponent(thiz); + DemoSimpleAutoOutputComponent outputComponent = new DemoSimpleAutoOutputComponent(thiz); thiz.outputComponent = outputComponent; return thiz; } - public static BaseIdleForestConstruction typeClick(String prototypeId, - String id, - GridPosition position, - DescriptionPackage descriptionPackage) + public static BaseIdleDemoConstruction typeClick(String prototypeId, + String id, + GridPosition position, + DescriptionPackage descriptionPackage) { - BaseIdleForestConstruction thiz = new BaseIdleForestConstruction(prototypeId, id, position, descriptionPackage); + BaseIdleDemoConstruction thiz = new BaseIdleDemoConstruction(prototypeId, id, position, descriptionPackage); - IdleForestClickOutputComponent outputComponent = new IdleForestClickOutputComponent(thiz); + ConstProficiencyComponent proficiencyComponent = new ConstProficiencyComponent(thiz); + thiz.proficiencyComponent = proficiencyComponent; + + EmptyAutoOutputComponent outputComponent = new EmptyAutoOutputComponent(thiz); + outputComponent.setTypeClickOutput(true); thiz.outputComponent = outputComponent; return thiz; diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestOutputComponent.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/DemoSimpleAutoOutputComponent.java similarity index 79% rename from IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestOutputComponent.java rename to IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/DemoSimpleAutoOutputComponent.java index 2a9d0dc..6c2c145 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestOutputComponent.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/DemoSimpleAutoOutputComponent.java @@ -3,9 +3,9 @@ import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.starter.BaseAutoOutputComponent; -public class IdleForestOutputComponent extends BaseAutoOutputComponent { +public class DemoSimpleAutoOutputComponent extends BaseAutoOutputComponent { - public IdleForestOutputComponent(BaseConstruction construction) { + public DemoSimpleAutoOutputComponent(BaseConstruction construction) { super(construction); } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestProficiencyComponent.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/DemoSimpleProficiencyComponent.java similarity index 77% rename from IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestProficiencyComponent.java rename to IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/DemoSimpleProficiencyComponent.java index 44efa92..2224783 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestProficiencyComponent.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/DemoSimpleProficiencyComponent.java @@ -3,15 +3,15 @@ import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.starter.BaseAutoProficiencyComponent; -public class IdleForestProficiencyComponent extends BaseAutoProficiencyComponent { +public class DemoSimpleProficiencyComponent extends BaseAutoProficiencyComponent { public static interface ProficiencySpeedCalculator { - int invoke(BaseIdleForestConstruction thiz); + int invoke(BaseIdleDemoConstruction thiz); } public ProficiencySpeedCalculator proficiencySpeedCalculator; - public IdleForestProficiencyComponent(BaseConstruction construction, Integer second) { + public DemoSimpleProficiencyComponent(BaseConstruction construction, Integer second) { super(construction, second, 50); } @@ -26,7 +26,7 @@ public void onSubLogicFrame() protected void tryProficiencyOnce() { if (this.proficiencySpeedCalculator != null) { - this.changeProficiency(proficiencySpeedCalculator.invoke((BaseIdleForestConstruction)construction)); + this.changeProficiency(proficiencySpeedCalculator.invoke((BaseIdleDemoConstruction)construction)); } } } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestClickOutputComponent.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestClickOutputComponent.java deleted file mode 100644 index 7712258..0000000 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/construction/IdleForestClickOutputComponent.java +++ /dev/null @@ -1,10 +0,0 @@ -package hundun.gdxgame.idledemo.logic.construction; - -import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; -import hundun.gdxgame.idleshare.gamelib.framework.model.construction.starter.EmptyOutputComponent; - -public class IdleForestClickOutputComponent extends EmptyOutputComponent { - public IdleForestClickOutputComponent(BaseConstruction construction) { - super(construction); - } -} 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 86c9504..cc4d084 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 @@ -4,7 +4,7 @@ import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.DemoBuiltinConstructionsLoader; import hundun.gdxgame.idledemo.logic.ResourceType; -import hundun.gdxgame.idledemo.logic.construction.BaseIdleForestConstruction; +import hundun.gdxgame.idledemo.logic.construction.BaseIdleDemoConstruction; 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.construction.base.DescriptionPackage; @@ -17,24 +17,24 @@ public class CookieAutoProviderPrototype extends AbstractConstructionPrototype { public static DescriptionPackage descriptionPackageEN = DescriptionPackage.builder() - .buttonDescroption("Upgrade") + .upgradeButtonText("Upgrade") .outputCostDescriptionStart("Consume") .outputGainDescriptionStart("Produce") .upgradeCostDescriptionStart("Upgrade cost") .upgradeMaxLevelDescription("(max)") - .levelDescroptionProvider(DescriptionPackageFactory.ONLY_LEVEL_IMP) - .proficiencyDescroptionProvider(DescriptionPackageFactory.EN_PROFICIENCY_IMP) + .levelDescriptionProvider(DescriptionPackageFactory.ONLY_LEVEL_IMP) + .proficiencyDescriptionProvider(DescriptionPackageFactory.EN_PROFICIENCY_IMP) .build(); public static DescriptionPackage descriptionPackageCN = DescriptionPackage.builder() - .buttonDescroption("升级") + .upgradeButtonText("升级") .outputCostDescriptionStart("自动消耗") .outputGainDescriptionStart("自动产出") .upgradeCostDescriptionStart("升级费用") .upgradeMaxLevelDescription("(已达到最大等级)") - .levelDescroptionProvider(DescriptionPackageFactory.ONLY_LEVEL_IMP) - .proficiencyDescroptionProvider(DescriptionPackageFactory.CN_PROFICIENCY_IMP) + .levelDescriptionProvider(DescriptionPackageFactory.ONLY_LEVEL_IMP) + .proficiencyDescriptionProvider(DescriptionPackageFactory.CN_PROFICIENCY_IMP) .build(); public CookieAutoProviderPrototype(Language language) { @@ -58,7 +58,7 @@ public CookieAutoProviderPrototype(Language language) { @Override public BaseConstruction getInstance(GridPosition position) { String id = prototypeId + "_" + UUID.randomUUID().toString(); - BaseIdleForestConstruction construction = BaseIdleForestConstruction.typeAutoConstProficienc(prototypeId, id, position, descriptionPackage); + BaseIdleDemoConstruction construction = BaseIdleDemoConstruction.typeAutoConstProficienc(prototypeId, id, position, descriptionPackage); construction.getOutputComponent().setOutputCostPack(DemoBuiltinConstructionsLoader.toPack(new HashMap<>())); construction.getOutputComponent().setOutputGainPack(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 a41e3a1..1b52511 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 @@ -4,15 +4,12 @@ import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.DemoBuiltinConstructionsLoader; import hundun.gdxgame.idledemo.logic.ResourceType; -import hundun.gdxgame.idledemo.logic.construction.BaseIdleForestConstruction; +import hundun.gdxgame.idledemo.logic.construction.BaseIdleDemoConstruction; 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.construction.base.DescriptionPackage; -import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.DescriptionPackageFactory; import hundun.gdxgame.idleshare.gamelib.framework.model.grid.GridPosition; import hundun.gdxgame.idleshare.gamelib.framework.util.text.Language; -import java.util.HashMap; import java.util.UUID; public class CookieAutoSellerPrototype extends AbstractConstructionPrototype { @@ -38,7 +35,7 @@ public CookieAutoSellerPrototype(Language language) { @Override public BaseConstruction getInstance(GridPosition position) { String id = prototypeId + "_" + UUID.randomUUID().toString(); - BaseIdleForestConstruction construction = BaseIdleForestConstruction.typeAutoConstProficienc(prototypeId, id, position, descriptionPackage); + BaseIdleDemoConstruction construction = BaseIdleDemoConstruction.typeAutoConstProficienc(prototypeId, id, position, descriptionPackage); construction.getOutputComponent().setOutputCostPack(DemoBuiltinConstructionsLoader.toPack(JavaFeatureForGwt.mapOf( ResourceType.COOKIE, 1 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 new file mode 100644 index 0000000..642db84 --- /dev/null +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/prototype/CookieClickProviderPrototype.java @@ -0,0 +1,66 @@ +package hundun.gdxgame.idledemo.logic.prototype; + +import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; +import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; +import hundun.gdxgame.idledemo.logic.DemoBuiltinConstructionsLoader; +import hundun.gdxgame.idledemo.logic.ResourceType; +import hundun.gdxgame.idledemo.logic.construction.BaseIdleDemoConstruction; +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.construction.base.DescriptionPackage; +import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.DescriptionPackageFactory; +import hundun.gdxgame.idleshare.gamelib.framework.model.grid.GridPosition; +import hundun.gdxgame.idleshare.gamelib.framework.util.text.Language; + +import java.util.HashMap; +import java.util.UUID; + +public class CookieClickProviderPrototype extends AbstractConstructionPrototype { + public static DescriptionPackage descriptionPackageEN = DescriptionPackage.builder() + .clickOutputButtonText("Gather") + .outputCostDescriptionStart("Consume") + .outputGainDescriptionStart("Produce") + .levelDescriptionProvider(DescriptionPackageFactory.NO_LEVEL_IMP) + .proficiencyDescriptionProvider(DescriptionPackageFactory.EN_PROFICIENCY_IMP) + .build(); + + + public static DescriptionPackage descriptionPackageCN = DescriptionPackage.builder() + .clickOutputButtonText("收集") + .outputCostDescriptionStart("消耗") + .outputGainDescriptionStart("产出") + .levelDescriptionProvider(DescriptionPackageFactory.CN_NO_LEVEL_IMP) + .proficiencyDescriptionProvider(DescriptionPackageFactory.CN_PROFICIENCY_IMP) + .build(); + + public CookieClickProviderPrototype(Language language) { + super( + ConstructionPrototypeId.COOKIE_CLICK_PROVIDER, + language, + DemoBuiltinConstructionsLoader.toPack(JavaFeatureForGwt.mapOf()) + ); + switch (language) + { + case CN: + this.descriptionPackage = descriptionPackageCN; + break; + default: + this.descriptionPackage = descriptionPackageEN; + break; + } + + } + + @Override + public BaseConstruction getInstance(GridPosition position) { + String id = prototypeId + "_" + UUID.randomUUID().toString(); + BaseIdleDemoConstruction construction = BaseIdleDemoConstruction.typeClick(prototypeId, id, position, descriptionPackage); + + construction.getOutputComponent().setOutputCostPack(DemoBuiltinConstructionsLoader.toPack(new HashMap<>())); + construction.getOutputComponent().setOutputGainPack(DemoBuiltinConstructionsLoader.toPack(JavaFeatureForGwt.mapOf( + ResourceType.COOKIE, 1 + ))); + + return construction; + } +} diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/ChessVM.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/ChessVM.java new file mode 100644 index 0000000..0cdf517 --- /dev/null +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/ChessVM.java @@ -0,0 +1,76 @@ +package hundun.gdxgame.idledemo.ui.entity; + +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.math.Vector; +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.utils.Drawable; +import hundun.gdxgame.corelib.base.util.DrawableFactory; +import hundun.gdxgame.idledemo.DemoIdleGame; +import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; +import lombok.Getter; + + +public class ChessVM extends Table { + + DemoIdleGame game; + + DeskAreaVM deskAreaVM; + @Getter + BaseConstruction deskData; + + Label mainLabel; + Image image; + + public ChessVM(DeskAreaVM deskAreaVM, BaseConstruction deskData) { + this.game = deskAreaVM.screen.getGame(); + this.deskAreaVM = deskAreaVM; + this.deskData = deskData; + + + this.image = new Image(); + image.setBounds( + 0, + 0, + deskAreaVM.screen.getLayoutConst().DESK_WIDTH, + deskAreaVM.screen.getLayoutConst().DESK_HEIGHT + ); + this.addActor(image); + /*this.setBackground(new TextureRegionDrawable(new TextureRegion(TextureFactory.getSimpleBoardBackground( + this.game.getScreenContext().getLayoutConst().DESK_WIDTH, + this.game.getScreenContext().getLayoutConst().DESK_HEIGHT + ))));*/ + + this.mainLabel = new Label("", game.getMainSkin()); + this.add(mainLabel); + + updateUI(); + } + + + + public void updateUI(){ + + this.mainLabel.setText(deskData.getId()); + image.setDrawable(DrawableFactory.createAlphaBoard(1, 1, Color.GRAY, 0.8f)); + Vector2 uiPosition = calculatePosition(deskData.getSaveData().getPosition().getX(), deskData.getSaveData().getPosition().getY()); + this.setBounds( + uiPosition.x, + uiPosition.y, + deskAreaVM.screen.getLayoutConst().DESK_WIDTH, + deskAreaVM.screen.getLayoutConst().DESK_HEIGHT + ); + } + + private static Vector2 calculatePosition(int gridX, int gridY) + { + Vector2 newposition = new Vector2(0, 0); + newposition.y += 0.75f * gridY; + newposition.x += Math.sqrt(3) / 2 * (gridX - (Math.abs(gridY) % 2) / 2.0f); + return newposition; + } + + +} diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/DeskAreaVM.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/DeskAreaVM.java new file mode 100644 index 0000000..d85930e --- /dev/null +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/DeskAreaVM.java @@ -0,0 +1,72 @@ +package hundun.gdxgame.idledemo.ui.entity; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; +import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen; +import hundun.gdxgame.idleshare.core.framework.model.CameraDataPackage; + +import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; +import lombok.Getter; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +public class DeskAreaVM extends Table { + public BaseDemoPlayScreen screen; + @Getter + Map nodes = new LinkedHashMap<>(); + @Getter + CameraDataPackage cameraDataPackage; + + public DeskAreaVM(BaseDemoPlayScreen screen) { + this.screen = screen; + this.cameraDataPackage = new CameraDataPackage(); + + if (screen.getGame().debugMode) { + this.debugAll(); + } + } + + public void updateDeskDatas( + List chessRuntimeDataList) { + this.clear(); + nodes.clear(); + + Image background = new Image(); + + background.setDrawable(new TextureRegionDrawable(new Texture(Gdx.files.internal("棋盘.jpg")))); + + int roomWidth = 5000; + int roomHeight = 5000; + + background.setBounds(0, 0, roomWidth, roomHeight); + + this.addActor(background); + //this.addListener(new CameraGestureListener(cameraDataPackage)); + //this.addListener(new CameraMouseListener(cameraDataPackage)); + this.getCameraDataPackage().forceSet( + roomWidth / 2.0f + 800, + roomHeight/ 2.0f, + null); + + chessRuntimeDataList.forEach(deskData -> { + + ChessVM actor = new ChessVM(this, deskData); + nodes.put(deskData.getId(), actor); + actor.addListener(new DeskClickListener(screen, actor)); + this.addActor(actor); + + }); + + + } + + + +} diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/DeskClickListener.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/DeskClickListener.java new file mode 100644 index 0000000..3729e87 --- /dev/null +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/entity/DeskClickListener.java @@ -0,0 +1,30 @@ +package hundun.gdxgame.idledemo.ui.entity; + +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import hundun.gdxgame.idledemo.DemoIdleGame; +import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen; + + + +public class DeskClickListener extends ClickListener { + DemoIdleGame game; + BaseDemoPlayScreen screen; + private final ChessVM vm; + + public DeskClickListener(BaseDemoPlayScreen screen, ChessVM vm) { + this.game = screen.getGame(); + this.screen = screen; + this.vm = vm; + } + + @Override + public void clicked(InputEvent event, float x, float y) { + screen.onDeskClicked(vm); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(vm.getDeskData().getId() + + " has been clicked." + ); + game.getFrontend().log(this.getClass().getSimpleName(), stringBuilder.toString()); + } +} 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 07d9616..e9bcd59 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 @@ -2,7 +2,7 @@ import hundun.gdxgame.idledemo.logic.ConstructionPrototypeId; import hundun.gdxgame.idledemo.logic.ResourceType; -import hundun.gdxgame.idledemo.ui.screen.DemoPlayScreen; +import hundun.gdxgame.idledemo.ui.screen.CookiePlayScreen; import hundun.gdxgame.idleshare.core.framework.model.entity.BaseGameEntityFactory; import hundun.gdxgame.idleshare.core.framework.model.entity.GameEntity; import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst; @@ -19,7 +19,7 @@ public class GameEntityFactory extends BaseGameEntityFactory { public float RESOURCE_MAX_DRAW_NUM = 15; - public GameEntityFactory(PlayScreenLayoutConst layoutConst, DemoPlayScreen parent) { + public GameEntityFactory(PlayScreenLayoutConst layoutConst, CookiePlayScreen parent) { super(layoutConst, parent); } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoPlayScreen.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/BaseDemoPlayScreen.java similarity index 51% rename from IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoPlayScreen.java rename to IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/BaseDemoPlayScreen.java index 46e5be9..1f07755 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoPlayScreen.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/BaseDemoPlayScreen.java @@ -3,51 +3,59 @@ import com.badlogic.gdx.graphics.g2d.NinePatch; import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; - +import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; +import hundun.gdxgame.gamelib.starter.listerner.IGameAreaChangeListener; import hundun.gdxgame.idledemo.DemoIdleGame; import hundun.gdxgame.idledemo.logic.GameArea; -import hundun.gdxgame.idledemo.logic.ResourceType; import hundun.gdxgame.idledemo.logic.RootSaveData; -import hundun.gdxgame.idledemo.ui.entity.GameEntityFactory; +import hundun.gdxgame.idledemo.ui.entity.ChessVM; import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdlePlayScreen; import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst; -/** - * @author hundun - * Created on 2021/11/02 - */ -public class DemoPlayScreen extends BaseIdlePlayScreen { +import java.util.Map; + +public abstract class BaseDemoPlayScreen extends BaseIdlePlayScreen implements IGameAreaChangeListener { - public DemoPlayScreen(DemoIdleGame game) { - super(game, GameArea.AREA_COOKIE, customLayoutConst(game)); + public BaseDemoPlayScreen(DemoIdleGame game, String startArea) { + super(game, startArea, customLayoutConst(game)); } - + private static PlayScreenLayoutConst customLayoutConst(DemoIdleGame game) { PlayScreenLayoutConst layoutConst = new PlayScreenLayoutConst(game.getWidth(), game.getHeight()); - NinePatch ninePatch = new NinePatch(game.getTextureManager().getDefaultBoardNinePatchTexture(), - game.getTextureManager().getDefaultBoardNinePatchEdgeSize(), - game.getTextureManager().getDefaultBoardNinePatchEdgeSize(), - game.getTextureManager().getDefaultBoardNinePatchEdgeSize(), + NinePatch ninePatch = new NinePatch(game.getTextureManager().getDefaultBoardNinePatchTexture(), + game.getTextureManager().getDefaultBoardNinePatchEdgeSize(), + game.getTextureManager().getDefaultBoardNinePatchEdgeSize(), + game.getTextureManager().getDefaultBoardNinePatchEdgeSize(), game.getTextureManager().getDefaultBoardNinePatchEdgeSize() - ); + ); layoutConst.simpleBoardBackground = new NinePatchDrawable(ninePatch); layoutConst.simpleBoardBackgroundMiddle = new TextureRegionDrawable(game.getTextureManager().getDefaultBoardNinePatchMiddle()); return layoutConst; } - - + Map areaToScreenIdMap = JavaFeatureForGwt.mapOf( + GameArea.AREA_COOKIE, CookiePlayScreen.class.getSimpleName(), + GameArea.AREA_FOREST, ForestPlayScreen.class.getSimpleName() + ); + @Override protected void lazyInitLogicContext() { super.lazyInitLogicContext(); - - GameEntityFactory gameEntityFactory = new GameEntityFactory(this.layoutConst, this); - gameImageDrawer.lazyInit(gameEntityFactory); - storageInfoTable.lazyInit(ResourceType.VALUES_FOR_SHOW_ORDER); - gameAreaControlBoard.lazyInit(GameArea.values); - } + gameAreaChangeListeners.add(this); + } + @Override + public void onGameAreaChange(String last, String current) { + String lastScreen = areaToScreenIdMap.get(last); + String currentScreen = areaToScreenIdMap.get(current); + if (lastScreen != null && !currentScreen.equals(lastScreen)) + { + game.getScreenManager().pushScreen(currentScreen, null); + game.getAudioPlayManager().intoScreen(currentScreen); + } + } + public abstract void onDeskClicked(ChessVM vm); } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/CookiePlayScreen.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/CookiePlayScreen.java new file mode 100644 index 0000000..36f8f2e --- /dev/null +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/CookiePlayScreen.java @@ -0,0 +1,86 @@ +package hundun.gdxgame.idledemo.ui.screen; + +import com.badlogic.gdx.InputProcessor; +import com.badlogic.gdx.graphics.g2d.NinePatch; +import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable; +import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; + +import hundun.gdxgame.idledemo.DemoIdleGame; +import hundun.gdxgame.idledemo.logic.GameArea; +import hundun.gdxgame.idledemo.logic.ResourceType; +import hundun.gdxgame.idledemo.logic.RootSaveData; +import hundun.gdxgame.idledemo.ui.entity.ChessVM; +import hundun.gdxgame.idledemo.ui.entity.GameEntityFactory; +import hundun.gdxgame.idleshare.core.framework.model.manager.GameEntityManager; +import hundun.gdxgame.idleshare.core.starter.ui.component.GameImageDrawer; +import hundun.gdxgame.idleshare.core.starter.ui.component.GameImageDrawer.GameImageDrawerOwner; +import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.AbstractConstructionControlBoard; +import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.impl.fixed.FixedConstructionControlBoard; +import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst; +import lombok.Getter; + +/** + * @author hundun + * Created on 2021/11/02 + */ +public class CookiePlayScreen extends BaseDemoPlayScreen implements GameImageDrawerOwner { + + protected GameEntityManager gameEntityManager; + protected GameImageDrawer gameImageDrawer; + protected AbstractConstructionControlBoard constructionControlBoard; + + public CookiePlayScreen(DemoIdleGame game) { + super(game, GameArea.AREA_COOKIE); + } + + + @Override + protected void lazyInitUiRootContext() { + super.lazyInitUiRootContext(); + + // impl switchable + constructionControlBoard = new FixedConstructionControlBoard<>(this); + uiRootTable.add(constructionControlBoard).height(layoutConst.CONSTRUCION_BOARD_ROOT_BOX_HEIGHT).fill(); + } + + protected void lazyInitLogicContext() { + super.lazyInitLogicContext(); + + this.gameImageDrawer = new GameImageDrawer<>(this, this); + this.gameEntityManager = new GameEntityManager(game); + gameEntityManager.lazyInit( + game.getChildGameConfig().getAreaShowEntityByOwnAmountConstructionPrototypeIds(), + game.getChildGameConfig().getAreaShowEntityByOwnAmountResourceIds(), + game.getChildGameConfig().getAreaShowEntityByChangeAmountResourceIds() + ); + GameEntityFactory gameEntityFactory = new GameEntityFactory(this.layoutConst, this); + gameImageDrawer.lazyInit(gameEntityFactory); + + logicFrameListeners.add(constructionControlBoard); + storageInfoTable.lazyInit(ResourceType.VALUES_FOR_SHOW_ORDER); + gameAreaControlBoard.lazyInit(GameArea.values); + gameAreaChangeListeners.add(constructionControlBoard); + + this.getGame().getIdleGameplayExport().getGameplayContext().getEventManager().registerListener(gameImageDrawer); + } + + @Override + protected InputProcessor provideDefaultInputProcessor() { + return uiStage; + } + + @Override + protected void belowUiStageDraw(float delta) { + gameImageDrawer.allEntitiesMoveForFrameAndDraw(); + } + + @Override + public void onDeskClicked(ChessVM vm) { + throw new UnsupportedOperationException(); + } + + @Override + public GameEntityManager getGameEntityManager() { + return gameEntityManager; + } +} diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoMenuScreen.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoMenuScreen.java index 894b7f5..e02825c 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoMenuScreen.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoMenuScreen.java @@ -19,8 +19,8 @@ public DemoMenuScreen(DemoIdleGame game) { @Override public void touchUp (InputEvent event, float x, float y, int pointer, int button) { game.getSaveHandler().gameplayLoadOrStarter(true); - game.getScreenManager().pushScreen(DemoPlayScreen.class.getSimpleName(), null); - game.getAudioPlayManager().intoScreen(DemoPlayScreen.class.getSimpleName()); + game.getScreenManager().pushScreen(CookiePlayScreen.class.getSimpleName(), null); + game.getAudioPlayManager().intoScreen(CookiePlayScreen.class.getSimpleName()); } @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { @@ -31,8 +31,8 @@ public boolean touchDown (InputEvent event, float x, float y, int pointer, int b @Override public void touchUp (InputEvent event, float x, float y, int pointer, int button) { game.getSaveHandler().gameplayLoadOrStarter(false); - game.getScreenManager().pushScreen(DemoPlayScreen.class.getSimpleName(), null); - game.getAudioPlayManager().intoScreen(DemoPlayScreen.class.getSimpleName()); + game.getScreenManager().pushScreen(CookiePlayScreen.class.getSimpleName(), null); + game.getAudioPlayManager().intoScreen(CookiePlayScreen.class.getSimpleName()); } @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoScreenContext.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoScreenContext.java index 8fea728..09fb2dc 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoScreenContext.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/DemoScreenContext.java @@ -11,8 +11,8 @@ public class DemoScreenContext extends AbstractIdleScreenContext { DemoMenuScreen menuScreen; - DemoPlayScreen playScreen; - + CookiePlayScreen cookiePlayScreen; + ForestPlayScreen forestPlayScreen; public DemoScreenContext(DemoIdleGame game) { super(game); @@ -21,10 +21,12 @@ public DemoScreenContext(DemoIdleGame game) { @Override public void lazyInit() { this.menuScreen = new DemoMenuScreen(game); - this.playScreen = new DemoPlayScreen(game); - + this.cookiePlayScreen = new CookiePlayScreen(game); + this.forestPlayScreen = new ForestPlayScreen(game); + game.getScreenManager().addScreen(menuScreen.getClass().getSimpleName(), menuScreen); - game.getScreenManager().addScreen(playScreen.getClass().getSimpleName(), playScreen); + game.getScreenManager().addScreen(cookiePlayScreen.getClass().getSimpleName(), cookiePlayScreen); + game.getScreenManager().addScreen(forestPlayScreen.getClass().getSimpleName(), forestPlayScreen); } } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/ForestPlayScreen.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/ForestPlayScreen.java new file mode 100644 index 0000000..b50cc75 --- /dev/null +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/ForestPlayScreen.java @@ -0,0 +1,84 @@ +package hundun.gdxgame.idledemo.ui.screen; + +import com.badlogic.gdx.InputMultiplexer; +import com.badlogic.gdx.InputProcessor; +import com.badlogic.gdx.graphics.OrthographicCamera; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.utils.viewport.ScreenViewport; +import hundun.gdxgame.idledemo.DemoIdleGame; +import hundun.gdxgame.idledemo.logic.GameArea; +import hundun.gdxgame.idledemo.logic.ResourceType; +import hundun.gdxgame.idledemo.ui.entity.ChessVM; +import hundun.gdxgame.idledemo.ui.entity.DeskAreaVM; +import hundun.gdxgame.idledemo.ui.entity.GameEntityFactory; +import hundun.gdxgame.idleshare.core.framework.model.CameraDataPackage; + +/** + * @author hundun + * Created on 2021/11/02 + */ +public class ForestPlayScreen extends BaseDemoPlayScreen { + + DeskAreaVM deskAreaVM; + protected OrthographicCamera deskCamera; + protected Stage deskStage; + + public ForestPlayScreen(DemoIdleGame game) { + super(game, GameArea.AREA_FOREST); + + this.deskCamera = new OrthographicCamera(); + this.deskStage = new Stage(new ScreenViewport(deskCamera), game.getBatch()); + } + + + + + + + protected void lazyInitLogicContext() { + super.lazyInitLogicContext(); + + storageInfoTable.lazyInit(ResourceType.VALUES_FOR_SHOW_ORDER); + gameAreaControlBoard.lazyInit(GameArea.values); + } + + @Override + protected void lazyInitBackUiAndPopupUiContent() { + super.lazyInitBackUiAndPopupUiContent(); + + deskAreaVM = new DeskAreaVM(this); + deskStage.addActor(deskAreaVM); + deskStage.setScrollFocus(deskAreaVM); + } + + @Override + protected void belowUiStageDraw(float delta) { + deskStage.act(); + deskStage.getViewport().getCamera().position.set( + deskAreaVM.getCameraDataPackage().getCurrentCameraX(), + deskAreaVM.getCameraDataPackage().getCurrentCameraY(), + 0); + if (deskAreaVM.getCameraDataPackage().getAndClearCameraZoomDirty()) { + float weight = deskAreaVM.getCameraDataPackage().getCurrentCameraZoomWeight(); + deskCamera.zoom = CameraDataPackage.cameraZoomWeightToZoomValue(weight); + game.getFrontend().log(this.getClass().getSimpleName(), "deskCamera.zoom = %s", deskCamera.zoom); + } + deskStage.getViewport().apply(); + deskStage.draw(); + } + + + @Override + protected InputProcessor provideDefaultInputProcessor() { + InputMultiplexer multiplexer = new InputMultiplexer(); + multiplexer.addProcessor(popupUiStage); + multiplexer.addProcessor(uiStage); + multiplexer.addProcessor(deskStage); + return multiplexer; + } + + @Override + public void onDeskClicked(ChessVM vm) { + + } +} diff --git a/build.gradle b/build.gradle index 449b586..297057f 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,7 @@ allprojects { gdxFreeTypeGwtVersion = '1.9.10.1' gwtFrameworkVersion = '2.8.2' - hundunLibVersion = '236a579777' + hundunLibVersion = 'f5e40d5fb1' raeleusStripeVersion = '1.4.1' } diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/framework/model/CameraDataPackage.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/framework/model/CameraDataPackage.java new file mode 100644 index 0000000..524e0f6 --- /dev/null +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/framework/model/CameraDataPackage.java @@ -0,0 +1,55 @@ +package hundun.gdxgame.idleshare.core.framework.model; + +import lombok.Getter; + +public class CameraDataPackage { + public static float DEFAULT_CAMERA_ZOOM_WEIGHT = 3.7f; + @Getter + private float currentCameraX; + @Getter + private float currentCameraY; + @Getter + private float currentCameraZoomWeight; + @Getter + private boolean currentCameraZoomDirty; + + public static float cameraZoomWeightToZoomValue(float weight){ + //return weight <= 0 ? (float)Math.pow(2, weight) : (float)Math.log(weight + 2); + return weight; + } + + + public void modifyCurrentCamera(Float deltaX, Float deltaY) { + if (deltaX != null) { + currentCameraX += deltaX; + } + if (deltaY != null) { + currentCameraY += deltaY; + } + } + + public void modifyCurrentCameraZoomWeight(Float delta) { + currentCameraZoomWeight += delta; + currentCameraZoomWeight = Math.max(0.1f, currentCameraZoomWeight); + currentCameraZoomDirty = true; + } + + public boolean getAndClearCameraZoomDirty () { + boolean result = currentCameraZoomDirty; + currentCameraZoomDirty = false; + return result; + } + + public void forceSet(Float currentCameraX, Float currentCameraY, Float currentCameraZoomWeight) { + if (currentCameraX != null) { + this.currentCameraX = currentCameraX; + } + if (currentCameraY != null) { + this.currentCameraY = currentCameraY; + } + if (currentCameraZoomWeight != null) { + this.currentCameraZoomWeight = currentCameraZoomWeight; + this.currentCameraZoomDirty = true; + } + } +} diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/GameImageDrawer.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/GameImageDrawer.java index 79f06a1..f1705f1 100644 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/GameImageDrawer.java +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/GameImageDrawer.java @@ -20,19 +20,24 @@ public class GameImageDrawer, T_SAVE> implements IOneFrameResourceChangeListener { BaseIdlePlayScreen parent; + GameImageDrawerOwner owner; BaseGameEntityFactory gameEntityFactory; + public static interface GameImageDrawerOwner { + GameEntityManager getGameEntityManager(); + } - public GameImageDrawer(BaseIdlePlayScreen parent) { - this.parent = parent; + public GameImageDrawer(BaseIdlePlayScreen parent, GameImageDrawerOwner owner) { + this.parent = parent; + this.owner = owner; } public void allEntitiesMoveForFrameAndDraw() { parent.getGame().getBatch().begin(); - GameEntityManager manager = parent.getGameEntityManager(); + GameEntityManager manager = owner.getGameEntityManager(); String gameArea = parent.getArea(); @@ -84,7 +89,7 @@ public void allEntitiesMoveForFrameAndDraw() { @Override public void onResourceChange(Map changeMap, Map> deltaHistoryMap) { - GameEntityManager manager = parent.getGameEntityManager(); + GameEntityManager manager = owner.getGameEntityManager(); String gameArea = parent.getArea(); manager.areaEntityCheckByOwnAmount(gameArea, gameEntityFactory); diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/ConstructionControlNode.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/ConstructionControlNode.java index 9e26baf..ae4752e 100644 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/ConstructionControlNode.java +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/ConstructionControlNode.java @@ -32,7 +32,7 @@ public class ConstructionControlNode, T_SAVE Label proficiencyLabel; Label positionLabel; - TextButton clickEffectButton; + TextButton clickOutputButton; TextButton upgradeButton; TextButton destoryButton; TextButton transformButton; @@ -53,8 +53,8 @@ public ConstructionControlNode(BaseIdlePlayScreen parent, int in this.constructionNameLabel = new Label("", parent.getGame().getMainSkin()); constructionNameLabel.setWrap(true); - this.clickEffectButton = new TextButton("", parent.getGame().getMainSkin()); - clickEffectButton.addListener(new ChangeListener() { + this.clickOutputButton = new TextButton("", parent.getGame().getMainSkin()); + clickOutputButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { Gdx.app.log(ConstructionControlNode.class.getSimpleName(), "clickEffectButton changed"); @@ -132,7 +132,7 @@ public void clicked(InputEvent event, float x, float y) { this.transformButton = new TextButton("-", parent.getGame().getMainSkin()); // ------ this ------ this.add(constructionNameLabel).size(CHILD_WIDTH, NAME_CHILD_HEIGHT).row(); - this.add(clickEffectButton).size(CHILD_WIDTH, CHILD_HEIGHT).row(); + this.add(clickOutputButton).size(CHILD_WIDTH, CHILD_HEIGHT).row(); this.add(upgradeButton).size(CHILD_WIDTH, CHILD_HEIGHT).row(); this.add(changeWorkingLevelGroup).size(CHILD_WIDTH, CHILD_HEIGHT).row(); this.add(proficiencyLabel).size(CHILD_WIDTH, CHILD_HEIGHT).row(); @@ -156,9 +156,11 @@ public void setModel(BaseConstruction constructionExportProxy) { this.downWorkingLevelButton.setVisible(false); } if (constructionExportProxy.getOutputComponent().isTypeClickOutput()) { - this.clickEffectButton.setVisible(true); + this.clickOutputButton.setVisible(true); + this.upgradeButton.setVisible(false); } else { - this.clickEffectButton.setVisible(false); + this.clickOutputButton.setVisible(false); + this.upgradeButton.setVisible(true); } } update(); @@ -178,20 +180,20 @@ public void update() { } // ------ update text ------ constructionNameLabel.setText(model.getName()); - clickEffectButton.setText(model.getDescriptionPackage().getButtonDescroption()); - upgradeButton.setText(model.getDescriptionPackage().getButtonDescroption()); + clickOutputButton.setText(model.getDescriptionPackage().getClickOutputButtonText()); + upgradeButton.setText(model.getDescriptionPackage().getUpgradeButtonText()); workingLevelLabel.setText(model.getLevelComponent().getWorkingLevelDescroption()); proficiencyLabel.setText(model.getProficiencyComponent().getProficiencyDescroption()); positionLabel.setText(model.getSaveData().getPosition().toShowText()); - destoryButton.setText(model.descriptionPackage.getDestroyButtonDescroption()); + destoryButton.setText(model.descriptionPackage.getDestroyButtonText()); // ------ update clickable-state ------ if (model.getOutputComponent().canOutput()) { - clickEffectButton.setDisabled(false); - clickEffectButton.getLabel().setColor(Color.WHITE); + clickOutputButton.setDisabled(false); + clickOutputButton.getLabel().setColor(Color.WHITE); } else { - clickEffectButton.setDisabled(true); - clickEffectButton.getLabel().setColor(Color.RED); + clickOutputButton.setDisabled(true); + clickOutputButton.getLabel().setColor(Color.RED); } if (model.getUpgradeComponent().canUpgrade()) { upgradeButton.setDisabled(false); diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/screen/play/BaseIdlePlayScreen.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/screen/play/BaseIdlePlayScreen.java index b5c3a3b..19d0761 100644 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/screen/play/BaseIdlePlayScreen.java +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/screen/play/BaseIdlePlayScreen.java @@ -1,6 +1,7 @@ package hundun.gdxgame.idleshare.core.starter.ui.screen.play; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.scenes.scene2d.ui.Image; import hundun.gdxgame.corelib.base.BaseHundunScreen; @@ -8,15 +9,11 @@ import hundun.gdxgame.gamelib.starter.listerner.IGameAreaChangeListener; import hundun.gdxgame.gamelib.starter.listerner.ILogicFrameListener; import hundun.gdxgame.idleshare.core.framework.BaseIdleGame; -import hundun.gdxgame.idleshare.core.framework.model.manager.GameEntityManager; import hundun.gdxgame.idleshare.core.starter.ui.component.AchievementMaskBoard; import hundun.gdxgame.idleshare.core.starter.ui.component.BackgroundImageBox; import hundun.gdxgame.idleshare.core.starter.ui.component.GameAreaControlBoard; -import hundun.gdxgame.idleshare.core.starter.ui.component.GameImageDrawer; import hundun.gdxgame.idleshare.core.starter.ui.component.PopupInfoBoard; import hundun.gdxgame.idleshare.core.starter.ui.component.StorageInfoBoard; -import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.AbstractConstructionControlBoard; -import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.impl.fixed.FixedConstructionControlBoard; import hundun.gdxgame.idleshare.gamelib.framework.callback.IAchievementUnlockCallback; import hundun.gdxgame.idleshare.gamelib.framework.callback.ISecondaryInfoBoardCallback; import hundun.gdxgame.idleshare.gamelib.framework.model.AbstractAchievement; @@ -25,7 +22,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Map; /** @@ -46,14 +42,12 @@ public abstract class BaseIdlePlayScreen, T_ // ====== need child lazy-init start ====== protected AchievementMaskBoard achievementMaskBoard; protected PopupInfoBoard secondaryInfoBoard; - protected GameImageDrawer gameImageDrawer; protected StorageInfoBoard storageInfoTable; - protected AbstractConstructionControlBoard constructionControlBoard; + protected BackgroundImageBox backgroundImageBox; protected GameAreaControlBoard gameAreaControlBoard; // ----- not ui ------ - @Getter - protected GameEntityManager gameEntityManager; + @Getter protected String area; private final String startArea; @@ -71,6 +65,13 @@ public BaseIdlePlayScreen(T_GAME game, String startArea, PlayScreenLayoutConst l @Override protected void create() { + + lazyInitBackUiAndPopupUiContent(); + + lazyInitUiRootContext(); + + lazyInitLogicContext(); + } @Override @@ -107,23 +108,18 @@ public void hideAndCleanGuideInfo() { } protected void lazyInitLogicContext() { - this.gameImageDrawer = new GameImageDrawer<>(this); - this.gameEntityManager = new GameEntityManager(game); - gameEntityManager.lazyInit( - game.getChildGameConfig().getAreaShowEntityByOwnAmountConstructionPrototypeIds(), - game.getChildGameConfig().getAreaShowEntityByOwnAmountResourceIds(), - game.getChildGameConfig().getAreaShowEntityByChangeAmountResourceIds() - ); + + - logicFrameListeners.add(constructionControlBoard); + logicFrameListeners.add(game.getIdleGameplayExport()); gameAreaChangeListeners.add(backgroundImageBox); - gameAreaChangeListeners.add(constructionControlBoard); + gameAreaChangeListeners.add(gameAreaControlBoard); this.getGame().getIdleGameplayExport().getGameplayContext().getEventManager().registerListener(this); - this.getGame().getIdleGameplayExport().getGameplayContext().getEventManager().registerListener(gameImageDrawer); + } @@ -135,10 +131,7 @@ protected void lazyInitUiRootContext() { gameAreaControlBoard = new GameAreaControlBoard<>(this); uiRootTable.add(gameAreaControlBoard).expand().right().row(); - // impl switchable - constructionControlBoard = new FixedConstructionControlBoard<>(this); - uiRootTable.add(constructionControlBoard).height(layoutConst.CONSTRUCION_BOARD_ROOT_BOX_HEIGHT).fill(); - + if (game.debugMode) { uiRootTable.debugCell(); } @@ -165,10 +158,7 @@ protected void lazyInitBackUiAndPopupUiContent() { } - @Override - protected void gameObjectDraw(float delta) { - gameImageDrawer.allEntitiesMoveForFrameAndDraw(); - } + @Override protected void onLogicFrame() { @@ -183,23 +173,20 @@ protected void onLogicFrame() { public void show() { super.show(); - Gdx.input.setInputProcessor(uiStage); - game.getBatch().setProjectionMatrix(uiStage.getViewport().getCamera().combined); - - backUiStage.clear(); - popupRootTable.clear(); - lazyInitBackUiAndPopupUiContent(); + Gdx.input.setInputProcessor(provideDefaultInputProcessor()); - uiRootTable.clear(); - lazyInitUiRootContext(); + updateUIForShow(); - lazyInitLogicContext(); + Gdx.app.log(this.getClass().getSimpleName(), "show done"); + } + protected void updateUIForShow() { // start area setAreaAndNotifyChildren(startArea); - Gdx.app.log(this.getClass().getSimpleName(), "show done"); } + protected abstract InputProcessor provideDefaultInputProcessor(); + public void setAreaAndNotifyChildren(String current) { String last = this.area; this.area = current; diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/screen/play/PlayScreenLayoutConst.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/screen/play/PlayScreenLayoutConst.java index f81782e..17daf30 100644 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/screen/play/PlayScreenLayoutConst.java +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/screen/play/PlayScreenLayoutConst.java @@ -10,6 +10,8 @@ * Created on 2022/01/22 */ public class PlayScreenLayoutConst { + public final float DESK_WIDTH = 100; + public final float DESK_HEIGHT = 100; public int CONSTRUCION_BOARD_ROOT_BOX_HEIGHT = 120; public int CONSTRUCION_CHILD_WIDTH = 100; public int CONSTRUCION_CHILD_BUTTON_HEIGHT = 30; diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/DescriptionPackage.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/DescriptionPackage.java index e6d377e..4b5410d 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/DescriptionPackage.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/DescriptionPackage.java @@ -15,7 +15,8 @@ @NoArgsConstructor @Builder public class DescriptionPackage { - String buttonDescroption; + String clickOutputButtonText; + String upgradeButtonText; String outputCostDescriptionStart; String outputGainDescriptionStart; @@ -23,19 +24,19 @@ public class DescriptionPackage { String upgradeCostDescriptionStart; String upgradeMaxLevelDescription; - private String transformButtonDescroption; + private String transformButtonText; private String transformCostDescriptionStart; private String upgradeMaxLevelHasTransferDescription; - private String destroyButtonDescroption; + private String destroyButtonText; private String destroyGainDescriptionStart; private String destroyCostDescriptionStart; - ILevelDescroptionProvider levelDescroptionProvider; + ILevelDescriptionProvider levelDescriptionProvider; - private IProficiencyDescroptionProvider proficiencyDescroptionProvider; + private IProficiencyDescroptionProvider proficiencyDescriptionProvider; - public static interface ILevelDescroptionProvider { + public static interface ILevelDescriptionProvider { String provide(int level, int workingLevel, boolean reachMaxLevel); } public static interface IProficiencyDescroptionProvider { diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/DescriptionPackageFactory.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/DescriptionPackageFactory.java index 0b759ee..cf3b4bf 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/DescriptionPackageFactory.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/DescriptionPackageFactory.java @@ -1,8 +1,7 @@ package hundun.gdxgame.idleshare.gamelib.framework.model.construction.base; -import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.DescriptionPackage.ILevelDescroptionProvider; +import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.DescriptionPackage.ILevelDescriptionProvider; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.DescriptionPackage.IProficiencyDescroptionProvider; -import hundun.gdxgame.idleshare.gamelib.framework.util.text.Language; /** * @author hundun @@ -10,28 +9,28 @@ */ public class DescriptionPackageFactory { - public static ILevelDescroptionProvider NO_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> ""; - public static ILevelDescroptionProvider ONLY_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> { + public static ILevelDescriptionProvider NO_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> ""; + public static ILevelDescriptionProvider ONLY_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> { return "lv." + level; }; - public static ILevelDescroptionProvider WORKING_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> { + public static ILevelDescriptionProvider WORKING_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> { return "lv." + workingLevel + "/" + level + (reachMaxLevel ? "(max)" : ""); }; - public static ILevelDescroptionProvider LOCK_IMP = (level, workingLevel, reachMaxLevel) -> { + public static ILevelDescriptionProvider LOCK_IMP = (level, workingLevel, reachMaxLevel) -> { return (reachMaxLevel ? "Unlocked" : ""); }; public static IProficiencyDescroptionProvider EN_PROFICIENCY_IMP = (proficiency, reachMaxProficiency) -> { return "efficiency: " + proficiency; }; - public static ILevelDescroptionProvider CN_NO_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> ""; - public static ILevelDescroptionProvider CN_ONLY_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> { + public static ILevelDescriptionProvider CN_NO_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> ""; + public static ILevelDescriptionProvider CN_ONLY_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> { return "等级" + level; }; - public static ILevelDescroptionProvider CN_WORKING_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> { + public static ILevelDescriptionProvider CN_WORKING_LEVEL_IMP = (level, workingLevel, reachMaxLevel) -> { return "等级" +workingLevel + "/" + level + (reachMaxLevel ? "(最大)" : ""); }; - public static ILevelDescroptionProvider CN_LOCK_IMP = (level, workingLevel, reachMaxLevel) -> { + public static ILevelDescriptionProvider CN_LOCK_IMP = (level, workingLevel, reachMaxLevel) -> { return (reachMaxLevel ? "已解锁" : ""); }; diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/LevelComponent.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/LevelComponent.java index 2135d3a..0322120 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/LevelComponent.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/LevelComponent.java @@ -27,7 +27,7 @@ public LevelComponent(BaseConstruction construction, boolean workingLevelChangab public String getWorkingLevelDescroption() { boolean reachMaxLevel = construction.getSaveData().getLevel() == this.maxLevel; - return construction.descriptionPackage.getLevelDescroptionProvider().provide(construction.saveData.getLevel(), construction.saveData.getWorkingLevel(), reachMaxLevel); + return construction.descriptionPackage.getLevelDescriptionProvider().provide(construction.saveData.getLevel(), construction.saveData.getWorkingLevel(), reachMaxLevel); } public boolean canChangeWorkingLevel(int delta) { diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/ProficiencyComponent.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/ProficiencyComponent.java index 9ba82f3..938076f 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/ProficiencyComponent.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/base/ProficiencyComponent.java @@ -15,7 +15,7 @@ public ProficiencyComponent(BaseConstruction construction) public String getProficiencyDescroption() { Boolean reachMaxLevel = construction.saveData.getProficiency() >= this.maxProficiency; - return construction.descriptionPackage.getProficiencyDescroptionProvider().provide(construction.saveData.getProficiency(), reachMaxLevel); + return construction.descriptionPackage.getProficiencyDescriptionProvider().provide(construction.saveData.getProficiency(), reachMaxLevel); } public Boolean canPromote() diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/starter/EmptyOutputComponent.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/starter/EmptyAutoOutputComponent.java similarity index 82% rename from idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/starter/EmptyOutputComponent.java rename to idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/starter/EmptyAutoOutputComponent.java index d6475f5..e2e8682 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/starter/EmptyOutputComponent.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/construction/starter/EmptyAutoOutputComponent.java @@ -3,9 +3,9 @@ import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.OutputComponent; -public class EmptyOutputComponent extends OutputComponent { +public class EmptyAutoOutputComponent extends OutputComponent { - public EmptyOutputComponent(BaseConstruction construction) { + public EmptyAutoOutputComponent(BaseConstruction construction) { super(construction); }