Esempio n. 1
0
        static void Start(Config config)
        {
            client = new TenhouClient(config.Id);

            gameEnd.Reset();

            client.OnLogin += () =>
            {
                client.EnterLobby(config.Lobby);
                client.Join(config.GameType);
            };
            client.OnGameEnd += () =>
            {
                config.Repeat--;
                gameEnd.Set();
            };
            client.OnConnectionException += () =>
            {
                if (config.Id.Length <= 8) // 如果没有天凤账号,无法断线重连
                {
                    config.Repeat--;
                }
                gameEnd.Set();
            };

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

            controller = new AIController(client);
            controller.Start();

            client.Login();
        }
Esempio n. 2
0
        static void Init(string programPath)
        {
            client = new TenhouClient("aixile");

            gameEnd.Reset();

            client.OnLogin += () =>
            {
                //client.EnterLobby(0);
                client.Join(GameType.North);
                client.Join(GameType.North_fast);
                client.Join(GameType.East);
                client.Join(GameType.East_fast);
            };
            client.OnGameEnd += () => { gameEnd.Set(); };
            client.OnClose   += () => { gameEnd.Set(); };

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

            controller = new Controller(client, programPath);
            controller.Start();

            client.Login();
        }
Esempio n. 3
0
        static void test()
        {
            var client = new TenhouClient("");

            client.gameData                      = new GameData();
            client.gameData.direction            = Direction.E;
            client.gameData.players[2].direction = Direction.E;
            client.gameData.players[3].direction = Direction.S;
            client.gameData.players[0].direction = Direction.W;
            client.gameData.players[1].direction = Direction.N;
            client.gameData.dora                 = new Dora()
            {
                new Tile(48)
            };
            client.player.hand = new Hand()
            {
                new Tile(16), new Tile(17), new Tile(20), new Tile(36),
                new Tile(37), new Tile(44), new Tile(45), new Tile(48),
                new Tile(68), new Tile(80), new Tile(92), new Tile(93),
                new Tile(96), new Tile(100)
            };
            client.player.fuuro = new Fuuro()
            {
            };
            var ai = new AIController(client);

            ai.chooseDiscardForAtk();
        }
Esempio n. 4
0
        static void Init(string programPath)
        {
            client = new TenhouClient("aixile");
            
            gameEnd.Reset();

            client.OnLogin += () =>
            {
                //client.EnterLobby(0);
                client.Join(GameType.North);
                client.Join(GameType.North_fast);
                client.Join(GameType.East);
                client.Join(GameType.East_fast);
            };
            client.OnGameEnd += () => { gameEnd.Set(); };
            client.OnClose += () => { gameEnd.Set(); };

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

            controller = new Controller(client, programPath);
            controller.Start();

            client.Login();
        }
Esempio n. 5
0
 public ProgramController(TenhouClient client, string program) : base(client)
 {
     this.process = new Process()
     {
         StartInfo = new ProcessStartInfo()
         {
             FileName               = program,
             WorkingDirectory       = Path.GetDirectoryName(program),
             CreateNoWindow         = true,
             UseShellExecute        = false,
             RedirectStandardInput  = true,
             RedirectStandardOutput = true,
             RedirectStandardError  = true
         }
     };
 }
Esempio n. 6
0
        public Controller(TenhouClient client, string program)
        {
            this.client = client;

            this.process = new Process()
            {
                StartInfo = new ProcessStartInfo()
                {
                    FileName = program,
                    WorkingDirectory = Path.GetDirectoryName(program),
                    CreateNoWindow = true,
                    UseShellExecute = false,
                    RedirectStandardInput = true,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true
                }
            };          

            this.isRunning = false;
        }
Esempio n. 7
0
 public Monitor(TenhouClient client)
 {
     this.client    = client;
     this.isRunning = false;
 }
Esempio n. 8
0
 public Monitor(TenhouClient client)
 {
     this.client = client;
     this.isRunning = false;
 }
Esempio n. 9
0
 public Monitor(TenhouClient client) : base(client)
 {
 }
Esempio n. 10
0
 public Controller(TenhouClient client)
 {
     this.client    = client;
     this.isRunning = false;
 }
Esempio n. 11
0
 public AIController(TenhouClient client) : base(client)
 {
     MahjongHelper.getInstance();
 }