Skip to content

Commit

Permalink
update UI; BaseIdleScreen不再含有任何UI,具体项目使用自己的BaseIdleXXXScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Oct 22, 2023
1 parent 74aac54 commit a957c4e
Show file tree
Hide file tree
Showing 36 changed files with 265 additions and 255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import com.badlogic.gdx.utils.Null;
import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;
import hundun.gdxgame.idleshare.core.starter.ui.component.ResourceAmountPairNode;
import hundun.gdxgame.idleshare.gamelib.framework.model.achievement.AbstractAchievement;
import hundun.gdxgame.idleshare.gamelib.framework.model.resource.ResourcePair;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
package hundun.gdxgame.idledemo.ui.achievement;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idleshare.core.framework.BaseIdleGame;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdleScreen;
import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementAndStatus;
import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementInfoPackage;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import hundun.gdxgame.gamelib.starter.listerner.IGameAreaChangeListener;
import hundun.gdxgame.gamelib.starter.listerner.ILogicFrameListener;
import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.logic.RootSaveData;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idleshare.core.framework.BaseIdleGame;
import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.AbstractConstructionControlBoard;
import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.impl.StarterConstructionControlNode;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdleScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;
import hundun.gdxgame.idleshare.gamelib.framework.callback.IConstructionCollectionListener;
import hundun.gdxgame.idleshare.gamelib.framework.callback.ISecondaryInfoBoardCallback;
import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.badlogic.gdx.utils.Align;
import hundun.gdxgame.corelib.base.util.DrawableFactory;
import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseCellDetailNodeVM;
import hundun.gdxgame.idleshare.core.starter.ui.component.board.construction.impl.StarterConstructionControlNode;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import hundun.gdxgame.idledemo.logic.ResourceType;
import hundun.gdxgame.idledemo.logic.RootSaveData;
import hundun.gdxgame.idledemo.ui.achievement.AllAchievementBoardVM;
import hundun.gdxgame.idledemo.ui.shared.BaseIdleDemoScreen;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdleScreen;
import hundun.gdxgame.idleshare.gamelib.framework.callback.IAchievementStateChangeListener;
import hundun.gdxgame.idleshare.gamelib.framework.model.achievement.AbstractAchievement;
import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementState;

public class DemoAchievementScreen extends BaseIdleScreen<DemoIdleGame, RootSaveData> implements IAchievementStateChangeListener {
public class DemoAchievementScreen extends BaseIdleDemoScreen implements IAchievementStateChangeListener {

AllAchievementBoardVM<DemoIdleGame, RootSaveData> allAchievementBoardVM;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.logic.DemoScreenId;
import hundun.gdxgame.idledemo.logic.ResourceType;
import hundun.gdxgame.idledemo.logic.RootSaveData;
import hundun.gdxgame.idledemo.ui.main.MainScreenConstructionControlBoard;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.world.HexCellVM;
import hundun.gdxgame.idledemo.ui.main.GameEntityFactory;
import hundun.gdxgame.idleshare.core.framework.model.manager.GameEntityManager;
Expand Down Expand Up @@ -64,7 +64,6 @@ protected void lazyInitLogicContext() {
gameImageDrawer.lazyInit(gameEntityFactory, gameEntityManager);

logicFrameListeners.add(constructionControlBoard);
storageInfoTable.lazyInit(ResourceType.VALUES_FOR_SHOW_ORDER);

gameAreaChangeListeners.add(constructionControlBoard);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.logic.DemoScreenId;
import hundun.gdxgame.idledemo.logic.ResourceType;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.world.HexCellVM;
import hundun.gdxgame.idledemo.ui.world.HexAreaVM;
import hundun.gdxgame.idledemo.ui.world.WorldCellDetailBoardVM;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package hundun.gdxgame.idledemo.ui.shared;

import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import hundun.gdxgame.gamelib.starter.listerner.ILogicFrameListener;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package hundun.gdxgame.idledemo.ui.shared;

import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
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.grid.GridPosition;

public abstract class BaseCellDetailNodeVM extends Table {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package hundun.gdxgame.idledemo.ui.screen;
package hundun.gdxgame.idledemo.ui.shared;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.Actor;
import hundun.gdxgame.gamelib.starter.listerner.IGameAreaChangeListener;
import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.logic.RootSaveData;
import hundun.gdxgame.idledemo.ui.main.FirstRunningAchievementBoardVM;
import hundun.gdxgame.idledemo.ui.screen.DemoScreenContext;
import hundun.gdxgame.idledemo.ui.shared.BaseIdleDemoScreen;
import hundun.gdxgame.idledemo.ui.world.HexCellVM;
import hundun.gdxgame.idledemo.ui.achievement.AchievementPopupBoard;
import hundun.gdxgame.idleshare.core.starter.ui.component.StarterStorageInfoBoard;
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 @@ -16,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;

public abstract class BaseDemoPlayScreen extends BaseIdleScreen<DemoIdleGame, RootSaveData>
public abstract class BaseDemoPlayScreen extends BaseIdleDemoScreen
implements IGameAreaChangeListener, IAchievementBoardCallback, IAchievementStateChangeListener
{

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package hundun.gdxgame.idledemo.ui.shared;

import com.badlogic.gdx.scenes.scene2d.ui.Table;
import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.logic.RootSaveData;
import hundun.gdxgame.idleshare.core.starter.ui.component.BackgroundImageBox;
import hundun.gdxgame.idleshare.core.starter.ui.component.GameAreaControlBoard;
import hundun.gdxgame.idleshare.core.starter.ui.component.StarterStorageInfoBoard;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdleScreen;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst;

public abstract class BaseIdleDemoScreen extends BaseIdleScreen<DemoIdleGame, RootSaveData> {

protected StarterStorageInfoBoard<DemoIdleGame, RootSaveData> storageInfoTable;

protected BackgroundImageBox<DemoIdleGame, RootSaveData> backgroundImageBox;
protected GameAreaControlBoard<DemoIdleGame, RootSaveData> gameAreaControlBoard;

protected Table leftSideGroup;
protected Table middleGroup;

protected static int UI_ROOT_TABLE_COLSPAN_SIZE = 3;

public BaseIdleDemoScreen(DemoIdleGame game, String screenId, PlayScreenLayoutConst layoutConst) {
super(game, screenId, layoutConst);
}

@Override
protected void lazyInitLogicContext() {
logicFrameListeners.add(game.getIdleGameplayExport());

gameAreaChangeListeners.add(backgroundImageBox);
gameAreaChangeListeners.add(gameAreaControlBoard);

gameAreaControlBoard.lazyInit(game.getControlBoardScreenIds());

this.getGame().getIdleGameplayExport().getGameplayContext().getEventManager().registerListener(this);
this.getGame().getIdleGameplayExport().getGameplayContext().getEventManager().registerListener(storageInfoTable);
}

@Override
protected void lazyInitUiRootContext() {

storageInfoTable = new StarterStorageInfoBoard<>(this);
uiRootTable.add(storageInfoTable)
.height(layoutConst.STORAGE_BOARD_BORDER_HEIGHT)
.fill()
.colspan(UI_ROOT_TABLE_COLSPAN_SIZE)
.row();

leftSideGroup = new Table();
uiRootTable.add(leftSideGroup)
.growY();

middleGroup = new Table();
uiRootTable.add(middleGroup).grow();

gameAreaControlBoard = new GameAreaControlBoard<>(this);
gameAreaControlBoard.top();
uiRootTable.add(gameAreaControlBoard)
.growY()
.row();

}

@Override
protected void lazyInitBackUiAndPopupUiContent() {

this.backgroundImageBox = new BackgroundImageBox<>(this);
backUiStage.addActor(backgroundImageBox);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import hundun.gdxgame.idledemo.DemoIdleGame;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import hundun.gdxgame.corelib.base.util.DrawableFactory;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst;
import hundun.gdxgame.idleshare.gamelib.framework.data.ChildGameConfig.ConstructionBuyCandidateConfig;
import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.badlogic.gdx.utils.Align;
import hundun.gdxgame.corelib.base.util.DrawableFactory;
import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseCellDetailNodeVM;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst;
import hundun.gdxgame.idleshare.gamelib.framework.model.construction.base.BaseConstruction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import hundun.gdxgame.corelib.base.util.DrawableFactory;
import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseCellDetailNodeVM;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.PlayScreenLayoutConst;
import hundun.gdxgame.idleshare.gamelib.framework.data.ChildGameConfig.ConstructionBuyCandidateConfig;
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.grid.GridPosition;

Expand Down
Binary file added IdleMushroom-game/core/assets/table_2.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 IdleMushroom-game/core/assets/table_3.png
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
Expand Up @@ -5,6 +5,7 @@
import com.badlogic.gdx.graphics.g2d.NinePatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable;
import hundun.gdxgame.idleshare.core.framework.model.manager.AbstractTextureManager;
import lombok.Getter;
Expand All @@ -14,6 +15,25 @@ public class IdleMushroomTextureManager extends AbstractTextureManager {
@Getter
TextureRegion questionMarkTexture;

@Getter
Drawable tableType1Drawable;

@Getter
Drawable tableType2Drawable;

@Getter
Drawable tableType3Drawable;

private Drawable quickTableNinePatchDrawable(Texture texture) {
return new NinePatchDrawable(new NinePatch(
texture,
(texture.getWidth() - 1) / 2,
(texture.getWidth() - 1) / 2,
(texture.getHeight() - 1) / 2,
(texture.getHeight() - 1) / 2
));
}

@Override
public void lazyInitOnGameCreateStage2() {
{
Expand All @@ -24,11 +44,14 @@ public void lazyInitOnGameCreateStage2() {

achievementMaskBoardTexture = new Texture(Gdx.files.internal("win.png"));
menuTexture = new Texture(Gdx.files.internal("menu.png"));

tableType1Drawable = quickTableNinePatchDrawable(new Texture(Gdx.files.internal("table.9.png")));
tableType2Drawable = quickTableNinePatchDrawable(new Texture(Gdx.files.internal("table_2.png")));
tableType3Drawable = quickTableNinePatchDrawable(new Texture(Gdx.files.internal("table_3.png")));

defaultBoardNinePatchTexture = new Texture(Gdx.files.internal("table.9.png"));
defaultBoardNinePatchDrawable = new NinePatchDrawable(new NinePatch(
defaultBoardNinePatchTexture,
3, 3, 3, 3
));
defaultBoardNinePatchDrawable = quickTableNinePatchDrawable(defaultBoardNinePatchTexture);

{
Texture texture = new Texture(Gdx.files.internal("mainCokie.png"));
mainClickAnimationTextureAtlas = TextureRegion.split(texture, 256, 256);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import com.badlogic.gdx.utils.Null;
import hundun.gdxgame.idledemo.IdleMushroomGame;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idledemo.ui.shared.BaseIdleMushroomPlayScreen;
import hundun.gdxgame.idleshare.core.starter.ui.component.ResourceAmountPairNode;
import hundun.gdxgame.idleshare.gamelib.framework.model.achievement.AbstractAchievement;
import hundun.gdxgame.idleshare.gamelib.framework.model.resource.ResourcePair;
Expand All @@ -25,12 +25,12 @@
*/
public class AchievementPopupBoard extends Table {

BaseDemoPlayScreen parent;
BaseIdleMushroomPlayScreen parent;


List<String> texts;

public AchievementPopupBoard(BaseDemoPlayScreen parent, List<String> texts) {
public AchievementPopupBoard(BaseIdleMushroomPlayScreen parent, List<String> texts) {
this.parent = parent;
this.texts = texts;
this.setBackground(new SpriteDrawable(new Sprite(parent.getGame().getTextureManager().getAchievementMaskBoardTexture())));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
package hundun.gdxgame.idledemo.ui.achievement;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import hundun.gdxgame.gamelib.base.util.JavaFeatureForGwt;
import hundun.gdxgame.idledemo.ui.screen.BaseDemoPlayScreen;
import hundun.gdxgame.idleshare.core.framework.BaseIdleGame;
import hundun.gdxgame.idleshare.core.starter.ui.screen.play.BaseIdleScreen;
import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementAndStatus;
import hundun.gdxgame.idleshare.gamelib.framework.model.manager.AchievementManager.AchievementInfoPackage;

import java.util.List;

Expand Down
Loading

0 comments on commit a957c4e

Please sign in to comment.