示例#1
0
        internal override RawCommand getRawCommand(DotMatrix dotMatrix, DisplayModel displayModel, Controller controller)
        {
            // Choose font and text alignment

            Fonts fontToUse = (fontSet?font:controller.DefaultTextFont);

            TextAlignments textAlignmentToUse;

            if (textAlignmentSet)
            {
                textAlignmentToUse = textAlignment;
            }
            else
            {
                if (this.HorPosition == HorPositions.Right)
                {
                    textAlignmentToUse = TextAlignments.Right;
                }
                else if (this.HorPosition == HorPositions.Center)
                {
                    textAlignmentToUse = TextAlignments.Center;
                }
                else
                {
                    textAlignmentToUse = TextAlignments.Left;
                }
            }

            // Get content
            int[,] content = TextToContent.getContent(textLines, fontToUse, fixedWidth, bold, textColor, backColor, charSpacing, lineSpacing, textAlignmentToUse);

            // Create raw command with this content
            return(base.getRawCommand(dotMatrix, displayModel, controller, content));
        }
示例#2
0
        internal void init(DotMatrix dotMatrix, DisplayModel displayModel)
        {
            // Set references and get display size
            this.displayModel = displayModel;
            int width  = displayModel.Width;
            int height = displayModel.Height;

            // Create dots
            createDots(RUNTIME_GROUP_NAME, width, height, borderDots);

            // Broken dots
            setBrokenDots(width, height, false);
            currentBrokenAlwaysOffDots = brokenAlwaysOffDots;
            currentBrokenAlwaysOnDots  = brokenAlwaysOnDots;

            // Set each dot initial state
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    displayDots[y, x].setNewStateInstantly(0);
                }
            }

            // Done
            runOwnUpdate        = false;
            needFullStateUpdate = false;
            runtimeInitDone     = true;
        }
示例#3
0
 internal Controller(DotMatrix dotMatrix, DisplayModel displayModel)
 {
     this.dotMatrix            = dotMatrix;
     this.displayModel         = displayModel;
     commands                  = new List <AbsCmd>();
     rawCommand                = null;
     timeToConsume             = 0f;
     defaultSpeedDotsPerSecond = 42;
     defaultTextFont           = TextCommand.Fonts.Normal;
 }
示例#4
0
        internal override RawCommand getRawCommand(DotMatrix dotMatrix, DisplayModel displayModel, Controller controller)
        {
            float dotsPerSecond = this.getDotsPerSecond(controller.DefaultSpeedDotsPerSecond);

            if (method == Methods.Instant || dotsPerSecond <= 0f)
            {
                return(new RawCommandClear(targetState));
            }
            else if (method == ClearCommand.Methods.MoveLeft || method == ClearCommand.Methods.MoveRight || method == ClearCommand.Methods.MoveUp || method == ClearCommand.Methods.MoveDown)
            {
                return(new RawCommandClear(targetState, method, dotsPerSecond));
            }
            else if (method == ClearCommand.Methods.ColumnByColumnFromLeft || method == ClearCommand.Methods.ColumnByColumnFromRight)
            {
                return(new RawCommandClear(targetState, method, dotsPerSecond, displayModel.Width));
            }
            else if (method == ClearCommand.Methods.RowByRowFromTop || method == ClearCommand.Methods.RowByRowFromBottom)
            {
                return(new RawCommandClear(targetState, method, dotsPerSecond, displayModel.Height));
            }
            // Should be never reached
            return(null);
        }
示例#5
0
        public override void OnInspectorGUI()
        {
            Undo.RecordObject(target, "DotMatrix Change");

            DotMatrix dmTarget = (DotMatrix)(target);

            EditorCommon.addHeader("Auto Init");

            dmTarget.initOnStart = EditorGUILayout.Toggle("Init on start", dmTarget.initOnStart);

            int indentLevel = EditorGUI.indentLevel;

            EditorGUI.indentLevel = indentLevel + 1;
            if (dmTarget.initOnStart)
            {
                EditorCommon.addNote("When application is playing, DotMatrix inits and display dots are created immediately when this gameobject starts (default setting)");
            }
            else
            {
                EditorCommon.addNote("When application is playing, DotMatrix dots are not created until Init() method of this script is called");
            }
            EditorGUI.indentLevel = indentLevel;
        }
        internal RawCommand getRawCommand(DotMatrix dotMatrix, DisplayModel displayModel, Controller controller, int[,] content)
        {
            int totalHeight = content.GetLength(0);
            int totalWidth  = content.GetLength(1);

            Movements movement      = this.Movement;
            float     dotsPerSecond = this.getDotsPerSecond(controller.DefaultSpeedDotsPerSecond);

            if (dotsPerSecond <= 0f)
            {
                movement = Movements.None;
            }

            int posX = 0;
            int posY = 0;

            if (this.HorPosition == HorPositions.Right)
            {
                posX = displayModel.Width - totalWidth;
            }
            else if (this.HorPosition == HorPositions.Center)
            {
                posX = (displayModel.Width - totalWidth) / 2;
            }
            if (this.VerPosition == VerPositions.Bottom)
            {
                posY = displayModel.Height - totalHeight;
            }
            else if (this.VerPosition == VerPositions.Middle)
            {
                posY = (displayModel.Height - totalHeight) / 2;
            }

            if (movement == Movements.None)
            {
                return(new RawCommandContent(content, posX, posY));
            }

            int push = 0;

            if (movement == Movements.MoveLeftAndStop)
            {
                if (this.HorPosition == HorPositions.Left)
                {
                    push = displayModel.Width;
                }
                else if (this.HorPosition == HorPositions.Right)
                {
                    push = totalWidth;
                }
                else if (this.HorPosition == HorPositions.Center)
                {
                    push = (displayModel.Width + totalWidth) / 2;
                }
            }
            else if (movement == Movements.MoveRightAndStop)
            {
                if (this.HorPosition == HorPositions.Left)
                {
                    push = totalWidth;
                }
                else if (this.HorPosition == HorPositions.Right)
                {
                    push = displayModel.Width;
                }
                else if (this.HorPosition == HorPositions.Center)
                {
                    push = (displayModel.Width + totalWidth) / 2;
                }
            }
            else if (movement == Movements.MoveLeftAndPass || movement == Movements.MoveRightAndPass)
            {
                push = displayModel.Width + totalWidth;
            }
            else if (movement == Movements.MoveUpAndStop)
            {
                if (this.VerPosition == VerPositions.Top)
                {
                    push = displayModel.Height;
                }
                else if (this.VerPosition == VerPositions.Bottom)
                {
                    push = totalHeight;
                }
                else if (this.VerPosition == VerPositions.Middle)
                {
                    push = (displayModel.Height + totalHeight) / 2;
                }
            }
            else if (movement == Movements.MoveDownAndStop)
            {
                if (this.VerPosition == VerPositions.Top)
                {
                    push = totalHeight;
                }
                else if (this.VerPosition == VerPositions.Bottom)
                {
                    push = displayModel.Height;
                }
                else if (this.VerPosition == VerPositions.Middle)
                {
                    push = (displayModel.Height + totalHeight) / 2;
                }
            }
            else if (movement == Movements.MoveUpAndPass || movement == Movements.MoveDownAndPass)
            {
                push = displayModel.Height + totalHeight;
            }

            return(new RawCommandContent(content, posX, posY, movement, push, dotsPerSecond));
        }
示例#7
0
 internal abstract RawCommand getRawCommand(DotMatrix dotMatrix, DisplayModel displayModel, Controller controller);
示例#8
0
 internal override RawCommand getRawCommand(DotMatrix dotMatrix, DisplayModel displayModel, Controller controller)
 {
     return(new RawCommandDelay(pauseSeconds));
 }
 internal override RawCommand getRawCommand(DotMatrix dotMatrix, DisplayModel displayModel, Controller controller)
 {
     return(base.getRawCommand(dotMatrix, displayModel, controller, content));
 }
示例#10
0
 internal override RawCommand getRawCommand(DotMatrix dotMatrix, DisplayModel displayModel, Controller controller)
 {
     return(new RawCommandCallback(callback));
 }