Exemple #1
0
        public override void  OnStart(PartModule.StartState state)
        {
            base.OnStart(state);
            if (state.Equals(PartModule.StartState.Editor))
            {
                return;                                            //don't start stuff in the editor
            }
            windowID      = Util.random();
            mem           = new Int32[4626];
            pointer       = 530;
            charSetPtr    = 18;
            colorPointer  = 2;
            modePtr       = 1;
            scrollPointer = 0;
            colors        = new Color32[16];
            for (int i = 0; i < 16; ++i)
            {
                colors[i]   = new Color32();
                colors[i].a = 255;
            }

            imageBuffer      = new Color32[256 * 256];
            image            = new Texture2D(256, 256, TextureFormat.ARGB32, false);
            image.filterMode = FilterMode.Point;
            windowPos        = new Rect();
            if ((windowPos.x == 0) && (windowPos.y == 0))//windowPos is used to position the GUI window, lets set it in the center of the screen
            {
                windowPos = new Rect(Screen.width / 2, Screen.height / 2, 100, 100);
            }
            //Set all the pixels to black. If you don't do this the image contains random junk.
            for (int y = 0; y < image.height; y++)
            {
                for (int x = 0; x < image.width; x++)
                {
                    image.SetPixel(x, y, Color.black);
                }
            }
            image.Apply();

            //init monitor drawing
            RenderingManager.AddToPostDrawQueue(3, new Callback(draw));

            //initialise fonts and colors and things
            //init default values in memory
            int index = charSetPtr;

            foreach (UInt32 font in getDefaultFont())
            {
                mem[index] = (Int32)font;
                ++index;
            }
            index = colorPointer;
            foreach (Int32 col in getDefaultColors())
            {
                mem[index] = col;
                ++index;
            }
            updateColors();
        }
Exemple #2
0
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     if (state.Equals(PartModule.StartState.Editor))
     {
         return;                                           //don't start stuff in the editor
     }
     vessel.OnFlyByWire += performManouvers;
 }
Exemple #3
0
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     if (state.Equals(StartState.Editor))
     {
         Events["chooseEquipment"].active = true;
     }
     else
     {
         Events["chooseEquipment"].active = false;
     }
 }
    public override void OnStart(PartModule.StartState state)
    {
        if (this.installtime == 0.0 && state.Equals(PartModule.StartState.PreLaunch))
        {
            //if we haven't installed the part yet, we set the installtime to current game time
            this.installtime = (double)Planetarium.GetUniversalTime();
        }

        //Get the number of years from the half-life by dividing # of seconds in a year.
        HalfYears = (float)(HalfLife / 9203400.0);         //Kerbin year
        //HalfYears = (float)(HalfLife / 31540000.0);  //earth year
    }
Exemple #5
0
 //rect initialized here
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     if (state.Equals(PartModule.StartState.Editor))
     {
         return;                                           //don't start anything in the editor
     }
     if (state.Equals(PartModule.StartState.PreLaunch))
     {
         return;                                               //I think starting in prelaunch will f**k things up. Not sure though.
     }
     print("initialising progCom..." + state.ToString());
     if ((windowPos.x == 0) && (windowPos.y == 0))//windowPos is used to position the GUI window, lets set it in the center of the screen
     {
         windowPos = new Rect(Screen.width / 2, Screen.height / 2, 100, 100);
     }
     init();
     //vessel.OnFlyByWire += new FlightInputCallback(performManouvers);
     //RenderingManager.AddToPostDrawQueue(3, new Callback(drawGUI));//start the GUI
     onFlightStart();
     print("Hello, World!");
     consoleWrite("Computer online!");
 }
Exemple #6
0
 //**************************************************************
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     if (state.Equals(PartModule.StartState.Editor))
     {
         return;                                            //don't start stuff in the editor
     }
     windowPos = new Rect();
     if ((windowPos.x == 0) && (windowPos.y == 0))//windowPos is used to position the GUI window, lets set it in the center of the screen
     {
         windowPos = new Rect(Screen.width / 2, Screen.height / 2, 100, 100);
     }
     RenderingManager.AddToPostDrawQueue(3, new Callback(draw));
 }