Skip to content

Commit

Permalink
MainClicker workable
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Sep 23, 2023
1 parent b079660 commit a8260bc
Show file tree
Hide file tree
Showing 28 changed files with 417 additions and 95 deletions.
Binary file added IdleDemo-game/core/assets/mainCokie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions IdleDemo-game/core/assets/quiz-animations.atlas
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@

quiz-animations.png
size: 2048, 2048
format: RGBA8888
filter: Nearest, Nearest
repeat: none
break
rotate: false
xy: 2, 1208
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 1
break
rotate: false
xy: 804, 1610
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 6
break
rotate: false
xy: 804, 1610
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 4
break
rotate: false
xy: 804, 1610
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 7
break
rotate: false
xy: 804, 1610
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 5
break
rotate: false
xy: 804, 1208
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 3
break
rotate: false
xy: 2, 404
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 0
break
rotate: false
xy: 2, 2
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 2
continue
rotate: false
xy: 2, 1610
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 5
continue
rotate: false
xy: 2, 1610
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 7
continue
rotate: false
xy: 2, 1610
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 4
continue
rotate: false
xy: 2, 1610
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 6
continue
rotate: false
xy: 2, 806
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 2
continue
rotate: false
xy: 804, 806
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 1
continue
rotate: false
xy: 804, 404
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 3
continue
rotate: false
xy: 804, 2
size: 800, 400
orig: 800, 400
offset: 0, 0
index: 0
Binary file added IdleDemo-game/core/assets/quiz-animations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IdleDemo-game/core/assets/raw/flare_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IdleDemo-game/core/assets/raw/mainCokie.psd
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package hundun.gdxgame.idledemo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -18,12 +19,9 @@ public class DemoChildGameConfig extends ChildGameConfig {

public DemoChildGameConfig() {

// BuiltinConstructionsLoader builtinConstructionsLoader = new BuiltinConstructionsLoader(game);
// this.setConstructions(builtinConstructionsLoader.load());


this.setConstructionConfig(
ConstructionConfig.builder()
.mainClickerConstructionPrototypeId(DemoConstructionPrototypeId.SINGLETON_COOKIE_MAIN_CLICKER)
.emptyConstructionConfig(EmptyConstructionConfig.builder()
.prototypeId(DemoConstructionPrototypeId.EMPTY_CELL)
.buyCandidatePrototypeIds(JavaFeatureForGwt.listOf(
Expand All @@ -32,7 +30,6 @@ public DemoChildGameConfig() {
.build()
)
.singletonPrototypeIds(JavaFeatureForGwt.listOf(
DemoConstructionPrototypeId.SINGLETON_COOKIE_CLICK_PROVIDER,
DemoConstructionPrototypeId.SINGLETON_COOKIE_AUTO_SELLER
))
.worldPrototypeIds(JavaFeatureForGwt.listOf(
Expand All @@ -41,19 +38,16 @@ public DemoChildGameConfig() {
))
.build()
);



Map<String, List<String>> areaShownResourceIds = new HashMap<>();
this.setAreaShowEntityByOwnAmountResourceIds(areaShownResourceIds);

Map<String, List<String>> areaShowEntityByChangeAmountResourceIds = new HashMap<>();
areaShowEntityByChangeAmountResourceIds.put(DemoScreenId.SCREEN_COOKIE, JavaFeatureForGwt.arraysAsList(
ResourceType.COOKIE
this.setAreaEntityEffectConfigMap(JavaFeatureForGwt.mapOf(
DemoScreenId.SCREEN_COOKIE,
AreaEntityEffectConfig.builder()
.changeAmountResourceIds(JavaFeatureForGwt.listOf(ResourceType.COOKIE))
.ownAmountConstructionPrototypeIds(new ArrayList<>(0))
.ownAmountResourceIds(new ArrayList<>(0))
.build()
));
this.setAreaShowEntityByChangeAmountResourceIds(areaShowEntityByChangeAmountResourceIds);

this.setAreaShowEntityByOwnAmountConstructionPrototypeIds(new HashMap<>());

Map<String, String> screenIdToFilePathMap = JavaFeatureForGwt.mapOf(
DemoScreenId.SCREEN_COOKIE, "audio/Loop-Menu.wav",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class DemoBuiltinConstructionsLoader implements IBuiltinConstructionsLoad
public Map<String, AbstractConstructionPrototype> getProviderMap(Language language) {
Map<String, AbstractConstructionPrototype> result = new HashMap<>();
result.put(DemoConstructionPrototypeId.EMPTY_CELL, new DirtPrototype(language));
result.put(DemoConstructionPrototypeId.SINGLETON_COOKIE_CLICK_PROVIDER, new CookieClickProviderPrototype(language));
result.put(DemoConstructionPrototypeId.SINGLETON_COOKIE_MAIN_CLICKER, new CookieClickProviderPrototype(language));
result.put(DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER, new CookieAutoProviderPrototype(language));
result.put(DemoConstructionPrototypeId.SINGLETON_COOKIE_AUTO_SELLER, new CookieAutoSellerPrototype(language));
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

public class DemoConstructionPrototypeId {

public static final String SINGLETON_COOKIE_CLICK_PROVIDER = "ENUM_CSTR@COOKIE_CLICK_PROVIDER";
public static final String SINGLETON_COOKIE_MAIN_CLICKER = "ENUM_CSTR@SINGLETON_COOKIE_MAIN_CLICKER";
public static final String COOKIE_AUTO_PROVIDER = "ENUM_CSTR@COOKIE_AUTO_PROVIDER";
public static final String SINGLETON_COOKIE_AUTO_SELLER = "ENUM_CSTR@COOKIE_AUTO_SELLER";
public static final String SINGLETON_COOKIE_AUTO_SELLER = "ENUM_CSTR@SINGLETON_COOKIE_AUTO_SELLER";
public static final String EMPTY_CELL = "ENUM_CSTR@EMPTY";
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public String constructionPrototypeIdToShowName(Language language, String constr
switch (language) {
case CN:
switch (constructionId) {
case DemoConstructionPrototypeId.SINGLETON_COOKIE_CLICK_PROVIDER:
case DemoConstructionPrototypeId.SINGLETON_COOKIE_MAIN_CLICKER:
return "点击器";
case DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER:
return "自动点击器";
Expand All @@ -29,7 +29,7 @@ public String constructionPrototypeIdToShowName(Language language, String constr
}
default:
switch (constructionId) {
case DemoConstructionPrototypeId.SINGLETON_COOKIE_CLICK_PROVIDER:
case DemoConstructionPrototypeId.SINGLETON_COOKIE_MAIN_CLICKER:
return "Clicker";
case DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER:
return "AutoClicker";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ protected RootSaveData genereateStarterRootSaveData() {
Map<String, ConstructionSaveData> map = new HashMap<>();

map.put(
DemoConstructionPrototypeId.SINGLETON_COOKIE_CLICK_PROVIDER + "_" + UUID.randomUUID(),
DemoConstructionPrototypeId.SINGLETON_COOKIE_MAIN_CLICKER + "_" + UUID.randomUUID(),
ConstructionSaveData.builder()
.prototypeId(DemoConstructionPrototypeId.SINGLETON_COOKIE_CLICK_PROVIDER)
.prototypeId(DemoConstructionPrototypeId.SINGLETON_COOKIE_MAIN_CLICKER)
.level(0)
.workingLevel(0)
.position( new GridPosition(0, 0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public void lazyInitOnGameCreateStage2() {
achievementMaskBoardTexture = new Texture(Gdx.files.internal("win.png"));
menuTexture = new Texture(Gdx.files.internal("menu.png"));
defaultBoardNinePatchTexture = new Texture(Gdx.files.internal("defaultBoardNinePatch.png"));
{
Texture texture = new Texture(Gdx.files.internal("mainCokie.png"));
mainClickAnimationTextureAtlas = TextureRegion.split(texture, 256, 256);
}
defaultBoardNinePatchEdgeSize = 4;
defaultBoardNinePatchMiddle = new TextureRegion(
defaultBoardNinePatchTexture,
Expand Down Expand Up @@ -66,7 +70,7 @@ public void lazyInitOnGameCreateStage2() {
TextureRegion[][] regions = TextureRegion.split(texture, 128, 128);
defaultAreaBack = regions[0][1];
constructionHexImageMap.put(DemoConstructionPrototypeId.EMPTY_CELL, regions[0][0]);
constructionHexImageMap.put(DemoConstructionPrototypeId.SINGLETON_COOKIE_CLICK_PROVIDER, regions[0][1]);
constructionHexImageMap.put(DemoConstructionPrototypeId.SINGLETON_COOKIE_MAIN_CLICKER, regions[0][1]);
constructionHexImageMap.put(DemoConstructionPrototypeId.COOKIE_AUTO_PROVIDER, regions[0][2]);
constructionHexImageMap.put(DemoConstructionPrototypeId.SINGLETON_COOKIE_AUTO_SELLER, regions[0][3]);
//gameAreaBackMap.put(GameArea.AREA_WIN, regions[0][3]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class CookieClickProviderPrototype extends AbstractConstructionPrototype

public CookieClickProviderPrototype(Language language) {
super(
DemoConstructionPrototypeId.SINGLETON_COOKIE_CLICK_PROVIDER,
DemoConstructionPrototypeId.SINGLETON_COOKIE_MAIN_CLICKER,
language,
DemoBuiltinConstructionsLoader.toPack(JavaFeatureForGwt.mapOf())
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
package hundun.gdxgame.idledemo.ui.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.Actor;
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 hundun.gdxgame.corelib.base.BaseHundunGame;
import hundun.gdxgame.corelib.base.BaseHundunScreen;
import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt;
import hundun.gdxgame.gamelib.starter.listerner.IGameAreaChangeListener;
import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.logic.RootSaveData;
import hundun.gdxgame.idledemo.ui.sub.FirstRunningAchievementBoardVM;
import hundun.gdxgame.idledemo.ui.world.HexCellVM;
import hundun.gdxgame.idledemo.ui.sub.AchievementMaskBoard;
import hundun.gdxgame.idleshare.core.starter.ui.component.GameAreaControlBoard;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdleScreen;
import hundun.gdxgame.idleshare.gamelib.framework.callback.IAchievementBoardCallback;
import hundun.gdxgame.idleshare.gamelib.framework.callback.IAchievementStateChangeListener;
Expand All @@ -23,7 +15,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public abstract class BaseDemoPlayScreen extends BaseIdleScreen<DemoIdleGame, RootSaveData>
implements IGameAreaChangeListener, IAchievementBoardCallback, IAchievementStateChangeListener
Expand Down Expand Up @@ -69,7 +60,7 @@ public void onGameAreaChange(String last, String current) {
firstRunningAchievementBoardVM.updateData();
}

public abstract void onDeskClicked(HexCellVM vm);
public abstract void onCellClicked(HexCellVM vm);

@Override
protected void onLogicFrame() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package hundun.gdxgame.idledemo.ui.screen;

import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

import hundun.gdxgame.idledemo.DemoIdleGame;
Expand All @@ -11,8 +12,8 @@
import hundun.gdxgame.idledemo.ui.entity.GameEntityFactory;
import hundun.gdxgame.idleshare.core.framework.model.manager.GameEntityManager;
import hundun.gdxgame.idleshare.core.starter.ui.component.GameImageDrawer;
import hundun.gdxgame.idleshare.core.starter.ui.component.GameImageDrawer.GameImageDrawerOwner;
import hundun.gdxgame.idleshare.core.starter.ui.component.PopupInfoBoard;
import hundun.gdxgame.idleshare.core.starter.ui.component.animation.MainClickerAnimationVM;
import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.AbstractConstructionControlBoard;
import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.impl.fixed.FixedConstructionControlBoard;
import hundun.gdxgame.idleshare.gamelib.framework.callback.ISecondaryInfoBoardCallback;
Expand All @@ -23,10 +24,11 @@
* Created on 2021/11/02
*/
public class CookiePlayScreen extends BaseDemoPlayScreen
implements GameImageDrawerOwner, ISecondaryInfoBoardCallback<BaseConstruction> {
implements ISecondaryInfoBoardCallback<BaseConstruction> {
protected PopupInfoBoard<DemoIdleGame, RootSaveData> secondaryInfoBoard;
protected GameEntityManager gameEntityManager;
protected GameImageDrawer<DemoIdleGame, RootSaveData> gameImageDrawer;
protected MainClickerAnimationVM<DemoIdleGame, RootSaveData> mainClickerAnimationVM;
protected AbstractConstructionControlBoard<DemoIdleGame, RootSaveData> constructionControlBoard;

public CookiePlayScreen(DemoIdleGame game) {
Expand All @@ -38,27 +40,31 @@ public CookiePlayScreen(DemoIdleGame game) {
protected void lazyInitUiRootContext() {
super.lazyInitUiRootContext();

mainClickerAnimationVM = new MainClickerAnimationVM<>(
this,
game.getTextureManager().getMainClickAnimationTextureAtlas()
);
middleGroup.add(mainClickerAnimationVM);

// impl switchable
constructionControlBoard = new FixedConstructionControlBoard<>(this, this);
uiRootTable.add(constructionControlBoard)
.height(layoutConst.CONSTRUCION_BOARD_ROOT_BOX_HEIGHT)
.fill()
.colspan(2)
.colspan(UI_ROOT_TABLE_COLSPAN_SIZE)
;
}

protected void lazyInitLogicContext() {
super.lazyInitLogicContext();

this.gameImageDrawer = new GameImageDrawer<>(this, this);
this.gameImageDrawer = new GameImageDrawer<>(this);
this.gameEntityManager = new GameEntityManager(game);
gameEntityManager.lazyInit(
game.getChildGameConfig().getAreaShowEntityByOwnAmountConstructionPrototypeIds(),
game.getChildGameConfig().getAreaShowEntityByOwnAmountResourceIds(),
game.getChildGameConfig().getAreaShowEntityByChangeAmountResourceIds()
game.getChildGameConfig().getAreaEntityEffectConfigMap()
);
GameEntityFactory gameEntityFactory = new GameEntityFactory(this.layoutConst, this);
gameImageDrawer.lazyInit(gameEntityFactory);
gameImageDrawer.lazyInit(gameEntityFactory, gameEntityManager);

logicFrameListeners.add(constructionControlBoard);
storageInfoTable.lazyInit(ResourceType.VALUES_FOR_SHOW_ORDER);
Expand All @@ -79,14 +85,10 @@ protected void belowUiStageDraw(float delta) {
}

@Override
public void onDeskClicked(HexCellVM vm) {
public void onCellClicked(HexCellVM vm) {
throw new UnsupportedOperationException();
}

@Override
public GameEntityManager getGameEntityManager() {
return gameEntityManager;
}

@Override
public void showAndUpdateGuideInfo(BaseConstruction model) {
Expand Down Expand Up @@ -115,4 +117,11 @@ protected void lazyInitBackUiAndPopupUiContent() {
protected void updateUIForShow() {

}

@Override
protected void renderPopupAnimations(float delta, SpriteBatch spriteBatch) {
super.renderPopupAnimations(delta, spriteBatch);

mainClickerAnimationVM.updateFrame(delta, spriteBatch);
}
}
Loading

0 comments on commit a8260bc

Please sign in to comment.