mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 18:56:55 +02:00
myBalance new layout changes
This commit is contained in:
parent
6365f6b857
commit
976b76ac85
1 changed files with 30 additions and 29 deletions
|
@ -20,44 +20,43 @@ var AccountManager = AccountManager || {};
|
||||||
"use strict";
|
"use strict";
|
||||||
var iconUrl = 'http://localhost/~stojce/',
|
var iconUrl = 'http://localhost/~stojce/',
|
||||||
overlayWidth = 150,
|
overlayWidth = 150,
|
||||||
overlayHeight = 150,
|
overlayHeight = 50,
|
||||||
redColor = {
|
overlayTopOffset = 15,
|
||||||
red: 255,
|
overlayRightOffset = 100,
|
||||||
|
textRightOffset = 75,
|
||||||
|
downColor = {
|
||||||
|
red: 0,
|
||||||
green: 0,
|
green: 0,
|
||||||
blue: 0
|
blue: 255
|
||||||
},
|
},
|
||||||
greenColor = {
|
upColor = {
|
||||||
red: 0,
|
red: 0,
|
||||||
green: 255,
|
green: 255,
|
||||||
blue: 0
|
blue: 0
|
||||||
},
|
},
|
||||||
whiteColor = {
|
normalColor = {
|
||||||
red: 255,
|
red: 204,
|
||||||
green: 255,
|
green: 204,
|
||||||
blue: 255
|
blue: 204
|
||||||
},
|
},
|
||||||
balance = 0,
|
balance = 0,
|
||||||
voxelTool = Overlays.addOverlay("image", {
|
voxelTool = Overlays.addOverlay("image", {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: overlayTopOffset,
|
||||||
width: 50,
|
width: 92,
|
||||||
height: 50,
|
height: 32,
|
||||||
subImage: {
|
|
||||||
x: 0,
|
|
||||||
y: 50,
|
|
||||||
width: 50,
|
|
||||||
height: 50
|
|
||||||
},
|
|
||||||
imageURL: iconUrl + "wallet.svg",
|
imageURL: iconUrl + "wallet.svg",
|
||||||
alpha: 1
|
alpha: 1
|
||||||
}),
|
}),
|
||||||
textOverlay = Overlays.addOverlay("text", {
|
textOverlay = Overlays.addOverlay("text", {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: overlayTopOffset,
|
||||||
width: 55,
|
topMargin: 9,
|
||||||
height: 13,
|
text: balance.toFixed(4),
|
||||||
topMargin: 5,
|
font: {
|
||||||
text: balance,
|
size: 15
|
||||||
|
},
|
||||||
|
color: normalColor,
|
||||||
alpha: 0
|
alpha: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -69,11 +68,11 @@ var AccountManager = AccountManager || {};
|
||||||
function update(deltaTime) {
|
function update(deltaTime) {
|
||||||
var xPos = Controller.getViewportDimensions().x;
|
var xPos = Controller.getViewportDimensions().x;
|
||||||
Overlays.editOverlay(voxelTool, {
|
Overlays.editOverlay(voxelTool, {
|
||||||
x: xPos - 150
|
x: xPos - overlayRightOffset
|
||||||
});
|
});
|
||||||
|
|
||||||
Overlays.editOverlay(textOverlay, {
|
Overlays.editOverlay(textOverlay, {
|
||||||
x: xPos - 100
|
x: xPos - textRightOffset
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,18 +81,20 @@ var AccountManager = AccountManager || {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var change = balance - newBalance,
|
var change = newBalance - balance,
|
||||||
textColor = change > 0 ? redColor : greenColor;
|
textColor = change < 0 ? downColor : upColor,
|
||||||
|
integers = balance.toFixed(0).length,
|
||||||
|
decimals = integers > 4 ? 0 : integers - 4;
|
||||||
|
|
||||||
balance = newBalance;
|
balance = newBalance;
|
||||||
Overlays.editOverlay(textOverlay, {
|
Overlays.editOverlay(textOverlay, {
|
||||||
text: balance,
|
text: balance.toFixed(decimals),
|
||||||
color: textColor
|
color: textColor
|
||||||
});
|
});
|
||||||
|
|
||||||
Script.setTimeout(function () {
|
Script.setTimeout(function () {
|
||||||
Overlays.editOverlay(textOverlay, {
|
Overlays.editOverlay(textOverlay, {
|
||||||
color: whiteColor
|
color: normalColor
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue