Пример #1
0
        private void IntroWindow(int id)
        {
            LoadAndDisplay(KSPUtil.ApplicationRootPath + "GameData/" + IntroPath);


            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("OK", GUILayout.Width(120)))
            {
                showHelp = false;
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Hide this window at startup"))
            {
                showHelp           = false;
                showIntroAtStartup = false;
                ToolbarControl.SaveData();
            }
            GUILayout.EndHorizontal();
            GUI.DragWindow();
        }
Пример #2
0
        private void DoWindow(int id)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("For each mod, select which toolbar to put it's button on.");
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("If the Blizzy toobar is not installed, all buttons will be put on the stock toolbar, regardless of the setting");
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Stock", GUILayout.Width(50));
            GUILayout.Label("Blizzy", GUILayout.Width(50));
            GUILayout.Label("Both", GUILayout.Width(50));
            GUILayout.Label("None", GUILayout.Width(50));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            //ToolbarControl.sortedModList = ToolbarControl.sortedModList.OrderBy(x => x.displayName).ToList();


            scrollVector = GUILayout.BeginScrollView(scrollVector, scrollbar_style, GUILayout.Height(scrollBarHeight));

            foreach (ToolbarControl.Mod mod in ToolbarControl.sortedModList)
            {
                bool doUseButtons = false;
                GUILayout.BeginHorizontal();
                bool stock = GUILayout.Toggle(mod.useStock, "", GUILayout.Width(60));
                if (stock != mod.useStock)
                {
                    if (ToolbarControl.registeredMods[mod.modId].useStock == ToolbarControl.registeredMods[mod.modId].useBlizzy &&
                        ToolbarControl.registeredMods[mod.modId].useStock)
                    {
                        ToolbarControl.registeredMods[mod.modId].useBlizzy = false;
                    }
                    else
                    {
                        ToolbarControl.registeredMods[mod.modId].useStock  = stock;
                        ToolbarControl.registeredMods[mod.modId].useBlizzy = !stock;
                    }

                    doUseButtons = true;
                }

                bool blizzy = GUILayout.Toggle(mod.useBlizzy, "", GUILayout.Width(50));

                if (blizzy != ToolbarControl.registeredMods[mod.modId].useBlizzy)
                {
                    if (ToolbarControl.registeredMods[mod.modId].useStock == ToolbarControl.registeredMods[mod.modId].useBlizzy &&
                        ToolbarControl.registeredMods[mod.modId].useBlizzy)
                    {
                        ToolbarControl.registeredMods[mod.modId].useStock = false;
                    }
                    else
                    {
                        ToolbarControl.registeredMods[mod.modId].useBlizzy = blizzy;
                        ToolbarControl.registeredMods[mod.modId].useStock  = !blizzy;
                    }

                    doUseButtons = true;
                }

                bool both    = (stock & blizzy);
                bool newboth = GUILayout.Toggle(both, "", GUILayout.Width(50));
                if (newboth != both)
                {
                    ToolbarControl.registeredMods[mod.modId].useBlizzy = true;
                    ToolbarControl.registeredMods[mod.modId].useStock  = true;

                    doUseButtons = true;
                }
                if (!ToolbarControl.registeredMods[mod.modId].noneAllowed)
                {
                    GUI.enabled = false;
                }
                bool none    = (!stock & !blizzy);
                bool newnone = GUILayout.Toggle(none, "", GUILayout.Width(25));
                if (newnone != none)
                {
                    ToolbarControl.registeredMods[mod.modId].useBlizzy = false;
                    ToolbarControl.registeredMods[mod.modId].useStock  = false;

                    doUseButtons = true;
                }

                if (doUseButtons)
                {
                    ToolbarControl.SaveData();
                    if (ToolbarControl.registeredMods[mod.modId].modToolbarControl != null)
                    {
                        ToolbarControl.registeredMods[mod.modId].modToolbarControl.UseButtons(mod.modId);
                    }
                    else
                    {
                        Log.Debug("mod.Key: " + mod.modId + " modToolbarControl is null");
                    }
                }
                GUI.enabled = true;
                GUILayout.Label(" " + mod.displayName);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close"))
            {
                GUIEnabled = false;
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("?"))
            {
                IntroWindowClass.showHelp  = true;
                IntroWindowClass.automoved = 0;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUI.DragWindow();
        }