Пример #1
0
        public void SetNeighbor(ImagePos other, int direction)
        {
            var map  = new[] { 2, 3, 0, 1 };
            var mapx = new[] { -1, 0, 1, 0 };
            var mapy = new[] { 0, 1, 0, -1 };

            this.Neighbors[direction]       = other;
            other.Neighbors[map[direction]] = this;

            other.X = this.X + mapx[direction];
            other.Y = this.Y + mapy[direction];
        }
Пример #2
0
 public ImageCode(TextCovertedData data)
 {
     if (data._data == "reset")
     {
         reset     = true;
         _imagePos = GetImagePos(data._text.Trim());
     }
     else
     {
         var d = data._data.Split(',');
         setName = d[0];
         number  = int.Parse(d[1]);
         var text = data._text.Split(' ');
         _imagePos = GetImagePos(text[0].Trim());
         if (text.Length >= 2)
         {
             _imageDirection = GetImageDir(text[1].Trim());
         }
     }
 }