Пример #1
0
        void Start()
        {
            ToolbarControl.RegisterMod(Graph.MODID, Graph.MODNAME, false, false, true);

            Graph.instance.InitToolbar();
        }
Пример #2
0
 void Start()
 {
     ToolbarControl.RegisterMod(FuelBalanceController.MODID, FuelBalanceController.MODNAME);
 }
Пример #3
0
 internal void OnDestroy()
 {
     toolbarControl.OnDestroy();
     Destroy(toolbarControl);
     toolbarControl = null;
 }
Пример #4
0
 void Start()
 {
     ToolbarControl.RegisterMod(QStockToolbar.MODID, QStockToolbar.MODNAME);
 }
Пример #5
0
 void Start()
 {
     ToolbarControl.RegisterMod(KEI.MODID, KEI.MODNAME);
 }
Пример #6
0
 void Start()
 {
     ToolbarControl.RegisterMod(AutoAsparagus.MODID, AutoAsparagus.MODNAME);
 }
        public void initToolbar()
        {
#if false
            if (VV == null)
                VV = GameDatabase.Instance.GetTexture("VesselView/Textures/icon38", false);
            if (VVconfig == null)
                VVconfig = GameDatabase.Instance.GetTexture("VesselView/Textures/iconC38", false);
#endif
#if false
            if (ToolbarManager.ToolbarAvailable &&
                HighLogic.CurrentGame.Parameters.CustomParams<VesselViewerPluginSettings>().useToolbarIfAvailable)
            {
                //setup the toolbar buttons
                toolbarButton = ToolbarManager.Instance.add("VV", "VVbutton");
                toolbarButton.TexturePath = "VesselView/Textures/icon";
                toolbarButton.ToolTip = "Vessel View";
                toolbarButton.OnClick += (e) =>
                {
                    ToggleMainWindow();
                };
                buttonC = ToolbarManager.Instance.add("VVC", "VVbuttonC");
                buttonC.TexturePath = "VesselView/Textures/iconC";
                buttonC.ToolTip = "Vessel View Config";
                buttonC.OnClick += (e) =>
                {
                    settings.configScreenVisible = !settings.configScreenVisible;
                };
                if (this.AppLauncherButton != null)
                {
                    ApplicationLauncher.Instance.RemoveModApplication(this.AppLauncherButton);
                    this.AppLauncherButton = null;
                }
            }
            else
            {
                if (this.AppLauncherButton == null)
                {
                    if (ApplicationLauncher.Instance != null)
                    {
                        this.AppLauncherButton = ApplicationLauncher.Instance.AddModApplication(
                            this.ToggleMainWindow, this.ToggleMainWindow,
                            null, null,
                            null, null,
                            ApplicationLauncher.AppScenes.FLIGHT,
                            VV
                        );
                        this.AppLauncherButton.onRightClick = onRightClick;

                    }
                }
                if (this.toolbarButton != null)
                {
                    this.toolbarButton.Destroy();
                    this.toolbarButton = null;
                }
                if (this.buttonC != null)
                {
                    this.buttonC.Destroy();
                    this.buttonC = null;
                }
            }
#endif
            if (toolbarControl == null)
            {
                toolbarControl = gameObject.AddComponent<ToolbarControl>();
                toolbarControl.AddToAllToolbars(ToggleMainWindow, ToggleMainWindow,
                    ApplicationLauncher.AppScenes.FLIGHT,
                    MODID,
                    "vesselViewerButton",
                    "VesselView/Textures/icon-38",
                    "VesselView/Textures/icon-24",
                    MODNAME
                );

                toolbarControlConfig = gameObject.AddComponent<ToolbarControl>();
                toolbarControlConfig.AddToAllToolbars(ToggleToolbarConfig, ToggleToolbarConfig,
                    ApplicationLauncher.AppScenes.FLIGHT,
                    MODIDCONFIG,
                    "vesselViewerConfigButton",
                    "VesselView/Textures/iconC-38",
                    "VesselView/Textures/iconC-24",
                    MODNAMECONFIG
                );
            }
        }
 void Start()
 {
     ToolbarControl.RegisterMod(KVrVesselShotUI.MODID, KVrVesselShotUI.MODNAME);
 }
 void Start()
 {
     ToolbarControl.RegisterMod(SectionNameUI.MODID, SectionNameUI.MODNAME);
 }
Пример #10
0
 void Start()
 {
     ToolbarControl.RegisterMod(Notes2Log.MODID, Notes2Log.MODNAME);
 }
 void Start()
 {
     ToolbarControl.RegisterMod(ClearInputLocks.MODID, ClearInputLocks.MODNAME);
 }
Пример #12
0
 void Start()
 {
     ToolbarControl.RegisterMod(EditorWindow.MODID, EditorWindow.MODNAME);
 }
Пример #13
0
 private void OnTaskbarEdgeChanged(object sender, TaskbarEdgeChangedEventArgs e)
 {
     ToolbarControl.SetTaskbarEdge(e.Edge);
 }
Пример #14
0
        private void AddToolbarUi()
        {
            var control = new ToolbarControl();

            base.AddToToolBar(control, "Standard");
        }
        public void LoadTextureConfigs()
        {
            var files = Directory.GetFiles(Constants.SKIN_DATADIR, "*.cfg");

            foreach (var f in files)
            {
                var fnode = ConfigNode.Load(f);
                if (fnode != null)
                {
                    var n1 = fnode.GetNodes(Constants.TEX_NODES);
                    if (n1 != null)
                    {
                        foreach (var fileNode in n1)
                        {
                            var nodes = fileNode.GetNodes(Constants.FILE_EMISSIVE);
                            if (nodes != null)
                            {
                                foreach (var n in nodes)
                                {
                                    string file     = n.SafeLoad("file", "");
                                    string emissive = n.SafeLoad("emissive", "");
                                    if (file != "")
                                    {
                                        string descr = n.SafeLoad("descr", "");
                                        if (descr == "")
                                        {
                                            descr = Path.GetFileNameWithoutExtension(file);
                                        }
                                        Color EmissiveColor = n.SafeLoad("EmissiveColor", new Color(0.376f, 0.376f, 0.376f, 1f));
                                        if (File.Exists(Constants.MOD_DIR + file))
                                        {
                                            FileEmissive fe = new FileEmissive(file, emissive, descr, EmissiveColor); //, Flight, Iva);

                                            name = Path.GetFileNameWithoutExtension(file);
                                            Texture2D image;
                                            var       thumb = ResizeImage(Constants.MOD_DIR + file, out image);
                                            if (thumb != null)
                                            {
                                                fe.thumb = thumb;
                                                fe.image = image;
                                            }

                                            if (emissive != null && emissive != "")
                                            {
                                                Texture2D emImg = new Texture2D(2, 2);
                                                ToolbarControl.LoadImageFromFile(ref emImg, Constants.MOD_DIR + emissive);
                                                fe.emissiveImg = emImg;
                                            }
                                            if (!fileEmissiveDict.ContainsKey(file))
                                            {
                                                fileEmissiveDict.Add(file, fe);
                                            }
                                            else
                                            {
                                                Log.Error("Duplicate key found: " + file);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Log.Info("Total skins loaded: " + fileEmissiveDict.Count);
        }
        public static void OnGUI()
        {
            // Initialize icon list
            if (icons == null)
            {
                List<GUIContent> content = new List<GUIContent>();

                // Get all the stock icons
                foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture.Where(t => t.name.StartsWith("Squad/Contracts/Icons/")))
                {
                    string name = texInfo.name.Replace("Squad/Contracts/Icons/", "");
                    if (forbiddenIcons.Contains(name))
                    {
                        continue;
                    }

                    content.Add(new GUIContent(ContractDefs.sprites[name].texture, name));
                }

                // Get all the directories for custom icons
                ConfigNode[] iconConfig = GameDatabase.Instance.GetConfigNodes("WAYPOINT_MANAGER_ICONS");
                foreach (ConfigNode configNode in iconConfig)
                {
                    string dir = configNode.GetValue("url");
                    if (Directory.Exists("GameData/" + dir))
                    {
                        foreach (var str in Directory.GetFiles("GameData/" + dir))
                        {
                            var icon = new Texture2D(2, 2);
                            ToolbarControl.LoadImageFromFile(ref icon, str);
                            content.Add(new GUIContent(icon, str));
                        }
                    }
#if false
                    foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture.Where(t => t.name.StartsWith(dir)))
                    {
                        content.Add(new GUIContent(texInfo.texture, texInfo.name));
                    }
#endif
                }

                // Add custom icons
                foreach (string icon in customIcons)
                {
                    foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture)
                    {
                        if (texInfo.name == icon)
                        {
                            content.Add(new GUIContent(texInfo.texture, texInfo.name));
                            break;
                        }
                    }
                }

                icons = content.ToArray();
            }

            // Initialize color list
            if (colors == null)
            {
                List<GUIContent> content = new List<GUIContent>();

                foreach (int seed in seeds)
                {
                    Color color = SystemUtilities.RandomColor(seed, 1.0f, 1.0f, 1.0f);
                    Texture2D texture = new Texture2D(6, 12, TextureFormat.RGBA32, false);

                    Color[] pixels = new Color[6 * 16];
                    for (int i = 0; i < pixels.Length; i++)
                    {
                        pixels[i] = color;
                    }
                    texture.SetPixels(pixels);
                    texture.Compress(true);

                    content.Add(new GUIContent(texture));
                }

                colors = content.ToArray();

                // Set the styles used
                colorWheelStyle = new GUIStyle(GUI.skin.label);
                colorWheelStyle.padding = new RectOffset(0, 0, 2, 2);
                colorWheelStyle.margin = new RectOffset(0, -1, 0, 0);

                colorLabelStyle = new GUIStyle(GUI.skin.label);
                colorLabelStyle.padding = new RectOffset(0, 0, 0, 0);
                colorLabelStyle.margin = new RectOffset(4, 4, 6, 6);
                colorLabelStyle.stretchWidth = true;
                colorLabelStyle.fixedHeight = 12;

                disabledText = new GUIStyle(GUI.skin.textField);
                disabledText.normal.textColor = Color.gray;
            }


            if (WaypointManager.Instance != null && WaypointManager.Instance.visible && !ImportExport.helpDialogVisible)
            {
                if (windowMode != WindowMode.None && windowMode != WindowMode.Delete)
                {
                    wpWindowPos = ClickThruBlocker.GUILayoutWindow(
                        typeof(WaypointManager).FullName.GetHashCode() + 2,
                        wpWindowPos,
                        WindowGUI,
                        windowModeStr[(int)windowMode] + " Waypoint",
                        GUILayout.Height(1), GUILayout.ExpandHeight(true));

                    // Add the close icon
                    if (GUI.Button(new Rect(wpWindowPos.xMax - 18, wpWindowPos.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
                    {
                        windowMode = WindowMode.None;
                    }

                    if (showIconPicker)
                    {
                        // Default iconPicker position
                        if (iconPickerPosition.xMin == iconPickerPosition.xMax)
                        {
                            iconPickerPosition = new Rect((Screen.width - ICON_PICKER_WIDTH) / 2.0f, wpWindowPos.yMax, ICON_PICKER_WIDTH, 1);
                        }

                        iconPickerPosition = ClickThruBlocker.GUILayoutWindow(
                            typeof(WaypointManager).FullName.GetHashCode() + 3,
                            iconPickerPosition,
                            IconPickerGUI,
                            "Icon Selector");

                        // Add the close icon
                        if (GUI.Button(new Rect(iconPickerPosition.xMax - 18, iconPickerPosition.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
                        {
                            showIconPicker = false;
                        }
                    }

                    // Reset the position of the iconPicker window
                    if (!showIconPicker)
                    {
                        iconPickerPosition.xMax = iconPickerPosition.xMin;
                    }
                }
                else if (windowMode == WindowMode.Delete)
                {
                    rmWindowPos = ClickThruBlocker.GUILayoutWindow(
                        typeof(WaypointManager).FullName.GetHashCode() + 2,
                        rmWindowPos,
                        DeleteGUI,
                        windowMode.ToString() + " Waypoint");

                    // Add the close icon
                    if (GUI.Button(new Rect(rmWindowPos.xMax - 18, rmWindowPos.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
                    {
                        windowMode = WindowMode.None;
                    }
                }

                if (showExportDialog)
                {
                    expWindowPos = ClickThruBlocker.GUILayoutWindow(
                        typeof(WaypointManager).FullName.GetHashCode() + 3,
                        expWindowPos,
                        ExportGUI,
                        "Overwrite export file?");

                    // Add the close icon
                    if (GUI.Button(new Rect(expWindowPos.xMax - 18, expWindowPos.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
                    {
                        showExportDialog = false;
                    }
                }

                if (mapLocationMode)
                {
                    PlaceWaypointAtCursor();

                    // Lock the waypoint if the user clicks
                    if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
                    {
                        mapLocationMode = false;
                    }
                }
            }
        }
Пример #17
0
        public virtual void Update()
        {
            this.LoadBeforeUpdate();

            if (
                this.vesselSimActive &&
                (
                    this.Vessel != null ||
                    (
                        HighLogic.LoadedSceneIsEditor &&
                        EditorLogic.RootPart != null &&
                        EditorLogic.SortedShipList.Count > 0
                    )
                )
                )
            {
                Logging.PostDebugMessage(this, "Updating SimManager.");
                this.UpdateSimManager();

                VOIDForEachPartArgs       partArgs;
                VOIDForEachPartModuleArgs moduleArgs;

                Part       part;
                PartModule partModule;

                bool doForEachPart   = this.onForEachPart != null;
                bool doForEachModule = this.onForEachModule != null;

                if (
                    (doForEachPart || doForEachModule) &&
                    (this.Vessel != null) &&
                    (this.Vessel.parts != null) &&
                    this.timeToUpdate
                    )
                {
                    if (this.onPreForEach != null)
                    {
                        this.onPreForEach(this);
                    }

                    for (int pIdx = 0; pIdx < this.Vessel.parts.Count; pIdx++)
                    {
                        part     = this.Vessel.parts[pIdx];
                        partArgs = new VOIDForEachPartArgs(part);

                        if (doForEachPart)
                        {
                            this.onForEachPart(this, partArgs);
                        }

                        if (doForEachModule && part.Modules != null)
                        {
                            for (int mIdx = 0; mIdx < part.Modules.Count; mIdx++)
                            {
                                partModule = part.Modules[mIdx];
                                moduleArgs = new VOIDForEachPartModuleArgs(partModule);

                                if (doForEachModule)
                                {
                                    this.onForEachModule(this, moduleArgs);
                                }
                            }
                        }
                    }

                    if (this.onPostForEach != null)
                    {
                        this.onPostForEach(this);
                    }
                }
            }

            if (!this.GUIRunning && !this.gameUIHidden)
            {
                this.StartGUI();
            }

            IVOID_Module module;

            for (int idx = 0; idx < this.modules.Count; idx++)
            {
                module = this.modules[idx];

                if (
                    !module.GUIRunning &&
                    module.Active &&
                    module.InValidScene &&
                    (
                        !HighLogic.LoadedSceneIsEditor ||
                        (EditorLogic.RootPart != null && EditorLogic.SortedShipList.Count > 0)
                    )
                    )
                {
                    module.StartGUI();
                }
                if (
                    module.GUIRunning &&
                    (
                        !module.Active ||
                        !this.togglePower ||
                        !module.InValidScene ||
                        this.FactoryReset ||
                        (
                            HighLogic.LoadedSceneIsEditor &&
                            (EditorLogic.RootPart == null || EditorLogic.SortedShipList.Count == 0)
                        )
                    )
                    )
                {
                    module.StopGUI();
                }

                if (module is IVOID_BehaviorModule)
                {
                    ((IVOID_BehaviorModule)module).Update();
                }
            }

            if (toolbarControl == null)
            {
                toolbarControl = ThisGameObject.thisGameObject.AddComponent <ToolbarControl>();
                toolbarControl.AddToAllToolbars(this.ToggleMainWindow, this.ToggleMainWindow,
                                                this.appIconVisibleScenes,
                                                MODID,
                                                "voidButton",
                                                "",
                                                "",
                                                MODNAME
                                                );
            }
            this.SetIconTexture(this.powerState | this.activeState);
            if (this.onUpdate != null)
            {
                this.onUpdate(this);
            }

            this.saveTimer += Time.deltaTime;

            if (this.modulesLoaded && this.saveTimer > 2f)
            {
                if (this.configDirty)
                {
                    Logging.PostDebugMessage(string.Format(
                                                 "{0}: Time to save, checking if configDirty: {1}",
                                                 this.GetType().Name,
                                                 this.configDirty
                                                 ));

                    this.SaveConfig();
                    this.saveTimer = 0;
                }
            }

            this.UpdateTimer += Time.deltaTime;
        }
Пример #18
0
 public void OnDisable()
 {
     this._toolbarControl.OnDestroy();
     this._toolbarControl = null;
 }
        void Start()
        {
            ToolbarControl.RegisterMod(PriorityUI.MODID, PriorityUI.MODNAME);

            BtnManager.allSavedDelegateRef = ModDelegateDefinition.LoadUserPriority();
        }
 void Start()
 {
     Debug.Log("UbioWeldingLtd RegisterToolbar");
     ToolbarControl.RegisterMod(EditorToolbar.MODID, Constants.weldManufacturer);
 }
Пример #21
0
 void Start()
 {
     ToolbarControl.RegisterMod(VOIDCore_Generic <VOIDCore_Editor> .MODID, VOIDCore_Generic <VOIDCore_Editor> .MODNAME);
 }
Пример #22
0
 void Start()
 {
     ToolbarControl.RegisterMod(ShipSaveSplicer.MODID, ShipSaveSplicer.MODNAME);
 }
Пример #23
0
 void Start()
 {
     ToolbarControl.RegisterMod(TooManyOrbitsCoreModule.MODID, TooManyOrbitsCoreModule.MODNAME);
 }
 void Destroy()
 {
     toolbarControl.OnDestroy();
     Destroy(toolbarControl);
     toolbarControl = null;
 }
Пример #25
0
 void Start()
 {
     ToolbarControl.RegisterMod(DangerAlertGUI.MODID, DangerAlertGUI.MODNAME);
 }
Пример #26
0
 void Start()
 {
     ToolbarControl.RegisterMod(CivilianPopulationUI.MODID, CivilianPopulationUI.MODNAME);
 }
Пример #27
0
 void Start()
 {
     ToolbarControl.RegisterMod(DebugStuff.MODID, DebugStuff.MODNAME);
 }
 protected void Start()
 {
     ToolbarControl.RegisterMod(MainMenuGui.MODID, MainMenuGui.MODNAME);
 }
Пример #29
0
 void Start()
 {
     ToolbarControl.RegisterMod(FourkSP.MODID, FourkSP.MODNAME);
 }
Пример #30
0
 void Start()
 {
     ToolbarControl.RegisterMod(ChampagneBottle.MODID, ChampagneBottle.MODNAME);
 }