Ejemplo n.º 1
0
        private void TrackSelection()
        {
            int index;
            if (Mode == SelectionMode.Shape3D)
            {
                bool newPatternTracked = false; ;
                temp.Clear();
                for (int i = 0; i < SelectedShape3Ds.Count; i++)
                {
                    Shape oldShape = SelectedShape3Ds[i].shape;
                    Shape newShape = OnlineFrame.Track(oldShape);
                    if (newShape == null)
                        continue;
                    if (oldShape.refPattern != newShape.refPattern)
                        newPatternTracked = true;

                    if ((index = Mathf.Min(SelectedShape3Ds[i].index, newShape.InsCount - 1)) != -1)
                        if (!temp.Contains(newShape[index]))
                            temp.Add(newShape[index]);
                }
                SelectedShape3Ds.Clear();
                SelectedShape3Ds.AddRange(temp);

                if (newPatternTracked)
                    onNewPatternTracked();
            }
            else
            {
            }
        }
Ejemplo n.º 2
0
 public bool IsSelected(TileObject tile)
 {
     if (Mode == SelectionMode.Shape3D)
         return SelectedShape3Ds.Find(x => x == tile.pattern3D) != null;
     else
         return SelectedTiles.Find(x => x == tile) != null;
 }
Ejemplo n.º 3
0
        public void InteractWithTile(TileObject info)
        {
            if (tracker.Running)
                return;
            if (Mode == SelectionMode.Shape3D)
            {
                if (!IsSelected(info))
                {
                    if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
                    {
                        if (SelectedShape3Ds.Count == 0 || SelectedShape3D.shape.bg == info.shape.bg)
                            SelectedShape3Ds.Insert(0, info.pattern3D);
                    }
                    else
                        SelectedShape3D = info.pattern3D;
                }
                else
                {
                    if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
                        SelectedShape3Ds.Remove(info.pattern3D);
                    else
                        SelectedShape3D = info.pattern3D;
                }
            }
            else
            {
                if (!IsSelected(info))
                {

                    {
                        if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
                        {
                            if (SelectedTiles.Count == 0 || SelectedTiles[0].shape.bg == info.shape.bg)
                                SelectedTiles.Add(info);
                        }
                        else
                        {
                            SelectedTiles.Clear();
                            SelectedTiles.Add(info);
                        }
                    }
                }
                else
                {
                    if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
                        SelectedTiles.Remove(info);
                    else
                    {
                        SelectedTiles.Clear();
                        SelectedTiles.Add(info);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public void ClearSelection()
 {
     SelectedTiles.Clear();
     SelectedShape3Ds.Clear();
 }