Skip to content

Commit

Permalink
update UI; add DemoConstructionPrototypeId.EPOCH_COUNTER
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Oct 21, 2023
1 parent 2ea4e7b commit 566f975
Show file tree
Hide file tree
Showing 16 changed files with 568 additions and 380 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public DemoChildGameConfig() {
.build()
)
.singletonPrototypeIds(JavaFeatureForGwt.listOf(
DemoConstructionPrototypeId.MUSHROOM_AUTO_SELLER
DemoConstructionPrototypeId.MUSHROOM_AUTO_SELLER,
DemoConstructionPrototypeId.EPOCH_COUNTER
))
.worldPrototypeIds(JavaFeatureForGwt.listOf(
DemoConstructionPrototypeId.EPOCH_1_EMPTY_CELL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public Map<String, AbstractConstructionPrototype> getProviderMap(Language langua
result.put(DemoConstructionPrototypeId.EPOCH_1_MUSHROOM_AUTO_PROVIDER, new Epoch1AutoProviderPrototype(language));
result.put(DemoConstructionPrototypeId.MUSHROOM_AUTO_SELLER, new AutoSellerPrototype(language));
result.put(DemoConstructionPrototypeId.EPOCH_1_TREE, new TreePrototype(language));
result.put(DemoConstructionPrototypeId.EPOCH_COUNTER, new EpochCounterPrototype(language));
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ public class DemoConstructionPrototypeId {

public static final String MAIN_MUSHROOM = "ENUM_CSTR@SINGLETON_COOKIE_MAIN_CLICKER";
public static final String EPOCH_1_MUSHROOM_AUTO_PROVIDER = "ENUM_CSTR@COOKIE_SIMPLE_AUTO_PROVIDER";
public static final String MUSHROOM_AUTO_SELLER = "ENUM_CSTR@SINGLETON_COOKIE_AUTO_SELLER";
public static final String EPOCH_1_EMPTY_CELL = "ENUM_CSTR@EMPTY";
public static final String EPOCH_1_TREE = "ENUM_CSTR@TREE";
public static final String EPOCH_2_MUSHROOM_AUTO_PROVIDER = "ENUM_CSTR@EPOCH_2_MUSHROOM_AUTO_PROVIDER";

// ------ singleton ------
public static final String MUSHROOM_AUTO_SELLER = "ENUM_CSTR@SINGLETON_COOKIE_AUTO_SELLER";
public static final String EPOCH_COUNTER = "ENUM_CSTR@EPOCH_COUNTER";


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Created on 2023/02/17
*/
public class DemoSaveHandler extends PairChildrenSaveHandler<RootSaveData, SystemSettingSaveData, GameplaySaveData> {

String SINGLETON = "SINGLETON";
public DemoSaveHandler(IFrontend frontEnd, ISaveTool<RootSaveData> saveTool) {
super(frontEnd, RootSaveData.RootSaveExtension.INSTANCE, saveTool);

Expand All @@ -29,45 +29,57 @@ public DemoSaveHandler(IFrontend frontEnd, ISaveTool<RootSaveData> saveTool) {
protected RootSaveData genereateStarterRootSaveData() {
Map<String, ConstructionSaveData> map = new HashMap<>();

GridPosition uselessPosition = new GridPosition(0, 0);
List<GridPosition> worldGridPositions = JavaFeatureForGwt.listOf(
new GridPosition(-1, -1),
new GridPosition(-1, 0),
new GridPosition(-1, 1),
new GridPosition(0, -1),
new GridPosition(0, 0),
new GridPosition(0, 1),
new GridPosition(1, 5),
new GridPosition(1, 4),
new GridPosition(1, 6)
);
map.put(
DemoConstructionPrototypeId.MAIN_MUSHROOM + "_" + UUID.randomUUID(),
DemoConstructionPrototypeId.MAIN_MUSHROOM + "_" + SINGLETON,
ConstructionSaveData.builder()
.prototypeId(DemoConstructionPrototypeId.MAIN_MUSHROOM)
.level(0)
.workingLevel(0)
.position( new GridPosition(999, 999))
.position(uselessPosition)
.build()
);
map.put(
DemoConstructionPrototypeId.EPOCH_1_MUSHROOM_AUTO_PROVIDER + "_" + UUID.randomUUID(),
DemoConstructionPrototypeId.MUSHROOM_AUTO_SELLER + "_" + SINGLETON,
ConstructionSaveData.builder()
.prototypeId(DemoConstructionPrototypeId.EPOCH_1_MUSHROOM_AUTO_PROVIDER)
.prototypeId(DemoConstructionPrototypeId.MUSHROOM_AUTO_SELLER)
.level(1)
.workingLevel(0)
.position(uselessPosition)
.build()
);
map.put(
DemoConstructionPrototypeId.EPOCH_COUNTER + "_" + SINGLETON,
ConstructionSaveData.builder()
.prototypeId(DemoConstructionPrototypeId.EPOCH_COUNTER)
.level(3)
.workingLevel(1)
.position( new GridPosition(0, 1))
.position(uselessPosition)
.build()
);
map.put(
DemoConstructionPrototypeId.MUSHROOM_AUTO_SELLER + "_" + UUID.randomUUID(),
DemoConstructionPrototypeId.EPOCH_1_MUSHROOM_AUTO_PROVIDER + "_" + UUID.randomUUID(),
ConstructionSaveData.builder()
.prototypeId(DemoConstructionPrototypeId.MUSHROOM_AUTO_SELLER)
.prototypeId(DemoConstructionPrototypeId.EPOCH_1_MUSHROOM_AUTO_PROVIDER)
.level(1)
.workingLevel(0)
.position( new GridPosition(999, 999))
.workingLevel(1)
.position(worldGridPositions.remove(0))
.build()
);
List<GridPosition> dirtGridPositions = JavaFeatureForGwt.listOf(
new GridPosition(4, 5),
new GridPosition(4, 4),
new GridPosition(4, 6),
new GridPosition(5, 5),
new GridPosition(5, 4),
new GridPosition(5, 6),
new GridPosition(6, 5),
new GridPosition(6, 4),
new GridPosition(6, 6)
);
dirtGridPositions.forEach(it -> {


worldGridPositions.forEach(it -> {
map.put(
DemoConstructionPrototypeId.EPOCH_1_EMPTY_CELL + "_" + UUID.randomUUID(),
ConstructionSaveData.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
@Data
@Builder
public class RootSaveData {

GameplaySaveData gameplaySave;
SystemSettingSaveData systemSettingSaveData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public BaseConstruction getInstance(GridPosition position) {
thiz.setProficiencyComponent(proficiencyComponent);

SimpleAutoOutputComponent outputComponent = new SimpleAutoOutputComponent(thiz);
outputComponent.setTypeClickOutput(true);
thiz.setOutputComponent(outputComponent);

return thiz;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package hundun.gdxgame.idledemo.logic.prototype;

import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt;
import hundun.gdxgame.idledemo.logic.DemoBuiltinConstructionsLoader;
import hundun.gdxgame.idledemo.logic.DemoConstructionPrototypeId;
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.construction.starter.ConstProficiencyComponent;
import hundun.gdxgame.idleshare.gamelib.framework.model.construction.starter.SimpleAutoOutputComponent;
import hundun.gdxgame.idleshare.gamelib.framework.model.grid.GridPosition;
import hundun.gdxgame.idleshare.gamelib.framework.util.text.Language;

import java.util.UUID;

public class EpochCounterPrototype extends AbstractConstructionPrototype {
public static DescriptionPackage descriptionPackageEN = DescriptionPackage.builder()
.levelDescriptionProvider(DescriptionPackageFactory.NO_LEVEL_IMP)
.proficiencyDescriptionProvider(DescriptionPackageFactory.EN_PROFICIENCY_IMP)
.build();


public static DescriptionPackage descriptionPackageCN = DescriptionPackage.builder()
.levelDescriptionProvider(DescriptionPackageFactory.CN_NO_LEVEL_IMP)
.proficiencyDescriptionProvider(DescriptionPackageFactory.CN_PROFICIENCY_IMP)
.build();

public EpochCounterPrototype(Language language) {
super(
DemoConstructionPrototypeId.EPOCH_COUNTER,
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 thiz = new BaseIdleDemoConstruction(prototypeId, id, position, descriptionPackage);

ConstProficiencyComponent proficiencyComponent = new ConstProficiencyComponent(thiz);
thiz.setProficiencyComponent(proficiencyComponent);

SimpleAutoOutputComponent outputComponent = new SimpleAutoOutputComponent(thiz);
thiz.setOutputComponent(outputComponent);

return thiz;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@

public class MainMushroomPrototype extends AbstractConstructionPrototype {
public static DescriptionPackage descriptionPackageEN = DescriptionPackage.builder()
.clickOutputButtonText("USELESS")
.outputCostDescriptionStart("USELESS")
.outputGainDescriptionStart("Produce")
.levelDescriptionProvider(DescriptionPackageFactory.NO_LEVEL_IMP)
.proficiencyDescriptionProvider(DescriptionPackageFactory.EN_PROFICIENCY_IMP)
.build();


public static DescriptionPackage descriptionPackageCN = DescriptionPackage.builder()
.clickOutputButtonText("USELESS")
.outputCostDescriptionStart("USELESS")
.outputGainDescriptionStart("产出")
.levelDescriptionProvider(DescriptionPackageFactory.CN_NO_LEVEL_IMP)
.proficiencyDescriptionProvider(DescriptionPackageFactory.CN_PROFICIENCY_IMP)
.build();
Expand Down
Loading

0 comments on commit 566f975

Please sign in to comment.