Пример #1
0
        private void assignResourcesToPart(bool calledByPlayer)
        {
            // destroying a resource messes up the gui in editor, but not in flight.
            setupTankInPart(part, calledByPlayer);
            if (HighLogic.LoadedSceneIsEditor)
            {
                for (int s = 0; s < part.symmetryCounterparts.Count; s++)
                {
                    setupTankInPart(part.symmetryCounterparts[s], calledByPlayer);
                    FSfuelSwitch symSwitch = part.symmetryCounterparts[s].GetComponent <FSfuelSwitch>();
                    if (symSwitch != null)
                    {
                        symSwitch.selectedTankSetup = selectedTankSetup;
                    }
                }
            }

            Log.dbg("refreshing UI");

            if (tweakableUI == null)
            {
                tweakableUI = Tools.FindActionWindow(part);
            }
            if (tweakableUI != null)
            {
                tweakableUI.CreatePartList(true);
                tweakableUI.displayDirty = true;
            }
            else
            {
                Log.info("no UI to refresh");
            }
        }
Пример #2
0
        public void initializeData()
        {
            if (!initialized)
            {
                debug = new info.FSdebugMessages(debugMode, "FSmeshSwitch");
                // you can't have fuel switching without symmetry, it breaks the editor GUI.
                if (useFuelSwitchModule)
                {
                    updateSymmetry = true;
                }

                parseObjectNames();
                fuelTankSetupList = Tools.parseIntegers(fuelTankSetups);
                objectDisplayList = Tools.parseNames(objectDisplayNames);

                if (useFuelSwitchModule)
                {
                    fuelSwitch = part.GetComponent <FSfuelSwitch>();
                    if (fuelSwitch == null)
                    {
                        useFuelSwitchModule = false;
                        debug.debugMessage("no FSfuelSwitch module found, despite useFuelSwitchModule being true");
                    }
                }
                initialized = true;
            }
        }
        // runs the kind of commands that would normally be in OnStart, if they have not already been run. In case a method is called upon externally, but values have not been set up yet
        private void initializeData()
        {
            if (!initialized)
            {
                debug = new FSdebugMessages(debugMode, "FStextureSwitch2");
                // you can't have fuel switching without symmetry, it breaks the editor GUI.
                if (useFuelSwitchModule)
                {
                    updateSymmetry = true;
                }

                objectList         = Tools.parseNames(objectNames, true);
                texList            = Tools.parseNames(textureNames, true, true, textureRootFolder);
                mapList            = Tools.parseNames(mapNames, true, true, textureRootFolder);
                textureDisplayList = Tools.parseNames(textureDisplayNames);
                fuelTankSetupList  = Tools.parseIntegers(fuelTankSetups);

                debug.debugMessage("found " + texList.Count + " textures, using number " + selectedTexture + ", found " + objectList.Count + " objects, " + mapList.Count + " maps");

                foreach (String targetObjectName in objectList)
                {
                    Transform[]     targetObjectTransformArray = part.FindModelTransforms(targetObjectName);
                    List <Material> matList = new List <Material>();
                    foreach (Transform t in targetObjectTransformArray)
                    {
                        if (t != null && t.gameObject.GetComponent <Renderer>() != null) // check for if the object even has a mesh. otherwise part list loading crashes
                        {
                            Material targetMat = t.gameObject.GetComponent <Renderer>().material;
                            if (targetMat != null)
                            {
                                if (!matList.Contains(targetMat))
                                {
                                    matList.Add(targetMat);
                                }
                            }
                        }
                    }
                    targetMats.Add(matList);
                }

                if (useFuelSwitchModule)
                {
                    fuelSwitch = part.GetComponent <FSfuelSwitch>(); // only looking for first, not supporting multiple fuel switchers
                    if (fuelSwitch == null)
                    {
                        useFuelSwitchModule = false;
                        debug.debugMessage("no FSfuelSwitch module found, despite useFuelSwitchModule being true");
                    }
                }
                initialized = true;
            }
        }
Пример #4
0
        // runs the kind of commands that would normally be in OnStart, if they have not already been run. In case a method is called upon externally, but values have not been set up yet
        private void initializeData()
        {
            if (!initialized)
            {
                debug = new FSdebugMessages(debugMode, "FStextureSwitch2");
                // you can't have fuel switching without symmetry, it breaks the editor GUI.
                if (useFuelSwitchModule) updateSymmetry = true;

                objectList = Tools.parseNames(objectNames, true);
                texList = Tools.parseNames(textureNames, true, true, textureRootFolder);
                mapList = Tools.parseNames(mapNames, true, true, textureRootFolder);
                textureDisplayList = Tools.parseNames(textureDisplayNames);
                fuelTankSetupList = Tools.parseIntegers(fuelTankSetups);

                debug.debugMessage("found " + texList.Count + " textures, using number " + selectedTexture + ", found " + objectList.Count + " objects, " + mapList.Count + " maps");

                foreach (String targetObjectName in objectList)
                {
                    Transform[] targetObjectTransformArray = part.FindModelTransforms(targetObjectName);
                    List<Material> matList = new List<Material>();
                    foreach (Transform t in targetObjectTransformArray)
                    {
                        if (t != null && t.gameObject.renderer != null) // check for if the object even has a mesh. otherwise part list loading crashes
                        {
                            Material targetMat = t.gameObject.renderer.material;
                            if (targetMat != null)
                            {
                                if (!matList.Contains(targetMat))
                                {
                                    matList.Add(targetMat);
                                }
                            }
                        }
                    }
                    targetMats.Add(matList);
                }

                if (useFuelSwitchModule)
                {
                    fuelSwitch = part.GetComponent<FSfuelSwitch>(); // only looking for first, not supporting multiple fuel switchers
                    if (fuelSwitch == null)
                    {
                        useFuelSwitchModule = false;
                        debug.debugMessage("no FSfuelSwitch module found, despite useFuelSwitchModule being true");
                    }
                }
                initialized = true;
            }
        }
Пример #5
0
        public void initializeData()
        {
            if (!initialized)
            {
                debug = new info.FSdebugMessages(debugMode, "FSmeshSwitch");
                // you can't have fuel switching without symmetry, it breaks the editor GUI.
                if (useFuelSwitchModule) updateSymmetry = true;

                parseObjectNames();
                fuelTankSetupList = Tools.parseIntegers(fuelTankSetups);
                objectDisplayList = Tools.parseNames(objectDisplayNames);

                if (useFuelSwitchModule)
                {
                    fuelSwitch = part.GetComponent<FSfuelSwitch>();
                    if (fuelSwitch == null)
                    {
                        useFuelSwitchModule = false;
                        debug.debugMessage("no FSfuelSwitch module found, despite useFuelSwitchModule being true");
                    }
                }
                initialized = true;
            }
        }