Пример #1
0
 public void MouseMove(DrawContext dc, double x, double y)
 {
     if (PointerMoved != null)
     {
         PointerMoved?.Invoke(this, dc, x, y);
     }
 }
Пример #2
0
        private void LateUpdate()
        {
            MoveHandler?.Invoke();
            //current scene score
            textCamPos.GetComponent <Text>().text = CurrentScore.ToString();

            List <Direction> moveDir = CustomController.PositionCompair(previousPos, currentRoundPos, sconfig.gap);

            foreach (Direction s in moveDir)
            {
                previousPos = currentRoundPos;
                ObserverUpate(s);
            }
        }
Пример #3
0
        public void Parse(SocketMessage message, int boardDimensions)
        {
            _tokens.Clear();
            string[] contentWords = message.Content.Split(" ");

            #region create tokens
            for (int i = 0; i < contentWords.Length; i++)
            {
                var tokenString = contentWords[i].ToLower();

                if (tokenString.Length == 2)
                {
                    if (ContainsLabelLetter(tokenString[0]) && ContainsLabelNumber(tokenString[1]))
                    {
                        _tokens.Add(new InGameToken(tokenString, InGameToken.TokenType.CellCoord));
                    }
                }
            }
            #endregion


            #region trigger events depending on grammer
            if (_tokens.Count == 1)
            {
                if (_tokens[0].Type == InGameToken.TokenType.CellCoord)
                {
                    DisplayHandler?.Invoke(Common.FromLabelToIndexCoordinate(_tokens[0].Value, boardDimensions));
                }
            }

            if (_tokens.Count == 2)
            {
                if (_tokens[0].Type == InGameToken.TokenType.CellCoord && _tokens[1].Type == InGameToken.TokenType.CellCoord)
                {
                    var coordFrom = Common.FromLabelToIndexCoordinate(_tokens[0].Value, boardDimensions);
                    var coordTo   = Common.FromLabelToIndexCoordinate(_tokens[1].Value, boardDimensions);
                    MoveHandler?.Invoke(coordFrom, coordTo, message.Author);
                }
            }

            #endregion
        }