예제 #1
0
        }   // end of UnindentBlock()

        public void MoveUp()
        {
            // If we're already at the top, do nothing.
            if (Index > 0)
            {
                List <ReflexPanel> panels = InGame.inGame.Editor.ActivePanels;

                // Find the block above this on and swap places with it.
                int topIndex = Index - 1;
                while (topIndex > 0)
                {
                    if (panels[topIndex].Reflex.Indentation <= panels[Index].Reflex.Indentation)
                    {
                        break;
                    }
                    --topIndex;
                }

                ReflexBlock topBlock = new ReflexBlock();
                topBlock.Init(topIndex);

                // If the block above this one actually contains this block then
                // we need to shorten the top block.  This can happen if you're
                // moving a child reflex out of a block.
                if (Index < topBlock.Index + topBlock.Size)
                {
                    topBlock.Size = Index - topBlock.Index;
                }

                SwapBlocks(this, topBlock);
            }
        }   // end of MoveUp()
예제 #2
0
        }   // end of MoveUp()

        public void MoveDown()
        {
            List <ReflexPanel> panels = InGame.inGame.Editor.ActivePanels;
            Task task = panels[0].Reflex.Task;

            // Find the block below this one and swap places with it.
            int bottomIndex = Index + Size;

            // If there are no reflexes below this one, there's
            // no place to go so don;t do anything.
            if (bottomIndex < panels.Count)
            {
                ReflexBlock bottomBlock = new ReflexBlock();
                bottomBlock.Init(bottomIndex);

                SwapBlocks(this, bottomBlock);
            }
        }   // end of MoveDown()
예제 #3
0
        }   // end of MoveDown()

        /// <summary>
        /// Put a reflex and its children into "moving" mode.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void MoveReflex(Object sender, EventArgs args)
        {
            Foley.PlayPressA();

            // Init the Moving block.
            ReflexPanel panel    = this.parent as ReflexPanel;
            int         curIndex = panel.LineNumber - 1;

            reflexBlock.Init(curIndex);
            reflexBlock.Moving = true;

            UiCursor.ActiveCursor.Parent = this;

            // switch modes
            this.updateObjPending = this.updateObjMoveReflex;
            this.renderObj.State  = ControlRenderObj.idStateSelected;
            AffixLineNumberToCurrentState();
            BokuGame.objectListDirty = true;
        }   // end of MoveReflex()
예제 #4
0
        }   // end of class ReflexComparer


        /// <summary>
        /// After an action this adjusts the indent level to ensure it's valid.
        /// </summary>
        private void ValidateIndent()
        {
            List <ReflexPanel> panels = InGame.inGame.Editor.ActivePanels;

            int max = Index == 0 ? 0 : panels[Index - 1].Reflex.Indentation + 1;

            while (panels[Index].Reflex.Indentation > max)
            {
                Unindent(false);
            }
            while (panels[Index].Reflex.Indentation < max && panels[Index].Reflex.Indentation < OriginalIndent)
            {
                Indent(false);
            }

            // Moving a block may cause the following block to also need to move.
            // If there are reflexes following this block create a new block and validate it.
            if (Index + Size < panels.Count)
            {
                ReflexBlock block = new ReflexBlock();
                block.Init(Index + Size);
                block.ValidateIndent();
            }
        }   // end of ValidateIndent()