상속: PartModule
예제 #1
0
 private void ResourceSetup()
 {
     try
     {
         inputResourceList    = UpdateResourceList(inputResources, 2);
         outputResourceList   = UpdateResourceList(outputResources, 3);
         requiredResourceList = UpdateResourceList(requiredResources, 2);
         _mks = part.Modules.OfType <MKSModule>().Any()
             ? part.Modules.OfType <MKSModule>().First()
             : new MKSModule();
     }
     catch (Exception ex)
     {
         print(String.Format("[MKS] - ERROR in ResourceSetup - {0}", ex.Message));
     }
 }
예제 #2
0
        protected void updateMKSModuleFromTemplate(ConfigNode mksTemplate)
        {
            string    value;
            MKSModule mksModule = this.part.FindModuleImplementing <MKSModule>();

            Log("updateMKSModuleFromTemplate called");

            if (mksModule)
            {
                //Has generators
                if (MultiConverter.converters.Count > 0)
                {
                    mksModule.hasGenerators = true;
                }
                else
                {
                    mksModule.hasGenerators = false;
                }

                //workspace
                value = mksTemplate.GetValue("workspace");
                if (!string.IsNullOrEmpty(value))
                {
                    mksModule.workSpace = int.Parse(value);
                }

                //livingSpace
                value = mksTemplate.GetValue("livingSpace");
                if (!string.IsNullOrEmpty(value))
                {
                    mksModule.livingSpace = int.Parse(value);
                }

                //efficiencyPart
                value = mksTemplate.GetValue("efficiencyPart");
                if (!string.IsNullOrEmpty(value))
                {
                    mksModule.efficiencyPart = value;
                }
            }
        }
예제 #3
0
        protected override void initModuleGUI()
        {
            base.initModuleGUI();
            MKSModule mksModule           = this.part.FindModuleImplementing <MKSModule>();
            bool      showNextPrevButtons = HighLogic.LoadedSceneIsEditor ? true : false;

            if (MultiConverter != null)
            {
                MultiConverter.ShowGUI = _showGUI;
            }

            if (mksModule != null)
            {
                mksModule.ShowGUI = _showGUI;
            }

            //Next/prev buttons
            Events["NextType"].guiActive = showNextPrevButtons;
            Events["NextType"].active    = showNextPrevButtons;
            Events["PrevType"].guiActive = showNextPrevButtons;
            Events["PrevType"].active    = showNextPrevButtons;
        }
예제 #4
0
 private void ResourceSetup()
 {
     try
     {
         inputResourceList = UpdateResourceList(inputResources,2);
         outputResourceList = UpdateResourceList(outputResources,3);
         requiredResourceList = UpdateResourceList(requiredResources,2);
         _mks = part.Modules.OfType<MKSModule>().Any()
             ? part.Modules.OfType<MKSModule>().First()
             : new MKSModule();
     }
     catch (Exception ex)
     {
         print(String.Format("[MKS] - ERROR in ResourceSetup - {0}", ex.Message));
     }
 }