示例#1
0
    // Extra OLED examples that covers multiple handler data types
    private ScreenHandler OLEDHandlerExamples()
    {
        ScreenedZoneOne zone = UnityEngine.ScriptableObject.CreateInstance <ScreenedZoneOne>();

        // base level line info
        LineDataProgressBar bar  = LineDataProgressBar.Create();
        LineDataText        text = LineDataText.Create("prefix", "suffix", true, 0);

        // base level image
        ImageDataTexture2D image = ImageDataTexture2D.Create(imagetex);

        // create lines from linedata
        LineData bar_line  = LineData.Create(bar);
        LineData text_line = LineData.Create(text);

        // modifiers for static and timed frames
        FrameModifiers mod0 = new FrameModifiers(0, false);
        FrameModifiers mod1 = new FrameModifiers(500, 1);

        // single line frame and single line with timed event frame
        FrameDataSingleLine[] single_line       = { FrameDataSingleLine.Create(bar_line, mod0) };
        FrameDataSingleLine[] multi_single_line = { FrameDataSingleLine.Create(text_line, mod1), FrameDataSingleLine.Create(bar_line, mod1) };



        // multi line frame and multi line with timed event frame
        FrameDataMultiLine[] multi_line = { FrameDataMultiLine.Create(new LineData[] { text_line, bar_line }, mod0) };

        // image frame - change 'Screened128x36ZoneOne' based on which screen you want it displayed on
        FrameDataImage[] image_frame = { FrameDataImage.Create(UnityEngine.ScriptableObject.CreateInstance <Screened128x36ZoneOne>(), image, mod1) };

        // mixing multi-line + image
        AbstractFrameData[] mixed_frames = { FrameDataImage.Create(UnityEngine.ScriptableObject.CreateInstance <Screened128x36ZoneOne>(), image, mod1), FrameDataMultiLine.Create(new LineData[] { text_line, bar_line }, mod0) };

        // range that from event values 0-10 will display multi-line, then from 10-100 displays image
        FrameDataRange[] ranged_frames = { new FrameDataRange(0, 50, multi_line), new FrameDataRange(50, 100, single_line) };



        // Choose from AbstractFrameDataRange[]'s above to pass into handler
        return(ScreenHandler.Create(zone, ScreenMode.screen, ranged_frames)); // can also use multi-line, image_frame, or mixed_frames
    }