コード例 #1
0
ファイル: OpsView.cs プロジェクト: ozraven/WildBlueTools
        public void GetPartModules()
        {
            commandModule = this.part.FindModuleImplementing <ModuleCommand>();
            if (commandModule != null)
            {
                foreach (BaseEvent cmdEvent in commandModule.Events)
                {
                    cmdEvent.guiActive          = false;
                    cmdEvent.guiActiveUnfocused = false;
                }
            }

            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.Events["ToggleDecals"].guiActive          = false;
                switcher.Events["ToggleDecals"].guiActiveUnfocused = false;
            }

            lightModule = this.part.FindModuleImplementing <WBILight>();
            if (lightModule != null)
            {
                lightModule.showGui(false);
            }
        }
コード例 #2
0
        public void GetPartModules()
        {
            BaseEvent cmdEvent;
            int       totalEvents;

            commandModule = this.part.FindModuleImplementing <ModuleCommand>();
            if (commandModule != null)
            {
                totalEvents = commandModule.Events.Count;
                for (int index = 0; index < totalEvents; index++)
                {
                    cmdEvent                    = commandModule.Events.GetByIndex(index);
                    cmdEvent.guiActive          = false;
                    cmdEvent.guiActiveUnfocused = false;
                }
            }

            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.Events["ToggleDecals"].guiActive           = false;
                switcher.Events["ToggleDecals"].guiActiveUnfocused  = false;
                switcher.Events["DumpResources"].guiActive          = false;
                switcher.Events["DumpResources"].guiActiveUnfocused = false;
            }

            lightModule = this.part.FindModuleImplementing <WBILight>();

            qualityControl = this.part.FindModuleImplementing <BaseQualityControl>();
        }
コード例 #3
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

                biomeName = biome.name;
                harvestID = (HarvestTypes)harvestType;
                planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
            }

            converters = this.part.FindModulesImplementing <ModuleResourceConverter>();

            originalEfficiencyType = efficiencyType;
            originalHarvestType    = harvestType;

            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += new ModuleRedecoratedEvent(switcher_onModuleRedecorated);
            }
        }
コード例 #4
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            //Tap into the resource switcher's redecoration event
            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += new ModuleRedecoratedEvent(switcher_onModuleRedecorated);
                templateName = switcher.CurrentTemplateName;
            }

            //if we have an empty list then create a new one.
            if (distributionMap.Count == 0)
            {
                RebuildDistributionList();
            }

            //Setup view
            distributionView.part            = this.part;
            distributionView.isParticipating = this.isParticipating;
            distributionView.distributionMap = this.distributionMap;

            if (isConsumer)
            {
                Events["SetupDistribution"].guiActive = false;
                Fields["isParticipating"].guiName     = "Acquire Resources";
            }
        }
コード例 #5
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            switcher = this.part.FindModuleImplementing<WBIResourceSwitcher>();

            updateTemplate();
        }
コード例 #6
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();

            updateTemplate();
        }
コード例 #7
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += new ModuleRedecoratedEvent(OnModuleRedecorated);

                OnModuleRedecorated(switcher.CurrentTemplate);
            }
        }
コード例 #8
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     GetExperimentSlots();
     switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
     manifestAdmin.SetupView(this.part, !HighLogic.LoadedSceneIsEditor, !HighLogic.LoadedSceneIsEditor, this);
     manifestAdmin.canCreateExperiments    = this.canCreateExperiments;
     manifestAdmin.needsConnectionToKSC    = this.needsConnectionToKSC;
     manifestAdmin.minimumCreationLevel    = this.minimumCreationLevel;
     manifestAdmin.experimentCreationSkill = this.experimentCreationSkill;
     manifestAdmin.creationTags            = this.creationTags;
     SetupGUI(isGUIVisible);
     setupExperimentResources();
 }
コード例 #9
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            Fields["efficiencyDisplayString"].guiName = efficiencyGUIName;

            //Get our biome, planet, and harvest ID.
            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

                if (biome != null)
                {
                    biomeName = biome.name;
                    harvestID = (HarvestTypes)harvestType;
                    planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
                }
            }

            //Get our converters
            converters = this.part.FindModulesImplementing <BaseConverter>();

            //Make sure we know the original efficiency and harvest type since these can change.
            originalEfficiencyType = efficiencyType;
            originalHarvestType    = harvestType;

            //Hook into the switcher's events
            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += switcher_onModuleRedecorated;
            }

            //Hook into the scenario's events
            WBIPathfinderScenario.Instance.onEfficiencyUpdate += onEfficiencyUpdate;

            //Make sure that we set up efficiency
            if (!string.IsNullOrEmpty(biomeName))
            {
                onEfficiencyUpdate(planetID, biomeName, harvestID, efficiencyType,
                                   WBIPathfinderScenario.Instance.GetEfficiencyModifier(planetID, biomeName, harvestID, efficiencyType));
            }
        }
コード例 #10
0
ファイル: JetWing.cs プロジェクト: wertyu756/Buffalo
        protected void setupGUI()
        {
            //Hide seat GUI
            seat = this.part.FindModuleImplementing <KerbalSeat>();
            seat.Events["BoardSeat"].guiActive          = false;
            seat.Events["BoardSeat"].guiActiveEditor    = false;
            seat.Events["BoardSeat"].guiActiveUnfocused = false;

            //Hide probe command GUI
            wingCommander = this.part.FindModuleImplementing <ModuleCommand>();
            wingCommander.Events["MakeReference"].guiActive          = false;
            wingCommander.Events["MakeReference"].guiActiveUnfocused = false;
            wingCommander.Events["RenameVessel"].guiActive           = false;

            //Hide decoupler GUI
            decoupler = this.part.FindModuleImplementing <ModuleDecouple>();
            decoupler.Events["Decouple"].guiActive          = false;
            decoupler.Events["Decouple"].guiActiveEditor    = false;
            decoupler.Events["Decouple"].guiActiveUnfocused = false;

            //Hide MultiModeEngine toggle button
            multiModeEngine = this.part.FindModuleImplementing <MultiModeEngine>();
            multiModeEngine.Events["ModeEvent"].guiActive          = false;
            multiModeEngine.Events["ModeEvent"].guiActiveEditor    = false;
            multiModeEngine.Events["ModeEvent"].guiActiveUnfocused = false;

            //Hide the Close Intake button.
            ModuleResourceIntake intake = this.part.FindModuleImplementing <ModuleResourceIntake>();

            intake.Events["Deactivate"].guiActive = false;

            //Hide RCS GUI
            ModuleRCS rcs = this.part.FindModuleImplementing <ModuleRCS>();

            rcs.Fields["realISP"].guiActive    = false;
            rcs.Fields["rcsEnabled"].guiActive = false;

            //Hide hover engine gui
            hoverEngine = this.part.FindModuleImplementing <WBIMultiEngineHover>();
            hoverEngine.SetGUIVisible(false);

            //Set fuel type
            resourceSwitcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            resourceSwitcher.Fields["shortName"].guiName = "Fuel Type";
        }
コード例 #11
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            //Object names
            if (string.IsNullOrEmpty(objects) == false)
            {
                objectNames = objects.Split(new char[] { ';' });
            }

            //Get switcher
            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += new ModuleRedecoratedEvent(switcher_onModuleRedecorated);
                waitForStartComplete          = true;
            }
        }
コード例 #12
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            //Setup view
            distributionView                     = new DistributionView();
            distributionView.part                = this.part;
            distributionView.isParticipating     = this.isParticipating;
            distributionView.distributionMap     = this.distributionMap;
            distributionView.rebuildCache        = RebuildDistributionCache;
            distributionView.setParticipation    = setParticipation;
            distributionView.setSharesWithVessel = setSharesWithVessel;

            //Tap into the resource switcher's redecoration event
            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += new ModuleRedecoratedEvent(switcher_onModuleRedecorated);
                templateName = switcher.CurrentTemplateName;
            }

            //if we have an empty list then create a new one.
            if (distributionMap.Keys.Count == 0)
            {
                RebuildDistributionList();
            }
            else
            {
                RebuildDistributionCache();
            }

            if (isConsumer)
            {
                Events["SetupDistribution"].guiActive = false;
                Fields["isParticipating"].guiName     = "Acquire Resources";
            }

            //Make sure we initiate resource distribution
            if (HighLogic.LoadedSceneIsFlight)
            {
                WBIDistributionManager.Instance.isDirty = true;
            }
        }
コード例 #13
0
        protected void drawCommandView()
        {
            commandModule = this.part.FindModuleImplementing <ModuleCommand>();
            switcher      = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            lightModule   = this.part.FindModuleImplementing <WBILight>();

            GUILayout.BeginVertical();

            GUILayout.BeginScrollView(new Vector2(), new GUIStyle(GUI.skin.textArea), new GUILayoutOption[] { GUILayout.Height(480) });
            if (!HighLogic.LoadedSceneIsFlight)
            {
                GUILayout.Label("This configuration is working, but the contents can only be accessed in flight.");
                GUILayout.EndScrollView();
                GUILayout.EndVertical();
                return;
            }

            //Control From Here
            if (commandModule != null)
            {
                if (GUILayout.Button("Control From Here"))
                {
                    commandModule.MakeReference();
                }

                //Rename Vessel
                if (GUILayout.Button("Rename Base"))
                {
                    commandModule.RenameVessel();
                }
            }

            //Toggle Decals
            if (switcher != null)
            {
                if (!string.IsNullOrEmpty(switcher.logoPanelTransforms))
                {
                    if (GUILayout.Button("Toggle Decals"))
                    {
                        switcher.ToggleDecals();
                    }
                }

                //Dump Resources
                if (GUILayout.Button("Dump Resources"))
                {
                    switcher.DumpResources();
                }
            }

            //Toggle Lights
            if (lightModule != null)
            {
                if (lightModule.isDeployed)
                {
                    if (GUILayout.Button(lightModule.endEventGUIName))
                    {
                        lightModule.TurnOffLights();
                    }
                }

                else
                {
                    if (GUILayout.Button(lightModule.startEventGUIName))
                    {
                        lightModule.TurnOnLights();
                    }
                }
            }

            GUILayout.EndScrollView();
            GUILayout.EndVertical();
        }
コード例 #14
0
ファイル: JetWing.cs プロジェクト: Kerbas-ad-astra/Buffalo
        protected void setupGUI()
        {
            //Hide seat GUI
            seat = this.part.FindModuleImplementing<KerbalSeat>();
            seat.Events["BoardSeat"].guiActive = false;
            seat.Events["BoardSeat"].guiActiveEditor = false;
            seat.Events["BoardSeat"].guiActiveUnfocused = false;

            //Hide probe command GUI
            wingCommander = this.part.FindModuleImplementing<ModuleCommand>();
            wingCommander.Events["MakeReference"].guiActive = false;
            wingCommander.Events["MakeReference"].guiActiveUnfocused = false;
            wingCommander.Events["RenameVessel"].guiActive = false;

            //Hide decoupler GUI
            decoupler = this.part.FindModuleImplementing<ModuleDecouple>();
            decoupler.Events["Decouple"].guiActive = false;
            decoupler.Events["Decouple"].guiActiveEditor = false;
            decoupler.Events["Decouple"].guiActiveUnfocused = false;

            //Hide MultiModeEngine toggle button
            multiModeEngine = this.part.FindModuleImplementing<MultiModeEngine>();
            multiModeEngine.Events["ModeEvent"].guiActive = false;
            multiModeEngine.Events["ModeEvent"].guiActiveEditor = false;
            multiModeEngine.Events["ModeEvent"].guiActiveUnfocused = false;

            //Hide the Close Intake button.
            ModuleResourceIntake intake = this.part.FindModuleImplementing<ModuleResourceIntake>();
            intake.Events["Deactivate"].guiActive = false;

            //Hide RCS GUI
            ModuleRCS rcs = this.part.FindModuleImplementing<ModuleRCS>();
            rcs.Fields["realISP"].guiActive = false;
            rcs.Events["Disable"].guiActive = false;

            //Hide hover engine gui
            hoverEngine = this.part.FindModuleImplementing<WBIMultiEngineHover>();
            hoverEngine.SetGUIVisible(false);

            //Set fuel type
            resourceSwitcher = this.part.FindModuleImplementing<WBIResourceSwitcher>();
            resourceSwitcher.Fields["shortName"].guiName = "Fuel Type";
        }
コード例 #15
0
        protected void reloadViews()
        {
            List <IOpsView> opsViews;
            List <string>   buttonLabels;
            SDrawbleView    drawableView;
            Vessel          vessel;
            IOpsView        opsView;
            string          label;
            int             totalVessels, totalViews, totalLabels;

            drawableViews.Clear();

            //Find all the loaded vessels in physics range
            totalVessels = FlightGlobals.VesselsLoaded.Count;
            for (int vesselIndex = 0; vesselIndex < totalVessels; vesselIndex++)
            {
                vessel = FlightGlobals.VesselsLoaded[vesselIndex];
                if (vessel.mainBody != FlightGlobals.ActiveVessel.mainBody)
                {
                    continue;
                }

                //Now find all part modules in the vessel that implement IOpsViews
                opsViews   = vessel.FindPartModulesImplementing <IOpsView>();
                totalViews = opsViews.Count;

                //Go through the list and get their drawable views
                for (int viewIndex = 0; viewIndex < totalViews; viewIndex++)
                {
                    opsView = opsViews[viewIndex];

                    //Set parent view
                    opsView.SetParentView(this);

                    if (opsView is WBIResourceSwitcher)
                    {
                        WBIResourceSwitcher switcher = (WBIResourceSwitcher)opsView;
                        switcher.onModuleRedecorated -= OnModuleRedecorated;
                        switcher.onModuleRedecorated += OnModuleRedecorated;
                    }

                    //Setup button labels
                    buttonLabels = opsView.GetButtonLabels();
                    totalLabels  = buttonLabels.Count;
                    for (int labelIndex = 0; labelIndex < totalLabels; labelIndex++)
                    {
                        label                    = buttonLabels[labelIndex];
                        drawableView             = new SDrawbleView();
                        drawableView.buttonLabel = label;
                        drawableView.view        = opsView;
                        drawableView.vessel      = vessel;
                        drawableView.partTitle   = opsView.GetPartTitle();

                        if (drawableViews.ContainsKey(label) == false)
                        {
                            drawableViews.Add(label, new List <SDrawbleView>());
                        }

                        drawableViews[label].Add(drawableView);
                    }
                }

                if (drawableViews.Count > 0)
                {
                    selectedButton = drawableViews.Keys.First <string>();
                    views          = drawableViews[selectedButton];
                }
            }
        }