diff --git a/client/naturalCrit/encounter/monsterCard/monsterCard.less b/client/naturalCrit/encounter/monsterCard/monsterCard.less index 22e4356d0..4c0eb97cf 100644 --- a/client/naturalCrit/encounter/monsterCard/monsterCard.less +++ b/client/naturalCrit/encounter/monsterCard/monsterCard.less @@ -1,13 +1,5 @@ @marginSize : 10px; -.noselect(){ - -webkit-touch-callout : none; - -webkit-user-select : none; - -khtml-user-select : none; - -moz-user-select : none; - -ms-user-select : none; - user-select : none; -} .playerCard{ display : inline-block; box-sizing : border-box; diff --git a/client/naturalCrit/naturalCrit.less b/client/naturalCrit/naturalCrit.less index 94ccc122f..a39709234 100644 --- a/client/naturalCrit/naturalCrit.less +++ b/client/naturalCrit/naturalCrit.less @@ -24,4 +24,13 @@ body{ display: inline-block; vertical-align: top; } +} + +.noselect(){ + -webkit-touch-callout : none; + -webkit-user-select : none; + -khtml-user-select : none; + -moz-user-select : none; + -ms-user-select : none; + user-select : none; } \ No newline at end of file diff --git a/client/naturalCrit/sidebar/dmDice/dmDice.jsx b/client/naturalCrit/sidebar/dmDice/dmDice.jsx index f8f932091..6bc0fa61c 100644 --- a/client/naturalCrit/sidebar/dmDice/dmDice.jsx +++ b/client/naturalCrit/sidebar/dmDice/dmDice.jsx @@ -2,13 +2,55 @@ var React = require('react'); var _ = require('lodash'); var cx = require('classnames'); +var RollDice = require('naturalCrit/rollDice'); + var DmDice = React.createClass({ + getInitialState: function() { + return { + lastRoll:{ }, + diceNotation : { + a : "1d20", + b : "6d6 + 3", + c : "1d20 - 1" + } + + }; + }, + + roll : function(id){ + this.state.lastRoll[id] = RollDice(this.state.diceNotation[id]); + this.setState({ + lastRoll : this.state.lastRoll + }); + }, + handleChange : function(id, e){ + this.state.diceNotation[id] = e.target.value; + this.setState({ + diceNotation : this.state.diceNotation + }); + + e.stopPropagation(); + e.preventDefault(); + }, + + renderRolls : function(){ + var self = this; + return _.map(['a', 'b', 'c'], function(id){ + return
+ + + {self.state.lastRoll[id]} +
+ }) + }, + render : function(){ var self = this; return(
- DmDice Ready! +

DM Dice

+ {this.renderRolls()}
); } diff --git a/client/naturalCrit/sidebar/dmDice/dmDice.less b/client/naturalCrit/sidebar/dmDice/dmDice.less index 2c1685bf9..7499d23b6 100644 --- a/client/naturalCrit/sidebar/dmDice/dmDice.less +++ b/client/naturalCrit/sidebar/dmDice/dmDice.less @@ -1,3 +1,28 @@ .dmDice{ + .roll{ + cursor: pointer; + .noselect(); + input[type="text"]{ + margin-left: 10px; + margin-bottom: 6px; + margin-top: 6px; + width : 60px; + font-family: monospace; + padding : 5px; + } + i.fa-random{ + font-size: 0.8em; + margin: 0 10px; + } + span{ + font-weight: 800; + .fadeInLeft(); + } + + &:hover{ + background-color: fade(@red, 20%); + } + } + } \ No newline at end of file diff --git a/client/naturalCrit/sidebar/sidebar.jsx b/client/naturalCrit/sidebar/sidebar.jsx index 127b34414..ff0e68679 100644 --- a/client/naturalCrit/sidebar/sidebar.jsx +++ b/client/naturalCrit/sidebar/sidebar.jsx @@ -4,6 +4,13 @@ var cx = require('classnames'); var JSONFileEditor = require('naturalCrit/jsonFileEditor/jsonFileEditor.jsx'); + +var DMDice = require('./dmDice/dmDice.jsx'); + +var Encounters = require('./encounters/encounters.jsx'); + + + var Sidebar = React.createClass({ getDefaultProps: function() { @@ -101,17 +108,16 @@ var Sidebar = React.createClass({ + + +

Players