Example #1
0
        protected virtual void setMainTankModuleFromEditor(String newMainTank, bool updateSymmetry)
        {
            SingleModelData newModule = Array.Find(mainTankModules, m => m.name == newMainTank);

            currentMainTankModule.destroyCurrentModel();
            currentMainTankModule = newModule;
            currentMainTankModule.setupModel(part, getTankRootTransform(false), ModelOrientation.CENTRAL);
            currentTankType = newModule.name;
            if (!currentMainTankModule.isValidTextureSet(currentTankTexture))
            {
                currentTankTexture = currentMainTankModule.getDefaultTextureSet();
            }
            currentMainTankModule.enableTextureSet(currentTankTexture);
            currentMainTankModule.updateTextureUIControl(this, "currentTankTexture", currentTankTexture);
            updateUIScaleControls();
            updateEditorStats(true);

            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    p.GetComponent <SSTUModularFuelTank>().setMainTankModuleFromEditor(newMainTank, false);
                }
            }
            SSTUStockInterop.fireEditorUpdate();
            SSTUModInterop.onPartGeometryUpdate(part, true);
        }
        private void setBottomDockEditor(string newBottomDock, bool updateSymmetry)
        {
            currentBottomDock = newBottomDock;
            SingleModelData prev = bottomDockModule;

            bottomDockModule.destroyCurrentModel();
            bottomDockModule = SingleModelData.findModel(bottomDockModules, currentBottomDock);
            bottomDockModule.setupModel(getBottomDockRoot(false), ModelOrientation.BOTTOM);
            onModelChanged(prev, bottomDockModule);
            updateDockingModules(true);
            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    p.GetComponent <SSTUModularStationCore>().setBottomDockEditor(newBottomDock, false);
                }
            }
        }
        private void setCoreEditor(string newCore, bool updateSymmetry)
        {
            currentCore = newCore;
            SingleModelData prev = coreModule;

            coreModule.destroyCurrentModel();
            coreModule = SingleModelData.findModel(coreModules, currentCore);
            coreModule.setupModel(getCoreRoot(false), ModelOrientation.CENTRAL);
            onModelChanged(prev, coreModule);
            if (!coreModule.isValidTextureSet(currentCoreTexture))
            {
                currentCoreTexture = coreModule.getDefaultTextureSet();
            }
            coreModule.enableTextureSet(currentCoreTexture);
            coreModule.updateTextureUIControl(this, "currentCoreTexture", currentCoreTexture);
            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    p.GetComponent <SSTUModularStationCore>().setCoreEditor(newCore, false);
                }
            }
        }
        private void setBottomEditor(string newBottom, bool updateSymmetry)
        {
            currentBottom = newBottom;
            SingleModelData prev = bottomModule;

            bottomModule.destroyCurrentModel();
            bottomModule = SingleModelData.findModel(bottomModules, currentBottom);
            bottomModule.setupModel(getBottomRoot(false), ModelOrientation.BOTTOM);
            onModelChanged(prev, bottomModule);
            if (!bottomModule.isValidTextureSet(currentBottomTexture))
            {
                currentBottomTexture = bottomModule.getDefaultTextureSet();
            }
            bottomModule.enableTextureSet(currentBottomTexture);
            bottomModule.updateTextureUIControl(this, "currentBottomTexture", currentBottomTexture);
            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    p.GetComponent <SSTUModularStationCore>().setBottomEditor(newBottom, false);
                }
            }
        }
        private void setTopEditor(string newTop, bool updateSymmetry)
        {
            currentTop = newTop;
            SingleModelData prev = topModule;

            topModule.destroyCurrentModel();
            topModule = SingleModelData.findModel(topModules, currentTop);
            topModule.setupModel(getTopRoot(false), ModelOrientation.TOP);
            onModelChanged(prev, topModule);
            if (!topModule.isValidTextureSet(currentTopTexture))
            {
                currentTopTexture = topModule.getDefaultTextureSet();
            }
            topModule.enableTextureSet(currentTopTexture);
            topModule.updateTextureUIControl(this, "currentTopTexture", currentTopTexture);
            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    p.GetComponent <SSTUModularStationCore>().setTopEditor(newTop, false);
                }
            }
        }