Exemple #1
0
 public AIController(PlatformClient client, Strategy strategy = null) : base(client)
 {
     MahjongHelper.getInstance();
     this.strategy      = strategy ?? new Strategy();
     evalResultComp     = new EvalResultComp(this);
     chiitoitsuTileComp = new ChiitoitsuTileComp(this);
 }
Exemple #2
0
        static void Start(Config config)
        {
            if (config.Platform == Platform.Tenhou)
            {
                client = new TenhouClient(config);
            }
            else if (config.Platform == Platform.Majsoul)
            {
                client = new MajsoulClient(config);
            }

            gameEnd.Reset();

            client.OnLogin += (resume, succeeded) =>
            {
                if (!resume && succeeded)
                {
                    client.EnterPrivateRoom(config.PrivateRoom);
                    client.Join(config.GameType);
                }
            };
            client.OnGameEnd += () =>
            {
                config.Repeat--;
                gameEnd.Set();
            };
            client.OnConnectionException += () =>
            {
                if (config.Platform == Platform.Tenhou && config.TenhouID.Length <= 8) // 如果没有天凤账号,无法断线重连
                {
                    config.Repeat--;
                }
                gameEnd.Set();
            };

            monitor = new Monitor(client);
            monitor.Start();

            controller = new AIController(client, config.strategy);
            controller.Start();

            client.Login();
        }
Exemple #3
0
 public Controller(PlatformClient client)
 {
     this.client    = client;
     this.isRunning = false;
 }
Exemple #4
0
 public Monitor(PlatformClient client) : base(client)
 {
 }