Esempio n. 1
0
        public override void OnAwake()
        {
            base.OnAwake();
            Instance = this;
#if false
            if (activeKeoCacheCollections == null)
            {
                activeKeoCacheCollections = new Dictionary <string, KeoCacheCollection>();
            }
#endif
        }
Esempio n. 2
0
        void UpdateEvents()
        {
            Log.Info("UpdateEvents, assigned: " + assigned);
            Log.Info("keocacheId: " + keocacheId);
            Log.Info("collectionId: " + collectionId);
            Log.Info("part.craftID: " + this.part.craftID);
            editInProgressFlag = KeoCacheDriver.editInProgress;

            if (!KeoCacheDriver.editInProgress || (HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel == this.vessel))
            {
                Events["AddToCollection"].guiActive               = false;
                Events["AddToCollection"].guiActiveUnfocused      = false;
                Events["RemoveFromCollection"].guiActive          = false;
                Events["RemoveFromCollection"].guiActiveUnfocused = false;
            }
            else
            {
                if (assigned == AssignStatus.assigned)
                {
                    Events["AddToCollection"].guiActive          = false;
                    Events["AddToCollection"].guiActiveUnfocused = false;
                    // need to see if this is in an active collection, if so, set to false
                    if (KeoScenario.IdInCollection(collectionId))
                    {
                        Log.Info("In collection");
                        Events["RemoveFromCollection"].guiActive          = false;
                        Events["RemoveFromCollection"].guiActiveUnfocused = false;
                    }
                    else
                    {
                        Log.Info("In collection");
                        Events["RemoveFromCollection"].guiActive          = true;
                        Events["RemoveFromCollection"].guiActiveUnfocused = true;
                    }
                }
                else
                {
                    if (assigned == AssignStatus.unassigned)
                    {
                        Events["AddToCollection"].guiActive               = true;
                        Events["AddToCollection"].guiActiveUnfocused      = true;
                        Events["RemoveFromCollection"].guiActive          = false;
                        Events["RemoveFromCollection"].guiActiveUnfocused = false;
                    }
                    else
                    {
                        Events["AddToCollection"].guiActive               = false;
                        Events["AddToCollection"].guiActiveUnfocused      = false;
                        Events["RemoveFromCollection"].guiActive          = false;
                        Events["RemoveFromCollection"].guiActiveUnfocused = false;
                    }
                }
            }
        }
Esempio n. 3
0
        void OnGUI()
        {
            InitializeGUIVars();

            if (hideUI || hideUIwhenPaused)
            {
                return;
            }

            if (HighLogic.CurrentGame.Parameters.CustomParams <KeoCacheOptions>().useKSPskin)
            {
                GUI.skin = HighLogic.Skin;
            }

            if (fsDialog != null && fsDialog.done &&
                fsDialog.SelectedDirectory != null && fsDialog.SelectedFile != null && dialogEntry == null)
            {
                if (fsDialog.SelectedDirectory != "" || fsDialog.SelectedFile != "")
                {
                    KeoScenario.Instance.lastDirectory = fsDialog.SelectedDirectory;
                    localFilePath = fsDialog.SelectedDirectory + FileIO.DirSeperator + fsDialog.SelectedFile;
                    localFilePath = localFilePath.Replace(@"\", "/");
                    if (visibleEditCollection)
                    {
                        var cache = FileIO.LoadKeoCacheData(fsDialog.SelectedDirectory + FileIO.DirSeperator + fsDialog.SelectedFile);
                        if (!visibleAllCollections)
                        {
                            activeKeoCacheCollection = cache;
                        }
                        else
                        {
                            if (!KeoScenario.AddCollection(cache))
                            {
                                // error message here, already in cache
                                ScreenMessages.PostScreenMessage("Collection already loaded", 10f, ScreenMessageStyle.UPPER_CENTER);
                            }
                        }
                    }
                }
                closeFSDialog();
            }
            if (visibleMenu)
            {
                menuWinRect = ClickThruBlocker.GUILayoutWindow(menuWinID, menuWinRect, KeoCaching_Menu_Window, "KeoCaching");
            }
            if (visibleEditCollection && !visibleKeoCache && !visibleAllCollections)
            {
                if (!visibleActiveCollectionsReadOnly)
                {
                    collectionWinRect = ClickThruBlocker.GUILayoutWindow(collectionWinID, collectionWinRect, KeoCaching_Collection_Window, "KeoCache Collection");
                }
                else
                {
                    collectionROWinRect = ClickThruBlocker.GUILayoutWindow(collectionWinID, collectionROWinRect, KeoCaching_Collection_Window, "KeoCache Collection");
                }
            }
            if (visibleKeoCache)
            {
                keocacheWinRect = ClickThruBlocker.GUILayoutWindow(KeocacheWinID, keocacheWinRect, KeoCache_Window, "KeoCache");
            }
            if (visibleHint)
            {
                // Only set the following two IF the hint window hasn't been moved
                // Once it gets moved, then use the saved coordinates
                hintWinRect.x = keocacheWinRect.x + keocacheWinRect.width;
                hintWinRect.y = keocacheWinRect.y;
                hintWinRect   = ClickThruBlocker.GUILayoutWindow(hintWinID, hintWinRect, Hint_Window, "Hint");
            }
            if (visibleTravelBug)
            {
                travelbugWinRect = ClickThruBlocker.GUILayoutWindow(travelbugWinID, travelbugWinRect, TravelBug_Window, "Travel Bugs");
            }
            if (visibleImportWindow)
            {
                importwinRect = ClickThruBlocker.GUILayoutWindow(importWinID, importwinRect, Import_Window, "Import Collection");
            }

            if (visibleAllCollections && !visibleEditCollection)
            {
                string s = "All Collections";
                if (selectForEdit || selectCollection)
                {
                    s = "Available Collections";
                }

                allCollectionsWinRect = ClickThruBlocker.GUILayoutWindow(activeCollectionsID, allCollectionsWinRect, All_Collections_Window, s);
            }
            if (showKerbalX)
            {
                kerbalXWinRect = ClickThruBlocker.GUILayoutWindow(kerbalXWinID, kerbalXWinRect, KerbalXInterface.Instance.IODisplay, "KerbalX Interface");
            }
        }