// Shift the entire strip as a single line, either left or right, circularly or not.
 public void Shift(ScrollDirection direction, ScrollingType scrollingType)
 {
     if (direction == ScrollDirection.Right)
     {
         if (scrollingType == ScrollingType.Circular)
         {
             Array.Copy(pixelBuffer, PixelBufferEnd, backgroundColor, 0, BytesPerPixel);
             Array.Copy(pixelBuffer, 0, pixelBuffer, BytesPerPixel, PixelBufferEnd);
             Array.Copy(backgroundColor, pixelBuffer, BytesPerPixel);
         }
         else
         {
             Array.Copy(pixelBuffer, 0, pixelBuffer, BytesPerPixel, PixelBufferEnd);
             Array.Copy(backgroundColor, pixelBuffer, BytesPerPixel);
         }
     }
     else     // Left Shift
     {
         if (scrollingType == ScrollingType.Circular)
         {
             Array.Copy(pixelBuffer, 0, backgroundColor, 0, BytesPerPixel);
             Array.Copy(pixelBuffer, BytesPerPixel, pixelBuffer, 0, PixelBufferEnd);
             Array.Copy(backgroundColor, 0, pixelBuffer, PixelBufferEnd, BytesPerPixel);
         }
         else
         {
             Array.Copy(pixelBuffer, BytesPerPixel, pixelBuffer, 0, PixelBufferEnd);
             Array.Copy(backgroundColor, 0, pixelBuffer, PixelBufferEnd, BytesPerPixel);
         }
     }
 }
 void ChangeMessage()
 {
     scrollingType = (ScrollingType)Random.Range(0,3); //working
     guiText.text = messages [Random.Range(0, messages.Length)];//working
     StartCoroutine("DisplayMessage");
 }
 // Scroll the entire frame by x pixels either left or right, circularly or not.
 public void Scroll(ScrollDirection direction, ScrollingType scrollingType, int pixelCount) {
     var length = (Width * BytesPerPixel) - BytesPerPixel;
     while (pixelCount != 0) {
         for (var row = 0; row < Height; row += 2) {
             var offset = Width * row * BytesPerPixel;
             if (direction == ScrollDirection.Right) {
                 if (scrollingType == ScrollingType.NonCircular) {
                     Array.Copy(pixelBuffer, offset, pixelBuffer, offset + BytesPerPixel, length);
                     Array.Copy(backgroundColor, 0, pixelBuffer, offset, BytesPerPixel);
                 } else { // Circular
                     Array.Copy(pixelBuffer, offset + length, backgroundColor, 0, BytesPerPixel);
                     Array.Copy(pixelBuffer, offset, pixelBuffer, offset + BytesPerPixel, length);
                     Array.Copy(backgroundColor, 0, pixelBuffer, offset, BytesPerPixel);
                 }
             } else { // Scrolling Left
                 if (scrollingType == ScrollingType.NonCircular) {
                     Array.Copy(pixelBuffer, offset + BytesPerPixel, pixelBuffer, offset, length);
                     Array.Copy(backgroundColor, 0, pixelBuffer, offset + length, BytesPerPixel);
                 } else { // Circular
                     Array.Copy(pixelBuffer, offset, backgroundColor, 0, BytesPerPixel);
                     Array.Copy(pixelBuffer, offset + BytesPerPixel, pixelBuffer, offset, length + BytesPerPixel);
                     Array.Copy(backgroundColor, 0, pixelBuffer, offset + length, BytesPerPixel);
                 }
             }
         }
         for (var row = 1; row < Height; row += 2) {
             var offset = Width * row * BytesPerPixel;
             if (direction == ScrollDirection.Right) {
                 if (scrollingType == ScrollingType.NonCircular) {
                     Array.Copy(pixelBuffer, offset + BytesPerPixel, pixelBuffer, offset, length);
                     Array.Copy(backgroundColor, 0, pixelBuffer, offset + length, BytesPerPixel);
                 } else { // Circular
                     Array.Copy(pixelBuffer, offset, backgroundColor, 0, BytesPerPixel);
                     Array.Copy(pixelBuffer, offset + BytesPerPixel, pixelBuffer, offset, length);
                     Array.Copy(backgroundColor, 0, pixelBuffer, offset + length, BytesPerPixel);
                 }
             } else { // Scrolling Left
                 var lengthLeftScrolling = Width * BytesPerPixel;
                 if (scrollingType == ScrollingType.NonCircular) {
                     ScrollEvenLineLeft(offset, lengthLeftScrolling);
                     Array.Copy(backgroundColor, 0, pixelBuffer, offset, BytesPerPixel);
                 } else { // Circular
                     Array.Copy(pixelBuffer, offset + (lengthLeftScrolling - BytesPerPixel), backgroundColor, 0, BytesPerPixel);
                     ScrollEvenLineLeft(offset, lengthLeftScrolling);
                     Array.Copy(backgroundColor, 0, pixelBuffer, offset, BytesPerPixel);
                 }
             }
         }
         Refresh();
         pixelCount--;
     }
 }
 // Shift the entire strip as a single line, either left or right, circularly or not.
 public void Shift(ScrollDirection direction, ScrollingType scrollingType) {
     if (direction == ScrollDirection.Right) {
         if (scrollingType == ScrollingType.Circular) {
             Array.Copy(pixelBuffer, PixelBufferEnd, backgroundColor, 0, BytesPerPixel);
             Array.Copy(pixelBuffer, 0, pixelBuffer, BytesPerPixel, PixelBufferEnd);
             Array.Copy(backgroundColor, pixelBuffer, BytesPerPixel);
         } else {
             Array.Copy(pixelBuffer, 0, pixelBuffer, BytesPerPixel, PixelBufferEnd);
             Array.Copy(backgroundColor, pixelBuffer, BytesPerPixel);
         }
     } else { // Left Shift
         if (scrollingType == ScrollingType.Circular) {
             Array.Copy(pixelBuffer, 0, backgroundColor, 0, BytesPerPixel);
             Array.Copy(pixelBuffer, BytesPerPixel, pixelBuffer, 0, PixelBufferEnd);
             Array.Copy(backgroundColor, 0, pixelBuffer, PixelBufferEnd, BytesPerPixel);
         } else {
             Array.Copy(pixelBuffer, BytesPerPixel, pixelBuffer, 0, PixelBufferEnd);
             Array.Copy(backgroundColor, 0, pixelBuffer, PixelBufferEnd, BytesPerPixel);
         }
     }
 }
        // Scroll the entire frame by x pixels either left or right, circularly or not.
        public void Scroll(ScrollDirection direction, ScrollingType scrollingType, int pixelCount)
        {
            var length = (Width * BytesPerPixel) - BytesPerPixel;

            while (pixelCount != 0)
            {
                for (var row = 0; row < Height; row += 2)
                {
                    var offset = Width * row * BytesPerPixel;
                    if (direction == ScrollDirection.Right)
                    {
                        if (scrollingType == ScrollingType.NonCircular)
                        {
                            Array.Copy(pixelBuffer, offset, pixelBuffer, offset + BytesPerPixel, length);
                            Array.Copy(backgroundColor, 0, pixelBuffer, offset, BytesPerPixel);
                        }
                        else     // Circular
                        {
                            Array.Copy(pixelBuffer, offset + length, backgroundColor, 0, BytesPerPixel);
                            Array.Copy(pixelBuffer, offset, pixelBuffer, offset + BytesPerPixel, length);
                            Array.Copy(backgroundColor, 0, pixelBuffer, offset, BytesPerPixel);
                        }
                    }
                    else     // Scrolling Left
                    {
                        if (scrollingType == ScrollingType.NonCircular)
                        {
                            Array.Copy(pixelBuffer, offset + BytesPerPixel, pixelBuffer, offset, length);
                            Array.Copy(backgroundColor, 0, pixelBuffer, offset + length, BytesPerPixel);
                        }
                        else     // Circular
                        {
                            Array.Copy(pixelBuffer, offset, backgroundColor, 0, BytesPerPixel);
                            Array.Copy(pixelBuffer, offset + BytesPerPixel, pixelBuffer, offset, length + BytesPerPixel);
                            Array.Copy(backgroundColor, 0, pixelBuffer, offset + length, BytesPerPixel);
                        }
                    }
                }
                for (var row = 1; row < Height; row += 2)
                {
                    var offset = Width * row * BytesPerPixel;
                    if (direction == ScrollDirection.Right)
                    {
                        if (scrollingType == ScrollingType.NonCircular)
                        {
                            Array.Copy(pixelBuffer, offset + BytesPerPixel, pixelBuffer, offset, length);
                            Array.Copy(backgroundColor, 0, pixelBuffer, offset + length, BytesPerPixel);
                        }
                        else     // Circular
                        {
                            Array.Copy(pixelBuffer, offset, backgroundColor, 0, BytesPerPixel);
                            Array.Copy(pixelBuffer, offset + BytesPerPixel, pixelBuffer, offset, length);
                            Array.Copy(backgroundColor, 0, pixelBuffer, offset + length, BytesPerPixel);
                        }
                    }
                    else     // Scrolling Left
                    {
                        var lengthLeftScrolling = Width * BytesPerPixel;
                        if (scrollingType == ScrollingType.NonCircular)
                        {
                            ScrollEvenLineLeft(offset, lengthLeftScrolling);
                            Array.Copy(backgroundColor, 0, pixelBuffer, offset, BytesPerPixel);
                        }
                        else     // Circular
                        {
                            Array.Copy(pixelBuffer, offset + (lengthLeftScrolling - BytesPerPixel), backgroundColor, 0, BytesPerPixel);
                            ScrollEvenLineLeft(offset, lengthLeftScrolling);
                            Array.Copy(backgroundColor, 0, pixelBuffer, offset, BytesPerPixel);
                        }
                    }
                }
                Refresh();
                pixelCount--;
            }
        }
Exemple #6
0
 void ChangeMessage()
 {
     scrollingType = (ScrollingType)Random.Range(0, 3);           //working
     guiText.text  = messages [Random.Range(0, messages.Length)]; //working
     StartCoroutine("DisplayMessage");
 }