Пример #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;
        }
Пример #2
0
 public override void Ready()
 {
     Judges.Enable();
     foreach (var token in tokens)
     {
         Pass(token, ActionType.Join, null);
     }
 }
Пример #3
0
 public virtual void OnBasicJudge(string token, JudgeCode code)
 {
     if (code == JudgeCode.Joined)
     {
         int boxId = Judges.GetBoxId(token);
         if (token == HostToken)
         {
             hostBoxId = boxId;
         }
         else if (token == JoinToken)
         {
             joinBoxId = boxId;
         }
     }
 }
Пример #4
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;
        }
Пример #5
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);
 }
Пример #6
0
 public override void Ready()
 {
     Judges.Enable();
     remote.EnableOut(outip, outport);
 }
Пример #7
0
 public virtual void Reset()
 {
     Judges.Reset();
 }
Пример #8
0
 public CoreResolverBase()
 {
     Judges         = new Judges();
     resolverCommon = new ResolverCommon(this);
 }