Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StaticUpdate #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/game-objects/bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,15 @@ Bus.prototype.leaveTween = function () {

this.movingTween = this.scene.add.tween({
targets: [this],
y: toRes(-500 - this.busHeight),
y: toRes(800),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we not use some percentage of the screen here? instead of 800

ease: "Cubic.easeIn",
duration: duration,
onStart: () => {
this.scene.busesMoving = true;
},
onComplete: () => {
this.movingTween = null;
this.bye();
//this.bye();
if (!this.scene.buses.countActive()) {
let newBus = this.scene.addBus(false);
newBus.moveToStop();
Expand Down
46 changes: 46 additions & 0 deletions src/components/game-objects/person.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,52 @@ const Person = new Phaser.Class({
},
});

Person.prototype.createPath = function(points){
this.points = points;
this.curve = new Phaser.Curves.Spline(this.points);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let sp= this.curve.getPoint(0);
this.x =  sp.x;
 this.y = sp.y

avoid calling the getpoint function twice

this.x = this.curve.getPoint(0).x;
this.y = this.curve.getPoint(0).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();
Expand Down
5 changes: 5 additions & 0 deletions src/components/street.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export class Street extends Phaser.Scene {

}

preload() {
}

//Phaser scene function
async create() {
this.createBuses();
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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();
}
Expand Down
88 changes: 83 additions & 5 deletions src/components/streets/ethereum.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
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) {
super(ETH, side);
}

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;
Expand Down Expand Up @@ -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: "<span class='fas fa-user-astronaut'></span>",
Expand Down Expand Up @@ -127,10 +131,82 @@ 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 = new Bus(this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.mybus = new Bus(this);
this.mybus.y = 200;
this.mybus.text1.setText("#20975174");
this.mybus.text2.setText("2Gwei");
this.mybus.text3.setText("+0Wei");

	this code looks like we can create a function for creating bus as we are using the same code on 149 only with different parameterts

this.mybus.y = 200;
this.mybus.text1.setText("#20975174");
this.mybus.text2.setText("2Gwei");
this.mybus.text3.setText("+0Wei");
this.mybus.logo.setScale(0.3);
this.mybus.createInside();
//this.busInsideSingle(this.mybus);
this.mybus.txsOverride = true;
//this.mybus.tx.length = 4;
this.mybus.loaded = 4 ;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.mybus.loaded = 4 ;
this.mymailman = this.add.image(this.mybus.x,this.mybus.y-50,getSheetKey("person-"),"mailman-0.png").setDepth(100).setScale(0.5);
this.mypersonman = this.add.image(this.mybus.x-20,this.mybus.y-50,getSheetKey("person-"),"person-59.png").setDepth(100).setScale(0.5);
this.mysecondpersonman = this.add.image(this.mybus.x+40,this.mybus.y-50,getSheetKey("person-"),"bear-0.png").setDepth(100).setScale(0.5);
this can also be having a functon created

this.mymailman = this.add.image(this.mybus.x,this.mybus.y-50,getSheetKey("person-"),"mailman-0.png").setDepth(100).setScale(0.5);
this.mypersonman = this.add.image(this.mybus.x-20,this.mybus.y-50,getSheetKey("person-"),"person-59.png").setDepth(100).setScale(0.5);
this.mysecondpersonman = this.add.image(this.mybus.x+40,this.mybus.y-50,getSheetKey("person-"),"bear-0.png").setDepth(100).setScale(0.5);

this.mymailman1 = this.add.image(this.mybus.x,this.mybus.y-28,getSheetKey("person-"),"lizard-0.png").setDepth(100).setScale(0.5);
this.mypersonman1 = this.add.image(this.mybus.x-30,this.mybus.y-28,getSheetKey("person-"),"person-59.png").setDepth(100).setScale(0.5);
this.mysecondpersonman1 = this.add.image(this.mybus.x+20,this.mybus.y-28,getSheetKey("person-"),"bear-0.png").setDepth(100).setScale(0.5);
//this.myPeopleInBus = this.scene.add.image(this.mybus.x,this.mybus.y, "myPeopleInBus").setOrigin(0, 0).setDepth(11);

this.mySecondBus = new Bus(this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can create one single function for this

this.mySecondBus.y =400;
this.mySecondBus.text1.setText("#20175274");
this.mySecondBus.text2.setText("4Gwei");
this.mySecondBus.text3.setText("+0Wei");
this.mySecondBus.logo.setScale(0.3);

this.myThirdBus = new Bus(this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can create a single function

this.myThirdBus.y = 600;
this.myThirdBus.text1.setText("#20188174");
this.myThirdBus.text2.setText("3Gwei");
this.myThirdBus.text3.setText("+0Wei");
this.myThirdBus.logo.setScale(0.3);
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.resetData();




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);


}



// cycleIsaMessage() {
Expand Down Expand Up @@ -348,6 +424,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;
Expand Down Expand Up @@ -413,6 +490,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];
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/components/vue/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<script>
// @ts-nocheck
import eventHub from './eventHub';
export default {
data: function (){
return {
Expand All @@ -32,6 +33,12 @@ export default {
//nothing to search
this.icon = "exclamation-circle"
}
this.$nextTick(() => {
//this.dropdownActive = false;
this.$emit("toggleWindowAfterSearch");
eventHub.$emit("createMyStaticSearch");

});
}, 1);
},
searchTransaction(query, icon=true){
Expand Down
2 changes: 1 addition & 1 deletion src/components/vue/SideController.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<div v-if="dropdownActive" class="coin-dropdown-container">
<div class="coin-dropdown box">
<search key="search" ref="search"></search>
<search key="search" ref="search" @toggleWindowAfterSearch="toggleWindow(window)"></search>
<div class="coin-dropdown-section section">
<div class="subtitle is-4 has-text-centered">Change Street</div>
<div class="columns is-multiline">
Expand Down