public override void OnStart(StartState state) { base.OnStart(state); initialize(); Fields[nameof(currentModel)].guiName = uiLabel; Fields[nameof(currentModel)].uiControlEditor.onFieldChanged = delegate(BaseField a, System.Object b) { models.modelSelected(a, b); this.actionWithSymmetry(m => { m.models.setScale(currentScale); m.models.updateModelMeshes(); m.models.updateSelections(); m.updateMassAndCost(); m.updateAttachNodes(true); SSTUModInterop.updateResourceVolume(m.part); SSTUModInterop.onPartGeometryUpdate(m.part, true); }); SSTUStockInterop.fireEditorUpdate(); }; Fields[nameof(currentScale)].guiActiveEditor = canAdjustScale; UI_FloatEdit fe = (UI_FloatEdit)Fields[nameof(currentScale)].uiControlEditor; if (fe != null) { fe.minValue = minScale; fe.maxValue = maxScale; fe.incrementLarge = incScaleLarge; fe.incrementSmall = incScaleSmall; fe.incrementSlide = incScaleSlide; } Fields[nameof(currentScale)].uiControlEditor.onFieldChanged = delegate(BaseField a, System.Object b) { this.actionWithSymmetry(m => { m.models.setScale(currentScale); m.models.updateModelMeshes(); m.updateMassAndCost(); m.updateAttachNodes(true); SSTUModInterop.updateResourceVolume(m.part); SSTUModInterop.onPartGeometryUpdate(m.part, true); }); SSTUStockInterop.fireEditorUpdate(); }; Fields[nameof(currentTexture)].uiControlEditor.onFieldChanged = delegate(BaseField a, System.Object b) { models.textureSetSelected(a, b); }; Fields[nameof(currentTexture)].guiActiveEditor = models.definition.textureSets.Length > 1; SSTUStockInterop.fireEditorUpdate(); SSTUModInterop.onPartGeometryUpdate(part, true); }
public override void OnStart(StartState state) { base.OnStart(state); initialize(); string[] options = SSTUUtils.getNames(shieldTypeData, m => m.baseType.name); this.updateUIChooseOptionControl(nameof(currentShieldType), options, options, true, currentShieldType); this.updateUIFloatEditControl(nameof(currentDiameter), minDiameter, maxDiameter, diameterIncrement * 2f, diameterIncrement, diameterIncrement * 0.05f, true, currentDiameter); this.Fields[nameof(currentShieldType)].uiControlEditor.onFieldChanged = delegate(BaseField a, System.Object b) { this.actionWithSymmetry(m => { if (m != this) { m.currentShieldType = currentShieldType; } m.currentShieldTypeData = Array.Find(m.shieldTypeData, s => s.baseType.name == m.currentShieldType); m.updateModuleStats(); m.updatePartResources(); m.updatePartCost(); }); }; this.Fields[nameof(currentDiameter)].uiControlEditor.onFieldChanged = delegate(BaseField a, System.Object b) { this.actionWithSymmetry(m => { if (m != this) { m.currentDiameter = currentDiameter; } m.model.model.updateScaleForDiameter(currentDiameter); m.model.model.setPosition(0, ModelOrientation.CENTRAL); m.model.updateModel(); m.updateFairing(true); m.updateModuleStats(); m.updatePartResources(); m.updatePartCost(); m.updateAttachNodes(true); m.updateDragCube(); }); }; this.Fields[nameof(currentDiameter)].guiActiveEditor = standAlonePart; this.Fields[nameof(currentShieldModel)].guiActiveEditor = false; Fields[nameof(currentShieldTexture)].uiControlEditor.onFieldChanged = delegate(BaseField a, System.Object b) { model.textureSetSelected(a, b); }; this.Fields[nameof(currentShieldTexture)].guiActiveEditor = standAlonePart && model.model.modelDefinition.textureSets.Length > 1; }