Пример #1
0
 protected void RelayMessage(object sender, Message msg)
 {
     Debug.WriteLine("......\nRelay --> " + msg.Type);
     if (msg.Type == MessageType.Judge)
     {
         OnJudge(msg.Token, msg.Content as object[]);
     }
     else if (msg.Type == MessageType.Action)
     {
         var objs = msg.Content as object[];
         int size = ProxyEx.ValidSize(objs);
         if (size > 0)
         {
             var type = (ActionType)objs[0];
             OnAction(type, objs);
         }
     }
 }
Пример #2
0
        public void OnJudge(string token, object[] data)
        {
            int size = ProxyEx.ValidSize(data);

            if (size < 1)
            {
                return;
            }
            JudgeCode code = (JudgeCode)data[0];

            switch (code)
            {
            case JudgeCode.Started:
                onStateJudge(code, true);
                break;

            case JudgeCode.Ended:
                onStateJudge(code, false);
                break;

            case JudgeCode.Active:
                ActiveToken = token;
                raiseStateChange(code);
                break;

            case JudgeCode.NewWinner:
                WinnerToken = token;
                raiseStateChange(code);
                break;

            case JudgeCode.Reset:
                raiseStateChange(code);
                resolver.OnStateJudge(code);
                break;
            }
            if (size == 2 && (code == JudgeCode.Input || code == JudgeCode.Undo))
            {
                var      input = (InputAction)data[1];
                IntPoint p     = (IntPoint)input.Data;
                resolver.OnJudgeInput(token, code, p);
            }
            resolver.OnBasicJudge(token, code);
            Debug.WriteLine("[Judge]-[" + code + "] " + token);
        }
Пример #3
0
 public override void Dispose()
 {
     ProxyEx.Dispose(local);
     ProxyEx.Dispose(remote);
 }
Пример #4
0
 public override void Dispose()
 {
     ProxyEx.Dispose(shareProxy);
 }