a little qol for public demo
This commit is contained in:
parent
d12af3eca4
commit
3ae4c1de07
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -24,6 +24,9 @@ jobs:
|
|||||||
npm install
|
npm install
|
||||||
npm run build # Adjust to your build command
|
npm run build # Adjust to your build command
|
||||||
|
|
||||||
|
- name: Save commit id to file
|
||||||
|
run: echo "$(git rev-parse --short HEAD)" >> dist/latest_commit
|
||||||
|
|
||||||
# Step 4: Deploy to GitHub Pages
|
# Step 4: Deploy to GitHub Pages
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="stylesheet" href="style.css" />
|
<link rel="stylesheet" href="style.css" />
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Aclonica" rel="stylesheet" />
|
||||||
<title>Bastion App</title>
|
<title>Bastion App</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
1
public/latest_commit
Normal file
1
public/latest_commit
Normal file
@ -0,0 +1 @@
|
|||||||
|
2f2a5s
|
@ -61,6 +61,9 @@ export default class GameAssets {
|
|||||||
GameAssets.BasicProjectileTexture = await PIXI.Assets.load({
|
GameAssets.BasicProjectileTexture = await PIXI.Assets.load({
|
||||||
src: '/assets/projectiles/basic_tower.png',
|
src: '/assets/projectiles/basic_tower.png',
|
||||||
});
|
});
|
||||||
|
await PIXI.Assets.load({
|
||||||
|
src: 'https://fonts.googleapis.com/css?family=Aclonica',
|
||||||
|
});
|
||||||
|
|
||||||
await this.LoadMissions();
|
await this.LoadMissions();
|
||||||
await this.LoadTowers();
|
await this.LoadTowers();
|
||||||
|
@ -17,6 +17,7 @@ export class Globals {
|
|||||||
public static WaveManager: WaveManager;
|
public static WaveManager: WaveManager;
|
||||||
public static TowerManager: TowerManager;
|
public static TowerManager: TowerManager;
|
||||||
public static GameScene: GameScene;
|
public static GameScene: GameScene;
|
||||||
|
public static latestCommit: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class GameMaster {
|
export default class GameMaster {
|
||||||
|
@ -50,7 +50,7 @@ import { log } from './utils';
|
|||||||
app.canvas.style.marginBottom = `0`; // Prevent unnecessary margin
|
app.canvas.style.marginBottom = `0`; // Prevent unnecessary margin
|
||||||
app.canvas.style.display = 'block'; // Prevent inline-block spacing issues
|
app.canvas.style.display = 'block'; // Prevent inline-block spacing issues
|
||||||
}
|
}
|
||||||
|
Globals.latestCommit = await fetch('/latest_commit').then((res) => res.text());
|
||||||
window.addEventListener('resize', resize);
|
window.addEventListener('resize', resize);
|
||||||
resize();
|
resize();
|
||||||
await Assets.LoadAssets();
|
await Assets.LoadAssets();
|
||||||
|
@ -8,21 +8,58 @@ export class MainScene extends Scene {
|
|||||||
public init() {
|
public init() {
|
||||||
const NewGameButton = {
|
const NewGameButton = {
|
||||||
caption: 'New Game',
|
caption: 'New Game',
|
||||||
rect: new PIXI.Rectangle(Globals.WindowWidth / 2 - 300 / 2, Globals.WindowHeight / 2 - 80, 300, 60),
|
rect: new PIXI.Rectangle(
|
||||||
texture: ButtonTexture.Button01,
|
Globals.app.canvas.width / 2 - 300 / 2,
|
||||||
|
Globals.app.canvas.height / 5 + 3 * 80,
|
||||||
|
300,
|
||||||
|
60
|
||||||
|
),
|
||||||
|
texture: ButtonTexture.Button02,
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingsButton = {
|
const SettingsButton = {
|
||||||
caption: 'Settings',
|
caption: 'Settings',
|
||||||
rect: new PIXI.Rectangle(Globals.WindowWidth / 2 - 300 / 2, Globals.WindowHeight / 2 + 20, 300, 60),
|
rect: new PIXI.Rectangle(
|
||||||
texture: ButtonTexture.Button01,
|
Globals.app.canvas.width / 2 - 300 / 2,
|
||||||
|
Globals.app.canvas.height / 5 + 4 * 80,
|
||||||
|
300,
|
||||||
|
60
|
||||||
|
),
|
||||||
|
texture: ButtonTexture.Button02,
|
||||||
};
|
};
|
||||||
|
let text = new PIXI.Text({
|
||||||
|
x: Globals.app.canvas.width / 2 - 300 / 2,
|
||||||
|
y: Globals.app.canvas.height / 5 + 1 * 80,
|
||||||
|
text: 'BASTION',
|
||||||
|
style: {
|
||||||
|
fill: 0xffaa00,
|
||||||
|
fontFamily: 'Aclonica',
|
||||||
|
fontSize: 100,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
text.x = text.x - text.width / 5;
|
||||||
|
Globals.app.stage.addChild(text);
|
||||||
|
let text2 = new PIXI.Text({
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
text: 'Latest commit: ' + Globals.latestCommit,
|
||||||
|
style: {
|
||||||
|
fill: 0x000000,
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Globals.app.stage.addChild(text2);
|
||||||
const button01 = new Button(NewGameButton.rect, NewGameButton.caption, NewGameButton.texture, true);
|
const button01 = new Button(NewGameButton.rect, NewGameButton.caption, NewGameButton.texture, true);
|
||||||
button01.onClick = (e) => {
|
button01.onClick = (e) => {
|
||||||
|
Globals.app.stage.removeChild(text);
|
||||||
|
Globals.app.stage.removeChild(text2);
|
||||||
Globals.GameMaster.changeScene(new MissionPickerScene());
|
Globals.GameMaster.changeScene(new MissionPickerScene());
|
||||||
};
|
};
|
||||||
|
|
||||||
new Button(SettingsButton.rect, SettingsButton.caption, SettingsButton.texture, true);
|
let b2 = new Button(SettingsButton.rect, SettingsButton.caption, SettingsButton.texture, true);
|
||||||
|
b2.onClick = (e) => {
|
||||||
|
alert('Does nothing for now, just placeholder.');
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,16 @@ import Assets from '../classes/Assets';
|
|||||||
import { Globals } from '../classes/Bastion';
|
import { Globals } from '../classes/Bastion';
|
||||||
import Button, { ButtonTexture } from '../classes/gui/Button';
|
import Button, { ButtonTexture } from '../classes/gui/Button';
|
||||||
import { GameScene } from './Game';
|
import { GameScene } from './Game';
|
||||||
|
import { MainScene } from './Main';
|
||||||
import Scene from './Scene';
|
import Scene from './Scene';
|
||||||
import * as PIXI from 'pixi.js';
|
import * as PIXI from 'pixi.js';
|
||||||
|
|
||||||
export class MissionPickerScene extends Scene {
|
export class MissionPickerScene extends Scene {
|
||||||
public init() {
|
public init() {
|
||||||
|
const button = new Button(new PIXI.Rectangle(0, 0, 300, 60), 'Back to main', ButtonTexture.Button01);
|
||||||
|
button.onClick = (e) => {
|
||||||
|
Globals.GameMaster.changeScene(new MainScene());
|
||||||
|
};
|
||||||
Assets.Missions.forEach((mission, index) => {
|
Assets.Missions.forEach((mission, index) => {
|
||||||
const button = new Button(
|
const button = new Button(
|
||||||
new PIXI.Rectangle(
|
new PIXI.Rectangle(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user