我想创建多个游戏实例。
目前,在客户端,呈现游戏模板
Template.game.rendered = function () {
graph = new Graph("#graph", nodes);
};
//
function Graph(selector, nodes) { //code here };
这给了我一个游戏实例。现在我想创建更多的游戏实例,托管在大厅里。
为此,我有一个collection.lobby。
id,
host,
players,
status,
invitedplayers,
url
此功能有效:我可以设置集合值并在指定的URL下检索它们。
现在我需要用它创建一个新的游戏实例。
我认为我需要一种“Meteor.method”来呈现'指定网址的新游戏容器。它是否正确 ? 我如何组合这些元素?
github上有足够的示例代码,但每个人都这样做有点不同,因此我无法分析并理解如何执行此操作。