예제 #1
0
 void Start()
 {
     // This example doesn't use DotMatrix Controller at all, but instead push data directly to DisplayModel
     displayModel = dotMatrix.GetDisplayModel();
     // Run example
     state    = 0;
     runner   = 0f;
     rotation = 0f;
 }
    void Start()
    {
        // Get both controller and display model
        controller   = dotMatrix.GetController();
        displayModel = dotMatrix.GetDisplayModel();

        // Go through all alignments
        for (int vp = 0; vp < 3; vp++)
        {
            for (int hp = 0; hp < 3; hp++)
            {
                for (int ta = 0; ta < 3; ta++)
                {
                    TextCommand testText = new TextCommand((vp == 0 ? "Top" : (vp == 1 ? "Middle" : "Bottom")) + "\n" + (hp == 0 ? "Left" : (hp == 1 ? "Center" : "Right")))
                    {
                        VerPosition   = (vp == 0 ? TextCommand.VerPositions.Top : (vp == 1 ? TextCommand.VerPositions.Middle : TextCommand.VerPositions.Bottom)),
                        HorPosition   = (hp == 0 ? TextCommand.HorPositions.Left : (hp == 1 ? TextCommand.HorPositions.Center : TextCommand.HorPositions.Right)),
                        TextAlignment = (ta == 0 ? TextCommand.TextAlignments.Left : (ta == 1 ? TextCommand.TextAlignments.Center : TextCommand.TextAlignments.Right)),
                        Movement      = AbsCmdPosition.Movements.None
                    };
                    controller.AddCommand(testText);
                    PauseCommand pause = new PauseCommand(1f);
                    controller.AddCommand(pause);
                }
            }
        }

        // Clear
        controller.AddCommand(new ClearCommand());

        // Basic multiple line scrolling text
        string[]    multiLine = new string[] { "Welcome", "back", "to 90s" };
        TextCommand text      = new TextCommand(multiLine)
        {
            Font          = TextCommand.Fonts.Large,
            Movement      = AbsCmdPosition.Movements.MoveUpAndStop,
            DotsPerSecond = 20,
            VerPosition   = AbsCmdPosition.VerPositions.Top,
            HorPosition   = AbsCmdPosition.HorPositions.Left
        };

        controller.AddCommand(text);

        // Add callback "ScrollDone" that is called when Controller reaches this command
        controller.AddCommand(new CallbackCommand(ScrollDone));

        wordsToRandomPositions = false;
    }
예제 #3
0
    public DotMatrix dotMatrix;     // Reference is set in Unity Editor inspector

    void Start()
    {
        // Simple arrows, using 2 colors (1 and 2) in addition to background color (0)

        int[,] arrowContent = new int[, ] {
            { 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0, 0 },
            { 0, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0 },
            { 0, 0, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0 },
            { 0, 0, 0, 1, 1, 1, 0, 0, 0, 2, 2, 2 },
            { 0, 0, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0 },
            { 0, 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0 },
            { 1, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0, 0 }
        };

        // Add arrows to display

        Controller controller = dotMatrix.GetController();

        controller.AddCommand(new ContentCommand(arrowContent));

        // Cycle all the content on display to right, any dots on rightmost column will appear on leftmost column of display

        DisplayModel displayModel = dotMatrix.GetDisplayModel();

        controller.AddCommand(new CallbackCommand(new Action(delegate() {
            displayModel.CycleRight();
        }))
        {
            Repeat = true
        });

        // Take a short break

        controller.AddCommand(new PauseCommand(0.2f)
        {
            Repeat = true
        });

        // Two last commands repeats forever, we are done here
    }
    void Start()
    {
        // Get controller & displaymodel

        controller   = dotMatrix.GetController();
        displayModel = dotMatrix.GetDisplayModel();

        controller.DefaultTextFont           = TextCommand.Fonts.Normal;
        controller.DefaultSpeedDotsPerSecond = 20f;

        // Some colorful texts

        TextCommand text;

        text = new TextCommand("Yellow")
        {
            Movement    = TextCommand.Movements.MoveLeftAndStop,
            HorPosition = AbsCmdPosition.HorPositions.Center,
            TextColor   = 4           // Color 4 is defined as yellow for this display in Unity editor inspector
        };
        controller.AddCommand(text);

        text = new TextCommand("Blue")
        {
            Movement    = TextCommand.Movements.MoveLeftAndStop,
            HorPosition = AbsCmdPosition.HorPositions.Center,
            TextColor   = 3           // Color 3 is defined as blue for this display in Unity editor inspector
        };
        controller.AddCommand(text);

        text = new TextCommand("Green")
        {
            Movement    = TextCommand.Movements.MoveLeftAndStop,
            HorPosition = AbsCmdPosition.HorPositions.Center,
            TextColor   = 2           // Color 2 is defined as green for this display in Unity editor inspector
        };
        controller.AddCommand(text);

        text = new TextCommand("Red")
        {
            Movement    = TextCommand.Movements.MoveLeftAndStop,
            HorPosition = AbsCmdPosition.HorPositions.Center,
            TextColor   = 1           // Color 1 is defined as red for this display in Unity editor inspector
        };
        controller.AddCommand(text);

        text = new TextCommand(" Inverse Green ")
        {
            Movement  = TextCommand.Movements.MoveLeftAndPass,
            TextColor = 0,
            BackColor = 2
        };
        controller.AddCommand(text);

        controller.AddCommand(new TextCommand("R")
        {
            Movement    = TextCommand.Movements.MoveLeftAndStop,
            HorPosition = AbsCmdPosition.HorPositions.Right,
            TextColor   = 1
        });
        controller.AddCommand(new TextCommand("G")
        {
            Movement    = TextCommand.Movements.MoveLeftAndStop,
            HorPosition = AbsCmdPosition.HorPositions.Right,
            TextColor   = 2
        });
        controller.AddCommand(new TextCommand("B")
        {
            Movement    = TextCommand.Movements.MoveLeftAndStop,
            HorPosition = AbsCmdPosition.HorPositions.Right,
            TextColor   = 3
        });

        // Scroll away

        controller.AddCommand(new ClearCommand()
        {
            Method = ClearCommand.Methods.MoveLeft
        });

        // Notify after done

        linesUpdate = 0f;
        runUpdate   = false;

        controller.AddCommand(new CallbackCommand(new Action(delegate() {
            runUpdate = true;
        })));
    }