/// <summary>
 /// 开始游戏
 /// </summary>
 /// <returns></returns>
 public async Task startGame(GameOption option, Player[] players)
 {
     this.option = option;
     playerList.Clear();
     playerList.AddRange(players);
     foreach (Player player in playerList)
     {
         await rule.onPlayerInit(this, player);
     }
     await rule.onGameStart(this);
 }
Пример #2
0
 public Task init(Assembly[] assemblies, Rule rule, GameOption options, IRoomPlayer[] players)
 {
     this.rule = rule;
     if (isInited)
     {
         logger.logError("游戏已经初始化");
         return(Task.CompletedTask);
     }
     isInited = true;
     //初始化随机
     random = new Random(options.randomSeed);
     //初始化卡片定义
     foreach (CardDefine define in rule.cardList)
     {
         addDefine(define);
     }
     //初始化动作定义
     foreach (var pair in ActionDefine.loadDefinesFromAssemblies(assemblies))
     {
         addActionDefine(pair.Key, pair.Value);
     }
     return(rule.onGameInit(this, options, players));
 }
Пример #3
0
 public abstract Task onGameInit(CardEngine game, GameOption options, IRoomPlayer[] players);