public void Start()
        {
            print("Landing Aid Ver. 3.2 start.");
            thisModule = this;
            //RenderingManager.AddToPostDrawQueue(0, LAOnDraw); //GUI window hook
            byte[] importTxtRed        = File.ReadAllBytes(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/iconRed.png"); //load our button textures
            byte[] importTxtBlue       = File.ReadAllBytes(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/iconBlue.png");
            byte[] importTxt           = File.ReadAllBytes(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/iconWhiteB.png");
            byte[] importTxtRedEnable  = File.ReadAllBytes(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/iconRedEnabled.png");  //load our button textures
            byte[] importTxtBlueEnable = File.ReadAllBytes(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/iconBlueEnabled.png"); //load our button textures


            btnRed.LoadImage(importTxtRed);
            btnRed.Apply();
            btnBlue.LoadImage(importTxtBlue);
            btnBlue.Apply();
            btnGray.LoadImage(importTxt);
            btnGray.Apply();
            btnRedEnable.LoadImage(importTxtRedEnable);
            btnRedEnable.Apply();
            btnBlueEnable.LoadImage(importTxtBlueEnable);
            btnBlueEnable.Apply();
            //RCSla = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/RCSla.settings");

            //forceSASup = Convert.ToBoolean(RCSla.GetValue("ForceSAS"));
            //FlightGlobals.ActiveVessel.OnFlyByWire += RCSLandAidControl;
            if (ToolbarManager.ToolbarAvailable) //check if toolbar available, load if it is
            {
                RCSla1Btn             = ToolbarManager.Instance.add("RCSla", "RCSlaBtn");
                RCSla1Btn.TexturePath = "Diazo/RCSLandAid/iconWhiteB";
                //RCSla1Btn.Text = "RCS";
                RCSla1Btn.ToolTip = "RCS Land Aid";

                RCSla1Btn.OnClick += (e) =>
                {
                    if (e.MouseButton == 0)
                    {
                        LeftClick();
                    }
                    if (e.MouseButton == 1)
                    {
                        RightClick();
                    }
                };
                checkBlizzyToolbar = true;
            }
            else
            {
                //AGXShow = true; //toolbar not installed, show AGX regardless
                //now using stock toolbar as fallback
                //LAButton = ApplicationLauncher.Instance.AddModApplication(onStockToolbarClick, onStockToolbarClick, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.FLIGHT, (Texture)GameDatabase.Instance.GetTexture("Diazo/RCSLandAid/iconWhiteB", false));
                StartCoroutine("AddButtons");
                checkBlizzyToolbar = false;
            }
            //RCSLandingAidWindow RCSwin = new RCSLandingAidWindow();
        }
Esempio n. 2
0
        public void Start()
        {
            print("Landing Aid Ver. 3.2 start.");
            thisModule = this;
            //RenderingManager.AddToPostDrawQueue(0, LAOnDraw); //GUI window hook

            //RCSla = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/Diazo/RCSLandAid/RCSla.settings");

            //forceSASup = Convert.ToBoolean(RCSla.GetValue("ForceSAS"));
            //FlightGlobals.ActiveVessel.OnFlyByWire += RCSLandAidControl;

            AddButtons();
        }
        public void Start()
        {
            if (HighLogic.LoadedSceneIsFlight)
            {
                theLine          = lineObj.AddComponent <LineRenderer>();
                theLine.material = new Material(Shader.Find("Legacy Shaders/Particles/Additive"));
                //theLine.SetColors(Color.red, Color.red);
                RCSLandingAid.SetColors(theLine, Color.blue, Color.blue);
                RCSLandingAid.SetWidth(theLine, 0, 0);
                SetVertexCount(theLine, 2);

                theLine.useWorldSpace              = true;
                this.vessel.OnPostAutopilotUpdate += ControlsOverride;
            }
        }