This commit is contained in:
Michael Zhang 2021-01-14 14:09:01 -06:00
parent cdd78585b8
commit 458e310086
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
4 changed files with 33 additions and 4 deletions

View file

@ -22,3 +22,4 @@ akryum:vue-component # Vue-CLI template to publish components
meteortesting:mocha # A package for writing and running your meteor app and package tests with mocha
johanbrook:publication-collector # Test a Meteor publication by collecting its output
accounts-base

View file

@ -1,3 +1,4 @@
accounts-base@1.7.0
akryum:vue-component@0.15.2
akryum:vue-component-dev-client@0.4.7
akryum:vue-component-dev-server@0.1.4
@ -16,6 +17,7 @@ check@1.3.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
ddp-rate-limiter@1.0.9
ddp-server@2.3.2
deps@1.0.12
diff-sequence@1.1.1
@ -37,6 +39,7 @@ inter-process-messaging@0.1.1
johanbrook:publication-collector@1.1.0
launch-screen@1.2.0
livedata@1.0.18
localstorage@1.2.0
logging@1.1.20
meteor@1.9.3
meteor-base@1.4.0
@ -59,10 +62,12 @@ npm-mongo@3.8.1
ordered-dict@1.1.0
promise@0.11.2
random@1.2.0
rate-limit@1.0.9
reactive-var@1.0.11
reload@1.3.0
retry@1.1.0
routepolicy@1.1.0
service-configuration@1.0.11
shell-server@0.5.0
socket-stream-client@0.3.1
spacebars-compiler@1.1.3

View file

@ -8,6 +8,8 @@
v-on:newGame="newGame"
v-on:joinGame="joinGame"
></component>
User ID: {{ userId }}
</div>
</template>
@ -39,21 +41,32 @@ export default {
data() {
return {
roomInfo: null,
whatScreen: Lobby,
};
},
computed: {
whatScreen: function() {
if (this.roomInfo === null)
return Lobby;
else if (this.currentRoom === null || this.currentRoom.state === "waitingRoom")
return WaitingRoom;
},
userId: function() {
console.log("userId", Meteor.userId());
return Meteor.userId();
},
},
methods: {
newGame: function(args) {
this.roomInfo = args;
this.whatScreen = WaitingRoom;
Meteor.subscribe("players", args.roomId);
Meteor.subscribe("currentRoom", args.roomId);
},
joinGame: function(args) {
this.roomInfo = args;
this.whatScreen = WaitingRoom;
Meteor.subscribe("players", args.roomId);
Meteor.subscribe("currentRoom", args.roomId);
},

View file

@ -13,7 +13,11 @@
</li>
</ul>
</p>
<p><button v-if="isOwner" :disabled="!canStart">Start Game</button></p>
<div>
<form v-on:submit.prevent="start">
<button v-if="isOwner" :disabled="!canStart">Start Game</button>
</form>
</div>
</div>
</template>
@ -47,6 +51,12 @@ export default {
return val;
},
},
methods: {
start: function() {
Meteor.call("startGame");
},
},
}
</script>