diff --git a/src/components/game-objects/bus.js b/src/components/game-objects/bus.js index 98a0dc8..59933ac 100644 --- a/src/components/game-objects/bus.js +++ b/src/components/game-objects/bus.js @@ -385,7 +385,7 @@ Bus.prototype.leaveTween = function () { this.movingTween = this.scene.add.tween({ targets: [this], - y: toRes(-500 - this.busHeight), + y: toRes(800), ease: "Cubic.easeIn", duration: duration, onStart: () => { @@ -393,7 +393,7 @@ Bus.prototype.leaveTween = function () { }, onComplete: () => { this.movingTween = null; - this.bye(); + //this.bye(); if (!this.scene.buses.countActive()) { let newBus = this.scene.addBus(false); newBus.moveToStop(); diff --git a/src/components/game-objects/person.js b/src/components/game-objects/person.js index 8e04cbb..b936ee8 100644 --- a/src/components/game-objects/person.js +++ b/src/components/game-objects/person.js @@ -17,6 +17,53 @@ const Person = new Phaser.Class({ }, }); +Person.prototype.createPath = function(points){ + this.points = points; + this.curve = new Phaser.Curves.Spline(this.points); + let sp= this.curve.getPoint(0); + this.x = sp.x; + this.y = sp.y +} + +Person.prototype.goAlongPath = function(){ + + + const tweenPath = { + t:0, + mycurve:this.curve, + mySprite:this, + getT:function(){ + return this.t; + }, + setT:function(v){ + this.t = v; + const point = this.mycurve.getPoint(this.t); + this.x = point.x; + this.y = point.y; + } + + } + + this.scene.tweens.add({ + targets:tweenPath, + t:1, + duration:3000, + ease:'Linear', + repeat:0, + yoyo:false, + onUpdate:()=>{ + const point = this.curve.getPoint(tweenPath.t); + this.x = point.x; + this.y = point.y; + }, + onComplete:()=>{ + + } + + }) + +} + Person.prototype.customResetData = function (char = "mailman") { if (userSettings.globalSettings.animations.value) this.animsEnabled = true; this.resetMoveList(); diff --git a/src/components/street.js b/src/components/street.js index 389d1db..060c07d 100644 --- a/src/components/street.js +++ b/src/components/street.js @@ -65,6 +65,9 @@ export class Street extends Phaser.Scene { } + preload() { +} + //Phaser scene function async create() { this.createBuses(); @@ -1138,6 +1141,7 @@ export class Street extends Phaser.Scene { if (type == "person") { let txData = gameObject.getLineData("txData"); this.vue.txWindow(txData); + console.log("txData", txData); } }); this.input.on("gameobjectup", (pointer, gameObject) => { @@ -1201,6 +1205,7 @@ export class Street extends Phaser.Scene { if (gameObject.person) { let txData = gameObject.person.getLineData("txData"); this.vue.txWindow(txData); + console.log("txData", txData); } gameObject.bye(); } diff --git a/src/components/streets/ethereum.js b/src/components/streets/ethereum.js index 0aafd8e..e1e7aca 100644 --- a/src/components/streets/ethereum.js +++ b/src/components/streets/ethereum.js @@ -1,10 +1,12 @@ import { Street } from "../street.js"; // import { toRes, ethNewTxSetDepending } from "../utils/"; -import { toRes, ethNewTxSetDepending } from "../utils/"; +import { toRes, ethNewTxSetDepending,getSheetKey } from "../utils/"; import { ETH, ethUnits } from "../config.js"; import i18n from "../../i18n"; import eventHub from "../vue/eventHub.js"; import state from "../../wallet"; +import Bus from "../game-objects/bus.js"; + export default class ETHStreet extends Street { constructor(side) { @@ -12,8 +14,10 @@ export default class ETHStreet extends Street { } init() { + this.myDummyData; this.foundBoarding = false; - this.busStop = toRes(200); + this.busStop = toRes(1500); + this.myMainCameraPosition= 1300; this.busDoorFromTop = toRes(42); this.personPixelsPerSecond = 5; this.decelerationArea = 500; @@ -84,14 +88,14 @@ export default class ETHStreet extends Street { this.bottomStats = this.config.stats; } - preload() { } + preload() {} + async create() { super.create(); this.addressNonces = this.config.addressNonces; - this.streetCreate(); - + this.cameras.main.scrollY =this.myMainCameraPosition; this.vue.navigation.unshift({ key: "characters", html: "", @@ -127,11 +131,76 @@ export default class ETHStreet extends Street { eventHub.$on(this.ticker + "-follow", (address) => { this.followAddress(address); }); + eventHub.$on("createMyStaticSearch",()=>{this.createStaticSearch()}); if (state.address) this.followAddress(state.address); this.createIsabella(); } + createStaticSearch(){ + + + setInterval(() => { + if(this.myMainCameraPosition > 0){ + this.myMainCameraPosition -= 10; + this.cameras.main.scrollY = this.myMainCameraPosition; + }}, 20); + + + this.mybus = this.createStaticBus(200,"#20975174","2Gwei","+0Wei",0.3,true); + + this.mySecondBus = this.createStaticBus(400,"#20175274","4Gwei","+0Wei",0.3,false); + + this.myThirdBus = this.createStaticBus(600,"#20188174","3Gwei","+0Wei",0.3,false); + this.createStaticPersonInBus(this.mybus.x,this.mybus.y-50,"mailman-0.png"); + this.createStaticPersonInBus(this.mybus.x-20,this.mybus.y-50,"person-59.png"); + this.createStaticPersonInBus(this.mybus.x+40,this.mybus.y-50,"bear-0.png"); + + this.createStaticPersonInBus(this.mybus.x,this.mybus.y-28,"lizard-0.png"); + this.createStaticPersonInBus(this.mybus.x-30,this.mybus.y-28,"person-59.png"); + this.createStaticPersonInBus(this.mybus.x+20,this.mybus.y-28,"bear-0.png"); + + this.time.delayedCall(3500, () => { + + console.log("tumeanzia hapa") + this.myPerson =this.newPerson(this.myDummyData); + this.myPerson.setTexture(getSheetKey("person-"),"mailman-0.png"); + + this.myPerson.active = true; + this.myPerson.visible = true; + this.myPerson.setDepth(10); + this.myPerson.setPosition(this.mybus.x,this.mybus.y); + this.myPerson.setInteractive({ useHandCursor: true }); + this.myPerson.createHitArea(); + this.myPerson.setLineData("status", null); + this.myPerson.setScale(1) + + this.myPerson.createPath([this.mybus.x-50,this.mybus.y, + this.mybus.x-200,this.mybus.y, + this.mybus.x-200,this.myThirdBus.y, + this.mybus.x-300,this.myThirdBus.y]) + this.myPerson.goAlongPath(); + }, [], this); + + } + + createStaticPersonInBus(xPos,yPos,personKey){ + let person = this.add.image(xPos,yPos,getSheetKey("person-"),personKey).setDepth(100).setScale(0.5); + return person; + + } + createStaticBus(yPos,text1,text2,text3,scale,createInside){ + let bus = new Bus(this); + bus.y = yPos; + bus.text1.setText(text1); + bus.text2.setText(text2); + bus.text3.setText(text3); + bus.logo.setScale(scale); + if(createInside){ + bus.createInside(); + } + return bus; + } // cycleIsaMessage() { // if (!this.isabella.isaChange) { @@ -348,6 +417,7 @@ export default class ETHStreet extends Street { //go through list sortBuses(instant = false, hashArray = false) { + console.log("sfjslkjf;lkasjfklja") if (!hashArray) hashArray = this.sortedLineHashes(false); for (let i = 0; i < hashArray.length; i++) { hashArray[i].txData.dependingOn = false; @@ -413,6 +483,7 @@ export default class ETHStreet extends Street { this.lineManager[entry.txData.tx].status = "waiting"; //add to line as person this.newPerson(this.lineManager[entry.txData.tx]); + this.myDummyData = this.lineManager[entry.txData.tx]; } } diff --git a/src/components/vue/Search.vue b/src/components/vue/Search.vue index a7bad23..0497642 100644 --- a/src/components/vue/Search.vue +++ b/src/components/vue/Search.vue @@ -9,6 +9,7 @@