Create PoC of Equipment window
This commit is contained in:
BIN
data.mv.db
BIN
data.mv.db
Binary file not shown.
@@ -18,7 +18,8 @@ $2261c04f-b02e-4486-b388-8a0fa41622e9(2261c04f-b02e-4486-b388-8a0fa41622e9.ttf
|
|||||||
$ab9d40b4-eb28-45d7-bff2-9432a05eb41a(ab9d40b4-eb28-45d7-bff2-9432a05eb41a.xml
|
$ab9d40b4-eb28-45d7-bff2-9432a05eb41a(ab9d40b4-eb28-45d7-bff2-9432a05eb41a.xml
|
||||||
Start MenuB[
|
Start MenuB[
|
||||||
$56ca6b39-f949-4212-9c23-312db25887e0(56ca6b39-f949-4212-9c23-312db25887e0.xml Game MenuBU
|
$56ca6b39-f949-4212-9c23-312db25887e0(56ca6b39-f949-4212-9c23-312db25887e0.xml Game MenuBU
|
||||||
$00bd0625-b3b8-4abf-97b7-91f42bce28ec(00bd0625-b3b8-4abf-97b7-91f42bce28ec.xmlHUDJZ
|
$00bd0625-b3b8-4abf-97b7-91f42bce28ec(00bd0625-b3b8-4abf-97b7-91f42bce28ec.xmlHUDB[
|
||||||
|
$c473a91a-ff25-4e71-9bec-b35e48102aeb(c473a91a-ff25-4e71-9bec-b35e48102aeb.xml EquipmentJZ
|
||||||
$e6f067f1-eba0-4e62-99c3-2fd867e6f142(e6f067f1-eba0-4e62-99c3-2fd867e6f142.pngPoof (J[
|
$e6f067f1-eba0-4e62-99c3-2fd867e6f142(e6f067f1-eba0-4e62-99c3-2fd867e6f142.pngPoof (J[
|
||||||
$312cc4e6-8c44-43e7-828a-e7e2a77836f3(312cc4e6-8c44-43e7-828a-e7e2a77836f3.pngArrow (J[
|
$312cc4e6-8c44-43e7-828a-e7e2a77836f3(312cc4e6-8c44-43e7-828a-e7e2a77836f3.pngArrow (J[
|
||||||
$54f657bd-8108-464c-9bbe-63944fc14f6b(54f657bd-8108-464c-9bbe-63944fc14f6b.pngPunch (J[
|
$54f657bd-8108-464c-9bbe-63944fc14f6b(54f657bd-8108-464c-9bbe-63944fc14f6b.pngPunch (J[
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.bartlomiejpluta.demo.gui;
|
||||||
|
|
||||||
|
import com.bartlomiejpluta.base.api.context.Context;
|
||||||
|
import com.bartlomiejpluta.base.api.screen.Screen;
|
||||||
|
import com.bartlomiejpluta.base.api.gui.*;
|
||||||
|
import com.bartlomiejpluta.base.lib.gui.*;
|
||||||
|
|
||||||
|
|
||||||
|
public class EquipmentWindow extends DecoratedWindow {
|
||||||
|
|
||||||
|
public EquipmentWindow(Context context, GUI gui) {
|
||||||
|
super(context, gui);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,6 +54,10 @@ public abstract class BaseMapHandler implements MapHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(runner.openedWindows() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(input.isKeyPressed(Key.KEY_SPACE)) {
|
if(input.isKeyPressed(Key.KEY_SPACE)) {
|
||||||
player.attack();
|
player.attack();
|
||||||
}
|
}
|
||||||
@@ -71,7 +75,7 @@ public abstract class BaseMapHandler implements MapHandler {
|
|||||||
player.setFaceDirection(Direction.LEFT);
|
player.setFaceDirection(Direction.LEFT);
|
||||||
} else if(input.isKeyPressed(Key.KEY_RIGHT)) {
|
} else if(input.isKeyPressed(Key.KEY_RIGHT)) {
|
||||||
player.setFaceDirection(Direction.RIGHT);
|
player.setFaceDirection(Direction.RIGHT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(input.isKeyPressed(Key.KEY_DOWN)) {
|
if(input.isKeyPressed(Key.KEY_DOWN)) {
|
||||||
player.getLayer().pushMovement(player.prepareMovement(Direction.DOWN));
|
player.getLayer().pushMovement(player.prepareMovement(Direction.DOWN));
|
||||||
@@ -123,7 +127,7 @@ public abstract class BaseMapHandler implements MapHandler {
|
|||||||
layer.addEntity(icon);
|
layer.addEntity(icon);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Warp warp(ObjectLayer layer, int x, int y, String targetMap, String targetLayer, int targetX, int targetY) {
|
public Warp warp(ObjectLayer layer, int x, int y, String targetMap, String targetLayer, int targetX, int targetY) {
|
||||||
var warp = new Warp(A.maps.get(targetMap).uid, A.maps.getLayer(targetMap, targetLayer), targetX, targetY);
|
var warp = new Warp(A.maps.get(targetMap).uid, A.maps.getLayer(targetMap, targetLayer), targetX, targetY);
|
||||||
warp.setEntity(player);
|
warp.setEntity(player);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class MenuManager {
|
|||||||
|
|
||||||
private final StartMenuWindow startMenu;
|
private final StartMenuWindow startMenu;
|
||||||
private final GameMenuWindow gameMenu;
|
private final GameMenuWindow gameMenu;
|
||||||
|
private final EquipmentWindow equipment;
|
||||||
|
|
||||||
private final Consumer<KeyEvent> gameMenuHandler = this::handleGameMenuKeyEvent;
|
private final Consumer<KeyEvent> gameMenuHandler = this::handleGameMenuKeyEvent;
|
||||||
|
|
||||||
@@ -40,9 +41,21 @@ public class MenuManager {
|
|||||||
this.gameMenu.getResumeGameBtn().setAction(this::resumeGame);
|
this.gameMenu.getResumeGameBtn().setAction(this::resumeGame);
|
||||||
this.gameMenu.getStartMenuBtn().setAction(runner::returnToStartMenu);
|
this.gameMenu.getStartMenuBtn().setAction(runner::returnToStartMenu);
|
||||||
this.gameMenu.getExitBtn().setAction(runner::exit);
|
this.gameMenu.getExitBtn().setAction(runner::exit);
|
||||||
|
|
||||||
|
this.equipment = (EquipmentWindow) gui.inflateWindow(A.widgets.equipment.uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleGameMenuKeyEvent(KeyEvent event) {
|
private void handleGameMenuKeyEvent(KeyEvent event) {
|
||||||
|
if (event.getKey() == Key.KEY_E && event.getAction() == KeyAction.PRESS) {
|
||||||
|
if(manager.isEmpty()) {
|
||||||
|
manager.open(equipment);
|
||||||
|
} else if (manager.top() == equipment) {
|
||||||
|
manager.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
event.consume();
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getKey() == Key.KEY_ESCAPE && event.getAction() == KeyAction.PRESS) {
|
if (event.getKey() == Key.KEY_ESCAPE && event.getAction() == KeyAction.PRESS) {
|
||||||
if(manager.size() > 0) {
|
if(manager.size() > 0) {
|
||||||
manager.close();
|
manager.close();
|
||||||
@@ -60,6 +73,10 @@ public class MenuManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int openedWindows() {
|
||||||
|
return manager.size();
|
||||||
|
}
|
||||||
|
|
||||||
public void showStartMenu() {
|
public void showStartMenu() {
|
||||||
manager.closeAll();
|
manager.closeAll();
|
||||||
manager.open(startMenu);
|
manager.open(startMenu);
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ public class DemoRunner implements GameRunner {
|
|||||||
private void initMenu() {
|
private void initMenu() {
|
||||||
this.menu = new MenuManager(this, context);
|
this.menu = new MenuManager(this, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int openedWindows() {
|
||||||
|
return this.menu.openedWindows();
|
||||||
|
}
|
||||||
|
|
||||||
private void initHUD() {
|
private void initHUD() {
|
||||||
hud = context.newGUI();
|
hud = context.newGUI();
|
||||||
|
|||||||
52
widgets/c473a91a-ff25-4e71-9bec-b35e48102aeb.xml
Normal file
52
widgets/c473a91a-ff25-4e71-9bec-b35e48102aeb.xml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<demo:EquipmentWindow
|
||||||
|
xmlns:base="com.bartlomiejpluta.base.lib.gui"
|
||||||
|
xmlns:demo="com.bartlomiejpluta.demo.gui"
|
||||||
|
windowPosition="WindowPosition.CENTER"
|
||||||
|
padding="20f"
|
||||||
|
widthMode="SizeMode.AUTO"
|
||||||
|
heightMode="SizeMode.AUTO">
|
||||||
|
|
||||||
|
<base:VLayout widthMode="SizeMode.AUTO" heightMode="SizeMode.AUTO">
|
||||||
|
<base:Label
|
||||||
|
font="A.fonts.roboto_regular.uid"
|
||||||
|
widthMode="SizeMode.RELATIVE"
|
||||||
|
width="1f"
|
||||||
|
alignment="GUI.ALIGN_TOP | GUI.ALIGN_CENTER"
|
||||||
|
red="1f"
|
||||||
|
green="1f"
|
||||||
|
blue="1f"
|
||||||
|
alpha="0.5f"
|
||||||
|
fontSize="30f">Equipment
|
||||||
|
</base:Label>
|
||||||
|
|
||||||
|
<base:VGridOptionChoice columns="4"
|
||||||
|
scrollSpeed="0.2f"
|
||||||
|
widthMode="SizeMode.ABSOLUTE"
|
||||||
|
width="4 * 68f"
|
||||||
|
heightMode="SizeMode.ABSOLUTE"
|
||||||
|
height="4 * 68f">
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="0" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="1" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="2" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="3" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="4" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="5" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="6" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="7" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="8" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="9" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="5" iconSetColumn="10" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="6" iconSetColumn="0" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="7" iconSetColumn="1" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="8" iconSetColumn="2" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="9" iconSetColumn="3" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="10" iconSetColumn="4" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="11" iconSetColumn="5" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="11" iconSetColumn="6" scale="2f"/>
|
||||||
|
<base:IconView iconSet="A.iconsets.generic.uid" iconSetRow="11" iconSetColumn="7" scale="2f"/>
|
||||||
|
</base:VGridOptionChoice>
|
||||||
|
</base:VLayout>
|
||||||
|
|
||||||
|
</demo:EquipmentWindow>
|
||||||
Reference in New Issue
Block a user