startgamemodel
version1 the logic is growing up
This commit is contained in:
parent
57a476113b
commit
dcf6d87886
441
laravel_server/public/js/vueapp.js
vendored
441
laravel_server/public/js/vueapp.js
vendored
@ -1375,7 +1375,7 @@ module.exports = Cancel;
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
__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(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 login = Vue.component('login', __webpack_require__(59));
|
||||
var singleplayer_game = Vue.component('singlegame', __webpack_require__(62));
|
||||
var multiplayerGame = Vue.component('multiplayergame', __webpack_require__(67));
|
||||
// const logout = Vue.component('logout', require('./components/logout.vue'));
|
||||
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 */]({
|
||||
routes: routes
|
||||
@ -1420,10 +1424,7 @@ var router = new __WEBPACK_IMPORTED_MODULE_0_vue_router__["a" /* default */]({
|
||||
|
||||
var app = new Vue({
|
||||
router: router,
|
||||
data: {
|
||||
player1: undefined,
|
||||
player2: undefined
|
||||
}
|
||||
data: {}
|
||||
}).$mount('#app');
|
||||
|
||||
/***/ }),
|
||||
@ -45734,6 +45735,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
|
||||
|
||||
|
||||
|
||||
/* harmony default export */ __webpack_exports__["default"] = ({
|
||||
data: function data() {
|
||||
return {
|
||||
@ -45741,8 +45743,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
showSuccess: false,
|
||||
successMessage: '',
|
||||
currentUser: null,
|
||||
users: [],
|
||||
departments: []
|
||||
users: []
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -45773,8 +45775,15 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
getUsers: function getUsers() {
|
||||
var _this2 = this;
|
||||
|
||||
axios.get('api/users').then(function (response) {
|
||||
/* buscar o user logado através do token guardado na LocalStorage */
|
||||
var auth_user_token = {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + localStorage.getItem("access_token")
|
||||
}
|
||||
};
|
||||
axios.get('api/users', auth_user_token).then(function (response) {
|
||||
_this2.users = response.data.data;
|
||||
console.log(_this2.users);
|
||||
});
|
||||
},
|
||||
childMessage: function childMessage(message) {
|
||||
@ -45787,17 +45796,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
'user-edit': __WEBPACK_IMPORTED_MODULE_1__userEdit_vue___default.a
|
||||
},
|
||||
mounted: function mounted() {
|
||||
var _this3 = this;
|
||||
|
||||
this.getUsers();
|
||||
if (this.$root.departments.length === 0) {
|
||||
axios.get('api/departments').then(function (response) {
|
||||
_this3.$root.departments = response.data.data;
|
||||
_this3.departments = _this3.$root.departments;
|
||||
});
|
||||
} else {
|
||||
this.departments = this.$root.departments;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -46463,7 +46462,7 @@ var render = function() {
|
||||
_vm._v(" "),
|
||||
_vm.currentUser
|
||||
? _c("user-edit", {
|
||||
attrs: { user: _vm.currentUser, departments: _vm.departments },
|
||||
attrs: { user: _vm.currentUser },
|
||||
on: { "user-saved": _vm.savedUser, "user-canceled": _vm.cancelEdit }
|
||||
})
|
||||
: _vm._e()
|
||||
@ -46565,8 +46564,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
data: function data() {
|
||||
return {
|
||||
user: {
|
||||
email: "",
|
||||
password: ""
|
||||
email: '',
|
||||
password: ''
|
||||
},
|
||||
loginError: false
|
||||
};
|
||||
@ -46594,9 +46593,6 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
loginError = true;
|
||||
console.log(loginError);
|
||||
});
|
||||
},
|
||||
register: function register() {
|
||||
this.$router.push('/register'); // vou chamar um component do appvue.vue
|
||||
}
|
||||
}
|
||||
|
||||
@ -46610,7 +46606,17 @@ var render = function() {
|
||||
var _vm = this
|
||||
var _h = _vm.$createElement
|
||||
var _c = _vm._self._c || _h
|
||||
return _c("form", { attrs: { action: "action_page.php" } }, [
|
||||
return _c(
|
||||
"form",
|
||||
{
|
||||
on: {
|
||||
submit: function($event) {
|
||||
$event.preventDefault()
|
||||
_vm.login(_vm.user)
|
||||
}
|
||||
}
|
||||
},
|
||||
[
|
||||
_c("div", { staticClass: "container" }, [
|
||||
_c("div", { staticClass: "form-group" }, [
|
||||
_c("label", [_vm._v("Email: ")]),
|
||||
@ -46702,7 +46708,8 @@ var render = function() {
|
||||
[_vm._v("Register")]
|
||||
)
|
||||
])
|
||||
])
|
||||
]
|
||||
)
|
||||
}
|
||||
var staticRenderFns = []
|
||||
render._withStripped = true
|
||||
@ -46718,16 +46725,314 @@ if (false) {
|
||||
/* 62 */
|
||||
/***/ (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
|
||||
function injectStyle (ssrContext) {
|
||||
if (disposed) return
|
||||
__webpack_require__(63)
|
||||
__webpack_require__(66)
|
||||
}
|
||||
var normalizeComponent = __webpack_require__(1)
|
||||
/* script */
|
||||
var __vue_script__ = __webpack_require__(65)
|
||||
var __vue_script__ = __webpack_require__(68)
|
||||
/* template */
|
||||
var __vue_template__ = __webpack_require__(66)
|
||||
var __vue_template__ = __webpack_require__(69)
|
||||
/* template functional */
|
||||
var __vue_template_functional__ = false
|
||||
/* styles */
|
||||
@ -46767,13 +47072,13 @@ module.exports = Component.exports
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 63 */
|
||||
/* 66 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||
|
||||
// load the styles
|
||||
var content = __webpack_require__(64);
|
||||
var content = __webpack_require__(67);
|
||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||
if(content.locals) module.exports = content.locals;
|
||||
// add the styles to the DOM
|
||||
@ -46793,7 +47098,7 @@ if(false) {
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 64 */
|
||||
/* 67 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
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__) {
|
||||
|
||||
"use strict";
|
||||
@ -46942,7 +47247,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 66 */
|
||||
/* 69 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var render = function() {
|
||||
@ -47035,19 +47340,19 @@ if (false) {
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 67 */
|
||||
/* 70 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var disposed = false
|
||||
function injectStyle (ssrContext) {
|
||||
if (disposed) return
|
||||
__webpack_require__(68)
|
||||
__webpack_require__(71)
|
||||
}
|
||||
var normalizeComponent = __webpack_require__(1)
|
||||
/* script */
|
||||
var __vue_script__ = __webpack_require__(70)
|
||||
var __vue_script__ = __webpack_require__(73)
|
||||
/* template */
|
||||
var __vue_template__ = __webpack_require__(81)
|
||||
var __vue_template__ = __webpack_require__(84)
|
||||
/* template functional */
|
||||
var __vue_template_functional__ = false
|
||||
/* styles */
|
||||
@ -47087,13 +47392,13 @@ module.exports = Component.exports
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 68 */
|
||||
/* 71 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||
|
||||
// load the styles
|
||||
var content = __webpack_require__(69);
|
||||
var content = __webpack_require__(72);
|
||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||
if(content.locals) module.exports = content.locals;
|
||||
// add the styles to the DOM
|
||||
@ -47113,7 +47418,7 @@ if(false) {
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 69 */
|
||||
/* 72 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
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__) {
|
||||
|
||||
"use strict";
|
||||
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_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__);
|
||||
//
|
||||
//
|
||||
@ -47300,19 +47605,19 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 71 */
|
||||
/* 74 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var disposed = false
|
||||
function injectStyle (ssrContext) {
|
||||
if (disposed) return
|
||||
__webpack_require__(72)
|
||||
__webpack_require__(75)
|
||||
}
|
||||
var normalizeComponent = __webpack_require__(1)
|
||||
/* script */
|
||||
var __vue_script__ = __webpack_require__(74)
|
||||
var __vue_script__ = __webpack_require__(77)
|
||||
/* template */
|
||||
var __vue_template__ = __webpack_require__(75)
|
||||
var __vue_template__ = __webpack_require__(78)
|
||||
/* template functional */
|
||||
var __vue_template_functional__ = false
|
||||
/* styles */
|
||||
@ -47352,13 +47657,13 @@ module.exports = Component.exports
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 72 */
|
||||
/* 75 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||
|
||||
// load the styles
|
||||
var content = __webpack_require__(73);
|
||||
var content = __webpack_require__(76);
|
||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||
if(content.locals) module.exports = content.locals;
|
||||
// add the styles to the DOM
|
||||
@ -47378,7 +47683,7 @@ if(false) {
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 73 */
|
||||
/* 76 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
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) {
|
||||
|
||||
//
|
||||
@ -47428,7 +47733,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 75 */
|
||||
/* 78 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var render = function() {
|
||||
@ -47492,19 +47797,19 @@ if (false) {
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 76 */
|
||||
/* 79 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var disposed = false
|
||||
function injectStyle (ssrContext) {
|
||||
if (disposed) return
|
||||
__webpack_require__(77)
|
||||
__webpack_require__(80)
|
||||
}
|
||||
var normalizeComponent = __webpack_require__(1)
|
||||
/* script */
|
||||
var __vue_script__ = __webpack_require__(79)
|
||||
var __vue_script__ = __webpack_require__(82)
|
||||
/* template */
|
||||
var __vue_template__ = __webpack_require__(80)
|
||||
var __vue_template__ = __webpack_require__(83)
|
||||
/* template functional */
|
||||
var __vue_template_functional__ = false
|
||||
/* styles */
|
||||
@ -47544,13 +47849,13 @@ module.exports = Component.exports
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 77 */
|
||||
/* 80 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||
|
||||
// load the styles
|
||||
var content = __webpack_require__(78);
|
||||
var content = __webpack_require__(81);
|
||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||
if(content.locals) module.exports = content.locals;
|
||||
// add the styles to the DOM
|
||||
@ -47570,7 +47875,7 @@ if(false) {
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 78 */
|
||||
/* 81 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
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__) {
|
||||
|
||||
"use strict";
|
||||
@ -47696,7 +48001,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 80 */
|
||||
/* 83 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var render = function() {
|
||||
@ -47771,7 +48076,7 @@ if (false) {
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 81 */
|
||||
/* 84 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var render = function() {
|
||||
@ -47893,7 +48198,7 @@ if (false) {
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 82 */
|
||||
/* 85 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// removed by extract-text-webpack-plugin
|
||||
|
6
laravel_server/resources/assets/js/vueapp.js
vendored
6
laravel_server/resources/assets/js/vueapp.js
vendored
@ -16,11 +16,11 @@ import VueSocketio from 'vue-socket.io';
|
||||
Vue.use(VueRouter);
|
||||
|
||||
//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 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 singleplayer_game = Vue.component('singlegame', require('./components/singleplayer_tictactoe.vue'));
|
||||
const multiplayerGame = Vue.component('multiplayergame', require('./components/multiplayer_tictactoe.vue'));
|
||||
@ -29,7 +29,7 @@ const routes = [
|
||||
{ path: '/', redirect: '/users' },
|
||||
{ path: '/users', component: user },
|
||||
{ path: '/login', component: login },
|
||||
{ path: '/logout', component: logout },
|
||||
// { path: '/logout', component: logout },
|
||||
{ path: '/register', component: register },
|
||||
{ path: '/singletictactoe', component: singleplayer_game },
|
||||
{ path: '/multitictactoe', component: multiplayerGame }
|
||||
|
@ -20,7 +20,8 @@ class MemoryGame {
|
||||
this.piece2x=null;
|
||||
this.piece1y=null;
|
||||
this.piece2y=null;
|
||||
|
||||
this.pontuacao = 0;
|
||||
this.winnerMessage = '';
|
||||
}
|
||||
|
||||
join(socketId){ // chamar pelo socket id do user
|
||||
@ -34,51 +35,86 @@ class MemoryGame {
|
||||
}
|
||||
|
||||
checkGameEnded(){
|
||||
if (this.hasRow(1)) {
|
||||
this.winner = 1;
|
||||
this.gameEnded = true;
|
||||
return true;
|
||||
} else if (this.hasRow(2)) {
|
||||
this.winner = 2;
|
||||
this.gameEnded = true;
|
||||
return true;
|
||||
} else if (this.isBoardComplete()) {
|
||||
this.winner = 0;
|
||||
//1 Board complete ??
|
||||
|
||||
if (this.isBoardComplete()) {
|
||||
//
|
||||
// for(let i=0; i<this.numPlayers; i++){
|
||||
// this.playerScore[i] = 0; //inicializa a pontuaçao do player a 0
|
||||
// this.calculateScore(i); //calcula o score do player
|
||||
// }
|
||||
|
||||
|
||||
// buscar o player com maior pontuação
|
||||
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;
|
||||
}
|
||||
|
||||
isBoardComplete(){
|
||||
for (let value of this.board) {
|
||||
if (value === 0) {
|
||||
|
||||
for(let x=0; x<this.line; x++){
|
||||
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;
|
||||
}
|
||||
|
||||
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){
|
||||
if (!this.gameStarted) {
|
||||
return false;
|
||||
|
||||
}
|
||||
if (this.gameEnded) {
|
||||
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 (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;
|
||||
return array;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = TicTacToeGame;
|
||||
module.exports = MemoryGame;
|
||||
|
21
npm-debug.log
Normal file
21
npm-debug.log
Normal file
@ -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…
x
Reference in New Issue
Block a user