コード例 #1
0
        public CaClient(TcpClient cli, TasClient tas)
        {
            try
            {
                con = new ClientConnection();
                con.ConnectionClosed += con_ConnectionClosed;
                con.CommandRecieved += con_CommandRecieved;

                this.tas = tas;
                tas.BattleUserJoined += tas_BattleUserJoined;
                tas.BattleInfoChanged += tas_BattleInfoChanged;

                con.Connect(cli);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                throw;
            }
        }
コード例 #2
0
        public void Dispose()
        {
            try
            {
                if (tas != null)
                {
                    tas.BattleUserJoined -= tas_BattleUserJoined;
                    tas.BattleInfoChanged -= tas_BattleInfoChanged;
                    tas = null;
                }

                if (con != null)
                {
                    con.ConnectionClosed -= con_ConnectionClosed;
                    con.CommandRecieved -= con_CommandRecieved;
                    con.Dispose();
                    con = null;
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
            }
        }