From c835fadbc9b36411bd379cb411011ab140eefc66 Mon Sep 17 00:00:00 2001 From: Iain C Docherty Date: Mon, 25 Apr 2016 13:04:56 -0400 Subject: [PATCH] Added planet details to starmap --- app/js/components/window/planetPanel.jsx | 2 +- app/js/components/window/planetPanel/line.jsx | 39 +++++++++++++++++++ .../window/planetPanel/planetDetails.jsx | 30 +++++++++----- .../window/planetPanel/planetDetailsTab.jsx | 8 ++-- .../window/planetPanel/planetOre.jsx | 23 +++++++---- .../window/shipyard/buildFleet/item.jsx | 5 ++- .../window/shipyard/buildQueue/item.jsx | 5 ++- app/js/constants.js | 23 +++++++++++ 8 files changed, 109 insertions(+), 26 deletions(-) create mode 100644 app/js/components/window/planetPanel/line.jsx diff --git a/app/js/components/window/planetPanel.jsx b/app/js/components/window/planetPanel.jsx index 3eb5597b..b886d01f 100644 --- a/app/js/components/window/planetPanel.jsx +++ b/app/js/components/window/planetPanel.jsx @@ -19,7 +19,7 @@ var PlanetPanel = React.createClass({ options : { title : 'Planet Details', width : 700, - height : 420 + height : 450 } }, mixins : [ diff --git a/app/js/components/window/planetPanel/line.jsx b/app/js/components/window/planetPanel/line.jsx new file mode 100644 index 00000000..55e5c401 --- /dev/null +++ b/app/js/components/window/planetPanel/line.jsx @@ -0,0 +1,39 @@ +'use strict'; + +var React = require('react'); +var Reflux = require('reflux'); +var _ = require('lodash'); + +var BodyRPCGetBodyStatusStore = require('js/stores/rpc/body/getBodyStatus'); + +var PlanetPanelLine = require('js/components/window/planetPanel/line'); + +var util = require('js/util'); +var constants = require('js/constants'); +var vex = require('js/vex'); + +var PlanetDetails = React.createClass({ + + mixins : [ + Reflux.connect(BodyRPCGetBodyStatusStore, 'bodyRPCGetBodyStatusStore') + ], + + render : function() { + var bodyStatus = this.state.bodyRPCGetBodyStatusStore; + + return ( +
+ {this.props.title}: + + {this.props.value} + +
+ ); + } +}); + +module.exports = PlanetDetails; diff --git a/app/js/components/window/planetPanel/planetDetails.jsx b/app/js/components/window/planetPanel/planetDetails.jsx index 99da795c..f581dcee 100644 --- a/app/js/components/window/planetPanel/planetDetails.jsx +++ b/app/js/components/window/planetPanel/planetDetails.jsx @@ -4,29 +4,39 @@ var React = require('react'); var Reflux = require('reflux'); var _ = require('lodash'); -var BodyRPCStore = require('js/stores/rpc/body'); -var GenericBuildingRPCActions = require('js/actions/rpc/genericBuilding'); +var BodyRPCGetBodyStatusStore = require('js/stores/rpc/body/getBodyStatus'); -var ActionButton = require('js/components/window/building/actionButton'); -var ResourceProduction = require('js/components/window/building/resourceProduction'); -var ResourceCost = require('js/components/window/building/resourceCost'); -var ResourceLine = require('js/components/window/building/resourceLine'); +var PlanetPanelLine = require('js/components/window/planetPanel/line'); var util = require('js/util'); +var constants = require('js/constants'); var vex = require('js/vex'); var PlanetDetails = React.createClass({ mixins : [ - Reflux.connect(BodyRPCStore, 'bodyRPCStore'), + Reflux.connect(BodyRPCGetBodyStatusStore, 'bodyRPCGetBodyStatusStore') ], render : function() { - + var bodyStatus = this.state.bodyRPCGetBodyStatusStore; + var location = bodyStatus.x+"x : "+bodyStatus.y+"y"; return (
-
- To Be Defined +
+ +
+
+ + + + + + + + + +
); diff --git a/app/js/components/window/planetPanel/planetDetailsTab.jsx b/app/js/components/window/planetPanel/planetDetailsTab.jsx index 4835c1fa..def28d26 100644 --- a/app/js/components/window/planetPanel/planetDetailsTab.jsx +++ b/app/js/components/window/planetPanel/planetDetailsTab.jsx @@ -25,7 +25,7 @@ var PlanetDetailsTab = React.createClass({
-
+
-
+
-
+
-
+
diff --git a/app/js/components/window/planetPanel/planetOre.jsx b/app/js/components/window/planetPanel/planetOre.jsx index b29d80f5..c3a9178b 100644 --- a/app/js/components/window/planetPanel/planetOre.jsx +++ b/app/js/components/window/planetPanel/planetOre.jsx @@ -5,28 +5,37 @@ var Reflux = require('reflux'); var _ = require('lodash'); var BodyRPCStore = require('js/stores/rpc/body'); +var BodyRPCGetBodyStatusStore = require('js/stores/rpc/body/getBodyStatus'); + var GenericBuildingRPCActions = require('js/actions/rpc/genericBuilding'); -var ActionButton = require('js/components/window/building/actionButton'); -var ResourceProduction = require('js/components/window/building/resourceProduction'); -var ResourceCost = require('js/components/window/building/resourceCost'); -var ResourceLine = require('js/components/window/building/resourceLine'); +var PlanetDetailLine = require('js/components/window/planetPanel/line'); var util = require('js/util'); var vex = require('js/vex'); +var constants = require('js/constants'); var PlanetOre = React.createClass({ mixins : [ - Reflux.connect(BodyRPCStore, 'bodyRPCStore'), + Reflux.connect(BodyRPCGetBodyStatusStore, 'bodyRPCGetBodyStatusStore') ], render : function() { + var ores = constants.ORES; + var bodyOre = this.state.bodyRPCGetBodyStatusStore.ore; + + var renderOres = []; + for (var prop in ores) { + if (ores.hasOwnProperty(prop)) { + renderOres.push( ); + } + } return (
-
- ORE To Be Defined +
+ {renderOres}
); diff --git a/app/js/components/window/shipyard/buildFleet/item.jsx b/app/js/components/window/shipyard/buildFleet/item.jsx index a66a2d23..5e7f9bad 100644 --- a/app/js/components/window/shipyard/buildFleet/item.jsx +++ b/app/js/components/window/shipyard/buildFleet/item.jsx @@ -8,6 +8,7 @@ var ResourceAttribute = require('js/components/window/shipyard/resourceAtt var BuildButton = require('js/components/window/shipyard/buildFleet/button'); var util = require('js/util'); +var constants = require('js/constants'); var BuildFleetItem = React.createClass({ @@ -25,10 +26,10 @@ var BuildFleetItem = React.createClass({ var starfieldStyle = { width: 100, height: 100, - background: "transparent url(//d16cbq0l6kkf21.cloudfront.net/assets/star_system/field.png) no-repeat center", + background: "transparent url("+constants.ASSETS_URL+"star_system/field.png) no-repeat center", }; var obj = this.props.obj - var shipImage = "//d16cbq0l6kkf21.cloudfront.net/assets/ships/"+this.props.fleetType+".png"; + var shipImage = constants.ASSETS_URL+"ships/"+this.props.fleetType+".png"; var reason = ''; var canBuild = 1; if (obj.reason) { diff --git a/app/js/components/window/shipyard/buildQueue/item.jsx b/app/js/components/window/shipyard/buildQueue/item.jsx index ec638fb7..4842563f 100644 --- a/app/js/components/window/shipyard/buildQueue/item.jsx +++ b/app/js/components/window/shipyard/buildQueue/item.jsx @@ -9,6 +9,7 @@ var SubsidizeButton = require('js/components/window/shipyard/buildQueue/ var CountdownTimer = require('js/components/countdownTimer'); var util = require('js/util'); +var constants = require('js/constants'); var BuildQueueItem = React.createClass({ @@ -21,10 +22,10 @@ var BuildQueueItem = React.createClass({ var starfieldStyle = { width: 100, height: 100, - background: "transparent url(//d16cbq0l6kkf21.cloudfront.net/assets/star_system/field.png) no-repeat center", + background: "transparent url("+constants.ASSETS_URL+"star_system/field.png) no-repeat center", }; var obj = this.props.obj - var shipImage = "//d16cbq0l6kkf21.cloudfront.net/assets/ships/"+this.props.obj.type+".png"; + var shipImage = constants.ASSETS_URL+"ships/"+this.props.obj.type+".png"; return (
diff --git a/app/js/constants.js b/app/js/constants.js index a69fd55e..eae269b5 100644 --- a/app/js/constants.js +++ b/app/js/constants.js @@ -1,3 +1,26 @@ 'use strict'; module.exports.ASSETS_URL = window.lacuna_s3_base_url + 'assets/'; + +module.exports.ORES = { + anthracite : 'Anthracite', + bauxite : 'Bauxite', + beryl : 'Beryl', + chromite : 'Chromite', + chalcopyrite : 'Chalcopyrite', + fluorite : 'Fluorite', + galena : 'Galena', + goethite : 'Goethite', + gold : 'Gold', + gypsum : 'Gypsum', + halite : 'Halite', + kerogen : 'Kerogen', + magnetite : 'Magnetite', + methane : 'Methane', + monazite : 'Monazite', + rutile : 'Rutile', + sulfur : 'Sulfur', + trona : 'Trona', + uraninite : 'Uraninite', + zircon : 'Zircon' +};