Skip to content

Commit

Permalink
fix typo, add COOKIE_CLICK_PROVIDER
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Jul 22, 2023
1 parent 1cd3856 commit 9f541f6
Show file tree
Hide file tree
Showing 34 changed files with 650 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,6 +26,7 @@ public DemoChildGameConfig() {

Map<String, List<String>> areaControlableConstructionVMPrototypeIds = new HashMap<>();
areaControlableConstructionVMPrototypeIds.put(GameArea.AREA_COOKIE, JavaFeatureForGwt.arraysAsList(
ConstructionPrototypeId.COOKIE_CLICK_PROVIDER,
ConstructionPrototypeId.COOKIE_AUTO_PROVIDER,
ConstructionPrototypeId.COOKIE_AUTO_SELLER
));
Expand All @@ -54,7 +53,7 @@ public DemoChildGameConfig() {

Map<String, String> 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,6 +26,7 @@ public class DemoBuiltinConstructionsLoader implements IBuiltinConstructionsLoad
@Override
public Map<String, AbstractConstructionPrototype> getProviderMap(Language language) {
Map<String, AbstractConstructionPrototype> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> values = Arrays.asList(AREA_COOKIE, AREA_BUILDING, AREA_WIN);
public static final List<String> values = Arrays.asList(AREA_COOKIE, AREA_FOREST);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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));
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Loading

0 comments on commit 9f541f6

Please sign in to comment.