-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
456 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoAchievementId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package hundun.gdxgame.idledemo.logic; | ||
|
||
public class DemoAchievementId { | ||
public static final String STEP_1 = "ENUM_ACHI@STEP_1"; | ||
public static final String STEP_2 = "ENUM_ACHI@STEP_2"; | ||
} |
58 changes: 55 additions & 3 deletions
58
IdleDemo-game/core/src/main/java/hundun/gdxgame/idledemo/logic/DemoAchievementLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,67 @@ | ||
package hundun.gdxgame.idledemo.logic; | ||
|
||
import hundun.gdxgame.idleshare.gamelib.framework.model.AbstractAchievement; | ||
import hundun.gdxgame.idleshare.gamelib.framework.model.IBuiltinAchievementsLoader; | ||
import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt; | ||
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.util.text.Language; | ||
|
||
import java.util.AbstractMap.SimpleEntry; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class DemoAchievementLoader implements IBuiltinAchievementsLoader { | ||
@Override | ||
public Map<String, AbstractAchievement> getProviderMap(Language language) { | ||
return new HashMap<>(); | ||
Map<String, List<String>> textMap = new HashMap<>(); | ||
switch (language) | ||
{ | ||
case CN: | ||
textMap.put(DemoAchievementId.STEP_1, JavaFeatureForGwt.listOf( | ||
"NO.1", | ||
"拥有两个小森林。", | ||
"你完成了任务NO.1。" | ||
)); | ||
textMap.put(DemoAchievementId.STEP_2, JavaFeatureForGwt.listOf( | ||
"NO.2", | ||
"拥有两个小工厂。", | ||
"你完成了任务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." | ||
)); | ||
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." | ||
)); | ||
break; | ||
} | ||
|
||
|
||
|
||
Map<String, AbstractAchievement> map = new HashMap<>(); | ||
OwnConstructionAchievement.Companion.quickAddOwnConstructionAchievement( | ||
map, | ||
DemoAchievementId.STEP_1, | ||
textMap, | ||
JavaFeatureForGwt.mapOf( | ||
ConstructionPrototypeId.COOKIE_AUTO_SELLER, new SimpleEntry<>(1, 2) | ||
) | ||
); | ||
OwnConstructionAchievement.Companion.quickAddOwnConstructionAchievement( | ||
map, | ||
DemoAchievementId.STEP_2, | ||
textMap, | ||
JavaFeatureForGwt.mapOf( | ||
ConstructionPrototypeId.COOKIE_AUTO_SELLER, new SimpleEntry<>(1, 2) | ||
) | ||
); | ||
return map; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...game/core/src/main/java/hundun/gdxgame/idledemo/ui/sub/FirstLockedAchievementBoardVM.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package hundun.gdxgame.idledemo.ui.sub; | ||
|
||
import com.badlogic.gdx.scenes.scene2d.ui.Label; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Table; | ||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; | ||
import hundun.gdxgame.gamelib.starter.listerner.IGameAreaChangeListener; | ||
import hundun.gdxgame.idleshare.core.framework.BaseIdleGame; | ||
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdlePlayScreen; | ||
import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementInfoPackage; | ||
|
||
public class FirstLockedAchievementBoardVM<T_GAME extends BaseIdleGame<T_SAVE>, T_SAVE> extends Table implements IGameAreaChangeListener { | ||
|
||
BaseIdlePlayScreen<T_GAME, T_SAVE> parent; | ||
|
||
Label nameStartLabel; | ||
Label nameValueLabel; | ||
Label descriptionLabel; | ||
Label countStartLabel; | ||
Label countValueLabel; | ||
|
||
|
||
public FirstLockedAchievementBoardVM(BaseIdlePlayScreen<T_GAME, T_SAVE> parent) | ||
{ | ||
this.parent = parent; | ||
this.setBackground(new TextureRegionDrawable(parent.getGame().getTextureManager().getDefaultBoardNinePatchTexture())); | ||
|
||
|
||
nameStartLabel = new Label("", parent.getGame().getMainSkin()); | ||
this.add(nameStartLabel).center(); | ||
nameValueLabel = new Label("", parent.getGame().getMainSkin()); | ||
this.add(nameValueLabel).center().row(); | ||
descriptionLabel = new Label("", parent.getGame().getMainSkin()); | ||
this.add(descriptionLabel).center().row(); | ||
countStartLabel = new Label("", parent.getGame().getMainSkin()); | ||
this.add(countStartLabel).center().row(); | ||
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)); | ||
updateData(); | ||
} | ||
|
||
private void updateData() | ||
{ | ||
AchievementInfoPackage data = parent.getGame().getIdleGameplayExport().getGameplayContext().getAchievementManager().getAchievementInfoPackage(); | ||
if (data.getFirstLockedAchievement() != null) | ||
{ | ||
nameValueLabel.setText(data.getFirstLockedAchievement().getName()); | ||
descriptionLabel.setText(data.getFirstLockedAchievement().getDescription()); | ||
} | ||
else | ||
{ | ||
nameValueLabel.setText("已完成"); | ||
descriptionLabel.setText("无"); | ||
} | ||
|
||
countValueLabel.setText(" " + data.getUnLockedSize() + "/" + data.getTotal()); | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void onGameAreaChange(String last, String current) { | ||
updateData(); | ||
} | ||
} |
Oops, something went wrong.