Skip to content

Commit 522fafd

Browse files
author
grimcoder
committed
updated react two dots
1 parent e3e4426 commit 522fafd

21 files changed

+20022
-27
lines changed

reactTwoDots/app/app.js

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7852,7 +7852,10 @@ var ReactDOMOption = {
78527852
}
78537853
});
78547854

7855-
nativeProps.children = content;
7855+
if (content) {
7856+
nativeProps.children = content;
7857+
}
7858+
78567859
return nativeProps;
78577860
}
78587861

@@ -14021,7 +14024,7 @@ module.exports = ReactUpdates;
1402114024

1402214025
'use strict';
1402314026

14024-
module.exports = '0.14.6';
14027+
module.exports = '0.14.7';
1402514028
},{}],87:[function(require,module,exports){
1402614029
/**
1402714030
* Copyright 2013-2015, Facebook, Inc.
@@ -15116,6 +15119,7 @@ var warning = require('fbjs/lib/warning');
1511615119
*/
1511715120
var EventInterface = {
1511815121
type: null,
15122+
target: null,
1511915123
// currentTarget is set when dispatching; no use in copying it here
1512015124
currentTarget: emptyFunction.thatReturnsNull,
1512115125
eventPhase: null,
@@ -15149,8 +15153,6 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEvent
1514915153
this.dispatchConfig = dispatchConfig;
1515015154
this.dispatchMarker = dispatchMarker;
1515115155
this.nativeEvent = nativeEvent;
15152-
this.target = nativeEventTarget;
15153-
this.currentTarget = nativeEventTarget;
1515415156

1515515157
var Interface = this.constructor.Interface;
1515615158
for (var propName in Interface) {
@@ -15161,7 +15163,11 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEvent
1516115163
if (normalize) {
1516215164
this[propName] = normalize(nativeEvent);
1516315165
} else {
15164-
this[propName] = nativeEvent[propName];
15166+
if (propName === 'target') {
15167+
this.target = nativeEventTarget;
15168+
} else {
15169+
this[propName] = nativeEvent[propName];
15170+
}
1516515171
}
1516615172
}
1516715173

@@ -19037,6 +19043,11 @@ var TwoDots;
1903719043
return colors[getRandomInt(0, colors.length)];
1903819044
};
1903919045
TwoDots.colors = ['red', 'yellow', 'brown', 'blue', 'green'];
19046+
TwoDots.colorsTable = { red: 'red', yellow: 'yellow', brown: 'orange', blue: '#4A90E2', green: 'green', grey: 'grey' };
19047+
function makeCopy(obj) {
19048+
return JSON.parse(JSON.stringify(obj));
19049+
}
19050+
TwoDots.makeCopy = makeCopy;
1904019051
function shuffleArray(array) {
1904119052
for (var i = array.length - 1; i > 0; i--) {
1904219053
var j = Math.floor(Math.random() * (i + 1));
@@ -19071,6 +19082,7 @@ var TwoDots;
1907119082
if (height === void 0) { height = 5; }
1907219083
this.width = width;
1907319084
this.height = height;
19085+
this.levelSolved = 0;
1907419086
this.Rules = new Rules();
1907519087
this.mode = 'board';
1907619088
this.Grid = [];
@@ -19109,9 +19121,6 @@ var Hello = React.createClass({displayName: "Hello",
1910919121
path: [],
1911019122
getInitialState: function () {
1911119123
return new TwoDotsState_1.TwoDots.TwoDotsState(Number(this.props.width), Number(this.props.height));
19112-
while (this.needsShuffling()) {
19113-
this.shuffleBoard();
19114-
}
1911519124
},
1911619125
needsShuffling: function () {
1911719126
var thisFlatArray = this.thisArray();
@@ -19346,6 +19355,7 @@ var LevelEditor = (function (_super) {
1934619355
LevelEditor.prototype.changedcolorRules = function () {
1934719356
var _this = this;
1934819357
var colorLimit = this.refs['colorRules'].value;
19358+
this.state.Rules.amountToCollect = {};
1934919359
TwoDotsState_1.TwoDots.colors.slice(0, Number(colorLimit)).map(function (color) {
1935019360
_this.state.Rules.amountToCollect[color] = 5;
1935119361
});
@@ -19450,6 +19460,7 @@ var __extends = (this && this.__extends) || function (d, b) {
1945019460
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1945119461
};
1945219462
var React = require('react');
19463+
var TwoDotsState_1 = require('./TwoDotsState');
1945319464
var ScoreTable = (function (_super) {
1945419465
__extends(ScoreTable, _super);
1945519466
function ScoreTable() {
@@ -19461,20 +19472,39 @@ var ScoreTable = (function (_super) {
1946119472
var turns = this.props.turns;
1946219473
var maxTurns = this.props.maxTurns;
1946319474
var cells = [];
19475+
var colors = [];
1946419476
Object.keys(rules.amountToCollect).map(function (key) {
1946519477
//var short = key + " short"
1946619478
var key2 = key + "value";
19467-
cells.push(React.createElement("td", {className: "short", key: key}, React.createElement("div", {className: key + ' cell'})));
19468-
cells.push(React.createElement("td", {className: 'short2 ' + (score[key] >= rules.amountToCollect[key] ? 'completedColor' : ''), key: key2}, score[key] + ' / ' + rules.amountToCollect[key]));
19479+
cells.push(React.createElement("td", {className: 'short2 ' + (score[key] >= rules.amountToCollect[key] ? 'completedColor' : ''), key: key2}, score[key] + ' / ' +
19480+
rules.amountToCollect[key]));
19481+
colors.push(React.createElement("td", {key: key},
19482+
React.createElement("svg", {height: "20", width: "20"},
19483+
React.createElement("circle", {cx: "10", cy: "10", r: "10", strokeWidth: "0", fill: TwoDotsState_1.TwoDots.colorsTable[key]})
19484+
)
19485+
));
1946919486
});
19470-
cells.push(React.createElement("td", {className: "short3", key: "turns"}, " ", 'Turns ' + turns + ' / ' + maxTurns, " "));
19471-
return (React.createElement("table", {className: "scoreTable"}, React.createElement("tbody", null, React.createElement("tr", null,
19472-
cells
19473-
))));
19487+
//cells.push(<td className="short3" key='turns'> {'Turns ' + turns + ' / ' + maxTurns} </td>)
19488+
return (React.createElement("div", {className: "score"},
19489+
19490+
19491+
React.createElement("table", null,
19492+
React.createElement("tbody", null,
19493+
React.createElement("tr", null,
19494+
cells
19495+
),
19496+
React.createElement("tr", null,
19497+
colors
19498+
19499+
)
19500+
)
19501+
)
19502+
19503+
));
1947419504
};
1947519505
return ScoreTable;
1947619506
})(React.Component);
1947719507
Object.defineProperty(exports, "__esModule", { value: true });
1947819508
exports.default = ScoreTable;
1947919509

19480-
},{"react":158}]},{},[160]);
19510+
},{"./TwoDotsState":159,"react":158}]},{},[160]);

0 commit comments

Comments
 (0)