private void onCoreTextureChanged(BaseField field, System.Object obj)
 {
     if ((String)obj != currentCoreTexture)
     {
         coreModule.enableTextureSet(currentCoreTexture);
     }
 }
 private void onBottomTextureChanged(BaseField field, System.Object obj)
 {
     if ((String)obj != currentBottomTexture)
     {
         bottomModule.enableTextureSet(currentBottomTexture);
     }
 }
Exemple #3
0
        private void setTankTextureFromEditor(String newSet, bool updateSymmetry)
        {
            currentTankTexture = newSet;
            currentMainTankModule.enableTextureSet(newSet);

            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    p.GetComponent <SSTUModularFuelTank>().setTankTextureFromEditor(newSet, false);
                }
            }
        }
Exemple #4
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 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 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 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);
                }
            }
        }
 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);
         }
     }
 }
 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 setMainTankModuleFromEditor(SingleModelData newModule, bool updateSymmetry)
        {
            currentMainTankModule.destroyCurrentModel();
            currentMainTankModule = newModule;
            currentMainTankModule.setupModel(part, part.transform.FindRecursive("model"), ModelOrientation.CENTRAL);
            currentTankType = newModule.name;
            if (!currentMainTankModule.isValidTextureSet(currentTankTexture)) { currentTankTexture = currentMainTankModule.modelDefinition.defaultTextureSet; }
            currentMainTankModule.enableTextureSet(currentTankTexture);

            updateEditorStats(true);

            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    SSTUModularFuelTank mft = p.GetComponent<SSTUModularFuelTank>();
                    SingleModelData mt = Array.Find(mft.mainTankModules, t => t.name == newModule.name);
                    mft.setMainTankModuleFromEditor(mt, false);
                }
            }
        }
 protected virtual void setNoseModuleFromEditor(String newNoseType, bool updateSymmetry)
 {
     currentNoseType = newNoseType;
     SingleModelData newModule = Array.Find(noseModules, m => m.name == newNoseType);
     currentNoseModule.destroyCurrentModel();
     currentNoseModule = newModule;
     newModule.setupModel(getNoseRootTransform(false), ModelOrientation.TOP);
     currentNoseType = newModule.name;
     if (!currentNoseModule.isValidTextureSet(currentNoseTexture)) { currentNoseTexture = currentNoseModule.getDefaultTextureSet(); }
     currentNoseModule.enableTextureSet(currentNoseTexture);
     currentNoseModule.updateTextureUIControl(this, "currentNoseTexture", currentNoseTexture);
     updateEditorStats(true);
     if (updateSymmetry)
     {
         foreach (Part p in part.symmetryCounterparts)
         {
             p.GetComponent<SSTUModularFuelTank>().setNoseModuleFromEditor(newNoseType, false);
         }
     }
     SSTUStockInterop.fireEditorUpdate();
     SSTUModInterop.onPartGeometryUpdate(part, true);
 }