firebase update

This commit is contained in:
Kelly Peng 2022-04-25 23:41:13 -04:00
parent 97c4f768d1
commit c7d225dd95
37 changed files with 123 additions and 108 deletions

View File

@ -6,10 +6,22 @@
"**/.*",
"**/node_modules/**"
],
"redirects": [{
"source": "/benchmark2",
"destination": "/benchmark2.html",
"type": 301
}]
"redirects": [
{
"source": "/benchmark1",
"destination": "/ShatteredSwordGameDesignDocument.html",
"type": 301
},
{
"source": "/benchmark2",
"destination": "/benchmark2.html",
"type": 301
},
{
"source": "/benchmark3",
"destination": "/banchmark3.html",
"type": 301
}
]
}
}

View File

@ -1,8 +1,9 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Game</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Benchmark 2</title>
<style>
#main {
width: 100%;
@ -44,7 +45,7 @@
@font-face {
font-family: 'NoPixel';
src: url('shattered_sword_assets/fonts/NoPixel.ttf');
src: url('shattered_sword_assets2/fonts/NoPixel.ttf');
}
</style>
</head>
@ -68,6 +69,6 @@
<div id="stats-display"></div>
</div>
</div>
<script src="bundle.js"></script>
<script src="bundle2.js"></script>
</body>
</html>

74
public/benchmark3.html Normal file
View File

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Benchmark 3</title>
<style>
#main {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
}
#game-window {
position: relative;
}
#game-canvas {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
}
#text-canvas {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
pointer-events: none;
}
#debug-canvas {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
pointer-events: none;
}
@font-face {
font-family: 'NoPixel';
src: url('shattered_sword_assets3/fonts/NoPixel.ttf');
}
</style>
</head>
<body>
<div id="main">
<!-- The main window of the game. This contains the rendered game and any debug text -->
<div id="game-window">
<!-- This is the canvas where the actual game is rendered -->
<canvas id="game-canvas"></canvas>
<!-- This is the canvas where text is rendered in WebGL -->
<canvas id="text-canvas" hidden></canvas>
<!-- This is the canvas where the debug text and graphics are rendered -->
<canvas id="debug-canvas"></canvas>
</div>
<!-- This contains stats about the game for development purposes, such as the average update time -->
<div id="stats" hidden>
<canvas id="stats-canvas"></canvas>
<select name="Display" id="chart-option">
</select>
<div id="stats-display"></div>
</div>
</div>
<script src="bundle3.js"></script>
</body>
</html>

View File

@ -11491,11 +11491,11 @@ class WeaponTemplateRegistry extends Registry_1.default {
const rm = ResourceManager_1.default.getInstance();
//TODO -
// Load sprites for each weapon
//rm.image("something", "shattered_sword_assets/sprites/something.png");
rm.image("knife", "shattered_sword_assets/sprites/knife.png");
//rm.image("something", "shattered_sword_assets2/sprites/something.png");
rm.image("knife", "shattered_sword_assets2/sprites/knife.png");
// Load spritesheets
//rm.spritesheet("weapon anim", "shattered_sword_assets/spritesheets/weapon anim.json");
rm.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");
//rm.spritesheet("weapon anim", "shattered_sword_assets2/spritesheets/weapon anim.json");
rm.spritesheet("slice", "shattered_sword_assets2/spritesheets/slice.json");
// Register default types
//this.registerItem("itemtype", itemTypefile);
this.registerItem("slice", Slice_1.default);
@ -11553,15 +11553,15 @@ class GameLevel extends Scene_1.default {
//can load player sprite here
//can load enemy sprite here
// Load the scene info
this.load.object("weaponData", "shattered_sword_assets/data/weaponData.json");
this.load.object("weaponData", "shattered_sword_assets2/data/weaponData.json");
// Load in the enemy info
//this.load.object("enemyData", "shattered_sword_assets/data/enemy.json");
//this.load.object("enemyData", "shattered_sword_assets2/data/enemy.json");
// Load in item info
//this.load.object("itemData", "shattered_sword_assets/data/items.json");
this.load.image("knife", "shattered_sword_assets/sprites/knife.png");
this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");
this.load.image("inventorySlot", "shattered_sword_assets/sprites/inventory.png");
this.load.spritesheet("test_dummy", "shattered_sword_assets/spritesheets/test_dummy.json");
//this.load.object("itemData", "shattered_sword_assets2/data/items.json");
this.load.image("knife", "shattered_sword_assets2/sprites/knife.png");
this.load.spritesheet("slice", "shattered_sword_assets2/spritesheets/slice.json");
this.load.image("inventorySlot", "shattered_sword_assets2/sprites/inventory.png");
this.load.spritesheet("test_dummy", "shattered_sword_assets2/spritesheets/test_dummy.json");
}
startScene() {
// Do the game level standard initializations
@ -11978,7 +11978,7 @@ const Levels_1 = require("./Levels");
class MainMenu extends Scene_1.default {
loadScene() {
// Load the menu song
//this.load.audio("menu", "shattered_sword_assets/music/menu.mp3");
//this.load.audio("menu", "shattered_sword_assets2/music/menu.mp3");
}
//TODO
startScene() {
@ -11990,7 +11990,7 @@ class MainMenu extends Scene_1.default {
// console.log(this.save.getLevel());
// this.save.setLevel(10);
// console.log(this.save.getLevel());
// this.rmg = new RandomMapGenerator("shattered_sword_assets/jsons/forest_template.json", 114514);
// this.rmg = new RandomMapGenerator("shattered_sword_assets2/jsons/forest_template.json", 114514);
// this.rmg.getMap();
// Scene has started, so start playing music
//this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "menu", loop: true, holdReference: true});
@ -12295,7 +12295,7 @@ class SceneWithStory extends Scene_1.default {
let event = this.receiver.getNextEvent();
// Testing code
if (event.type === "loadStory" && this.currentMode === Mode.GAME_MODE) {
this.storyLoader("shattered_sword_assets/jsons/story.json");
this.storyLoader("shattered_sword_assets2/jsons/story.json");
}
}
// Testing code
@ -12316,15 +12316,15 @@ class Tutorial extends GameLevel_1.default {
loadScene() {
super.loadScene();
// Load resources
// this.load.tilemap("forest1", "shattered_sword_assets/tilemaps/Tutorial.json");
// this.load.tilemap("forest1", "shattered_sword_assets2/tilemaps/Tutorial.json");
// let map = localStorage.getItem("map");
this.randomSeed = Math.floor(Math.random() * 10000000000);
let rmg = new RandomMapGenerator_1.default("shattered_sword_assets/jsons/forest_template.json", this.randomSeed);
let rmg = new RandomMapGenerator_1.default("shattered_sword_assets2/jsons/forest_template.json", this.randomSeed);
this.map = rmg.getMap();
this.load.tilemapFromObject("forest1", this.map);
this.load.spritesheet("player", "shattered_sword_assets/spritesheets/Hiro.json");
this.load.spritesheet("player", "shattered_sword_assets2/spritesheets/Hiro.json");
// TODO - change when done testing
this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");
this.load.spritesheet("slice", "shattered_sword_assets2/spritesheets/slice.json");
//load music here
}
startScene() {

View File

@ -1,89 +1,17 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to Firebase Hosting</title>
<!-- update the version number as needed -->
<script defer src="/__/firebase/9.6.9/firebase-app-compat.js"></script>
<!-- include only the Firebase features as you need -->
<script defer src="/__/firebase/9.6.9/firebase-auth-compat.js"></script>
<script defer src="/__/firebase/9.6.9/firebase-database-compat.js"></script>
<script defer src="/__/firebase/9.6.9/firebase-firestore-compat.js"></script>
<script defer src="/__/firebase/9.6.9/firebase-functions-compat.js"></script>
<script defer src="/__/firebase/9.6.9/firebase-messaging-compat.js"></script>
<script defer src="/__/firebase/9.6.9/firebase-storage-compat.js"></script>
<script defer src="/__/firebase/9.6.9/firebase-analytics-compat.js"></script>
<script defer src="/__/firebase/9.6.9/firebase-remote-config-compat.js"></script>
<script defer src="/__/firebase/9.6.9/firebase-performance-compat.js"></script>
<!--
initialize the SDK after all desired features are loaded, set useEmulator to false
to avoid connecting the SDK to running emulators.
-->
<script defer src="/__/firebase/init.js?useEmulator=true"></script>
<style media="screen">
body { background: #ECEFF1; color: rgba(0,0,0,0.87); font-family: Roboto, Helvetica, Arial, sans-serif; margin: 0; padding: 0; }
#message { background: white; max-width: 360px; margin: 100px auto 16px; padding: 32px 24px; border-radius: 3px; }
#message h2 { color: #ffa100; font-weight: bold; font-size: 16px; margin: 0 0 8px; }
#message h1 { font-size: 22px; font-weight: 300; color: rgba(0,0,0,0.6); margin: 0 0 16px;}
#message p { line-height: 140%; margin: 16px 0 24px; font-size: 14px; }
#message a { display: block; text-align: center; background: #039be5; text-transform: uppercase; text-decoration: none; color: white; padding: 16px; border-radius: 4px; }
#message, #message a { box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); }
#load { color: rgba(0,0,0,0.4); text-align: center; font-size: 13px; }
@media (max-width: 600px) {
body, #message { margin-top: 0; background: white; box-shadow: none; }
body { border-top: 16px solid #ffa100; }
}
</style>
<title>Shattered Sword</title>
</head>
<body>
<div id="message">
<h2>Welcome</h2>
<h1>Firebase Hosting Setup Complete</h1>
<p>You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!</p>
<a target="_blank" href="https://firebase.google.com/docs/hosting/">Open Hosting Documentation</a>
</div>
<p id="load">Firebase SDK Loading&hellip;</p>
<p>Benchmarks: </p>
<script>
document.addEventListener('DOMContentLoaded', function() {
const loadEl = document.querySelector('#load');
// // 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
// // The Firebase SDK is initialized and available here!
//
// firebase.auth().onAuthStateChanged(user => { });
// firebase.database().ref('/path/to/ref').on('value', snapshot => { });
// firebase.firestore().doc('/foo/bar').get().then(() => { });
// firebase.functions().httpsCallable('yourFunction')().then(() => { });
// firebase.messaging().requestPermission().then(() => { });
// firebase.storage().ref('/path/to/ref').getDownloadURL().then(() => { });
// firebase.analytics(); // call to activate
// firebase.analytics().logEvent('tutorial_completed');
// firebase.performance(); // call to activate
//
// // 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
try {
let app = firebase.app();
let features = [
'auth',
'database',
'firestore',
'functions',
'messaging',
'storage',
'analytics',
'remoteConfig',
'performance',
].filter(feature => typeof app[feature] === 'function');
loadEl.textContent = `Firebase SDK loaded with ${features.join(', ')}`;
} catch (e) {
console.error(e);
loadEl.textContent = 'Error loading the Firebase SDK, check the console.';
}
});
</script>
<ul>
<li><a href="https://shattered-sword.firebaseapp.com//ShatteredSwordGameDesignDocument.html">benchmark1</a></li>
<li><a href="https://shattered-sword.firebaseapp.com/benchmark2.html">benchmark2</a></li>
<li><a href="https://shattered-sword.firebaseapp.com/benchmark3.html">benchmark3</a></li>
</ul>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 592 B

After

Width:  |  Height:  |  Size: 592 B

View File

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 710 B

View File

Before

Width:  |  Height:  |  Size: 990 B

After

Width:  |  Height:  |  Size: 990 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View File

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 211 B

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 819 B

After

Width:  |  Height:  |  Size: 819 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

View File

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 276 B

View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB