parent
57a476113b
commit
dcf6d87886
|
@ -1375,7 +1375,7 @@ module.exports = Cancel;
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
__webpack_require__(13);
|
__webpack_require__(13);
|
||||||
module.exports = __webpack_require__(82);
|
module.exports = __webpack_require__(85);
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -1405,14 +1405,18 @@ window.Vue = __webpack_require__(38);
|
||||||
Vue.use(__WEBPACK_IMPORTED_MODULE_0_vue_router__["a" /* default */]);
|
Vue.use(__WEBPACK_IMPORTED_MODULE_0_vue_router__["a" /* default */]);
|
||||||
|
|
||||||
//Vue.use(VueSocketio, 'http://192.168.10.10:8080');
|
//Vue.use(VueSocketio, 'http://192.168.10.10:8080');
|
||||||
Vue.use(__WEBPACK_IMPORTED_MODULE_1_vue_socket_io___default.a, 'http://192.168.10.1:8080');
|
Vue.use(__WEBPACK_IMPORTED_MODULE_1_vue_socket_io___default.a, 'http://192.168.10.10:8080');
|
||||||
|
|
||||||
var user = Vue.component('user', __webpack_require__(43));
|
var user = Vue.component('user', __webpack_require__(43));
|
||||||
var login = Vue.component('login', __webpack_require__(59));
|
var login = Vue.component('login', __webpack_require__(59));
|
||||||
var singleplayer_game = Vue.component('singlegame', __webpack_require__(62));
|
// const logout = Vue.component('logout', require('./components/logout.vue'));
|
||||||
var multiplayerGame = Vue.component('multiplayergame', __webpack_require__(67));
|
var register = Vue.component('register', __webpack_require__(62));
|
||||||
|
var singleplayer_game = Vue.component('singlegame', __webpack_require__(65));
|
||||||
|
var multiplayerGame = Vue.component('multiplayergame', __webpack_require__(70));
|
||||||
|
|
||||||
var routes = [{ path: '/', redirect: '/users' }, { path: '/users', component: user }, { path: '/login', component: login }, { path: '/singletictactoe', component: singleplayer_game }, { path: '/multitictactoe', component: multiplayerGame }];
|
var routes = [{ path: '/', redirect: '/users' }, { path: '/users', component: user }, { path: '/login', component: login },
|
||||||
|
// { path: '/logout', component: logout },
|
||||||
|
{ path: '/register', component: register }, { path: '/singletictactoe', component: singleplayer_game }, { path: '/multitictactoe', component: multiplayerGame }];
|
||||||
|
|
||||||
var router = new __WEBPACK_IMPORTED_MODULE_0_vue_router__["a" /* default */]({
|
var router = new __WEBPACK_IMPORTED_MODULE_0_vue_router__["a" /* default */]({
|
||||||
routes: routes
|
routes: routes
|
||||||
|
@ -1420,10 +1424,7 @@ var router = new __WEBPACK_IMPORTED_MODULE_0_vue_router__["a" /* default */]({
|
||||||
|
|
||||||
var app = new Vue({
|
var app = new Vue({
|
||||||
router: router,
|
router: router,
|
||||||
data: {
|
data: {}
|
||||||
player1: undefined,
|
|
||||||
player2: undefined
|
|
||||||
}
|
|
||||||
}).$mount('#app');
|
}).$mount('#app');
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -45734,71 +45735,69 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* harmony default export */ __webpack_exports__["default"] = ({
|
/* harmony default export */ __webpack_exports__["default"] = ({
|
||||||
data: function data() {
|
data: function data() {
|
||||||
return {
|
return {
|
||||||
title: 'List Users',
|
title: 'List Users',
|
||||||
showSuccess: false,
|
showSuccess: false,
|
||||||
successMessage: '',
|
successMessage: '',
|
||||||
currentUser: null,
|
currentUser: null,
|
||||||
users: [],
|
users: []
|
||||||
departments: []
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
editUser: function editUser(user) {
|
|
||||||
this.currentUser = user;
|
|
||||||
this.showSuccess = false;
|
|
||||||
},
|
|
||||||
deleteUser: function deleteUser(user) {
|
|
||||||
var _this = this;
|
|
||||||
|
|
||||||
axios.delete('api/users/' + user.id).then(function (response) {
|
};
|
||||||
_this.showSuccess = true;
|
},
|
||||||
_this.successMessage = 'User Deleted';
|
methods: {
|
||||||
_this.getUsers();
|
editUser: function editUser(user) {
|
||||||
});
|
this.currentUser = user;
|
||||||
},
|
this.showSuccess = false;
|
||||||
savedUser: function savedUser() {
|
},
|
||||||
this.currentUser = null;
|
deleteUser: function deleteUser(user) {
|
||||||
this.$refs.usersListRef.editingUser = null;
|
var _this = this;
|
||||||
this.showSuccess = true;
|
|
||||||
this.successMessage = 'User Saved';
|
|
||||||
},
|
|
||||||
cancelEdit: function cancelEdit() {
|
|
||||||
this.currentUser = null;
|
|
||||||
this.$refs.usersListRef.editingUser = null;
|
|
||||||
this.showSuccess = false;
|
|
||||||
},
|
|
||||||
getUsers: function getUsers() {
|
|
||||||
var _this2 = this;
|
|
||||||
|
|
||||||
axios.get('api/users').then(function (response) {
|
axios.delete('api/users/' + user.id).then(function (response) {
|
||||||
_this2.users = response.data.data;
|
_this.showSuccess = true;
|
||||||
});
|
_this.successMessage = 'User Deleted';
|
||||||
},
|
_this.getUsers();
|
||||||
childMessage: function childMessage(message) {
|
});
|
||||||
this.showSuccess = true;
|
},
|
||||||
this.successMessage = message;
|
savedUser: function savedUser() {
|
||||||
}
|
this.currentUser = null;
|
||||||
},
|
this.$refs.usersListRef.editingUser = null;
|
||||||
components: {
|
this.showSuccess = true;
|
||||||
'user-list': __WEBPACK_IMPORTED_MODULE_0__userList_vue___default.a,
|
this.successMessage = 'User Saved';
|
||||||
'user-edit': __WEBPACK_IMPORTED_MODULE_1__userEdit_vue___default.a
|
},
|
||||||
},
|
cancelEdit: function cancelEdit() {
|
||||||
mounted: function mounted() {
|
this.currentUser = null;
|
||||||
var _this3 = this;
|
this.$refs.usersListRef.editingUser = null;
|
||||||
|
this.showSuccess = false;
|
||||||
|
},
|
||||||
|
getUsers: function getUsers() {
|
||||||
|
var _this2 = this;
|
||||||
|
|
||||||
this.getUsers();
|
/* buscar o user logado através do token guardado na LocalStorage */
|
||||||
if (this.$root.departments.length === 0) {
|
var auth_user_token = {
|
||||||
axios.get('api/departments').then(function (response) {
|
headers: {
|
||||||
_this3.$root.departments = response.data.data;
|
'Authorization': 'Bearer ' + localStorage.getItem("access_token")
|
||||||
_this3.departments = _this3.$root.departments;
|
}
|
||||||
});
|
};
|
||||||
} else {
|
axios.get('api/users', auth_user_token).then(function (response) {
|
||||||
this.departments = this.$root.departments;
|
_this2.users = response.data.data;
|
||||||
}
|
console.log(_this2.users);
|
||||||
}
|
});
|
||||||
|
},
|
||||||
|
childMessage: function childMessage(message) {
|
||||||
|
this.showSuccess = true;
|
||||||
|
this.successMessage = message;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'user-list': __WEBPACK_IMPORTED_MODULE_0__userList_vue___default.a,
|
||||||
|
'user-edit': __WEBPACK_IMPORTED_MODULE_1__userEdit_vue___default.a
|
||||||
|
},
|
||||||
|
mounted: function mounted() {
|
||||||
|
this.getUsers();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -46463,7 +46462,7 @@ var render = function() {
|
||||||
_vm._v(" "),
|
_vm._v(" "),
|
||||||
_vm.currentUser
|
_vm.currentUser
|
||||||
? _c("user-edit", {
|
? _c("user-edit", {
|
||||||
attrs: { user: _vm.currentUser, departments: _vm.departments },
|
attrs: { user: _vm.currentUser },
|
||||||
on: { "user-saved": _vm.savedUser, "user-canceled": _vm.cancelEdit }
|
on: { "user-saved": _vm.savedUser, "user-canceled": _vm.cancelEdit }
|
||||||
})
|
})
|
||||||
: _vm._e()
|
: _vm._e()
|
||||||
|
@ -46565,8 +46564,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||||
data: function data() {
|
data: function data() {
|
||||||
return {
|
return {
|
||||||
user: {
|
user: {
|
||||||
email: "",
|
email: '',
|
||||||
password: ""
|
password: ''
|
||||||
},
|
},
|
||||||
loginError: false
|
loginError: false
|
||||||
};
|
};
|
||||||
|
@ -46594,9 +46593,6 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||||
loginError = true;
|
loginError = true;
|
||||||
console.log(loginError);
|
console.log(loginError);
|
||||||
});
|
});
|
||||||
},
|
|
||||||
register: function register() {
|
|
||||||
this.$router.push('/register'); // vou chamar um component do appvue.vue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46610,99 +46606,110 @@ var render = function() {
|
||||||
var _vm = this
|
var _vm = this
|
||||||
var _h = _vm.$createElement
|
var _h = _vm.$createElement
|
||||||
var _c = _vm._self._c || _h
|
var _c = _vm._self._c || _h
|
||||||
return _c("form", { attrs: { action: "action_page.php" } }, [
|
return _c(
|
||||||
_c("div", { staticClass: "container" }, [
|
"form",
|
||||||
_c("div", { staticClass: "form-group" }, [
|
{
|
||||||
_c("label", [_vm._v("Email: ")]),
|
on: {
|
||||||
_vm._v(" "),
|
submit: function($event) {
|
||||||
_c("input", {
|
$event.preventDefault()
|
||||||
directives: [
|
_vm.login(_vm.user)
|
||||||
{
|
}
|
||||||
name: "model",
|
}
|
||||||
rawName: "v-model",
|
},
|
||||||
value: _vm.user.email,
|
[
|
||||||
expression: "user.email"
|
_c("div", { staticClass: "container" }, [
|
||||||
}
|
_c("div", { staticClass: "form-group" }, [
|
||||||
],
|
_c("label", [_vm._v("Email: ")]),
|
||||||
attrs: {
|
_vm._v(" "),
|
||||||
type: "text",
|
_c("input", {
|
||||||
placeholder: "Enter Your Email",
|
directives: [
|
||||||
id: "inputEmail",
|
{
|
||||||
name: "email",
|
name: "model",
|
||||||
required: ""
|
rawName: "v-model",
|
||||||
},
|
value: _vm.user.email,
|
||||||
domProps: { value: _vm.user.email },
|
expression: "user.email"
|
||||||
on: {
|
|
||||||
input: function($event) {
|
|
||||||
if ($event.target.composing) {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
_vm.$set(_vm.user, "email", $event.target.value)
|
],
|
||||||
}
|
attrs: {
|
||||||
}
|
type: "text",
|
||||||
})
|
placeholder: "Enter Your Email",
|
||||||
]),
|
id: "inputEmail",
|
||||||
_vm._v(" "),
|
name: "email",
|
||||||
_c("div", { staticClass: "form-group" }, [
|
required: ""
|
||||||
_c("label", [_vm._v("Password: ")]),
|
},
|
||||||
_vm._v(" "),
|
domProps: { value: _vm.user.email },
|
||||||
_c("input", {
|
on: {
|
||||||
directives: [
|
input: function($event) {
|
||||||
{
|
if ($event.target.composing) {
|
||||||
name: "model",
|
return
|
||||||
rawName: "v-model",
|
}
|
||||||
value: _vm.user.password,
|
_vm.$set(_vm.user, "email", $event.target.value)
|
||||||
expression: "user.password"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
attrs: {
|
|
||||||
type: "password",
|
|
||||||
placeholder: "Enter Your Password",
|
|
||||||
id: "inputPassword",
|
|
||||||
name: "password",
|
|
||||||
required: ""
|
|
||||||
},
|
|
||||||
domProps: { value: _vm.user.password },
|
|
||||||
on: {
|
|
||||||
input: function($event) {
|
|
||||||
if ($event.target.composing) {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
_vm.$set(_vm.user, "password", $event.target.value)
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
]),
|
||||||
]),
|
_vm._v(" "),
|
||||||
_vm._v(" "),
|
_c("div", { staticClass: "form-group" }, [
|
||||||
_c(
|
_c("label", [_vm._v("Password: ")]),
|
||||||
"button",
|
_vm._v(" "),
|
||||||
{
|
_c("input", {
|
||||||
attrs: { type: "submit" },
|
directives: [
|
||||||
on: {
|
{
|
||||||
"click()": function($event) {
|
name: "model",
|
||||||
$event.preventDefault()
|
rawName: "v-model",
|
||||||
_vm.login()
|
value: _vm.user.password,
|
||||||
|
expression: "user.password"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
attrs: {
|
||||||
|
type: "password",
|
||||||
|
placeholder: "Enter Your Password",
|
||||||
|
id: "inputPassword",
|
||||||
|
name: "password",
|
||||||
|
required: ""
|
||||||
|
},
|
||||||
|
domProps: { value: _vm.user.password },
|
||||||
|
on: {
|
||||||
|
input: function($event) {
|
||||||
|
if ($event.target.composing) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_vm.$set(_vm.user, "password", $event.target.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
},
|
]),
|
||||||
[_vm._v("Login")]
|
_vm._v(" "),
|
||||||
),
|
_c(
|
||||||
_vm._v(" "),
|
"button",
|
||||||
_c(
|
{
|
||||||
"button",
|
attrs: { type: "submit" },
|
||||||
{
|
on: {
|
||||||
attrs: { type: "submit" },
|
"click()": function($event) {
|
||||||
on: {
|
$event.preventDefault()
|
||||||
"click()": function($event) {
|
_vm.login()
|
||||||
$event.preventDefault()
|
}
|
||||||
_vm.register()
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
[_vm._v("Login")]
|
||||||
[_vm._v("Register")]
|
),
|
||||||
)
|
_vm._v(" "),
|
||||||
])
|
_c(
|
||||||
])
|
"button",
|
||||||
|
{
|
||||||
|
attrs: { type: "submit" },
|
||||||
|
on: {
|
||||||
|
"click()": function($event) {
|
||||||
|
$event.preventDefault()
|
||||||
|
_vm.register()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[_vm._v("Register")]
|
||||||
|
)
|
||||||
|
])
|
||||||
|
]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
var staticRenderFns = []
|
var staticRenderFns = []
|
||||||
render._withStripped = true
|
render._withStripped = true
|
||||||
|
@ -46718,16 +46725,314 @@ if (false) {
|
||||||
/* 62 */
|
/* 62 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
var disposed = false
|
||||||
|
var normalizeComponent = __webpack_require__(1)
|
||||||
|
/* script */
|
||||||
|
var __vue_script__ = __webpack_require__(63)
|
||||||
|
/* template */
|
||||||
|
var __vue_template__ = __webpack_require__(64)
|
||||||
|
/* template functional */
|
||||||
|
var __vue_template_functional__ = false
|
||||||
|
/* styles */
|
||||||
|
var __vue_styles__ = null
|
||||||
|
/* scopeId */
|
||||||
|
var __vue_scopeId__ = null
|
||||||
|
/* moduleIdentifier (server only) */
|
||||||
|
var __vue_module_identifier__ = null
|
||||||
|
var Component = normalizeComponent(
|
||||||
|
__vue_script__,
|
||||||
|
__vue_template__,
|
||||||
|
__vue_template_functional__,
|
||||||
|
__vue_styles__,
|
||||||
|
__vue_scopeId__,
|
||||||
|
__vue_module_identifier__
|
||||||
|
)
|
||||||
|
Component.options.__file = "resources/assets/js/components/register.vue"
|
||||||
|
if (Component.esModule && Object.keys(Component.esModule).some(function (key) { return key !== "default" && key.substr(0, 2) !== "__"})) { console.error("named exports are not supported in *.vue files.")}
|
||||||
|
|
||||||
|
|
||||||
|
/* hot reload */
|
||||||
|
if (false) {(function () {
|
||||||
|
var hotAPI = require("vue-hot-reload-api")
|
||||||
|
hotAPI.install(require("vue"), false)
|
||||||
|
if (!hotAPI.compatible) return
|
||||||
|
module.hot.accept()
|
||||||
|
if (!module.hot.data) {
|
||||||
|
hotAPI.createRecord("data-v-897e4240", Component.options)
|
||||||
|
} else {
|
||||||
|
hotAPI.reload("data-v-897e4240", Component.options)
|
||||||
|
' + ' }
|
||||||
|
module.hot.dispose(function (data) {
|
||||||
|
disposed = true
|
||||||
|
})
|
||||||
|
})()}
|
||||||
|
|
||||||
|
module.exports = Component.exports
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
/* 63 */
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/* harmony default export */ __webpack_exports__["default"] = ({
|
||||||
|
data: function data() {
|
||||||
|
return {
|
||||||
|
user: {
|
||||||
|
username: '',
|
||||||
|
email: '',
|
||||||
|
password: '',
|
||||||
|
name: ''
|
||||||
|
|
||||||
|
},
|
||||||
|
registerError: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
register: function register() {
|
||||||
|
axios.post('api/register', {
|
||||||
|
username: user.username,
|
||||||
|
email: user.email,
|
||||||
|
password: user.password,
|
||||||
|
name: user.name
|
||||||
|
}).then(function (response) {
|
||||||
|
// guarda logo o token do registado
|
||||||
|
localStorage.setItem('token', response.data.access_token);
|
||||||
|
}).catch(function (registerError) {
|
||||||
|
console.log(registerError);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
/* 64 */
|
||||||
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
var render = function() {
|
||||||
|
var _vm = this
|
||||||
|
var _h = _vm.$createElement
|
||||||
|
var _c = _vm._self._c || _h
|
||||||
|
return _c(
|
||||||
|
"form",
|
||||||
|
{
|
||||||
|
on: {
|
||||||
|
submit: function($event) {
|
||||||
|
$event.preventDefault()
|
||||||
|
_vm.register(_vm.user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[
|
||||||
|
_c("div", { staticClass: "control-group" }, [
|
||||||
|
_c(
|
||||||
|
"label",
|
||||||
|
{ staticClass: "control-label", attrs: { for: "username" } },
|
||||||
|
[_vm._v("Username")]
|
||||||
|
),
|
||||||
|
_vm._v(" "),
|
||||||
|
_c("div", { staticClass: "controls" }, [
|
||||||
|
_c("input", {
|
||||||
|
directives: [
|
||||||
|
{
|
||||||
|
name: "model",
|
||||||
|
rawName: "v-model",
|
||||||
|
value: _vm.user.username,
|
||||||
|
expression: "user.username"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
staticClass: "input-xlarge",
|
||||||
|
attrs: { type: "text", id: "username", name: "username" },
|
||||||
|
domProps: { value: _vm.user.username },
|
||||||
|
on: {
|
||||||
|
input: function($event) {
|
||||||
|
if ($event.target.composing) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_vm.$set(_vm.user, "username", $event.target.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
_vm._v(" "),
|
||||||
|
_c("div", { staticClass: "control-group" }, [
|
||||||
|
_c("label", { staticClass: "control-label", attrs: { for: "email" } }, [
|
||||||
|
_vm._v("E-mail")
|
||||||
|
]),
|
||||||
|
_vm._v(" "),
|
||||||
|
_c("div", { staticClass: "controls" }, [
|
||||||
|
_c("input", {
|
||||||
|
directives: [
|
||||||
|
{
|
||||||
|
name: "model",
|
||||||
|
rawName: "v-model",
|
||||||
|
value: _vm.user.email,
|
||||||
|
expression: "user.email"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
staticClass: "input-xlarge",
|
||||||
|
attrs: { type: "text", id: "email", name: "email" },
|
||||||
|
domProps: { value: _vm.user.email },
|
||||||
|
on: {
|
||||||
|
input: function($event) {
|
||||||
|
if ($event.target.composing) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_vm.$set(_vm.user, "email", $event.target.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
_vm._v(" "),
|
||||||
|
_c("div", { staticClass: "control-group" }, [
|
||||||
|
_c(
|
||||||
|
"label",
|
||||||
|
{ staticClass: "control-label", attrs: { for: "password" } },
|
||||||
|
[_vm._v("Password")]
|
||||||
|
),
|
||||||
|
_vm._v(" "),
|
||||||
|
_c("div", { staticClass: "controls" }, [
|
||||||
|
_c("input", {
|
||||||
|
directives: [
|
||||||
|
{
|
||||||
|
name: "model",
|
||||||
|
rawName: "v-model",
|
||||||
|
value: _vm.user.password,
|
||||||
|
expression: "user.password"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
staticClass: "input-xlarge",
|
||||||
|
attrs: { type: "password", id: "password", name: "password" },
|
||||||
|
domProps: { value: _vm.user.password },
|
||||||
|
on: {
|
||||||
|
input: function($event) {
|
||||||
|
if ($event.target.composing) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_vm.$set(_vm.user, "password", $event.target.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
_vm._v(" "),
|
||||||
|
_c("div", { staticClass: "control-group" }, [
|
||||||
|
_c("label", { staticClass: "control-label", attrs: { for: "name" } }, [
|
||||||
|
_vm._v(" Name ")
|
||||||
|
]),
|
||||||
|
_vm._v(" "),
|
||||||
|
_c("div", { staticClass: "controls" }, [
|
||||||
|
_c("input", {
|
||||||
|
directives: [
|
||||||
|
{
|
||||||
|
name: "model",
|
||||||
|
rawName: "v-model",
|
||||||
|
value: _vm.user.name,
|
||||||
|
expression: "user.name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
staticClass: "input-xlarge",
|
||||||
|
attrs: { type: "text", id: "name", name: "name" },
|
||||||
|
domProps: { value: _vm.user.name },
|
||||||
|
on: {
|
||||||
|
input: function($event) {
|
||||||
|
if ($event.target.composing) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_vm.$set(_vm.user, "name", $event.target.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
_vm._v(" "),
|
||||||
|
_vm._m(0)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
var staticRenderFns = [
|
||||||
|
function() {
|
||||||
|
var _vm = this
|
||||||
|
var _h = _vm.$createElement
|
||||||
|
var _c = _vm._self._c || _h
|
||||||
|
return _c("div", { staticClass: "control-group" }, [
|
||||||
|
_c("div", { staticClass: "controls" }, [
|
||||||
|
_c("button", { staticClass: "btn btn-success" }, [_vm._v("Register")])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
}
|
||||||
|
]
|
||||||
|
render._withStripped = true
|
||||||
|
module.exports = { render: render, staticRenderFns: staticRenderFns }
|
||||||
|
if (false) {
|
||||||
|
module.hot.accept()
|
||||||
|
if (module.hot.data) {
|
||||||
|
require("vue-hot-reload-api") .rerender("data-v-897e4240", module.exports)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
/* 65 */
|
||||||
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var disposed = false
|
var disposed = false
|
||||||
function injectStyle (ssrContext) {
|
function injectStyle (ssrContext) {
|
||||||
if (disposed) return
|
if (disposed) return
|
||||||
__webpack_require__(63)
|
__webpack_require__(66)
|
||||||
}
|
}
|
||||||
var normalizeComponent = __webpack_require__(1)
|
var normalizeComponent = __webpack_require__(1)
|
||||||
/* script */
|
/* script */
|
||||||
var __vue_script__ = __webpack_require__(65)
|
var __vue_script__ = __webpack_require__(68)
|
||||||
/* template */
|
/* template */
|
||||||
var __vue_template__ = __webpack_require__(66)
|
var __vue_template__ = __webpack_require__(69)
|
||||||
/* template functional */
|
/* template functional */
|
||||||
var __vue_template_functional__ = false
|
var __vue_template_functional__ = false
|
||||||
/* styles */
|
/* styles */
|
||||||
|
@ -46767,13 +47072,13 @@ module.exports = Component.exports
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 63 */
|
/* 66 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||||
|
|
||||||
// load the styles
|
// load the styles
|
||||||
var content = __webpack_require__(64);
|
var content = __webpack_require__(67);
|
||||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||||
if(content.locals) module.exports = content.locals;
|
if(content.locals) module.exports = content.locals;
|
||||||
// add the styles to the DOM
|
// add the styles to the DOM
|
||||||
|
@ -46793,7 +47098,7 @@ if(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 64 */
|
/* 67 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
exports = module.exports = __webpack_require__(2)(undefined);
|
exports = module.exports = __webpack_require__(2)(undefined);
|
||||||
|
@ -46807,7 +47112,7 @@ exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 65 */
|
/* 68 */
|
||||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -46942,7 +47247,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 66 */
|
/* 69 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var render = function() {
|
var render = function() {
|
||||||
|
@ -47035,19 +47340,19 @@ if (false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 67 */
|
/* 70 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var disposed = false
|
var disposed = false
|
||||||
function injectStyle (ssrContext) {
|
function injectStyle (ssrContext) {
|
||||||
if (disposed) return
|
if (disposed) return
|
||||||
__webpack_require__(68)
|
__webpack_require__(71)
|
||||||
}
|
}
|
||||||
var normalizeComponent = __webpack_require__(1)
|
var normalizeComponent = __webpack_require__(1)
|
||||||
/* script */
|
/* script */
|
||||||
var __vue_script__ = __webpack_require__(70)
|
var __vue_script__ = __webpack_require__(73)
|
||||||
/* template */
|
/* template */
|
||||||
var __vue_template__ = __webpack_require__(81)
|
var __vue_template__ = __webpack_require__(84)
|
||||||
/* template functional */
|
/* template functional */
|
||||||
var __vue_template_functional__ = false
|
var __vue_template_functional__ = false
|
||||||
/* styles */
|
/* styles */
|
||||||
|
@ -47087,13 +47392,13 @@ module.exports = Component.exports
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 68 */
|
/* 71 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||||
|
|
||||||
// load the styles
|
// load the styles
|
||||||
var content = __webpack_require__(69);
|
var content = __webpack_require__(72);
|
||||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||||
if(content.locals) module.exports = content.locals;
|
if(content.locals) module.exports = content.locals;
|
||||||
// add the styles to the DOM
|
// add the styles to the DOM
|
||||||
|
@ -47113,7 +47418,7 @@ if(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 69 */
|
/* 72 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
exports = module.exports = __webpack_require__(2)(undefined);
|
exports = module.exports = __webpack_require__(2)(undefined);
|
||||||
|
@ -47127,14 +47432,14 @@ exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 70 */
|
/* 73 */
|
||||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__lobby_vue__ = __webpack_require__(71);
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__lobby_vue__ = __webpack_require__(74);
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__lobby_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__lobby_vue__);
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__lobby_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__lobby_vue__);
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__game_tictactoe_vue__ = __webpack_require__(76);
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__game_tictactoe_vue__ = __webpack_require__(79);
|
||||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__game_tictactoe_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__game_tictactoe_vue__);
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__game_tictactoe_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__game_tictactoe_vue__);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -47300,19 +47605,19 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 71 */
|
/* 74 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var disposed = false
|
var disposed = false
|
||||||
function injectStyle (ssrContext) {
|
function injectStyle (ssrContext) {
|
||||||
if (disposed) return
|
if (disposed) return
|
||||||
__webpack_require__(72)
|
__webpack_require__(75)
|
||||||
}
|
}
|
||||||
var normalizeComponent = __webpack_require__(1)
|
var normalizeComponent = __webpack_require__(1)
|
||||||
/* script */
|
/* script */
|
||||||
var __vue_script__ = __webpack_require__(74)
|
var __vue_script__ = __webpack_require__(77)
|
||||||
/* template */
|
/* template */
|
||||||
var __vue_template__ = __webpack_require__(75)
|
var __vue_template__ = __webpack_require__(78)
|
||||||
/* template functional */
|
/* template functional */
|
||||||
var __vue_template_functional__ = false
|
var __vue_template_functional__ = false
|
||||||
/* styles */
|
/* styles */
|
||||||
|
@ -47352,13 +47657,13 @@ module.exports = Component.exports
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 72 */
|
/* 75 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||||
|
|
||||||
// load the styles
|
// load the styles
|
||||||
var content = __webpack_require__(73);
|
var content = __webpack_require__(76);
|
||||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||||
if(content.locals) module.exports = content.locals;
|
if(content.locals) module.exports = content.locals;
|
||||||
// add the styles to the DOM
|
// add the styles to the DOM
|
||||||
|
@ -47378,7 +47683,7 @@ if(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 73 */
|
/* 76 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
exports = module.exports = __webpack_require__(2)(undefined);
|
exports = module.exports = __webpack_require__(2)(undefined);
|
||||||
|
@ -47392,7 +47697,7 @@ exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 74 */
|
/* 77 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -47428,7 +47733,7 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 75 */
|
/* 78 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var render = function() {
|
var render = function() {
|
||||||
|
@ -47492,19 +47797,19 @@ if (false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 76 */
|
/* 79 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var disposed = false
|
var disposed = false
|
||||||
function injectStyle (ssrContext) {
|
function injectStyle (ssrContext) {
|
||||||
if (disposed) return
|
if (disposed) return
|
||||||
__webpack_require__(77)
|
__webpack_require__(80)
|
||||||
}
|
}
|
||||||
var normalizeComponent = __webpack_require__(1)
|
var normalizeComponent = __webpack_require__(1)
|
||||||
/* script */
|
/* script */
|
||||||
var __vue_script__ = __webpack_require__(79)
|
var __vue_script__ = __webpack_require__(82)
|
||||||
/* template */
|
/* template */
|
||||||
var __vue_template__ = __webpack_require__(80)
|
var __vue_template__ = __webpack_require__(83)
|
||||||
/* template functional */
|
/* template functional */
|
||||||
var __vue_template_functional__ = false
|
var __vue_template_functional__ = false
|
||||||
/* styles */
|
/* styles */
|
||||||
|
@ -47544,13 +47849,13 @@ module.exports = Component.exports
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 77 */
|
/* 80 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||||
|
|
||||||
// load the styles
|
// load the styles
|
||||||
var content = __webpack_require__(78);
|
var content = __webpack_require__(81);
|
||||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||||
if(content.locals) module.exports = content.locals;
|
if(content.locals) module.exports = content.locals;
|
||||||
// add the styles to the DOM
|
// add the styles to the DOM
|
||||||
|
@ -47570,7 +47875,7 @@ if(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 78 */
|
/* 81 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
exports = module.exports = __webpack_require__(2)(undefined);
|
exports = module.exports = __webpack_require__(2)(undefined);
|
||||||
|
@ -47584,7 +47889,7 @@ exports.push([module.i, "\n.gameseparator[data-v-3d129664]{\n border-style: s
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 79 */
|
/* 82 */
|
||||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -47696,7 +48001,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 80 */
|
/* 83 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var render = function() {
|
var render = function() {
|
||||||
|
@ -47771,7 +48076,7 @@ if (false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 81 */
|
/* 84 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var render = function() {
|
var render = function() {
|
||||||
|
@ -47893,7 +48198,7 @@ if (false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 82 */
|
/* 85 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
// removed by extract-text-webpack-plugin
|
// removed by extract-text-webpack-plugin
|
||||||
|
|
|
@ -16,11 +16,11 @@ import VueSocketio from 'vue-socket.io';
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
//Vue.use(VueSocketio, 'http://192.168.10.10:8080');
|
//Vue.use(VueSocketio, 'http://192.168.10.10:8080');
|
||||||
Vue.use(VueSocketio, 'http://192.168.10.1:8080');
|
Vue.use(VueSocketio, 'http://192.168.10.10:8080');
|
||||||
|
|
||||||
const user = Vue.component('user', require('./components/user.vue'));
|
const user = Vue.component('user', require('./components/user.vue'));
|
||||||
const login = Vue.component('login', require('./components/login.vue'));
|
const login = Vue.component('login', require('./components/login.vue'));
|
||||||
const logout = Vue.component('logout', require('./components/logout.vue'));
|
// const logout = Vue.component('logout', require('./components/logout.vue'));
|
||||||
const register = Vue.component('register', require('./components/register.vue'));
|
const register = Vue.component('register', require('./components/register.vue'));
|
||||||
const singleplayer_game = Vue.component('singlegame', require('./components/singleplayer_tictactoe.vue'));
|
const singleplayer_game = Vue.component('singlegame', require('./components/singleplayer_tictactoe.vue'));
|
||||||
const multiplayerGame = Vue.component('multiplayergame', require('./components/multiplayer_tictactoe.vue'));
|
const multiplayerGame = Vue.component('multiplayergame', require('./components/multiplayer_tictactoe.vue'));
|
||||||
|
@ -29,7 +29,7 @@ const routes = [
|
||||||
{ path: '/', redirect: '/users' },
|
{ path: '/', redirect: '/users' },
|
||||||
{ path: '/users', component: user },
|
{ path: '/users', component: user },
|
||||||
{ path: '/login', component: login },
|
{ path: '/login', component: login },
|
||||||
{ path: '/logout', component: logout },
|
// { path: '/logout', component: logout },
|
||||||
{ path: '/register', component: register },
|
{ path: '/register', component: register },
|
||||||
{ path: '/singletictactoe', component: singleplayer_game },
|
{ path: '/singletictactoe', component: singleplayer_game },
|
||||||
{ path: '/multitictactoe', component: multiplayerGame }
|
{ path: '/multitictactoe', component: multiplayerGame }
|
||||||
|
|
|
@ -20,7 +20,8 @@ class MemoryGame {
|
||||||
this.piece2x=null;
|
this.piece2x=null;
|
||||||
this.piece1y=null;
|
this.piece1y=null;
|
||||||
this.piece2y=null;
|
this.piece2y=null;
|
||||||
|
this.pontuacao = 0;
|
||||||
|
this.winnerMessage = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
join(socketId){ // chamar pelo socket id do user
|
join(socketId){ // chamar pelo socket id do user
|
||||||
|
@ -34,51 +35,86 @@ class MemoryGame {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkGameEnded(){
|
checkGameEnded(){
|
||||||
if (this.hasRow(1)) {
|
//1 Board complete ??
|
||||||
this.winner = 1;
|
|
||||||
this.gameEnded = true;
|
if (this.isBoardComplete()) {
|
||||||
return true;
|
//
|
||||||
} else if (this.hasRow(2)) {
|
// for(let i=0; i<this.numPlayers; i++){
|
||||||
this.winner = 2;
|
// this.playerScore[i] = 0; //inicializa a pontuaçao do player a 0
|
||||||
this.gameEnded = true;
|
// this.calculateScore(i); //calcula o score do player
|
||||||
return true;
|
// }
|
||||||
} else if (this.isBoardComplete()) {
|
|
||||||
this.winner = 0;
|
|
||||||
this.gameEnded = true;
|
// buscar o player com maior pontuação
|
||||||
return true;
|
for(let a = 0; a < this.players.lenght; a++) {
|
||||||
|
if (this.playerScore[a] > this.pontuacao) {
|
||||||
|
this.pontuacao = this.playerScore[a];
|
||||||
|
this.winner = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// mostrá-lo
|
||||||
|
console.log('player' + this.players[this.winner]);
|
||||||
|
console.log('position ' + this.winner);
|
||||||
|
console.log('pontuacao: ' + this.pontuacao);
|
||||||
|
this.winnerMessage = this.players[this.winner] + ' won the game with ' + this.pontuacao + ' pontos.';
|
||||||
|
console.log('winnerMessage: ' + this.winnerMessage);
|
||||||
|
|
||||||
|
this.gameEnded = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//ou se empataram
|
||||||
|
|
||||||
|
//se nao estiver complete return false
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isBoardComplete(){
|
isBoardComplete(){
|
||||||
for (let value of this.board) {
|
|
||||||
if (value === 0) {
|
for(let x=0; x<this.line; x++){
|
||||||
return false;
|
for(let y=0; y<this.column; y++){
|
||||||
|
if (this.boardHidden[x][y] == "hidden") { //se houver alguma img hidden em x e/ou y entao a board nao esta completa logo nao acabou o Jogo
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
calculatePlayerScore(player){
|
||||||
|
|
||||||
|
//calcula o score com base na posiçao x e y que carregou
|
||||||
|
for(let x=0; x<this.line; x++){
|
||||||
|
for(let y=0; y<this.column; y++){
|
||||||
|
if (this.boardImages[x][y] == player){
|
||||||
|
this.playerScore[player]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
play(playerNumber, index){
|
play(playerNumber, index){
|
||||||
if (!this.gameStarted) {
|
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
shuffleArray(array){
|
||||||
|
let arraySize = array.length;
|
||||||
|
while(arraySize > 0){
|
||||||
|
let index = Math.floor(Math.random()* arraySize);
|
||||||
|
arraySize --;
|
||||||
|
let temp = array[arraySize];
|
||||||
|
array[arraySize] = array[index];
|
||||||
|
array[index] = temp;
|
||||||
}
|
}
|
||||||
if (this.gameEnded) {
|
return array;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (playerNumber != this.playerTurn) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.board[index] !== 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.board[index] = playerNumber;
|
|
||||||
if (!this.checkGameEnded()) {
|
|
||||||
this.playerTurn = this.playerTurn == 1 ? 2 : 1;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = TicTacToeGame;
|
module.exports = MemoryGame;
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
0 info it worked if it ends with ok
|
||||||
|
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'watch', '--poll' ]
|
||||||
|
2 info using npm@3.10.10
|
||||||
|
3 info using node@v6.11.3
|
||||||
|
4 verbose config Skipping project config: /home/vagrant/.npmrc. (matches userconfig)
|
||||||
|
5 verbose stack Error: ENOENT: no such file or directory, open '/home/vagrant/package.json'
|
||||||
|
5 verbose stack at Error (native)
|
||||||
|
6 verbose cwd /home/vagrant/projeto
|
||||||
|
7 error Linux 4.4.0-92-generic
|
||||||
|
8 error argv "/usr/bin/node" "/usr/bin/npm" "run" "watch" "--poll"
|
||||||
|
9 error node v6.11.3
|
||||||
|
10 error npm v3.10.10
|
||||||
|
11 error path /home/vagrant/package.json
|
||||||
|
12 error code ENOENT
|
||||||
|
13 error errno -2
|
||||||
|
14 error syscall open
|
||||||
|
15 error enoent ENOENT: no such file or directory, open '/home/vagrant/package.json'
|
||||||
|
16 error enoent ENOENT: no such file or directory, open '/home/vagrant/package.json'
|
||||||
|
16 error enoent This is most likely not a problem with npm itself
|
||||||
|
16 error enoent and is related to npm not being able to find a file.
|
||||||
|
17 verbose exit [ -2, true ]
|
Loading…
Reference in New Issue