Skip to content

Commit

Permalink
Merge pull request #15 from wizguin/develop
Browse files Browse the repository at this point in the history
1.7.0-beta
  • Loading branch information
wizguin authored Nov 17, 2023
2 parents 6deff57 + c12ac17 commit f5b13b6
Show file tree
Hide file tree
Showing 44 changed files with 3,602 additions and 760 deletions.
5 changes: 5 additions & 0 deletions assets/styles/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,8 @@
font-weight: bold;
src: url('../fonts/CCFaceFront Bold Italic.woff2');
}

@font-face {
font-family: 'CPLCD';
src: url('../fonts/CPLCD.woff2');
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yukon",
"version": "1.6.0-beta",
"version": "1.7.0-beta",
"scripts": {
"dev": "webpack serve",
"editor": "phasereditor2d-launcher -project . -max-number-files 5000",
Expand Down
3 changes: 2 additions & 1 deletion src/data/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const fonts = {
'Burbank Big Regular:n7',
'Burbank Small:n4,n7',
'CCComiccrazy:n4,n7',
'CCFaceFront:n4,i7'
'CCFaceFront:n4,i7',
'CPLCD:n4'
],
urls: [
'assets/styles/fonts.css'
Expand Down
4 changes: 4 additions & 0 deletions src/data/rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ const rooms = {
998: {
key: 'CardJitsu',
scene: require('@rooms/../games/card/CardJitsu').default
},
999: {
key: 'Sled',
scene: require('@rooms/../games/sled/Sled').default
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/engine/loaders/BaseLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export default class BaseLoader extends Phaser.Loader.LoaderPlugin {
super(scene)

this.globalLoadQueue = scene.world.globalLoadQueue

this.on('loaderror', this.onLoadError, this)
}

get crumbs() {
Expand Down Expand Up @@ -36,12 +38,12 @@ export default class BaseLoader extends Phaser.Loader.LoaderPlugin {
return parseInt(last)
}

attachErrorListener() {
this.on('loaderror', this.onLoadError, this)
}

onLoadError(file) {
if (file.key in this.globalLoadQueue) {
this.off(`filecomplete-${file.type}-${file.key}`)

delete this.globalLoadQueue[file.key]
}
}

checkComplete(type, key, callback = () => {}) {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/loaders/ClothingLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default class ClothingLoader extends BaseLoader {
}

loadSecretFrames(secretFrames, slot, item) {
this.framesLoader.loadFrames(secretFrames, () => {
this.framesLoader.loadFrames(item, secretFrames, () => {
this.addItem(slot, item)
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/engine/loaders/GridViewLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export default class GridViewLoader extends BaseLoader {

this.filter
this.page

this.attachErrorListener()
}

get baseURL() {
Expand Down Expand Up @@ -94,6 +92,8 @@ export default class GridViewLoader extends BaseLoader {
}

onLoadError(file) {
super.onLoadError(file)

if (!this.gridView.visible) {
return
}
Expand Down
8 changes: 6 additions & 2 deletions src/engine/loaders/InventoryLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export default class InventoryLoader extends BaseLoader {

this.baseURL = '/assets/media/clothing/icon/120/'
this.keyPrefix = 'clothing/icon/120/'

this.attachErrorListener()
}

loadPage(page) {
Expand Down Expand Up @@ -80,6 +78,8 @@ export default class InventoryLoader extends BaseLoader {
}

onLoadError(file) {
super.onLoadError(file)

let item = this.getKeyId(file.key)

this.addIcon(item, 'main', 'x-icon')
Expand All @@ -97,6 +97,10 @@ export default class InventoryLoader extends BaseLoader {
return
}

if (slot.item) {
slot.item.destroy()
}

if (slot.spinner) {
slot.spinner.destroy()
}
Expand Down
36 changes: 24 additions & 12 deletions src/engine/loaders/SecretFramesLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,46 @@ export default class SecretFramesLoader extends BaseLoader {

this.baseURL = '/assets/media/penguin/actions/'
this.keyPrefix = 'secret_frames/'

// Track current items loading
this.currentItems = {}
}

loadFrames(frames, callback) {
for (let frame of frames) {
this.loadFrame(frame)
loadFrames(itemId, frames, callback) {
if (itemId in this.currentItems) {
return
}

if (this.list.size == 0) {
return callback()
}
this.currentItems[itemId] = { remaining: frames.length, callback: callback }

this.once('complete', () => callback())
for (let frame of frames) {
this.loadFrame(frame, itemId)
}

this.start()
}

loadFrame(frame) {
let key = this.getKey(frame)
loadFrame(frame, itemId) {
const key = this.getKey(frame)

if (this.checkComplete('json', key)) {
if (this.checkComplete('json', key, () => {
this.onFrameComplete(itemId)
})) {
return
}

this.multiatlas(key, `${frame}.json`)
}

loadComplete() {
super.loadComplete()
onFrameComplete(itemId) {
this.currentItems[itemId].remaining--

if (this.currentItems[itemId].remaining < 1) {
// All frames loaded for item
this.currentItems[itemId].callback()

delete this.currentItems[itemId]
}
}

}
2 changes: 1 addition & 1 deletion src/engine/network/plugins/plugins/Waddle.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class Waddle extends Plugin {

updateWaddle(args) {
if (this.world.room.isReady) {
this.interface.main.waddle.updateWaddle(args.waddle, args.seat, args.username)
this.world.room.updateWaddle(args.waddle, args.seat, args.username)
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/engine/ruffle/RuffleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ export default class RuffleController extends BaseScene {

this.container.visible = false
this.stopMusic()

this.world.client.sendJoinLastRoom()
}

getKeys() {
Expand Down
6 changes: 6 additions & 0 deletions src/engine/world/WorldController.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class WorldController extends BaseScene {
this.secretFramesCache = {}

this.globalLoadQueue = {}

this.worldTimeZone = 'America/Los_Angeles'
}

create() {
Expand Down Expand Up @@ -108,4 +110,8 @@ export default class WorldController extends BaseScene {
return this.crumbs.colors[id - 1] || this.crumbs.colors[0]
}

getWorldTime() {
return new Date(new Date().toLocaleString('en-US', { timeZone: this.worldTimeZone }))
}

}
13 changes: 8 additions & 5 deletions src/engine/world/penguin/ClientController.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default class ClientController {

this.lastRoom
this.activeSeat
this.lastSledId

// Item inventory
this.slots = ['color', 'head', 'face', 'neck', 'body', 'hand', 'feet', 'flag', 'photo', 'award']
Expand Down Expand Up @@ -242,12 +243,14 @@ export default class ClientController {
}

sendJoinLastRoom() {
if (this.world.lastRoom) {
let room = this.crumbs.scenes.rooms[this.world.lastRoom]
if (!this.world.lastRoom || this.world.room && this.world.lastRoom === this.world.room.id) {
return
}

if (room) {
this.sendJoinRoom(this.world.lastRoom, room.key, room.x, room.y, 80)
}
const room = this.crumbs.scenes.rooms[this.world.lastRoom]

if (room) {
this.sendJoinRoom(this.world.lastRoom, room.key, room.x, room.y, 80)
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/engine/world/penguin/ClientPenguin.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export default class ClientPenguin extends Penguin {
if (path) {
this.addMoveTween(path)
this.network.send('send_position', { x: path.target.x, y: path.target.y })

this.scene.events.emit('move_start', { x: x, y: y })
}
}

Expand All @@ -62,6 +64,8 @@ export default class ClientPenguin extends Penguin {

super.onMoveComplete()
this.isTrigger()

this.scene.events.emit('move_end')
}

isTrigger() {
Expand Down
27 changes: 26 additions & 1 deletion src/scenes/components/Zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export default class Zone extends SimpleButton {
start() {
this.gameObject.visible = false

let zone = this.scene.add.zone(this.gameObject.x, this.gameObject.y, this.gameObject.width, this.gameObject.height)
const x = this.getX(this.gameObject)
const y = this.getY(this.gameObject)

const zone = this.scene.add.zone(x, y, this.gameObject.width, this.gameObject.height)
zone.isButton = true
zone.angle = this.gameObject.angle

Expand All @@ -54,6 +57,28 @@ export default class Zone extends SimpleButton {
this.gameObject.zone = zone
}

getX(gameObject) {
if (!gameObject.parentContainer) {
return gameObject.x
}

// Get global coordinates of gameObject
const matrix = gameObject.getWorldTransformMatrix()

return matrix.getX(0, 0)
}

getY(gameObject) {
if (!gameObject.parentContainer) {
return gameObject.y
}

// Get global coordinates of gameObject
const matrix = gameObject.getWorldTransformMatrix()

return matrix.getY(0, 0)
}

/* END-USER-CODE */
}

Expand Down
89 changes: 89 additions & 0 deletions src/scenes/games/sled/ClientSledPlayer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import SledPlayer from './SledPlayer'


export default class ClientSledPlayer extends SledPlayer {

constructor(scene, x, y) {
super(scene, x, y)

scene.input.keyboard.on('keydown-UP', this.onMoveUpKey, this)
scene.input.keyboard.on('keydown-RIGHT', this.onMoveUpKey, this)
scene.input.keyboard.on('keydown-DOWN', this.onMoveDownKey, this)
scene.input.keyboard.on('keydown-LEFT', this.onMoveDownKey, this)
}

get canMove() {
return this.started && !this.isCrashed && !this.isFinished
}

get isGameXUpdated() {
return this.gameX !== this.lastGameX
}

setPlayer(playerData, index) {
super.setPlayer(playerData, index)

this.icon.setFrame('progress/icon_2')
}

onMoveUpKey() {
if (!this.canMove) {
return
}

this.moveUp()

if (this.isGameXUpdated) {
this.sendMove(1)
}
}

onMoveDownKey() {
if (!this.canMove) {
return
}

this.moveDown()

if (this.isGameXUpdated) {
this.sendMove(2)
}
}

checkMap() {
if (this.map === 220 && !this.isCrashed) {
this.startCrash()
this.sendCrash()
}

if (this.map === 240) {
this.startBoost()
this.sendBoost()
}

super.checkMap()
}

endFinish() {
super.endFinish()

this.sendFinished()
}

sendMove(move) {
this.network.send('send_move', { move: move })
}

sendCrash() {
this.sendMove(3)
}

sendBoost() {
this.sendMove(4)
}

sendFinished() {
this.sendMove(5)
}

}
Loading

0 comments on commit f5b13b6

Please sign in to comment.