Example #1
0
        public virtual Selection PreSelection(SelectionManager sm, Selection sel)
        {
            if ( !sel.IsEmpty && !sel.Start.Node.Equals(node) )
                return new Selection(SelectionManager.CreateSelectionPoint(node, false));

            return sel;
        }
Example #2
0
    void Start()
    {
        selectionManager = GameObject.Find("PlayerGameManager").GetComponent<SelectionManager>();
        selectionManager.RegisterUnit(new UnitObject(gameObject, unitClass, 1));

        GetComponent<Renderer>().material = normalMat;
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        tier = 1;

        grid = GameObject.FindGameObjectWithTag ("Grid").GetComponent<Grid> ();
        render = GetComponent<SpriteRenderer>();
        selection = grid.GetComponent<SelectionManager> ();
    }
Example #4
0
 protected override void Awake() {
     base.Awake();
     UnityUtility.ValidateComponentPresence<Rigidbody>(gameObject);
     _shipGraphics = gameObject.GetSafeMonoBehaviour<ShipGraphics>();
     _fleetMgr = gameObject.GetSafeFirstMonoBehaviourInParents<FleetUnitCreator>();
     _fleetCmd = _fleetMgr.gameObject.GetSafeFirstMonoBehaviourInChildren<FleetCommand>();
     _selectionMgr = SelectionManager.Instance;
 }
 void Start()
 {
     selectionManager = GetComponent<SelectionManager> ();
     commandToTowerType = new Dictionary<CommandType, TowerType> ();
     commandToTowerType.Add (CommandType.BUILD_GREEN, TowerType.GREEN);
     commandToTowerType.Add (CommandType.BUILD_RED, TowerType.RED);
     commandToTowerType.Add (CommandType.BUILD_BLUE, TowerType.BLUE);
 }
        public void TestSetup()
        {
            collection = new ObservableCollection<Stub>();
            manager = new SelectionManager<Stub>(collection);

            selectionChangedCount = 0;
            manager.SelectionChanged += delegate { selectionChangedCount++; };
        }
		public MonthViewControl(ICalendarControl calendar)
		{
			InitializeComponent();
			Dock = DockStyle.Fill;
			Calendar = calendar;
			Months = new Dictionary<DateTime, MonthControl>();
			SelectionManager = new SelectionManager(this);
			CopyPasteManager = new CopyPasteManager(this);
		}
Example #8
0
		public void Setup ()
		{
			var i = r.Next (4, 1000);
			Selectable = new List<int> (i);
			for (int j = 0; j < i; j++)
				Selectable.Add (j);

			Selector = new SelectionManager<int> (Selectable);
		}
Example #9
0
 protected override void Awake() {
     base.Awake();
     _orbitalPlane = gameObject.GetSafeFirstMonoBehaviourInChildren<OrbitalPlaneInputEventRouter>();
     _systemGraphics = gameObject.GetSafeMonoBehaviour<SystemGraphics>();
     _star = gameObject.GetSafeFirstMonoBehaviourInChildren<Star>();
     _planetsAndMoons = gameObject.GetSafeMonoBehavioursInChildren<FollowableItem>();
     _eventMgr = GameEventManager.Instance;
     _selectionMgr = SelectionManager.Instance;
 }
Example #10
0
 void Start()
 {
     selectionManager = GameObject.Find("PlayerGameManager").GetComponent<SelectionManager>();
     //		selectionManager.RegisterUnit(new UnitObject());
     spawnQueueManager = GameObject.Find("PlayerGameManager").GetComponent<SpawnQueueManager>();
     selectionAgent = GetComponent<SelectionAgent>();
     state = UnitState.Defend;
     transform.GetChild(0).localScale = new Vector3(1, 1, 0) * throwRadius * 1.4f;
     // NOTE: I have no idea why 1.4 works.  It's 2 * 0.7, but I don't know why 70% is special.
 }
Example #11
0
 protected override void Awake() {
     base.Awake();
     _collider = UnityUtility.ValidateComponentPresence<BoxCollider>(gameObject);
     _selectionMgr = SelectionManager.Instance;
     _mesh = gameObject.GetComponentInChildren<MeshFilter>().mesh;
     _size = _mesh.bounds.size;
     _collider.size = _size;
     _collider.enabled = true;
     //EnableSector(true);
     // NOTE: Collider usage: I'm keeping the colliders on all the time for now and using the camera's culling mask and UICamera.EventReceiverMask to ignore them
     InitializeNeighborDirections();
 }
Example #12
0
    protected void Start()
    {
        gg = AstarPath.active.astarData.gridGraph;
        //InvokeRepeating("updateGraph", 0, 1);
        updateGraph();
        selectBox = gameObject.AddComponent ("SelectionManager") as SelectionManager;

        Simulator.Instance.setTimeStep(1);
        //sim.setTimeStep (0.25f);
        Simulator.Instance.setAgentDefaults(30, 20, 30, 15, 3.5f, 10, new RVO.Vector2());

        QualitySettings.antiAliasing = 8;
        System.Random rng = new System.Random();
        int randomX;
        int randomY;
        int randomZ;

        GameObject[] allUnits = GameObject.FindGameObjectsWithTag("Unit");
        for(int i = 0; i < allUnits.Length; i ++) {
            Unit unit = allUnits[i].GetComponent("Unit") as Unit;
            //unit.rotation = allUnits[i].transform.eulerAngles;
            unit.team = localPlayerTeam;
            objectList.Add (allUnits[i]);
            //Simulator.Instance.addAgent (new RVO.Vector2(unit.transform.position.x, unit.transform.position.z));
            //RVO.Vector2 goalVector = new RVO.Vector2(unit.transform.position.x, unit.transform.position.z) - Simulator.Instance.getAgentPosition(i);
            //Simulator.Instance.setAgentPrefVelocity (i, new RVO.Vector2(unit.transform.position.x, unit.transform.position.z));
            //if (RVOMath.absSq(goalVector) > 1.0f)
            {
                //goalVector = RVOMath.normalize(goalVector) * Time.deltaTime * 10;
                //Simulator.Instance.setAgentPrefVelocity(i, goalVector);
                //realGoal = (realGoal - unitPos).normalized;
            }
            unitList.Add (unit);
            //guo = new GraphUpdateObject(unit.collider.bounds);
            //guo.addPenalty = 0;
            //AstarPath.active.UpdateGraphs (guo);
        }
        for(int i = 0; i < unitList.Count; i++) {
            for(int z = 0; z < unitList.Count; z++) {
                unitList[i].addObstacle (unitList[z]);
            }
        }
        //Debug.Log (Simulator.Instance.getNumAgents ());
        allUnits = GameObject.FindGameObjectsWithTag("Building");
        for(int i = 0; i < allUnits.Length; i ++) {
            Building unit = allUnits[i].GetComponent("Building") as Building;
            //unit.rotation = allUnits[i].transform.eulerAngles;
            unit.team = localPlayerTeam;
            objectList.Add (allUnits[i]);
        }

        selectBox.ObjectList = objectList;
    }
Example #13
0
 protected override void Awake() {
     base.Awake();
     enabled = false;    // disabled behaviours aren't updated
     _fleetCmd = gameObject.GetSafeFirstMonoBehaviourInChildren<FleetCommand>();
     _fleetCmdTransform = _fleetCmd.transform;
     _fleetGraphics = gameObject.GetSafeMonoBehaviour<FleetGraphics>();
     ShipCaptains = gameObject.GetSafeMonoBehavioursInChildren<ShipCaptain>().ToList();
     _gameMgr = GameManager.Instance;
     _eventMgr = GameEventManager.Instance;
     _selectionMgr = SelectionManager.Instance;
     InitializeFleetIcon();
     Subscribe();
 }
Example #14
0
        public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
        {
            this.motherTextAreaControl   = motherTextAreaControl;
            this.motherTextEditorControl = motherTextEditorControl;

            caret            = new Caret(this);
            selectionManager = new SelectionManager(Document, this);

            this.textAreaClipboardHandler = new TextAreaClipboardHandler(this);

            ResizeRedraw = true;

            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
//			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
//			SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.Opaque, false);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, true);

            textView = new TextView(this);

            gutterMargin  = new GutterMargin(this);
            foldMargin    = new FoldMargin(this);
            iconBarMargin = new IconBarMargin(this);
            leftMargins.AddRange(new AbstractMargin[] { iconBarMargin, gutterMargin, foldMargin });
            OptionsChanged();


            new TextAreaMouseHandler(this).Attach();
            new TextAreaDragDropHandler().Attach(this);

            bracketshemes.Add(new BracketHighlightingSheme('{', '}'));
            bracketshemes.Add(new BracketHighlightingSheme('(', ')'));
            bracketshemes.Add(new BracketHighlightingSheme('[', ']'));

            caret.PositionChanged                   += new EventHandler(SearchMatchingBracket);
            Document.TextContentChanged             += new EventHandler(TextContentChanged);
            Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged);
        }
Example #15
0
        /// <summary>
        /// This method executes a dialog key
        /// </summary>
        public bool ExecuteDialogKey(Keys keyData)
        {
            // try, if a dialog key processor was set to use this
            if (DoProcessDialogKey != null && DoProcessDialogKey(keyData))
            {
                return(true);
            }

            // if not (or the process was 'silent', use the standard edit actions
            IEditAction action = _motherTextEditorControl.GetEditAction(keyData);

            AutoClearSelection = true;
            if (action != null)
            {
                BeginUpdate();
                try
                {
                    lock (Document)
                    {
                        action.Execute(this);
                        if (SelectionManager.HasSomethingSelected && AutoClearSelection /*&& caretchanged*/)
                        {
                            if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal)
                            {
                                SelectionManager.ClearSelection();
                            }
                        }
                    }
                }
                finally
                {
                    EndUpdate();
                    Caret.UpdateCaretPosition();
                }
                return(true);
            }
            return(false);
        }
            public void AddMultipleItemsWithMultiSelectEnabledAndEmptyStart(string scope)
            {
                var addedItems   = new List <int>();
                var removedItems = new List <int>();

                var selectionManager = new SelectionManager <int>
                {
                    AllowMultiSelect = true
                };

                selectionManager.SelectionChanged += (sender, e) =>
                {
                    Assert.AreEqual(scope, e.Scope);

                    addedItems.AddRange(e.Added);
                    removedItems.AddRange(e.Removed);
                };

                selectionManager.Add(new[] { 1, 2, 3 }, scope);

                Assert.AreEqual(3, addedItems.Count);
                Assert.AreEqual(1, addedItems[0]);
                Assert.AreEqual(2, addedItems[1]);
                Assert.AreEqual(3, addedItems[2]);

                Assert.AreEqual(0, removedItems.Count);

                var selectedItems = selectionManager.GetSelectedItems(scope);

                Assert.AreEqual(3, selectedItems.Count);
                Assert.AreEqual(1, selectedItems[0]);
                Assert.AreEqual(2, selectedItems[1]);
                Assert.AreEqual(3, selectedItems[2]);

                var selectedItem = selectionManager.GetSelectedItem(scope);

                Assert.AreEqual(3, selectedItem);
            }
Example #17
0
        public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
        {
            MotherTextAreaControl   = motherTextAreaControl;
            MotherTextEditorControl = motherTextEditorControl;

            Caret            = new Caret(this);
            SelectionManager = new SelectionManager(Document, this);
            MousePos         = new Point(0, 0);

            ResizeRedraw = true;

            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            //			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            //			SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.Opaque, false);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, true);

            TextView = new TextView(this);

            GutterMargin  = new GutterMargin(this);
            FoldMargin    = new FoldMargin(this);
            IconBarMargin = new IconBarMargin(this);
            _leftMargins.AddRange(new IMargin[] { IconBarMargin, GutterMargin, FoldMargin });
            OptionsChanged();


            new TextAreaMouseHandler(this).Attach(); //TODO1 refactor all these
            new TextAreaDragDropHandler().Attach(this);

            _bracketSchemes.Add(new BracketHighlightingSheme('{', '}')); //TODO1 hardcoded
            _bracketSchemes.Add(new BracketHighlightingSheme('(', ')'));
            _bracketSchemes.Add(new BracketHighlightingSheme('[', ']'));

            Caret.PositionChanged                   += new EventHandler(SearchMatchingBracket);
            Document.TextContentChanged             += TextContentChanged;
            Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged);
        }
        public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
        {
            MotherTextAreaControl   = motherTextAreaControl;
            MotherTextEditorControl = motherTextEditorControl;

            Caret            = new Caret(this);
            SelectionManager = new SelectionManager(Document, this);

            ClipboardHandler = new TextAreaClipboardHandler(this);

            ResizeRedraw = true;

            SetStyle(ControlStyles.OptimizedDoubleBuffer, value: true);
//            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
//            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.Opaque, value: false);
            SetStyle(ControlStyles.ResizeRedraw, value: true);
            SetStyle(ControlStyles.Selectable, value: true);

            TextView = new TextView(this);

            GutterMargin  = new GutterMargin(this);
            FoldMargin    = new FoldMargin(this);
            IconBarMargin = new IconBarMargin(this);
            leftMargins.AddRange(new AbstractMargin[] { IconBarMargin, GutterMargin, FoldMargin });
            OptionsChanged();

            new TextAreaMouseHandler(this).Attach();
            new TextAreaDragDropHandler().Attach(this);

            bracketshemes.Add(new BracketHighlightingSheme(opentag: '{', closingtag: '}'));
            bracketshemes.Add(new BracketHighlightingSheme(opentag: '(', closingtag: ')'));
            bracketshemes.Add(new BracketHighlightingSheme(opentag: '[', closingtag: ']'));

            Caret.PositionChanged                   += SearchMatchingBracket;
            Document.TextContentChanged             += TextContentChanged;
            Document.FoldingManager.FoldingsChanged += DocumentFoldingsChanged;
        }
Example #19
0
        void Render3D(double delta, float t)
        {
            CurrentCameraPos = Camera.GetCameraPos(LocalPlayer.EyePosition);
            if (SkyboxRenderer.ShouldRender)
            {
                SkyboxRenderer.Render(delta);
            }
            AxisLinesRenderer.Render(delta);
            Entities.RenderModels(Graphics, delta, t);
            Entities.RenderNames(Graphics, delta, t);

            ParticleManager.Render(delta, t);
            Camera.GetPickedBlock(SelectedPos);               // TODO: only pick when necessary
            EnvRenderer.Render(delta);
            MapRenderer.Render(delta);
            MapBordersRenderer.RenderSides(delta);

            if (SelectedPos.Valid && !HideGui)
            {
                Picking.Render(delta, SelectedPos);
            }
            MapBordersRenderer.RenderEdges(delta);
            MapRenderer.RenderTranslucent(delta);

            Entities.DrawShadows();
            SelectionManager.Render(delta);
            Entities.RenderHoveredNames(Graphics, delta, t);

            bool left   = IsMousePressed(MouseButton.Left);
            bool middle = IsMousePressed(MouseButton.Middle);
            bool right  = IsMousePressed(MouseButton.Right);

            InputHandler.PickBlocks(true, left, middle, right);
            if (!HideGui)
            {
                BlockHandRenderer.Render(delta, t);
            }
        }
Example #20
0
        public void TwoCollectionsTest()
        {
            var element1         = new SelectableElementStub();
            var element2         = new SelectableElementStub();
            var element3         = new SelectableElementStub();
            var selectionManager = new SelectionManager();

            selectionManager.AddCollection(new ObservableCollectionEx <SelectableElementStub>
            {
                element1,
                element2
            });
            selectionManager.AddCollection(new ObservableCollectionEx <SelectableElementStub>
            {
                element3,
            });
            element1.Selected = true;

            element3.Selected = true;

            Assert.AreEqual(element3, selectionManager.SelectedElement);
            Assert.IsFalse(element1.Selected);
        }
Example #21
0
        public void Add(SelectionCellRange item)
        {
            DataGridContext dataGridContext = m_list.DataGridContext;
            DataGridControl dataGridControl = dataGridContext.DataGridControl;

            if (dataGridControl.SelectionUnit == SelectionUnit.Row)
            {
                throw new InvalidOperationException("Can't add cell range when SelectionUnit is Row.");
            }

            SelectionManager selectionManager = dataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                selectionManager.SelectCells(dataGridContext, new SelectionCellRangeWithItems(item.ItemRange, null, item.ColumnRange));
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }
Example #22
0
 public virtual void HandleParsingException(ParsingException ex)
 {
     try
     {
         if (string.IsNullOrEmpty(ex.FileName) || ex.FileName == this.FileName)
         {
             if (ex.Line >= 1 && ex.CharPositionInLine >= 0 && ex.Text != null)
             {
                 this.textEditorControl.ActiveTextAreaControl.JumpTo(ex.Line - 1);
                 SelectionManager selectionManager =
                     textEditorControl.ActiveTextAreaControl.TextArea.SelectionManager;
                 selectionManager.ClearSelection();
                 selectionManager.SetSelection(new TextLocation(ex.CharPositionInLine, ex.Line - 1),
                                               new TextLocation(ex.CharPositionInLine + ex.Text.Length,
                                                                ex.Line - 1));
                 textEditorControl.Refresh();
             }
         }
     }
     catch
     {
     }
 }
        public void Add(SelectionRange item)
        {
            DataGridContext dataGridContext = m_list.DataGridContext;
            DataGridControl dataGridControl = dataGridContext.DataGridControl;

            if (dataGridControl.SelectionUnit == SelectionUnit.Cell)
            {
                throw new InvalidOperationException("Can't add item when SelectionUnit is Cell.");
            }

            SelectionManager selectionManager = dataGridControl.SelectionChangerManager;

            selectionManager.Begin();

            try
            {
                selectionManager.SelectItems(dataGridContext, new SelectionRangeWithItems(item, null));
            }
            finally
            {
                selectionManager.End(false, true, true);
            }
        }
Example #24
0
        public NavigationView()
        {
            InitializeComponent();

            panel1.BackColor = Program.TitleBarBorderColor;

            treeView.ImageList = Images.ImageList16;
            if (treeView.ItemHeight < 18)
            {
                treeView.ItemHeight = 18;
            }
            //otherwise it's too close together on XP and the icons crash into each other

            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return;
            }

            treeBuilder                   = new MainWindowTreeBuilder(treeView);
            treeViewUpdateManager         = new UpdateManager(30 * 1000);
            treeViewUpdateManager.Update += treeViewUpdateManager_Update;
            selectionManager              = new SelectionManager();
        }
Example #25
0
 private void DrawCurveEditorsForClipsOnTrack(Rect headerRect, Rect trackRect, TimelineWindow.TimelineState state)
 {
     if (this.m_TrackGUI.clips.Count != 0)
     {
         if (Event.get_current().get_type() == 8)
         {
             TimelineClipGUI timelineClipGUI = SelectionManager.SelectedClipGUI().FirstOrDefault((TimelineClipGUI x) => x.parentTrackGUI == this.m_TrackGUI);
             if (timelineClipGUI != null && timelineClipGUI != this.m_LastSelectedClipGUI)
             {
                 this.m_LastSelectedClipGUI = timelineClipGUI;
             }
             if (this.m_LastSelectedClipGUI == null)
             {
                 this.m_LastSelectedClipGUI = this.m_TrackGUI.clips[0];
             }
         }
         if (this.m_LastSelectedClipGUI != null && this.m_LastSelectedClipGUI.clipCurveEditor != null)
         {
             Rect rect = this.m_LastSelectedClipGUI.rect;
             InlineCurveEditor.DrawCurveEditor(this.m_LastSelectedClipGUI, state, headerRect, trackRect, new Vector2(rect.get_xMin(), rect.get_xMax()), this.m_TrackGUI.locked);
         }
     }
 }
Example #26
0
    private void OnLevelWasLoaded(int level)
    {
        string sceneName = SceneManager.GetSceneByBuildIndex(level).name;

        if (sceneName.Equals("InGame"))
        {
            sendTypeDisplay.text = "[ì „ì²´]";
            inGameTimer          = GameObject.FindGameObjectWithTag("InGameManager").GetComponent <InGameTimer>();
            isInGame             = true;
            chatBox.fontSize     = 22;
        }
        else if (sceneName.Equals("Selection"))
        {
            isInGame  = false;
            selection = GameObject.FindGameObjectWithTag("SelectionManager").GetComponent <SelectionManager>();
        }
        else
        {
            isInGame = false;
        }
        myChampionName = PlayerData.Instance.championName;
        chatInput.text = string.Empty;
    }
Example #27
0
        public void CopyAction()
        {
            CopyData = new List <CopyDecalData>();

            int count = DecalsControler.AllDecals.Count;
            List <GameObject> Objs = SelectionManager.GetAllSelectedGameobjects(false);

            Debug.Log("Copied " + Objs.Count + " decal");


            int selectionCount = Objs.Count;

            for (int i = 0; i < count; i++)
            {
                for (int s = 0; s < selectionCount; s++)
                {
                    if (Objs[s] == DecalsControler.AllDecals[i].Obj.gameObject)
                    {
                        CopyData.Add(
                            new CopyDecalData(DecalsControler.AllDecals[i].Shared,
                                              DecalsControler.AllDecals[i].Obj.tr.localPosition,
                                              DecalsControler.AllDecals[i].Obj.tr.localRotation,
                                              DecalsControler.AllDecals[i].Obj.tr.localScale)
                            );
                        CopyCenterPoint += DecalsControler.AllDecals[i].Obj.tr.localPosition;
                        break;
                    }
                }
            }

            if (CopyData.Count > 0)
            {
                CopyCenterPoint /= CopyData.Count;
            }

            DecalsControler.Sort();
        }
Example #28
0
        /// <remarks>
        /// Replaces a char at the caret position
        /// </remarks>
        public void ReplaceChar(char ch)
        {
            bool updating = MotherTextEditorControl.IsInUpdate;

            if (!updating)
            {
                BeginUpdate();
            }

            if (Shared.TEP.DocumentSelectionMode == DocumentSelectionMode.Normal && SelectionManager.IsValid)
            {
                Caret.Position = SelectionManager.StartPosition;
                SelectionManager.RemoveSelectedText();
            }

            int         lineNr = Caret.Line;
            LineSegment line   = Document.GetLineSegment(lineNr);
            int         offset = Document.PositionToOffset(Caret.Position);

            if (offset < line.Offset + line.Length)
            {
                Document.Replace(offset, 1, ch.ToString());
            }
            else
            {
                Document.Insert(offset, ch.ToString());
            }

            if (!updating)
            {
                EndUpdate();
                UpdateLineToEnd(lineNr, Caret.Column);
            }

            ++Caret.Column;
            //			++Caret.DesiredColumn;
        }
Example #29
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                if (!_disposed)
                {
                    _disposed = true;
                    if (Caret != null)
                    {
                        Caret.PositionChanged -= new EventHandler(SearchMatchingBracket);
                        Caret.Dispose();
                    }

                    if (SelectionManager != null)
                    {
                        SelectionManager.Dispose();
                    }

                    Document.TextContentChanged             -= TextContentChanged;
                    Document.FoldingManager.FoldingsChanged -= DocumentFoldingsChanged;
                    MotherTextAreaControl   = null;
                    MotherTextEditorControl = null;

                    foreach (IMargin margin in _leftMargins)
                    {
                        if (margin is IDisposable)
                        {
                            (margin as IDisposable).Dispose();
                        }
                    }

                    TextView.Dispose();
                }
            }
        }
Example #30
0
    public void MoveTo(Tile tile)
    {
        starting_turn_tile      = GetCurrentTile();
        starting_turn_direction = direction;
        starting_turn_position  = transform.position;
        lerp_time = 0;
        if (tile != GetCurrentTile())
        {
            moves_remaining -= tile.distance;
            //build path
            Stack <Tile> stack = new Stack <Tile>();
            Tile         t     = tile;
            while (t.parent != null)
            {
                stack.Push(t);
                t = t.parent;
            }
            while (stack.Count > 0)
            {
                path.Enqueue(stack.Pop());
            }
            previous_tile = GetCurrentTile();
            next_tile     = path.Dequeue();
            FaceDirection(Tile.GetDirectionBetweenTiles(previous_tile, next_tile));
            //begin movement
            GetCurrentTile().Unplace();
            tile.Place(this);
            IsMoving = true;
        }

        SetState(new ReadyToAttackState(this));
        //Board.ResetAllTiles();
        //GetOwner().SetChosenUnit(this);
        SelectionManager.Reselect();
        //move camera
        Camera.main.GetComponent <MainCamera>().MoveToTile(tile);
    }
        public void ShowFor(TextEditorControl editor, bool replaceMode)
        {
            Editor = editor;

            _search.ClearScanRegion();
            SelectionManager sm = editor.ActiveTextAreaControl.SelectionManager;

            if (sm.HasSomethingSelected && sm.SelectionCollection.Count == 1)
            {
                ISelection sel = sm.SelectionCollection[0];
                if (sel.StartPosition.Line == sel.EndPosition.Line)
                {
                    txtLookFor.Text = sm.SelectedText;
                }
                else
                {
                    _search.SetScanRegion(sel);
                }
            }
            else
            {
                // Get the current word that the caret is on
                Caret caret = editor.ActiveTextAreaControl.Caret;
                int   start = TextUtilities.FindWordStart(editor.Document, caret.Offset);
                int   endAt = TextUtilities.FindWordEnd(editor.Document, caret.Offset);
                txtLookFor.Text = editor.Document.GetText(start, endAt - start);
            }

            ReplaceMode = replaceMode;

            Owner    = (Form)editor.TopLevelControl;
            Location = new Point(Owner.Location.X + 100, Owner.Location.Y + 100);
            Show();

            txtLookFor.SelectAll();
            txtLookFor.Focus();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            SelectionManager selectionManager = (SelectionManager)target;

            DrawDefaultInspector();

            selectionManager.FileName = EditorGUILayout.TextField("File name: ", selectionManager.FileName);

            SerializedProperty objects = serializedObject.FindProperty("_editableObjects");

            if (objects.arraySize <= 0)
            {
                if (GUILayout.Button("Get Editable Object"))
                {
                    selectionManager.GetAllEditableObjects();
                }
            }

            //Uncomment in you want to be able too edit the list
            //EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(objects, true);
            //if (EditorGUI.EndChangeCheck())
            //{
            //serializedObject.ApplyModifiedProperties();
            //}

            if (GUILayout.Button("Save to file"))
            {
                selectionManager.SaveObjectsToFile();
            }

            if (GUILayout.Button("Load from file"))
            {
                selectionManager.LoadObjectsFromFile();
            }
        }
            public void RemoveMultipleItemsWithMultiSelectEnabledAndFilledUpStart_ExistingItems(string scope)
            {
                var addedItems   = new List <int>();
                var removedItems = new List <int>();

                var selectionManager = new SelectionManager <int>
                {
                    AllowMultiSelect = true
                };

                selectionManager.Add(new[] { 4, 5, 6 }, scope);

                selectionManager.SelectionChanged += (sender, e) =>
                {
                    Assert.AreEqual(scope, e.Scope);

                    addedItems.AddRange(e.Added);
                    removedItems.AddRange(e.Removed);
                };

                selectionManager.Remove(new[] { 4, 5, 6 }, scope);

                Assert.AreEqual(0, addedItems.Count);

                Assert.AreEqual(3, removedItems.Count);
                Assert.AreEqual(4, removedItems[0]);
                Assert.AreEqual(5, removedItems[1]);
                Assert.AreEqual(6, removedItems[2]);

                var selectedItems = selectionManager.GetSelectedItems(scope);

                Assert.AreEqual(0, selectedItems.Count);

                var selectedItem = selectionManager.GetSelectedItem(scope);

                Assert.AreEqual(0, selectedItem);
            }
    public static void RemoveNode(Node node, bool markHistory = true)
    {
        if (markHistory)
        {
            HistoryManager.RecordEditor();
        }

        // build the list of Connections to remove
        List <Connection> connectionsToRemove = new List <Connection>();

        connectionsToRemove.AddRange(node.inPoint.connections);

        // remove any associated Interrupt Nodes and Connections
        if (node.nodeType == NodeType.Dialog)
        {
            RemoveInterruptNodes(connectionsToRemove, node);
        }
        else
        {
            connectionsToRemove.AddRange(GetConnections(node));
        }

        // remove all the connections from the global list of connections.
        for (int i = 0; i < connectionsToRemove.Count; i++)
        {
            ConnectionManager.RemoveConnection(connectionsToRemove[i], markHistory: false);
        }


        // free the reference for GC
        connectionsToRemove = null;

        // remove the node from the global node list and the SelectionManager
        mainEditor.nodes.Remove(node);
        SelectionManager.Deselect(node);
    }
Example #35
0
        public TimelineTreeViewGUI(TimelineWindow sequencerWindow, TimelineAsset timeline, Rect rect)
        {
            this.m_Timeline = timeline;
            this.m_Window   = sequencerWindow;
            TreeViewState treeViewState = new TreeViewState();

            this.m_TreeView = new TreeViewController(sequencerWindow, treeViewState);
            this.m_TreeView.set_horizontalScrollbarStyle(GUIStyle.get_none());
            this.m_TimelineTreeView = new TimelineTreeView(sequencerWindow, this.m_TreeView);
            TimelineDragging timelineDragging = new TimelineDragging(this.m_TreeView, this.m_Window, this.m_Timeline);

            this.m_DataSource = new TimelineDataSource(this, this.m_TreeView, sequencerWindow);
            TimelineDataSource expr_7B = this.m_DataSource;

            expr_7B.onVisibleRowsChanged = (Action)Delegate.Combine(expr_7B.onVisibleRowsChanged, new Action(this.m_TimelineTreeView.CalculateRowRects));
            this.m_TreeView.Init(rect, this.m_DataSource, this.m_TimelineTreeView, timelineDragging);
            TreeViewController expr_C0 = this.m_TreeView;

            expr_C0.set_dragEndedCallback((Action <int[], bool>) Delegate.Combine(expr_C0.get_dragEndedCallback(), new Action <int[], bool>(delegate(int[] ids, bool value)
            {
                SelectionManager.Clear();
            })));
            this.m_DataSource.ExpandItems(this.m_DataSource.get_root());
        }
Example #36
0
        public FrameEnvelopeForceResult GetFrameForces(string GroupName, string ComboName, string UnitSystem)
        {
            FrameEnvelopeForceResult result = null;


            ModelUnits units;
            bool       IsValidUnit = Enum.TryParse(UnitSystem, out units);

            if (IsValidUnit == true)
            {
                //Get selected frames

                SelectionManager sm = new SelectionManager(ETABSModel);

                //Use frame extractor to get frame forces
                FrameForceExtractor ext = new FrameForceExtractor(ETABSModel);
                result = ext.GetFrameForces(GroupName, ComboName, units);
            }
            else
            {
                throw new Exception("Invalid Unit System");
            }
            return(result);
        }
Example #37
0
        public void DrawInto(Rect drawRect, GUIStyle style, TimelineWindow.TimelineState state)
        {
            this.CreateInlineCurveEditor(state);
            GUI.BeginClip(drawRect);
            Rect rect = drawRect;

            rect.set_x(0f);
            rect.set_y(0f);
            string str = "";

            if (SelectionManager.Contains(this.clip) && !object.Equals(1.0, this.clip.timeScale))
            {
                str = " " + this.clip.timeScale.ToString("F2") + "x";
            }
            string title = this.m_Styles.Elipsify(this.name, rect, this.m_Styles.fontClip) + str;

            this.DrawClipByDrawer(rect, title, style, state, drawRect.get_x());
            GUI.EndClip();
            if (SelectionManager.Contains(this.clip) && this.supportResize)
            {
                Rect bounds = this.bounds;
                bounds.set_xMin(bounds.get_xMin() + this.m_LeftHandle.bounds.get_width());
                bounds.set_xMax(bounds.get_xMax() - this.m_RightHandle.bounds.get_width());
                EditorGUIUtility.AddCursorRect(bounds, 8);
            }
            if (this.supportResize)
            {
                if (drawRect.get_width() > 3f * TimelineClipGUI.k_HandleWidth)
                {
                    this.m_LeftHandle.Draw(drawRect);
                }
                this.m_RightHandle.Draw(drawRect);
                state.quadTree.Insert(this.m_LeftHandle);
                state.quadTree.Insert(this.m_RightHandle);
            }
        }
        protected override bool UpdateLocation()
        {
            ValidationManager vm = editor.ValidationManager;

            if ((editor.Selection.IsEmpty || vm == null))
            {
                return(SetEmpty());
            }

            SelectionPoint sp = editor.Selection.Start;
            XmlNode        n;
            XmlElement     p = SelectionManager.GetInsertionContext(sp, out n);

            if (node == n && parent == p)
            {
                // nothing changed
                return(false);
            }

            node   = n;
            parent = p;

            return(true);
        }
        internal void NavigateUp()
        {
            if (Direction == TreeViewNavigationDirection.Down)
            {
                Direction = TreeViewNavigationDirection.Up;
                ShouldNavigationSelect = !ShouldNavigationSelect;
            }

            TreeViewItem lastSelectedItem = CurrentNavigationItem;
            var          previous         = lastSelectedItem.GetPrevious();

            if (previous == null)
            {
                return;
            }

            if (previous != Origin)
            {
                if (ShouldNavigationSelect)
                {
                    SelectionManager.SelectItem(previous);
                }
                else
                {
                    SelectionManager.UnselectItem(lastSelectedItem);
                }
            }
            else
            {
                SelectionManager.UnselectItem(lastSelectedItem);
                ShouldNavigationSelect = !ShouldNavigationSelect;
            }

            CurrentNavigationItem = previous;
            CurrentNavigationItem.Focus();
        }
Example #40
0
 public override void Open()
 {
     base.Open();
     currentPlayer = SelectionManager.GetCurrentSelection() as BaseCard;
     if (currentPlayer == null)
     {
         UIManager.CloseActiveWindow();
     }
     else
     {
         // editFields["name"].text = currentPlayer.data.key;
         // editFields["hp"].text = currentPlayer.data.hp.ToString();
         // editFields["dmg"].text = currentPlayer.data.dmg.ToString();
         // editFields["mass"].text = currentPlayer.data.mass.ToString();
         // editFields["drag"].text = currentPlayer.data.drag.ToString();
         // editFields["angulardrag"].text = currentPlayer.data.angularDrag.ToString();
         // editFields["bounciness"].text = currentPlayer.data.bounciness.ToString();
         // editFields["friction"].text = currentPlayer.data.friction.ToString();
         // editFields["scale"].text = currentPlayer.data.scale.ToString();
         //    editFields["speedCutOff"].text = currentPlayer.data.speedCutOff.ToString();
         //    editFields["cutOffTime"].text = currentPlayer.data.cutOffTime.ToString();
         //    editFields["teamId"].text = currentPlayer.data.teamId.ToString();
     }
 }
        internal void NavigateDown()
        {
            if (Direction == TreeViewNavigationDirection.Up)
            {
                Direction = TreeViewNavigationDirection.Down;
                ShouldNavigationSelect = !ShouldNavigationSelect;
            }

            TreeViewItem lastSelectedItem = CurrentNavigationItem;
            var          next             = lastSelectedItem.GetNext();

            if (next == null)
            {
                return;
            }

            if (next != Origin)
            {
                if (ShouldNavigationSelect)
                {
                    SelectionManager.SelectItem(next);
                }
                else
                {
                    SelectionManager.UnselectItem(lastSelectedItem);
                }
            }
            else
            {
                SelectionManager.UnselectItem(lastSelectedItem);
                ShouldNavigationSelect = !ShouldNavigationSelect;
            }

            CurrentNavigationItem = next;
            CurrentNavigationItem.Focus();
        }
Example #42
0
        protected override bool UpdateLocation()
        {
            ValidationManager vm = editor.ValidationManager;

            Selection sel = editor.Selection;

            if ((sel.IsEmpty || vm == null))
            {
                return(SetEmpty());
            }

            XmlNode    n;
            XmlElement p;

            if (sel.IsSingleNode)
            {
                p = null;
                n = sel.Start.Node;
            }
            else
            {
                SelectionPoint sp = sel.Start;
                p = SelectionManager.GetInsertionContext(sp, out n);
            }

            if (node == n && parent == p)
            {
                // nothing changed
                return(false);
            }

            node   = n;
            parent = p;

            return(true);
        }
Example #43
0
    // Use this for initialization
    void Start()
    {
        //This will change as tier increases later
        tier = 1;
        archerTime = 120;

        //Initialize the soldier queue
        soldiers = new Queue ();
        grid = GameObject.FindGameObjectWithTag ("Grid").GetComponent<Grid> ();
        render = GetComponent<SpriteRenderer>();
        selection = grid.GetComponent<SelectionManager> ();
    }
Example #44
0
 protected override void Awake() {
     base.Awake();
     _selectionMgr = SelectionManager.Instance;
     Subscribe();
 }
Example #45
0
        public override Selection Perform(SelectionManager sm)
        {
            SelectionPoint sp=SelectionManager.CreateSelectionPoint(node, false);
            sp=sm.NextSelectionPoint(sp);

            foreach ( XmlNode n in node.ChildNodes )
                node.ParentNode.InsertBefore(n, node);

            node.ParentNode.RemoveChild(node);

            return new Selection(sp);
        }
Example #46
0
        public override Selection Perform(SelectionManager sm)
        {
            XmlElement e=XmlUtil.CreateElement(name, node.OwnerDocument);
            node.ParentNode.InsertBefore(e, node);
            SelectionPoint sp=SelectionManager.CreateSelectionPoint(e, true);

            return new Selection(sp);
        }
        public void ShouldReactToEventsOfPreexistingItemsAddedToConstructor()
        {
            AddStubsToCollection(3);
            collection.Count.ShouldBe(3);

            manager = new SelectionManager<Stub>(collection);
            manager.SelectedItems.Count().ShouldBe(0);

            manager.Collection[0].IsSelected = true;
            selectionChangedCount.ShouldBe(1);

            manager.Collection[2].IsSelected = true;

            manager.Collection[0].IsSelected.ShouldBe(false);
            selectionChangedCount.ShouldBe(2);
        }
Example #48
0
 void Start()
 {
     _sManager = GetComponent<SelectionManager>();
     Register();
 }
Example #49
0
 public override Selection Perform(SelectionManager sm)
 {
     return SelectionManager.Change(Selection.Empty, (XmlElement) node,
         XmlUtil.CreateElement(name, node.OwnerDocument));
 }
Example #50
0
 public override Selection Perform(SelectionManager sm)
 {
     // TODO: M: think about selection returned
     ((XmlElement) node).SetAttribute(name, newValue);
     return sm.CreateSelection(node);
 }
Example #51
0
        public override Selection Perform(SelectionManager sm)
        {
            XmlElement e=XmlUtil.CreateElement(name, node.OwnerDocument);
            node.AppendChild(e);
            SelectionPoint sp=SelectionManager.CreateSelectionPoint(e, true);

            return new Selection(sp);
        }
        /// <summary>
        /// Constructor. Creates new instance of OptimizeAndEditPage, initializes multi collection binding, map control, 
        /// event handlers, PageBase properties and command to cancel routing.
        /// </summary>
        public OptimizeAndEditPage()
        {
            InitializeComponent();

            // Sets parent windoe for docking.
            DockManager1.ParentWindow = Application.Current.MainWindow;

            _InitEventHandlers();

            _InitGeocodablePage();

            // Define main PageBase properties.
            IsRequired = true;
            CanBeLeft = true;
            DoesSupportCompleteStatus = true;
            IsAllowed = true;

            // Add solver handlers.
            IVrpSolver solver = App.Current.Solver;
            if (solver != null)
            {
                solver.AsyncSolveStarted +=
                    new AsyncSolveStartedEventHandler(OptimizeAndEditPage_AsyncSolveStarted);
                solver.AsyncSolveCompleted +=
                    new AsyncSolveCompletedEventHandler(OptimizeAndEditPage_AsyncSolveCompleted);
            }

            _selectionManager = new SelectionManager(this);
            _selectionManager.SelectionChanged +=
                new EventHandler(_SelectionManagerSelectionChanged);

            _dateSelectionKeeper = new DateSelectionKeeper();

            // Create handlers to all editing events.
            _InitEditingEventHandlers();

            // Creates command to cancel routing operation.
            _InitCancelRoutingButtonCommand();

            _InitializeScheduleManager();
        }
Example #53
0
 void Start()
 {
     selectionManager = GetComponent<SelectionManager>();
 }
Example #54
0
        public override Selection Perform(SelectionManager sm)
        {
            SelectionPoint sp=SelectionManager.CreateSelectionPoint(node, true);
            sp=sm.NextSelectionPoint(sp);

            node.ParentNode.RemoveChild(node);

            return new Selection(sp);
        }
Example #55
0
 // Get the selection manager to invoke cancelling
 void Start()
 {
     selection = transform.parent.GetComponent<SelectionManager> ();
 }
Example #56
0
 public abstract Selection Perform(SelectionManager sm);
Example #57
0
 void Start()
 {
     HarvestedResources = new Units.Resources();
     if (playerView == null)
     {
         playerView = GetComponent<Camera>();
     }
     minimap = new Minimap();
     TownCenter center = new TownCenter();
     center.CreateFreeUnit(this, startPos, Quaternion.identity);
     m_selectionManager = new SelectionManager(this);
 }
    // Use this for initialization
    void Start()
    {
        GameObject selectionManager = GameObject.Find("Selection Manager");
        manager = selectionManager.GetComponent<SelectionManager>();

        MVP = camera.projectionMatrix * camera.worldToCameraMatrix;
        meshMaterial = GameObject.Find("Cube").renderer.material;
    }
Example #59
0
 void Start()
 {
     _selection = GetComponent <SelectionManager>();
 }
        public void ShouldNotFailWhenCollectionContainsNullEntries()
        {
            AddStubsToCollection(2);
            collection.Add(null);
            AddStubsToCollection(2);

            manager = new SelectionManager<Stub>(collection);
        }