Ejemplo n.º 1
0
        internal OnlineHostResolver(IBoard board, string outip, int outport, int inport)
        {
            this.outip   = outip;
            this.inport  = inport;
            this.outport = outport;

            HostToken = TokenHelper.NewToken();
            tokens    = new List <string>();
            Board     = board;
            Judges.onAttach();
            //Create local proxy
            local       = new LocalProxy(RelayMessage);
            local.Token = HostToken;
            tokens.Add(HostToken);
            //Create remote proxy
            JoinToken = TokenHelper.NewToken();
            var connector = new Connector(JoinToken);

            remote       = new RemoteProxy(connector);
            remote.Token = JoinToken;
            tokens.Add(remote.Token);
            remote.EnableIn(System.Net.IPAddress.Any, inport);
            Judges.AttachProxy(local);
            Judges.AttachProxy(remote);
            Board.LatticClick += onLatticClick;
        }
Ejemplo n.º 2
0
        internal PVPResolver(IBoard board)
        {
            Board = board;

            Judges.onAttach();
            HostToken = TokenHelper.NewToken();
            JoinToken = TokenHelper.NewToken();
            tokens    = new List <string>()
            {
                HostToken, JoinToken
            };
            shareProxy       = new LocalProxy(RelayMessage);
            shareProxy.Token = HostToken;
            Judges.AttachProxy(shareProxy);
            board.LatticClick += onLatticClick;
        }
Ejemplo n.º 3
0
 internal EVPResolver(IBoard board, AILevel level)
 {
     Board = board;
     Judges.onAttach();
     //Attach proxy
     JoinToken        = TokenHelper.NewToken();
     HostToken        = TokenHelper.NewToken();
     shareProxy       = new LocalProxy(RelayMessage);
     shareProxy.Token = TokenHelper.NewToken();
     Judges.AttachProxy(shareProxy);
     //Subscribe event
     board.LatticClick += onLatticClick;
     //Generate token and store it.
     tokens = new List <string>(2);
     tokens.Add(JoinToken);
     tokens.Add(HostToken);
     setDeep(level);
 }
Ejemplo n.º 4
0
 internal static void PassActionByToken(this LocalProxy proxy, string token, ActionType type, object data)
 {
     proxy.SendByToken(token, action(token, type, data));
 }
Ejemplo n.º 5
0
 internal static void PassAction(this LocalProxy proxy, ActionType type, object data)
 {
     proxy.Send(action(proxy.Token, type, data));
 }