Skip to content

Commit

Permalink
fix AchievementMaskBoard
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Sep 10, 2023
1 parent 6263050 commit 52fac32
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ public Map<String, AbstractAchievement> getProviderMap(Language language) {
case CN:
textMap.put(DemoAchievementId.STEP_1, JavaFeatureForGwt.listOf(
"NO.1",
"拥有两个小森林。",
"拥有2级AUTO_PROVIDER。",
"你完成了任务NO.1。"
));
textMap.put(DemoAchievementId.STEP_2, JavaFeatureForGwt.listOf(
"NO.2",
"拥有两个小工厂。",
"拥有2级AUTO_SELLER。",
"你完成了任务NO.2。"
));
break;
default:
textMap.put(DemoAchievementId.STEP_1, JavaFeatureForGwt.listOf(
"NO.1",
"Own two small forests.",
"You completed Quest NO.1.\nThank you for your tireless efforts to protect our planet and make it a better place for future generations."
"Own lv.2 AUTO_PROVIDER.",
"You completed Quest NO.1."
));
textMap.put(DemoAchievementId.STEP_2, JavaFeatureForGwt.listOf(
"NO.2",
"Own two small factories.",
"You completed Quest NO.2.\nWe are thrilled to see the positive impact on our local economy with more jobs and increased business opportunities. Thank you to all who have contributed to our economic success."
"Own lv.2 AUTO_SELLER.",
"You completed Quest NO.2."
));
break;
}
Expand All @@ -51,7 +51,7 @@ public Map<String, AbstractAchievement> getProviderMap(Language language) {
DemoAchievementId.STEP_1,
textMap,
JavaFeatureForGwt.mapOf(
ConstructionPrototypeId.COOKIE_AUTO_SELLER, new SimpleEntry<>(1, 2)
ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, new SimpleEntry<>(1, 2)
)
);
OwnConstructionAchievement.Companion.quickAddOwnConstructionAchievement(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected RootSaveData genereateStarterRootSaveData() {
Map<String, ConstructionSaveData> map = new HashMap<>();

map.put(
ConstructionPrototypeId.COOKIE_CLICK_PROVIDER + "_" + UUID.randomUUID().toString(),
ConstructionPrototypeId.COOKIE_CLICK_PROVIDER + "_" + UUID.randomUUID(),
ConstructionSaveData.builder()
.prototypeId(ConstructionPrototypeId.COOKIE_CLICK_PROVIDER)
.level(0)
Expand All @@ -37,7 +37,7 @@ protected RootSaveData genereateStarterRootSaveData() {
.build()
);
map.put(
ConstructionPrototypeId.COOKIE_AUTO_PROVIDER + "_" + UUID.randomUUID().toString(),
ConstructionPrototypeId.COOKIE_AUTO_PROVIDER + "_" + UUID.randomUUID(),
ConstructionSaveData.builder()
.prototypeId(ConstructionPrototypeId.COOKIE_AUTO_PROVIDER)
.level(1)
Expand All @@ -46,7 +46,7 @@ protected RootSaveData genereateStarterRootSaveData() {
.build()
);
map.put(
ConstructionPrototypeId.COOKIE_AUTO_SELLER + "_" + UUID.randomUUID().toString(),
ConstructionPrototypeId.COOKIE_AUTO_SELLER + "_" + UUID.randomUUID(),
ConstructionSaveData.builder()
.prototypeId(ConstructionPrototypeId.COOKIE_AUTO_SELLER)
.level(1)
Expand All @@ -61,7 +61,7 @@ protected RootSaveData genereateStarterRootSaveData() {
);
dirtGridPositions.forEach(it -> {
map.put(
ConstructionPrototypeId.EMPTY_CELL + "_" + UUID.randomUUID().toString(),
ConstructionPrototypeId.EMPTY_CELL + "_" + UUID.randomUUID(),
ConstructionSaveData.builder()
.prototypeId(ConstructionPrototypeId.EMPTY_CELL)
.level(0)
Expand All @@ -70,10 +70,14 @@ protected RootSaveData genereateStarterRootSaveData() {
.build()
);
});

Map<String, Long> ownResources = new HashMap<>();
ownResources.put(ResourceType.COIN, 500L);

return RootSaveData.builder()
.gameplaySave(GameplaySaveData.builder()
.constructionSaveDataMap(map)
.ownResoueces(new HashMap<>())
.ownResources(ownResources)
.unlockedResourceTypes(new HashSet<>())
.unlockedAchievementIds(new HashSet<>())
.build())
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ allprojects {
gdxFreeTypeGwtVersion = '1.9.10.1'
gwtFrameworkVersion = '2.8.2'

hundunLibVersion = 'f5e40d5fb1'
hundunLibVersion = '77884f68d3'
raeleusStripeVersion = '1.4.1'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable;

Expand All @@ -32,9 +34,9 @@ public AchievementMaskBoard(BaseIdlePlayScreen<T_GAME, T_SAVE> parent) {
this.add(label).center().row();

Button textButton = new TextButton("continue", parent.getGame().getMainSkin());
textButton.addListener(new ClickListener() {
textButton.addListener(new ChangeListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
public void changed(ChangeEvent event, Actor actor) {
parent.hideAchievementMaskBoard();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class BaseIdlePlayScreen<T_GAME extends BaseIdleGame<T_SAVE>, T_
@Getter
protected final PlayScreenLayoutConst layoutConst;


protected boolean hidden;
// ====== need child lazy-init start ======
protected AchievementMaskBoard<T_GAME, T_SAVE> achievementMaskBoard;

Expand Down Expand Up @@ -75,12 +75,15 @@ public void dispose() {
public void hideAchievementMaskBoard() {
game.getFrontend().log(this.getClass().getSimpleName(), "hideAchievementMaskBoard called");
achievementMaskBoard.setVisible(false);
Gdx.input.setInputProcessor(uiStage);
Gdx.input.setInputProcessor(provideDefaultInputProcessor());
logicFrameHelper.setLogicFramePause(false);
}

@Override
public void showAchievementMaskBoard(AbstractAchievement prototype) {
if (this.hidden) {
return;
}
game.getFrontend().log(this.getClass().getSimpleName(), "onAchievementUnlock called");
achievementMaskBoard.setAchievementPrototype(prototype);
achievementMaskBoard.setVisible(true);
Expand Down Expand Up @@ -153,9 +156,17 @@ public void show() {

updateUIForShow();

this.hidden = false;
Gdx.app.log(this.getClass().getSimpleName(), "show done");
}

@Override
public void hide() {
super.hide();

this.hidden = true;
}

protected abstract void updateUIForShow();

protected abstract InputProcessor provideDefaultInputProcessor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public class IdleGameplayExport implements ILogicFrameListener,
ISubSystemSettingSaveHandler<SystemSettingSaveData> {

@Getter
private IdleGameplayContext gameplayContext;
private IBuiltinConstructionsLoader builtinConstructionsLoader;
private IBuiltinAchievementsLoader builtinAchievementsLoader;
private ChildGameConfig childGameConfig;
private final IdleGameplayContext gameplayContext;
private final IBuiltinConstructionsLoader builtinConstructionsLoader;
private final IBuiltinAchievementsLoader builtinAchievementsLoader;
private final ChildGameConfig childGameConfig;
@Getter
private IGameDictionary gameDictionary;
private final IGameDictionary gameDictionary;
@Setter
@Getter
private Language language;
Expand Down Expand Up @@ -68,7 +68,7 @@ public void applyGameplaySaveData(GameplaySaveData gameplaySaveData) {
});

gameplayContext.getStorageManager().setUnlockedResourceTypes(gameplaySaveData.getUnlockedResourceTypes());
gameplayContext.getStorageManager().setOwnResoueces(gameplaySaveData.getOwnResoueces());
gameplayContext.getStorageManager().setOwnResoueces(gameplaySaveData.getOwnResources());
gameplayContext.getAchievementManager().setUnlockedAchievementIds(gameplaySaveData.getUnlockedAchievementIds());
}

Expand All @@ -83,7 +83,7 @@ public void currentSituationToGameplaySaveData(GameplaySaveData gameplaySaveData
))
);
gameplaySaveData.setUnlockedResourceTypes(gameplayContext.getStorageManager().getUnlockedResourceTypes());
gameplaySaveData.setOwnResoueces(gameplayContext.getStorageManager().getOwnResoueces());
gameplaySaveData.setOwnResources(gameplayContext.getStorageManager().getOwnResoueces());
gameplaySaveData.setUnlockedAchievementIds(gameplayContext.getAchievementManager().getUnlockedAchievementIds());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.Map;
import java.util.Set;

import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
Expand All @@ -19,7 +18,7 @@
@NoArgsConstructor
public class GameplaySaveData {
String stageId;
Map<String, Long> ownResoueces;
Map<String, Long> ownResources;
Set<String> unlockedResourceTypes;
Map<String, ConstructionSaveData> constructionSaveDataMap;
Set<String> unlockedAchievementIds;
Expand Down

0 comments on commit 52fac32

Please sign in to comment.