Skip to content

Commit

Permalink
Merge pull request #17 from wizguin/develop
Browse files Browse the repository at this point in the history
1.9.0-beta
  • Loading branch information
wizguin authored Mar 21, 2024
2 parents ad4eacc + ee92586 commit ce179fa
Show file tree
Hide file tree
Showing 79 changed files with 6,666 additions and 1,560 deletions.
2,215 changes: 1,125 additions & 1,090 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yukon",
"version": "1.8.0-beta",
"version": "1.9.0-beta",
"scripts": {
"dev": "webpack serve",
"editor": "phasereditor2d-launcher -project .",
Expand All @@ -18,21 +18,21 @@
},
"homepage": "https://github.com/wizguin/yukon#readme",
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/core": "^7.24.3",
"@babel/preset-env": "^7.24.3",
"babel-loader": "^9.1.3",
"compression-webpack-plugin": "^10.0.0",
"core-js": "^3.33.0",
"core-js": "^3.36.1",
"howler": "^2.2.4",
"html-webpack-plugin": "^5.5.3",
"html-webpack-plugin": "^5.6.0",
"javascript-obfuscator": "^4.1.0",
"phasereditor2d-launcher": "^3.65.0",
"phasereditor2d-launcher": "^3.67.0",
"phasereditor2d-ninepatch-plugin": "^1.2.0",
"socket.io-client": "^4.7.2",
"socket.io-client": "^4.7.5",
"source-map": "^0.7.4",
"webpack": "^5.89.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"webpack-dev-server": "^4.15.2",
"webpack-obfuscator": "^3.5.1"
}
}
2 changes: 2 additions & 0 deletions src/data/widgets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const widgets = {
'AdoptCatalog': require('@scenes/interface/catalogs/adopt/AdoptCatalog'),
'ClothingCatalog': require('@scenes/interface/catalogs/clothing/ClothingCatalog'),
'FurnitureCatalog': require('@scenes/interface/catalogs/furniture/FurnitureCatalog'),
'IglooCatalog': require('@scenes/interface/catalogs/igloo/IglooCatalog'),
'PetsCatalog': require('@scenes/interface/catalogs/pets/PetsCatalog'),

'FindFour': require('@scenes/games/four/FindFour'),
'Mancala': require('@scenes/games/mancala/Mancala'),
Expand Down
38 changes: 16 additions & 22 deletions src/engine/interface/balloons/Balloon.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,29 @@ export default class Balloon extends BaseContainer {
if (width < this.minWidth) width = this.minWidth
if (height < this.minHeight) height = this.minHeight

this.balloon = this.scene.add.nineslice(
0, 0,
width, height,
{
key: 'main',
frame: 'balloon'
},
15 // Corner slice
)

this.balloon.setOrigin(0.5, 1)
this.balloon = this.scene.add.ninePatchContainer(0, 0, width, height, 'main', 'balloon')

this.balloon.marginTop = 15
this.balloon.marginRight = 15
this.balloon.marginBottom = 15
this.balloon.marginLeft = 15

this.balloon.setNinePatchContainerOrigin(0.5, 1)

this.add(this.balloon)
}

addPointer(width, frame) {
if (width < this.minWidth) width = this.minWidth

let pointer = this.scene.add.nineslice(
0, 0,
width, 40,
{
key: 'main',
frame: frame
},
[0, 110, 0, 15] // Non-uniform corner slice
)

pointer.setOrigin(0.5, 0)
const pointer = this.scene.add.ninePatchContainer(0, 0, width, 40, 'main', frame)

pointer.marginTop = 0
pointer.marginRight = 110
pointer.marginBottom = 0
pointer.marginLeft = 15

pointer.setNinePatchContainerOrigin(0.5, 0)

this.add(pointer)
}
Expand Down
56 changes: 56 additions & 0 deletions src/engine/interface/prompt/PromptController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import CoinPrompt from '@scenes/interface/prompts/CoinPrompt'
import ErrorPrompt from './ErrorPrompt'
import ItemPrompt from '@scenes/interface/prompts/ItemPrompt'
import InputPrompt from '@scenes/interface/prompts/InputPrompt'
import LoadingPromptFactory from './LoadingPromptFactory'
import WindowPrompt from '@scenes/interface/prompts/WindowPrompt'

Expand All @@ -20,6 +21,7 @@ export default class PromptController {
this.coin = this.createPrompt(CoinPrompt)
this.error = this.createPrompt(ErrorPrompt)
this.item = this.createPrompt(ItemPrompt)
this.input = this.createPrompt(InputPrompt)
this.window = this.createPrompt(WindowPrompt)

this.mailError = this.createPrompt(MailErrorPrompt)
Expand All @@ -28,6 +30,10 @@ export default class PromptController {
this.loadingPromptFactory = new LoadingPromptFactory(this.interface)
}

get coins() {
return this.world.client.coins
}

createPrompt(promptClass) {
const prompt = new promptClass(this.interface, 760, 480)

Expand Down Expand Up @@ -94,6 +100,56 @@ export default class PromptController {
this.mailSuccess.show(text)
}

showAdopt(typeId) {
const maxPets = 18

if (this.world.client.pets.length >= maxPets) {
return this.showError(this.getFormatString('max_pets', maxPets))
}

this.item.showAdopt(typeId)
}

showAdoptName(typeId) {
this.input.showAdoptName(typeId)
}

showPetFood(pet) {
if (this.coins < 10) return this.showLowCoins()

this.item.showPetFood(pet)
}

showPetBath(pet) {
if (this.coins < 5) return this.showLowCoins()

this.item.showPetBath(pet)
}

showPetGum(pet) {
if (this.coins < 5) return this.showLowCoins()

this.item.showPetGum(pet)
}

showPetCookie(pet) {
if (this.coins < 5) return this.showLowCoins()

this.item.showPetCookie(pet)
}

showLowCoins() {
this.showError(this.getString('low_coin_warn'))
}

getString(...args) {
return this.interface.getString(...args)
}

getFormatString(id, ...args) {
return this.interface.getFormatString(id, ...args)
}

hideAll() {
this.loadingPromptFactory.hideAll()
}
Expand Down
37 changes: 37 additions & 0 deletions src/engine/loaders/IglooPetLoader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import BaseLoader from './BaseLoader'


export default class IglooPetLoader extends BaseLoader {

constructor(scene) {
super(scene)

this.baseURL = '/assets/media/pet/sprites/'
this.keyPrefix = 'pet/sprites/'
}

loadPet(typeId, callback) {
if (!(typeId in this.crumbs.pets)) return

const name = this.crumbs.pets[typeId].name.toLowerCase()
const key = this.getKey(name)

if (this.checkComplete('json', key, () => {
this.onFileComplete(key, callback)
})) {
return
}

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

onFileComplete(key, callback) {
if (!this.textureExists(key)) {
return
}

callback(key)
}

}
54 changes: 12 additions & 42 deletions src/engine/loaders/ItemPromptLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,33 @@ export default class ItemPromptLoader extends BaseLoader {
super(scene)

this.prompt = prompt

this.config = {
clothing: {
baseURL: '/assets/media/clothing/icon/240/',
keyPrefix: 'clothing/icon/240/'
},
furniture: {
baseURL: '/assets/media/furniture/icon/@5x/',
keyPrefix: 'furniture/icon/@5x/',
scale: 0.65
}
}
}

get baseURL() {
return this.config[this.prompt.type].baseURL
}

get keyPrefix() {
return this.config[this.prompt.type].keyPrefix
}

get scale() {
return this.config[this.prompt.type].scale || 1
}

loadIcon(item) {
loadIcon(config) {
if (this.prompt.icon) {
this.prompt.icon.destroy()
}

let key = this.getKey(item)
if (!config.key || !config.url) {
return
}

const scale = config.scale || 1

if (this.checkComplete('image', key, () => {
this.onFileComplete(key, item)
if (this.checkComplete('image', config.key, () => {
this.onFileComplete(config.key, scale)
})) {
return
}

this.image(key, `${item}.png`)
this.image(config.key, config.url)
this.start()
}

onFileComplete(key, item) {
if (!this.prompt.visible || !this.textureExists(key) || item != this.prompt.item) {
return
onFileComplete(key, scale) {
if (this.textureExists(key)) {
this.prompt.addIcon(key, scale)
}

if (this.prompt.icon) {
this.prompt.icon.destroy()
}

let icon = this.scene.add.image(0, -182, key)
icon.scale = this.scale

this.prompt.add(icon)
this.prompt.icon = icon
}

}
4 changes: 4 additions & 0 deletions src/engine/network/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export default class Network {
}

send(action, args = {}) {
if (!this.client) {
return
}

if (localStorage.logging == 'true') {
console.log('Message sending:', action, args)
}
Expand Down
4 changes: 1 addition & 3 deletions src/engine/network/plugins/plugins/Mail.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ export default class Mail extends Plugin {
}

receiveMail(args) {
this.world.client.postcards.push(args)

this.world.client.refreshPostcards()
this.world.client?.addPostcard(args)
}

showInsufficientCoins() {
Expand Down
Loading

0 comments on commit ce179fa

Please sign in to comment.