Ejemplo n.º 1
0
        public override void OnDoubleClick(MouseButtonEventArgs e)
        {
            base.OnDoubleClick(e);

            Paragraph para = RowManager.CurrentParagraph;

            if (para == null)
            {
                return;
            }
            if (Environment.TickCount - lastDoubleClickTicks < 500)
            {
                // Select Paragraph
                SelStart  = para.PositionOffset;
                SelLength = para.Length - 1;
                RowManager.SetCursorAbsPosition(para.PositionOffset + para.Length - 1);
            }
            else
            {
                // Select Word
                RowManager.MovePrevWord();
                SelStart = para.PositionOffset + RowManager.CursorPosition;
                RowManager.MoveEndOfWord();
                SelLength = (para.PositionOffset + RowManager.CursorPosition) - SelStart;

                Invalidate();
                lastDoubleClickTicks = Environment.TickCount;
            }
        }
Ejemplo n.º 2
0
        public void Paste()
        {
            if (!CanPaste)
            {
                return;
            }

            string content = PlatformExtensions.GetClipboardText();

            // Important: filter valid characters
            if (content != null)
            {
                content = new string (content.Where(IsInputChar).ToArray());
            }

            if (!String.IsNullOrEmpty(content))
            {
                SetUndoInsert(content);
                if (SelLength > 0)
                {
                    DeleteSelection();
                }
                SelLength = 0;
                RowManager.InsertRange(PlatformExtensions.GetClipboardText());
                EnsureCurrentRowVisible();
                ResetSelection();
                Modified = true;
                Invalidate();
            }
        }
Ejemplo n.º 3
0
        protected void StartOutOfBoundsSelection(int direction)
        {
            if (VScrollBar == null || !VScrollBar.Visible)
            {
                return;
            }

            OutOfBondsDirection = direction;
            if (OutOfBoundsSelectionTimer == null)
            {
                OutOfBoundsSelectionTimer = new TaskTimer(50, () => {
                    if (OutOfBondsDirection < 0)
                    {
                        RowManager.SetCursorPosition(0, 0 - ScrollOffsetY - Padding.Top - RowManager.LineHeight);
                        SetSelection();
                    }
                    else if (OutOfBondsDirection > 0)
                    {
                        RowManager.SetCursorPosition(0, Height - ScrollOffsetY + Padding.Height + RowManager.LineHeight + RowManager.LineHeight);
                        SetSelection();
                    }

                    EnsureCurrentRowVisible();
                    VScrollBar.Value += OutOfBondsDirection * VScrollBar.SmallChange;
                }, 500);
                OutOfBoundsSelectionTimer.Start();
            }
            else if (!OutOfBoundsSelectionTimer.Enabled)
            {
                OutOfBoundsSelectionTimer.Start();
            }
        }
    private void Awake()
    {
        blockInput = GameObject.FindGameObjectWithTag(ConstVar.tag_controller).GetComponent <BlockInput>();
        row1       = GameObject.Find("ROW_1");
        rowManager = row1.GetComponent <RowManager>();

        // Getting list of prefabs to randomly choose one that will be created
        listOfPrefabs = transform.GetComponent <ListOfPrefabs>();

        // Checking what type of game user has chosen, then we set block_falling_rate
        switch (ActiveGame.gameLevel)
        {
        case ActiveGame.difficulty.easy:
            block_falling_rate = 0.8f;
            block_death_rate   = 0.8f;
            break;

        case ActiveGame.difficulty.medium:
            block_falling_rate = 0.6f;
            block_death_rate   = 0.6f;
            break;

        case ActiveGame.difficulty.hard:
            block_falling_rate = 0.4f;
            block_death_rate   = 0.4f;
            break;
        }

        blocksNames[0] = "Cube.000";
        blocksNames[1] = "Cube.001";
        blocksNames[2] = "Cube.002";
        blocksNames[3] = "Cube.003";
    }
Ejemplo n.º 5
0
    void FindScripts()
    {
        // Find Controller GameObject
        GameObject controller =  Camera.main.gameObject;

        // Attach scripts that are attached to controller object
        sc_CameraController = controller.GetComponent<CameraController>();
        sc_GameController   = controller.GetComponent<GameController>();
        sc_LevelManager     = controller.GetComponent<LevelManager>();
        sc_RowManager       = controller.GetComponent<RowManager>();

        // Find Scripts not attached to controller object
        sc_AudioManager     = GameObject.Find("audio_manager").GetComponent<AudioManager>();

        if (LevelName == "Intro") return;

        sc_FadeToScene      = GameObject.FindGameObjectWithTag("Fade").GetComponent<FadeToScene>();
        sc_HighScoreManager = GameObject.FindGameObjectWithTag("Scores").GetComponent<HighScoreManager>();

        if (CheckObjectExist("score_tracker"))
            sc_ScoreTracker     = GameObject.Find("score_tracker").GetComponent<ScoreTracker>();

        if (CheckObjectExist("glow_ball"))
            sc_BallController   = GameObject.Find("glow_ball").GetComponent<BallController>();

        if (CheckObjectExist("boundaries"))
            sc_BoundaryManager   = GameObject.Find("boundaries").GetComponent<BoundaryManager>();
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes the database. Sets up data collections.
 /// </summary>
 /// <param name="options"></param>
 public Database(DatabaseOptions options)
 {
     Options    = options;
     Classes    = new List <VltClass>();
     Types      = new List <DatabaseTypeInfo>();
     Vaults     = new List <Vault>();
     RowManager = new RowManager(this);
 }
Ejemplo n.º 7
0
 public void DeleteRange(int pos, int len)
 {
     if (ReadOnly)
     {
         return;
     }
     RowManager.DeleteRange(pos, len);
 }
Ejemplo n.º 8
0
        public override void OnPaint(IGUIContext ctx, RectangleF bounds)
        {
            base.OnPaint(ctx, bounds);

            bounds.Offset(Padding.Left, Padding.Top);

            int lineHeight = RowManager.LineHeight;
            int offsetY    = (int)ScrollOffsetY;

            int      rowIndex = RowManager.FirstParagraphOnScreen;
            IGUIFont font     = RowManager.Font;

            try {
                while (rowIndex < RowManager.Paragraphs.Count)
                {
                    Paragraph para      = RowManager.Paragraphs[rowIndex];
                    Rectangle rowBounds = new Rectangle((int)bounds.Left + (int)ScrollOffsetX,
                                                        (int)(bounds.Top + para.Top + offsetY),
                                                        (int)bounds.Width,
                                                        lineHeight);

                    var glyphLines = para.ToGlyphs();

                    foreach (var line in glyphLines)
                    {
                        if (rowBounds.Bottom > bounds.Top)
                        {
                            font.Begin(ctx);
                            font.PrintTextLine(line.Select(g => g.Glyph).ToArray(), rowBounds, Style.ForeColorBrush.Color);
                            font.End();
                        }
                        rowBounds.Offset(0, lineHeight);
                        if (rowBounds.Top > bounds.Bottom)
                        {
                            break;
                        }
                    }

                    if (rowBounds.Top > bounds.Bottom)
                    {
                        break;
                    }

                    rowIndex++;
                }

                if (CursorOn && CursorVisible)
                {
                    RectangleF CursorRectangle = RowManager.CalcCursorRectangle();
                    int        x  = Math.Max((int)bounds.Left + 1, (int)(CursorRectangle.X + bounds.Left + ScrollOffsetX + 0.5f));
                    float      y1 = CursorRectangle.Top + bounds.Top + ScrollOffsetY + 2;
                    float      y2 = y1 + CursorRectangle.Height - 4;
                    ctx.DrawLine(CursorPen, x, y1, x, y2);
                }
            } catch (Exception ex) {
                ex.LogError();
            }
        }
Ejemplo n.º 9
0
 internal void LeaveRow(ToolStrip toolStripToDrag)
 {
     RowManager.LeaveRow(toolStripToDrag);
     if (ControlsInternal.Count == 0)
     {
         ToolStripPanel.RowsInternal.Remove(this);
         Dispose();
     }
 }
Ejemplo n.º 10
0
    // Use this for initialization
    void Awake()
    {
//		GameObject.FindGameObjectWithTag()
        buttonOkay   = GameObject.FindGameObjectWithTag(Tags.ModalOk).GetComponent <ButtonPlus>();
        buttonNo     = GameObject.FindGameObjectWithTag(Tags.ModalNo).GetComponent <ButtonPlus>();
        buttonCancel = GameObject.FindGameObjectWithTag(Tags.ModalCancel).GetComponent <ButtonPlus>();
        title        = GameObject.FindGameObjectWithTag(Tags.ModalTitle).GetComponent <Text>();
        rowManager   = GetComponentInChildren <RowManager> ();
    }
Ejemplo n.º 11
0
        /// <summary>
        /// Begins inserting child row after specified child row.
        /// </summary>
        /// <param name="child">The specified child row, <see langword="null"/> if insert as last child row.</param>
        public void BeginInsertAfter(RowPresenter child = null)
        {
            VerifyInsert(child);
            var elementManager = ElementManager;

            elementManager?.SuspendInvalidateView();
            RowManager.BeginInsertAfter(this, child);
            elementManager?.ResumeInvalidateView();
        }
Ejemplo n.º 12
0
        public void SelectPoint(GraphPoint point)
        {
            int index = Points.IndexOf(point);

            if (index >= 0 && index < Points.Count)
            {
                RowManager.CurrentRowIndex = index;
                RowManager.EnsureRowindexVisible(index);
            }
        }
Ejemplo n.º 13
0
 public void DeleteSelection()
 {
     if (CanDelete)
     {
         RowManager.DeleteRange(SelStart, SelLength);
         RowManager.SetCursorAbsPosition(SelStart);
         ResetSelection();
         Modified = true;
     }
 }
Ejemplo n.º 14
0
        protected internal virtual void OnControlAdded(Control control, int index)
        {
            // if previously added - remove.

            if (control is ISupportToolStripPanel controlToBeDragged)
            {
                controlToBeDragged.ToolStripPanelRow = this;
            }
            RowManager.OnControlAdded(control, index);
        }
Ejemplo n.º 15
0
        public void Copy()
        {
            if (!CanCopy)
            {
                return;
            }
            string content = RowManager.GetCharRange(SelStart, SelLength);

            PlatformExtensions.SetClipboardText(content);
            Modified = true;
        }
Ejemplo n.º 16
0
 void SetUndoDelete(int pos, int delLen)
 {
     UndoRedoManager.Do(new UndoRedoDeleteMemento {
         ScrollOffset = ScrollOffset,
         SelStart     = SelStart,
         SelLength    = SelLength,
         SelectedText = SelectedText,
         Position     = pos,
         Data         = RowManager.GetCharRange(pos, delLen),
     });
 }
Ejemplo n.º 17
0
 public void AddContact(Contact contact)
 {
     if (contact == null)
     {
         return;
     }
     Contacts.Add(contact);
     contact.ID          = Contacts.Count;
     RowManager.RowCount = Contacts.Count;
     RowManager.MoveLast();
 }
Ejemplo n.º 18
0
    private void Awake()
    {
        ready = false;

        blocksNames[0] = "Cube.000";
        blocksNames[1] = "Cube.001";
        blocksNames[2] = "Cube.002";
        blocksNames[3] = "Cube.003";

        rowManager = transform.parent.GetComponent <RowManager>();
    }
Ejemplo n.º 19
0
 public virtual void SelectAll()
 {
     if (!CanSelectAll)
     {
         return;
     }
     RowManager.MoveHome();
     ResetSelection();
     RowManager.MoveEnd();
     SetSelection();
     EnsureCurrentRowVisible();
     Update(true);
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Cancels the editing mode.
        /// </summary>
        public void CancelEdit()
        {
            if (!IsEditing)
            {
                throw new InvalidOperationException(DiagnosticMessages._VerifyIsEditing);
            }

            var elementManager = ElementManager;

            elementManager?.SuspendInvalidateView();
            RowManager.CancelEdit();
            elementManager?.ResumeInvalidateView();
        }
Ejemplo n.º 21
0
        public override void Update(IGUIContext ctx)
        {
            // this sets RowManager.FirstParagraphOnScreen
            // to a common value for the following OnPaintBackground and OnPaint
            // so that all paintings are guaranteed synchronized and thus flicker-free

            // An important point about such implementations:
            // * The "manager" calculates everything in it's own absolute (0/0) metrics.
            // * The "presenter" (this class) finally adds all kinds of "Offsets" (Paddings, Scrolling, ..)
            // otherwise you'd have to deal with strange feedback effects
            // which can make life very very hard.

            RowManager.OnLayout(-ScrollOffsetY);
            base.Update(ctx);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Ends the editing mode.
        /// </summary>
        /// <param name="staysOnInserting">Indicates whether should stay on inserting.</param>
        /// <returns>The row presenter.</returns>
        public RowPresenter EndEdit(bool staysOnInserting = true)
        {
            if (!IsEditing)
            {
                throw new InvalidOperationException(DiagnosticMessages._VerifyIsEditing);
            }

            var elementManager = ElementManager;

            elementManager?.SuspendInvalidateView();
            var result = RowManager.EndEdit(staysOnInserting);

            elementManager?.ResumeInvalidateView();
            return(result);
        }
Ejemplo n.º 23
0
        private void LeasingChart_Unloaded(object sender, RoutedEventArgs e)
        {
            Unloaded -= LeasingChart_Unloaded;

            Subscribe(false);

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

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

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

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

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

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

            if (m_tooltipM != null)
            {
                m_tooltipM.Dispose();
                m_tooltipM = null;
            }
        }
Ejemplo n.º 24
0
        public override void OnMouseDown(MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button == MouseButton.Left)
            {
                RowManager.SetCursorPosition(e.X - Left - ScrollOffsetX - Padding.Left, e.Y - Top - ScrollOffsetY - Padding.Top);
                m_SelStart = RowManager.AbsCursorPosition;
                if (!ModifierKeys.ShiftPressed)
                {
                    SelLength = 0;
                }
                IsMouseMoving = true;
                CursorOn      = true;
            }
            Invalidate();
        }
Ejemplo n.º 25
0
        protected override void CleanupUnmanagedResources()
        {
            if (OutOfBoundsSelectionTimer != null)
            {
                StopOutOfBoundsSelection();
                OutOfBoundsSelectionTimer.Dispose();
            }

            if (painter.IsValueCreated)
            {
                painter.Value.Clear();
                painter.Value.Dispose();
            }

            UndoRedoManager.Dispose();
            RowManager.Dispose();
            base.CleanupUnmanagedResources();
        }
Ejemplo n.º 26
0
        // *** Clipboard ***

        public void Cut()
        {
            if (!CanCut)
            {
                return;
            }

            int pos = RowManager.AbsCursorPosition;

            this.SetUndoDelete(pos, 0);

            string content = RowManager.GetCharRange(SelStart, SelLength);

            DeleteSelection();
            PlatformExtensions.SetClipboardText(content);
            ResetSelection();
            Invalidate();
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Begins the editing mode.
        /// </summary>
        public void BeginEdit()
        {
            if (IsEditing)
            {
                return;
            }

            VerifyIsCurrent();
            VerifyNoPendingEdit();
            if (IsVirtual && RowManager.Template.VirtualRowPlacement == VirtualRowPlacement.Exclusive)
            {
                throw new InvalidOperationException(DiagnosticMessages.RowPresenter_BeginEditExclusiveVirtual);
            }
            var elementManager = ElementManager;

            elementManager?.SuspendInvalidateView();
            RowManager.BeginEdit();
            elementManager?.ResumeInvalidateView();
        }
Ejemplo n.º 28
0
        public LeasingChart()
        {
            InitializeComponent();

            m_gridM      = new CanvasGridDrawManager(this);
            m_barM       = new CanvasBarDrawManager(this);
            m_textM      = new CanvasTextDrawManager(this);
            m_rowLayoutM = new CanvasRowLayoutDrawManager(this);
            //важно!!! подписывать крайним - зависим (подписывается) от других
            m_rowM        = new RowManager(this);
            m_hightlightM = new HightlightManager(this);
            m_tooltipM    = new TooltipManager(this);

            base.Unloaded += LeasingChart_Unloaded;

            m_children = new VisualCollection(this);

            Subscribe(true);
        }
Ejemplo n.º 29
0
        public void Delete()
        {
            if (!CanDelete)
            {
                return;
            }

            int pos = RowManager.AbsCursorPosition;

            if (SelLength > 0)
            {
                this.SetUndoDelete(pos, 0);
                DeleteSelection();
            }
            else
            {
                this.SetUndoDelete(pos, 1);
                RowManager.DeleteCurrentChar();
            }
        }
Ejemplo n.º 30
0
        protected virtual void OnLayout(LayoutEventArgs e)
        {
            if (Initialized && !_state[s_stateInLayout])
            {
                _state[s_stateInLayout] = true;
                try
                {
                    Margin           = DefaultMargin;
                    CachedBoundsMode = true;
                    try
                    {
                        // dont layout in the constructor that's just tacky.
                        bool parentNeedsLayout = LayoutEngine.Layout(this, e);
                    }
                    finally
                    {
                        CachedBoundsMode = false;
                    }

                    ToolStripPanelCell cell = RowManager.GetNextVisibleCell(Cells.Count - 1, /*forward*/ false);
                    if (cell is null)
                    {
                        ApplyCachedBounds();
                    }
                    else if (Orientation == Orientation.Horizontal)
                    {
                        OnLayoutHorizontalPostFix();
                    }
                    else
                    {
                        OnLayoutVerticalPostFix();
                    }
                }
                finally
                {
                    _state[s_stateInLayout] = false;
                }
            }
        }
Ejemplo n.º 31
0
        protected internal virtual void OnControlRemoved(Control control, int index)
        {
            if (!_state[s_stateDisposing])
            {
                SuspendLayout();
                RowManager.OnControlRemoved(control, index);

                // if previously added - remove.

                if (control is ISupportToolStripPanel controlToBeDragged && controlToBeDragged.ToolStripPanelRow == this)
                {
                    controlToBeDragged.ToolStripPanelRow = null;
                }

                ResumeLayout(true);
                if (ControlsInternal.Count <= 0)
                {
                    ToolStripPanel.RowsInternal.Remove(this);
                    Dispose();
                }
            }
        }
Ejemplo n.º 32
0
    void Start()
    {
        // Attach Scripts to holders
        sc_ScriptHelper     = Camera.main.GetComponent<ScriptHelper>();
        sc_BallController   = sc_ScriptHelper.sc_BallController;
        sc_BoundaryManager  = sc_ScriptHelper.sc_BoundaryManager;
        sc_CameraController = sc_ScriptHelper.sc_CameraController;
        sc_GameController   = sc_ScriptHelper.sc_GameController;
        sc_RowManager       = sc_ScriptHelper.sc_RowManager;

        // Set intermission time intertval
        Time_Between_Intermission = 5.0f;

        // Set intermission height
        BallIntermissionHeight = 65;

        // Set speed at which rows move up
        LevelSpeed = 2.0f;
        sc_RowManager.SET_RowSpeed(LevelSpeed);

        StartCoroutine( StartInitermission() );
    }