From 324284c7734e2005e50e6a699428102720ec92d7 Mon Sep 17 00:00:00 2001 From: hundun Date: Sun, 17 Sep 2023 16:34:35 +0800 Subject: [PATCH] update Achievement --- .../idledemo/logic/DemoAchievementLoader.java | 7 +- .../idledemo/logic/DemoGameDictionary.java | 10 +- .../ui/screen/BaseDemoPlayScreen.java | 5 +- .../ui/sub/FirstLockedAchievementBoardVM.java | 13 ++- .../core/starter/ConstructionsConfig.java | 96 ------------------- .../ui/component/AchievementMaskBoard.java | 46 +++++++-- .../starter/ui/component/IdleEntityArea.java | 17 ---- .../starter/ui/component/PopupInfoBoard.java | 6 +- .../impl/ConstructionControlNode.java | 6 +- .../fixed/FixedConstructionControlBoard.java | 2 +- .../ScrollConstructionControlBoard.java | 12 +-- .../ui/screen/play/BaseIdlePlayScreen.java | 11 ++- .../ui/screen/play/PlayScreenLayoutConst.java | 4 + .../achievement/AbstractAchievement.java | 7 +- .../OwnConstructionAchievement.java | 15 ++- .../model/manager/AchievementManager.java | 4 - 16 files changed, 105 insertions(+), 156 deletions(-) delete mode 100644 idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ConstructionsConfig.java delete mode 100644 idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/IdleEntityArea.java 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 a0c5582..52e2a2e 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 @@ -4,6 +4,7 @@ import hundun.gdxgame.idleshare.gamelib.framework.model.achievement.AbstractAchievement; import hundun.gdxgame.idleshare.gamelib.framework.model.achievement.IBuiltinAchievementsLoader; import hundun.gdxgame.idleshare.gamelib.framework.model.achievement.OwnConstructionAchievement; +import hundun.gdxgame.idleshare.gamelib.framework.model.resource.ResourcePair; import hundun.gdxgame.idleshare.gamelib.framework.util.text.Language; import java.util.AbstractMap.SimpleEntry; @@ -52,7 +53,8 @@ public Map getProviderMap(Language language) { textMap, JavaFeatureForGwt.mapOf( ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, new SimpleEntry<>(1, 2) - ) + ), + new ResourcePair(ResourceType.COIN, 1000L) ); OwnConstructionAchievement.Companion.quickAddOwnConstructionAchievement( map, @@ -60,7 +62,8 @@ public Map getProviderMap(Language language) { textMap, JavaFeatureForGwt.mapOf( ConstructionPrototypeId.COOKIE_AUTO_SELLER, new SimpleEntry<>(1, 2) - ) + ), + new ResourcePair(ResourceType.COIN, 1000L) ); return map; } 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 0065894..efc0584 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 @@ -93,9 +93,15 @@ public List getAchievementTexts(Language language) switch (language) { case CN: - return JavaFeatureForGwt.arraysAsList("当前任务:", "已完成:", "回到游戏"); + return JavaFeatureForGwt.listOf( + "当前任务:", "已完成:", "回到游戏", "奖励内容:", "领取", + "无" + ); default: - return JavaFeatureForGwt.arraysAsList("Quest: ", "Completed: ", "back"); + return JavaFeatureForGwt.listOf( + "Quest: ", "Completed: ", "back", "reward: ", "Get it", + "None" + ); } } diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/BaseDemoPlayScreen.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/BaseDemoPlayScreen.java index f9dfbd5..b9355ad 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/BaseDemoPlayScreen.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/screen/BaseDemoPlayScreen.java @@ -58,7 +58,10 @@ protected void lazyInitUiRootContext() { Table rightSideGroup = new Table(); firstLockedAchievementBoardVM = new FirstLockedAchievementBoardVM<>(this); - rightSideGroup.add(firstLockedAchievementBoardVM).expandX().height(200).row(); + rightSideGroup.add(firstLockedAchievementBoardVM) + .width(getLayoutConst().FIRST_LOCKED_ACHIEVEMENT_BOARD_WIDTH) + .height(getLayoutConst().FIRST_LOCKED_ACHIEVEMENT_BOARD_HEIGHT) + .row(); gameAreaControlBoard = new GameAreaControlBoard<>(this); rightSideGroup.add(gameAreaControlBoard).expand().right(); diff --git a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/sub/FirstLockedAchievementBoardVM.java b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/sub/FirstLockedAchievementBoardVM.java index cc1326d..bb6147c 100644 --- a/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/sub/FirstLockedAchievementBoardVM.java +++ b/IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/ui/sub/FirstLockedAchievementBoardVM.java @@ -8,6 +8,8 @@ import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdlePlayScreen; import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementInfoPackage; +import java.util.List; + public class FirstLockedAchievementBoardVM, T_SAVE> extends Table implements IGameAreaChangeListener { BaseIdlePlayScreen parent; @@ -18,10 +20,13 @@ public class FirstLockedAchievementBoardVM, Label countStartLabel; Label countValueLabel; + List texts; public FirstLockedAchievementBoardVM(BaseIdlePlayScreen parent) { this.parent = parent; + this.texts = parent.getGame().getIdleGameplayExport().getGameDictionary() + .getAchievementTexts(parent.getGame().getIdleGameplayExport().getLanguage()); this.setBackground(new TextureRegionDrawable(parent.getGame().getTextureManager().getDefaultBoardNinePatchTexture())); @@ -36,8 +41,8 @@ public FirstLockedAchievementBoardVM(BaseIdlePlayScreen parent) countValueLabel = new Label("", parent.getGame().getMainSkin()); this.add(countValueLabel).center().row(); - nameStartLabel.setText(parent.getGame().getIdleGameplayExport().getGameDictionary().getAchievementTexts(parent.getGame().getIdleGameplayExport().getLanguage()).get(0)); - countStartLabel.setText(parent.getGame().getIdleGameplayExport().getGameDictionary().getAchievementTexts(parent.getGame().getIdleGameplayExport().getLanguage()).get(1)); + nameStartLabel.setText(texts.get(0)); + countStartLabel.setText(texts.get(1)); updateData(); } @@ -51,8 +56,8 @@ private void updateData() } else { - nameValueLabel.setText("已完成"); - descriptionLabel.setText("无"); + nameValueLabel.setText(""); + descriptionLabel.setText(texts.get(5)); } countValueLabel.setText(" " + data.getUnLockedSize() + "/" + data.getTotal()); diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ConstructionsConfig.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ConstructionsConfig.java deleted file mode 100644 index 41cae6d..0000000 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ConstructionsConfig.java +++ /dev/null @@ -1,96 +0,0 @@ -package hundun.gdxgame.idleshare.core.starter; - -import java.util.List; - -import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.DescriptionPackage; -import hundun.gdxgame.idleshare.gamelib.framework.model.resource.ResourcePack; - -/** - * @author hundun - * Created on 2021/12/17 - */ -public class ConstructionsConfig { - - List nodes; - - public static class ConstructionNode { - String id; - ConstructionClazz clazz; - String detailDescroptionConstPart; - DescriptionPackage descriptionPackage; - ResourcePack upgradeCostPack; - ResourcePack outputGainPack; - ResourcePack outputCostPack; - boolean workingLevelChangable; - - // ------ replace-lombok ------ - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public ConstructionClazz getClazz() { - return clazz; - } - public void setClazz(ConstructionClazz clazz) { - this.clazz = clazz; - } - public String getDetailDescroptionConstPart() { - return detailDescroptionConstPart; - } - public void setDetailDescroptionConstPart(String detailDescroptionConstPart) { - this.detailDescroptionConstPart = detailDescroptionConstPart; - } - public DescriptionPackage getDescriptionPackage() { - return descriptionPackage; - } - public void setDescriptionPackage(DescriptionPackage descriptionPackage) { - this.descriptionPackage = descriptionPackage; - } - public ResourcePack getUpgradeCostPack() { - return upgradeCostPack; - } - public void setUpgradeCostPack(ResourcePack upgradeCostPack) { - this.upgradeCostPack = upgradeCostPack; - } - public ResourcePack getOutputGainPack() { - return outputGainPack; - } - public void setOutputGainPack(ResourcePack outputGainPack) { - this.outputGainPack = outputGainPack; - } - public ResourcePack getOutputCostPack() { - return outputCostPack; - } - public void setOutputCostPack(ResourcePack outputCostPack) { - this.outputCostPack = outputCostPack; - } - public boolean isWorkingLevelChangable() { - return workingLevelChangable; - } - public void setWorkingLevelChangable(boolean workingLevelChangable) { - this.workingLevelChangable = workingLevelChangable; - } - - - } - - - public static enum ConstructionClazz { - AUTO, - CLICK, - ; - } - - - // ------ replace-lombok ------ - public List getNodes() { - return nodes; - } - public void setNodes(List nodes) { - this.nodes = nodes; - } - - -} diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/AchievementMaskBoard.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/AchievementMaskBoard.java index 6590215..c41118f 100644 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/AchievementMaskBoard.java +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/AchievementMaskBoard.java @@ -12,9 +12,13 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable; +import com.badlogic.gdx.utils.Null; import hundun.gdxgame.idleshare.core.framework.BaseIdleGame; import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdlePlayScreen; import hundun.gdxgame.idleshare.gamelib.framework.model.achievement.AbstractAchievement; +import hundun.gdxgame.idleshare.gamelib.framework.model.resource.ResourcePair; + +import java.util.List; /** * @author hundun @@ -23,29 +27,57 @@ public class AchievementMaskBoard, T_SAVE> extends Table { BaseIdlePlayScreen parent; - Label label; - public AchievementMaskBoard(BaseIdlePlayScreen parent) { + + List texts; + + public AchievementMaskBoard(BaseIdlePlayScreen parent, List texts) { this.parent = parent; + this.texts = texts; this.setBackground(new SpriteDrawable(new Sprite(parent.getGame().getTextureManager().getAchievementMaskBoardTexture()))); this.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + rebuildUi(null); + this.setVisible(false); + + } + + private void rebuildUi(@Null AbstractAchievement prototype) { + this.clearChildren(); - label = new Label("", parent.getGame().getMainSkin()); + Label label = new Label(prototype != null ? prototype.getDescription() : "", parent.getGame().getMainSkin()); this.add(label).center().row(); - Button textButton = new TextButton("continue", parent.getGame().getMainSkin()); + if (prototype != null && prototype.getAwardResourceMap() != null) { + Label rewardLabel = new Label(texts.get(3), parent.getGame().getMainSkin()); + this.add(rewardLabel).center().row(); + for (ResourcePair entry : prototype.getAwardResourceMap()) { + ResourceAmountPairNode node = new ResourceAmountPairNode<>(parent.getGame(), entry.getType()); + node.update(entry.getAmount()); + this.add(node) + .height(parent.getLayoutConst().RESOURCE_AMOUNT_PAIR_NODE_HEIGHT) + .width(parent.getLayoutConst().RESOURCE_AMOUNT_PAIR_NODE_WIDTH); + this.row(); + } + } + + Button textButton = new TextButton(texts.get(4), parent.getGame().getMainSkin()); textButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { + if (prototype != null && prototype.getAwardResourceMap() != null) + { + parent.getGame().getIdleGameplayExport().getGameplayContext().getStorageManager().modifyAllResourceNum(prototype.getAwardResourceMap(), true); + } parent.hideAchievementMaskBoard(); } }); this.add(textButton).center(); + } - this.setVisible(false); - } public void setAchievementPrototype(AbstractAchievement prototype) { - label.setText(prototype.getDescription()); + + rebuildUi(prototype); + } } diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/IdleEntityArea.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/IdleEntityArea.java deleted file mode 100644 index 8ea430f..0000000 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/IdleEntityArea.java +++ /dev/null @@ -1,17 +0,0 @@ -package hundun.gdxgame.idleshare.core.starter.ui.component; - -import com.badlogic.gdx.scenes.scene2d.ui.Table; - -import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdlePlayScreen; - -/** - * @author hundun - * Created on 2023/02/17 - */ -public class IdleEntityArea extends Table { - - public IdleEntityArea(BaseIdlePlayScreen baseIdlePlayScreen) { - // TODO Auto-generated constructor stub - } - -} diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/PopupInfoBoard.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/PopupInfoBoard.java index a9814e1..af8f29f 100644 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/PopupInfoBoard.java +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/PopupInfoBoard.java @@ -19,8 +19,6 @@ * Created on 2021/11/08 */ public class PopupInfoBoard, T_SAVE> extends Table { - private static int NODE_HEIGHT = 25; - private static int NODE_WIDTH = 70; BaseIdlePlayScreen parent; @@ -74,7 +72,9 @@ private void buildOnePack(ResourcePack pack) { for (ResourcePair entry : pack.getModifiedValues()) { ResourceAmountPairNode node = new ResourceAmountPairNode<>(parent.getGame(), entry.getType()); node.update(entry.getAmount()); - this.add(wapperContainer(node)).height(NODE_HEIGHT).width(NODE_WIDTH); + this.add(wapperContainer(node)) + .height(parent.getLayoutConst().RESOURCE_AMOUNT_PAIR_NODE_HEIGHT) + .width(parent.getLayoutConst().RESOURCE_AMOUNT_PAIR_NODE_WIDTH); } this.row(); } 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 1f572d8..3fd8a25 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 @@ -116,11 +116,11 @@ public void clicked(InputEvent event, float x, float y) { model.getLevelComponent().changeWorkingLevel(-1); } }); - changeWorkingLevelGroup.add(downWorkingLevelButton).size(CHILD_WIDTH / 4, CHILD_HEIGHT); + changeWorkingLevelGroup.add(downWorkingLevelButton).size(CHILD_WIDTH / 4.0f, CHILD_HEIGHT); this.workingLevelLabel = new Label("", parent.getGame().getMainSkin()); workingLevelLabel.setAlignment(Align.center); - changeWorkingLevelGroup.add(workingLevelLabel).size(CHILD_WIDTH / 2, CHILD_HEIGHT); + changeWorkingLevelGroup.add(workingLevelLabel).size(CHILD_WIDTH / 2.0f, CHILD_HEIGHT); this.upWorkingLevelButton = new TextButton("+", parent.getGame().getMainSkin()); upWorkingLevelButton.addListener(new ClickListener() { @@ -130,7 +130,7 @@ public void clicked(InputEvent event, float x, float y) { model.getLevelComponent().changeWorkingLevel(1); } }); - changeWorkingLevelGroup.add(upWorkingLevelButton).size(CHILD_WIDTH / 4, CHILD_HEIGHT); + changeWorkingLevelGroup.add(upWorkingLevelButton).size(CHILD_WIDTH / 4.0f, CHILD_HEIGHT); this.proficiencyLabel = new Label("", parent.getGame().getMainSkin()); this.positionLabel = new Label("", parent.getGame().getMainSkin()); diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/fixed/FixedConstructionControlBoard.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/fixed/FixedConstructionControlBoard.java index 34c36b4..bef2333 100644 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/fixed/FixedConstructionControlBoard.java +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/fixed/FixedConstructionControlBoard.java @@ -46,7 +46,7 @@ protected int initChild(int areaShownConstructionsSize) { childTable.clearChildren(); for (int i = 0; i < childrenSize; i++) { - ConstructionControlNode constructionView = new ConstructionControlNode(parent, callback, i, parent.getLayoutConst()); + ConstructionControlNode constructionView = new ConstructionControlNode<>(parent, callback, i, parent.getLayoutConst()); constructionControlNodes.add(constructionView); childTable.add(constructionView).spaceRight(10).expand(); } diff --git a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/scroll/ScrollConstructionControlBoard.java b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/scroll/ScrollConstructionControlBoard.java index b18472c..fd0a176 100644 --- a/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/scroll/ScrollConstructionControlBoard.java +++ b/idleshare/core/src/hundun/gdxgame/idleshare/core/starter/ui/component/board/construction/impl/scroll/ScrollConstructionControlBoard.java @@ -7,6 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import hundun.gdxgame.corelib.base.util.DrawableFactory; +import hundun.gdxgame.idleshare.core.framework.BaseIdleGame; import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.AbstractConstructionControlBoard; import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.impl.ConstructionControlNode; import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdlePlayScreen; @@ -18,7 +19,7 @@ * @author hundun * Created on 2021/11/05 */ -public class ScrollConstructionControlBoard extends AbstractConstructionControlBoard { +public class ScrollConstructionControlBoard, T_SAVE> extends AbstractConstructionControlBoard { @@ -35,7 +36,7 @@ public class ScrollConstructionControlBoard extends AbstractConstructionControlB - public ScrollConstructionControlBoard(BaseIdlePlayScreen parent, ISecondaryInfoBoardCallback callback) { + public ScrollConstructionControlBoard(BaseIdlePlayScreen parent, ISecondaryInfoBoardCallback callback) { super(parent, callback); this.LR_BUTTON_HEIGHT = parent.getLayoutConst().CONSTRUCION_BOARD_ROOT_BOX_HEIGHT; @@ -76,17 +77,16 @@ public void clicked(InputEvent event, float x, float y) { @Override protected int initChild(int areaShownConstructionsSize) { - int childrenSize = areaShownConstructionsSize; constructionControlNodes.clear(); childTable.clearChildren(); - for (int i = 0; i < childrenSize; i++) { - ConstructionControlNode constructionView = new ConstructionControlNode(parent, callback, i, parent.getLayoutConst()); + for (int i = 0; i < areaShownConstructionsSize; i++) { + ConstructionControlNode constructionView = new ConstructionControlNode<>(parent, callback, i, parent.getLayoutConst()); constructionControlNodes.add(constructionView); childTable.add(constructionView).spaceRight(10).expand(); } - return childrenSize; + return areaShownConstructionsSize; } 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 f040f29..9735ca6 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 @@ -125,10 +125,13 @@ protected void lazyInitBackUiAndPopupUiContent() { this.backgroundImageBox = new BackgroundImageBox<>(this); backUiStage.addActor(backgroundImageBox); - - - - achievementMaskBoard = new AchievementMaskBoard<>(this); + achievementMaskBoard = new AchievementMaskBoard<>( + this, + game.getIdleGameplayExport() + .getGameplayContext() + .getGameDictionary() + .getAchievementTexts(game.getIdleGameplayExport().getLanguage()) + ); popupUiStage.addActor(achievementMaskBoard); if (game.debugMode) { 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 17daf30..a716ad6 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 @@ -30,6 +30,10 @@ public class PlayScreenLayoutConst { public int EXPECTED_DRAW_MIN_Y; public int EXPECTED_DRAW_MAX_Y; + public int RESOURCE_AMOUNT_PAIR_NODE_HEIGHT = 25; + public int RESOURCE_AMOUNT_PAIR_NODE_WIDTH = 70; + public int FIRST_LOCKED_ACHIEVEMENT_BOARD_WIDTH = 150; + public int FIRST_LOCKED_ACHIEVEMENT_BOARD_HEIGHT = 150; public PlayScreenLayoutConst(int gameLogicWidth, int gameLogicHeight) { this.EXPECTED_DRAW_MIN_X = 0; this.EXPECTED_DRAW_MAX_X = gameLogicWidth; diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/achievement/AbstractAchievement.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/achievement/AbstractAchievement.java index 24cb83c..f9fc004 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/achievement/AbstractAchievement.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/achievement/AbstractAchievement.java @@ -1,10 +1,13 @@ package hundun.gdxgame.idleshare.gamelib.framework.model.achievement; import hundun.gdxgame.idleshare.gamelib.framework.IdleGameplayContext; +import hundun.gdxgame.idleshare.gamelib.framework.model.resource.ResourcePack; +import hundun.gdxgame.idleshare.gamelib.framework.model.resource.ResourcePair; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.List; import java.util.Map; /** @@ -20,11 +23,11 @@ public abstract class AbstractAchievement { protected String name; protected String description; protected String congratulationText; - protected Map awardResourceMap; + protected List awardResourceMap; public abstract boolean checkUnlock(); - public AbstractAchievement(String id, String name, String description, String congratulationText, Map awardResourceMap) { + public AbstractAchievement(String id, String name, String description, String congratulationText, List awardResourceMap) { this.id = id; this.name = name; this.description = description; diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/achievement/OwnConstructionAchievement.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/achievement/OwnConstructionAchievement.java index 31d70da..eccc309 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/achievement/OwnConstructionAchievement.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/achievement/OwnConstructionAchievement.java @@ -1,7 +1,10 @@ package hundun.gdxgame.idleshare.gamelib.framework.model.achievement; +import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction; +import hundun.gdxgame.idleshare.gamelib.framework.model.resource.ResourcePair; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -13,11 +16,12 @@ public class OwnConstructionAchievement extends AbstractAchievement { public OwnConstructionAchievement( String id, String name, String description, String congratulationText, - Map> requireds + Map> requireds, + List awardResourceMap ) { - super(id, name, description, congratulationText, new HashMap<>()); + super(id, name, description, congratulationText, awardResourceMap); this.requireds = requireds; } @@ -52,12 +56,15 @@ public static void quickAddOwnConstructionAchievement( Map map, String id, Map> textMap, - Map> requireds) + Map> requireds, + ResourcePair... awardResourceMap + ) { AbstractAchievement achievement = new OwnConstructionAchievement( id, textMap.get(id).get(0), textMap.get(id).get(1), textMap.get(id).get(2), - requireds + requireds, + JavaFeatureForGwt.listOf(awardResourceMap) ); map.put(id, achievement); } diff --git a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/manager/AchievementManager.java b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/manager/AchievementManager.java index bc0ab51..a3d944b 100644 --- a/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/manager/AchievementManager.java +++ b/idleshare/gamelib/src/hundun/gdxgame/idleshare/gamelib/framework/model/manager/AchievementManager.java @@ -104,10 +104,6 @@ private void checkAllAchievementUnlock() { if (resourceMatched) { unlockedAchievementIds.add(prototype.getId()); gameContext.getEventManager().notifyAchievementUnlock(prototype); - if (prototype.getAwardResourceMap() != null) - { - gameContext.getStorageManager().modifyAllResourceNum(prototype.getAwardResourceMap(), true); - } } } }