Update() private method

private Update ( ) : void
return void
Exemplo n.º 1
0
        public override bool UpdateMiddle(GameTime gt)
        {
            LogsSelection.Update();

            if (LogsSelection.Selected)
            {
                if (SaveMode)
                {
                    return(true);
                }
                else
                {
                    if (LogsSelection.SelectedIndex >= 8 ||
                        Properties.Settings.Default.Logs[LogsSelection.SelectedIndex] != "0")
                    {
                        return(true);
                    }
                    else
                    {
                        LogsSelection.Selected = false;
                    }
                }
            }

            return(false);
        }
        //--------------------------------------------------------------------------------------------------

        public void UpdateSelection()
        {
            if (_LastMouseMoveViewportController == null)
            {
                return;
            }
            Selection.Update();
            MouseMove(_LastMouseMovePosition, _LastMouseMoveViewportController);
        }
Exemplo n.º 3
0
        public void Select(ChartObject[] mapObjects, bool exclusive)
        {
            if (mapObjects == null || mapObjects.Length == 0)
            {
                if (exclusive)
                {
                    ClearSelection();
                }
                return;
            }

            BeginUpdateView();

            Selection.Update(mapObjects, exclusive);
            OnSelectionChanged();

            EndUpdateView(ChangeTypes.Visual);
        }
Exemplo n.º 4
0
        private void CreateSelectionItemsCollection(IEnumerable <IdAndValue> items)
        {
            var smartSelectItems = new Collection <SmartSelectItem>();

            foreach (var item in items)
            {
                var smartSelectItem = new SmartSelectItem()
                {
                    Id       = item.Id,
                    IsActive = true,
                    Value    = item.Value
                };

                smartSelectItems.Add(smartSelectItem);
            }

            Selection.Update(smartSelectItems);
        }
Exemplo n.º 5
0
    void Update()
    {
        UpdateCurStepBoxes();

        // selection operations
        selection.Update(curEvent);

        hasSelectedABoxThisFrame = false;

        // should not try to select other box if the selected one is clicked
        if (selection.selectedBox != null && selection.selectedBox.IsClicked(0, curEvent))
        {
            hasSelectedABoxThisFrame = true;
        }
        // try select box
        else
        {
            foreach (var hitbox in hitboxes)
            {
                if (hitbox.IsClicked(0, curEvent))
                {
                    selection.Select(hitbox);

                    hasSelectedABoxThisFrame = true;

                    // dont check all other boxes if one is clicked
                    break;
                }
            }
        }

        // unselection
        if (!hasSelectedABoxThisFrame && selection.selectedBox != null &&
            curEvent.type == EventType.MouseDown && !selection.IsReceivingEvent())
        {
            selection.Unselect();
        }
    }
Exemplo n.º 6
0
 /// <summary>
 /// Update the slide.
 /// </summary>
 /// <param name="gt"></param>
 /// <returns></returns>
 public override bool UpdateMiddle(GameTime gt)
 {
     if (InstructionIndex >= Instructions.Count)
     {
         InstructionIndex--;
         return(true);
     }
     else
     {
         if (Instructions[InstructionIndex] is Action)
         {
             Action a = (Action)Instructions[InstructionIndex];
             InstructionIndex++;
             a.Invoke();
         }
         else if (Instructions[InstructionIndex] is State.State)
         {
             Main.ChangeCurrentState((State.State)Instructions[InstructionIndex]);
         }
         else if (Instructions[InstructionIndex] is Texture2D)
         {
             if (AlphaCounter > 0)
             {
                 AlphaCounter     -= 0.05f;
                 CurrentBackground = (Texture2D)Instructions[InstructionIndex];
             }
             else
             {
                 if (UpdateWithInput())
                 {
                     AlphaCounter = 1;
                 }
             }
         }
         else if (Instructions[InstructionIndex] is String)
         {
             if (AlphaCounter2 < 1)
             {
                 AlphaCounter2 += 0.1f;
                 CurrentText    = WrapText(PersistentContent.GetFont("Slide"), (string)Instructions[InstructionIndex],
                                           900);
             }
             else
             {
                 if (UpdateWithInput())
                 {
                     CurrentText   = "";
                     AlphaCounter2 = 0;
                 }
             }
         }
         else if (Instructions[InstructionIndex] is Selection)
         {
             if (CurrentSelection == null)
             {
                 CurrentSelection = (Selection)Instructions[InstructionIndex];
                 if (CurrentSelection.Question != null)
                 {
                     CurrentSelection.Question = WrapText(PersistentContent.GetFont("Normal"),
                                                          CurrentSelection.Question, 900);
                 }
                 CurrentText = "";
             }
             else
             {
                 if (AlphaCounter2 < 1)
                 {
                     AlphaCounter2 += 0.1f;
                 }
                 else
                 {
                     CurrentSelection.Update();
                     LastSelectionIndex = CurrentSelection.SelectedIndex;
                     if (UpdateWithInput())
                     {
                         CurrentSelection = null;
                         AlphaCounter2    = 0;
                     }
                 }
             }
         }
         else if (Instructions[InstructionIndex] is SoundEffect)
         {
             CurrentBackgroundMusic = new SoundEffectInstance(
                 (SoundEffect)Instructions[InstructionIndex]);
             CurrentBackgroundMusic.IsLooped = false;
             CurrentBackgroundMusic.Play();
             InstructionIndex++;
         }
         else if (Instructions[InstructionIndex] is Soundtrack)
         {
             Soundtrack s = (Soundtrack)Instructions[InstructionIndex];
             s.Play(Main.SongPlayer);
             InstructionIndex++;
         }
         else if (Instructions[InstructionIndex] is Tuple <object, Type> )
         {
             Tuple <object, Type> t = (Tuple <object, Type>)Instructions[InstructionIndex];
             if (t.Item1 == null)
             {
                 if (t.Item2 == typeof(SoundEffect))
                 {
                     CurrentBackgroundMusic.Stop();
                     InstructionIndex++;
                 }
                 else if (t.Item2 == typeof(Texture2D))
                 {
                     CurrentBackground = null;
                     if (UpdateWithInput())
                     {
                         AlphaCounter = 1;
                     }
                 }
             }
             else
             {
                 throw new SlideException("The slide instruction type is not supported!");
             }
         }
         else
         {
             throw new SlideException("The slide instruction type is not supported!");
         }
         return(false);
     }
 }
Exemplo n.º 7
0
 public void OrderSelection()
 {
     Selection.Update(Selection.OrderBy(x => x.Value));
 }
        //--------------------------------------------------------------------------------------------------

        public void MouseMove(Point pos, ViewportController viewportController)
        {
            _LastMouseMovePosition           = pos;
            _LastMouseMoveViewportController = viewportController;

            Selection.Update();

            if (pos.X < 0 || pos.Y < 0)
            {
                // Position is out of bounds, reset highlighting
                Workspace.AisContext.MoveTo(Int32.MinValue, Int32.MinValue, viewportController.Viewport.V3dView, false);;
                Invalidate(true);
                return;
            }

            var status = Workspace.AisContext.MoveTo(Convert.ToInt32(pos.X), Convert.ToInt32(pos.Y), viewportController.Viewport.V3dView, false);

            Invalidate(true);

            if (status != AIS_StatusOfDetection.AIS_SOD_Error)
            {
                Pnt rawPoint;
                if (!viewportController.Viewport.ScreenToPoint(Convert.ToInt32(pos.X), Convert.ToInt32(pos.Y), out rawPoint))
                {
                    IsMouseEventDataValid = false;
                    IsCursorPositionValid = false;
                    return;
                }

                Pnt planePoint;
                if (!viewportController.Viewport.ScreenToPoint(Workspace.WorkingPlane, Convert.ToInt32(pos.X), Convert.ToInt32(pos.Y), out planePoint))
                {
                    IsMouseEventDataValid = false;
                    IsCursorPositionValid = false;
                }

                _LastDetectedInteractive = null;
                _LastDetectedOwner       = null;
                InteractiveEntity detectedEntity = null;
                TopoDS_Shape      detectedShape  = null;
                if (Workspace.AisContext.HasDetected())
                {
                    _LastDetectedInteractive = Workspace.AisContext.DetectedInteractive();
                    _LastDetectedOwner       = Workspace.AisContext.DetectedOwner();
                    detectedEntity           = VisualShapes.GetVisibleEntity(_LastDetectedInteractive);
                    detectedShape            = Occt.Helper.Ais.GetDetectedShapeFromContext(Workspace.AisContext);
                }

                _MouseEventData.Set(viewportController.Viewport, pos, rawPoint, planePoint, detectedEntity, _LastDetectedInteractive, detectedShape);
                IsMouseEventDataValid = true;

                CursorPosition        = planePoint;
                CursorPosition2d      = Workspace.WorkingPlane.Parameters(planePoint);
                IsCursorPositionValid = true;
                bool handled = false;

                if (CurrentTool != null)
                {
                    handled = CurrentTool.OnMouseMove(_MouseEventData);
                }

                if (_ToolActions.Any() && !handled)
                {
                    foreach (var toolAction in _ToolActions)
                    {
                        if (toolAction.OnMouseMove(_MouseEventData))
                        {
                            break;
                        }
                    }
                }

                if (_MouseEventData.ForceReDetection)
                {
                    Workspace.AisContext.MoveTo(Convert.ToInt32(pos.X), Convert.ToInt32(pos.Y), viewportController.Viewport.V3dView, false);
                }

                return;
            }

            IsMouseEventDataValid = false;
            IsCursorPositionValid = false;
        }
Exemplo n.º 9
0
        private void AddPercentsButton_Click(object sender, EventArgs e)
        {
            var All = selectionReqs.GroupBy(GroupRows.Cost);

            SelectionDataView.Rows.Clear();
            List <IDataModel> updatedList = new List <IDataModel>();

            switch (PercentsEn.SelectedIndex)
            {
            case 0:
                foreach (IntercitySelection item in All)
                {
                    IntercitySelection model = new IntercitySelection(
                        item.callPrice + (item.callPrice / 100) * 5,
                        item.Date,
                        item.surname);
                    updatedList.Add(model);
                }
                break;

            case 1:
                foreach (IntercitySelection item in All)
                {
                    IntercitySelection model = new IntercitySelection(
                        item.callPrice + (item.callPrice / 100) * 10,
                        item.Date,
                        item.surname);
                    updatedList.Add(model);
                }
                break;

            case 2:
                foreach (IntercitySelection item in All)
                {
                    IntercitySelection model = new IntercitySelection(
                        item.callPrice + (item.callPrice / 100) * 15,
                        item.Date,
                        item.surname);
                    updatedList.Add(model);
                }
                break;

            case 3:
                foreach (IntercitySelection item in All)
                {
                    IntercitySelection model = new IntercitySelection(
                        item.callPrice + (item.callPrice / 100) * 20,
                        item.Date,
                        item.surname);
                    updatedList.Add(model);
                }
                break;

            default:
                foreach (IntercitySelection item in All)
                {
                    IntercitySelection model = new IntercitySelection(
                        item.callPrice + (item.callPrice / 100) * 5,
                        item.Date,
                        item.surname);
                    updatedList.Add(model);
                }
                break;
            }

            foreach (IntercitySelection item in updatedList)
            {
                selectionReqs.Update(item);
            }

            updatedList = selectionReqs.GroupBy(GroupRows.Cost);
            foreach (IntercitySelection item in updatedList)
            {
                SelectionDataView.Rows.Add(item.callPrice,
                                           item.Date,
                                           item.surname);
            }
        }