Little bit of work on Trade screen.

This commit is contained in:
Robbie Antenesse 2016-04-11 22:47:01 -06:00
parent b4afa9c8a8
commit 1e2638c1f0
4 changed files with 24 additions and 13 deletions

View File

@ -2,7 +2,9 @@ function tradeGUI() {
guiControl.trade = {
screen: "main", // "main", "buy", "sell", "gossip"
cursorPosition: 0,
show: true, // Leaving this in just in case I change my mind about stopping time while trading.
show: false,
island: null,
padding: 2 * OS.S.pixelScale,
leftBorder: 12 * OS.S.pixelScale,
@ -15,6 +17,11 @@ function tradeGUI() {
function drawTradeGUI() {
if (guiControl.trade.show) {
var tmp = Oversimplified.context.fillStyle;
Oversimplified.context.fillStyle = "#D9BEA5";
Oversimplified.context.fillRect(0, 0, Oversimplified.camera.width, Oversimplified.camera.height);
Oversimplified.context.fillStyle = tmp;
if (ct_down().down) {
guiControl.trade.cursorPosition++;
}
@ -62,8 +69,7 @@ function drawTradeGUI() {
guiControl.trade.screen = "gossip";
break;
default:
OS.SetRoom(rm_Ocean);
// guiControl.trade.show = false;
guiControl.trade.show = false;
break;
}

View File

@ -13,6 +13,7 @@ var pr_island = OS.P.Add("Island", {
mapHeight: 1,
mapColor: "#00AB00",
inventory: [],
priceDifferences: [],
itemsSold: [0, 0, 0, 0, // The more you sell, the lower the price gets
0, 0, 0, 0,
@ -21,7 +22,7 @@ var pr_island = OS.P.Add("Island", {
itemsBought: [0, 0, 0, 0, // The more you buy, the higher the price gets
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0],
0, 0, 0, 0]
});
pr_island.DoFirst = function () {
@ -34,9 +35,10 @@ pr_island.GetMapPosition = function () {
this.mapY = (this.y / OS.S.pixelScale) / (OS.camera.height / OS.S.pixelScale);
}
pr_island.SetUpPrices = function () {
pr_island.SetUp = function () {
for (var i = 0; i < 15; i++) {
this.priceDifferences[i] = Math.randomRange(-100, 100);
this.inventory[i] = Math.round(Math.randomRange(0, 20));
this.priceDifferences[i] = Math.round(Math.randomRange(-100, 100));
}
}

View File

@ -27,7 +27,7 @@ var pr_ship = OS.P.Add("Ship", {
});
pr_ship.Do = function () {
if (!guiControl.inventory.show) {
if (!guiControl.inventory.show && !guiControl.trade.show) {
if (ct_left().down) {
this.direction += 45;
} else if (ct_right().down) {

View File

@ -54,12 +54,14 @@ rm_Ocean.Do = function () {
this.waveTimer = Math.round(Math.randomRange(30, 150));
}
if (!guiControl.inventory.show && ct_cancel().down) {
guiControl.inventory.show = true;
}
if (!guiControl.inventory.show && ct_esc.down) {
OS.SetRoom(rm_Trade);
if (!guiControl.inventory.show && !guiControl.trade.show) {
if (ct_cancel().down) {
guiControl.inventory.show = true;
}
if (ct_esc.down) {
guiControl.trade.show = true;
G.player.speed = 0;
}
}
}
@ -73,6 +75,7 @@ rm_Ocean.DrawAbove = function () {
// drawPixelText("Testing 1 2 3!", 0, 0, 0, "white", 4);
// drawPixelText("Testing 1 2 3!", 0, 64, 0, "white", 6);
drawInventoryGUI();
drawTradeGUI();
}
rm_Ocean.DoLast = function () {