예제 #1
0
        public void NextRackConfiguration()
        {
            switch (rackConfiguration)
            {
            case RackConfigurations.None:
                rackConfiguration = RackConfigurations.Two;
                Events["NextRackConfiguration"].guiName = kThreeRacks;
                break;

            case RackConfigurations.Two:
                rackConfiguration = RackConfigurations.Three;
                Events["NextRackConfiguration"].guiName = kSixRacks;
                break;

            case RackConfigurations.Three:
                rackConfiguration = RackConfigurations.Six;
                Events["NextRackConfiguration"].guiName = kNoRacks;
                break;

            case RackConfigurations.Six:
            default:
                rackConfiguration = RackConfigurations.None;
                Events["NextRackConfiguration"].guiName = kTwoRacks;
                break;
            }

            SetVisibleObjects();
            UpdateSymmetryParts();
        }
예제 #2
0
 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (node.HasValue("rackConfiguration"))
     {
         rackConfiguration = (RackConfigurations)Enum.Parse(typeof(RackConfigurations), node.GetValue("rackConfiguration"));
     }
 }
예제 #3
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            int nextIndex = -1;

            //Find the switch if any.
            switcher = this.part.FindModuleImplementing <WBIConvertibleStorage>();

            //Find the resource distributor if any
            int        totalCount = this.part.Modules.Count;
            PartModule module;

            for (int index = 0; index < totalCount; index++)
            {
                module = this.part.Modules[index];
                if (module.moduleName == "WBIResourceDistributor")
                {
                    resourceDistributor = module;
                }
            }

            //Hide base GUI
            Events["NextMesh"].guiActive = false;
            Events["NextMesh"].active    = false;
            Events["PrevMesh"].active    = false;
            Events["PrevMesh"].guiActive = false;

            //Set initial values
            if (rackConfiguration == RackConfigurations.Unknown)
            {
                rackConfiguration = kDefaultRacks;
            }
            Log("rack configuration: " + rackConfiguration);

            if (endCapIndex == -1)
            {
                endCapIndex = kDefaultEndCapIndex;
            }

            //Setup the GUI
            if (endCapNames != null)
            {
                nextIndex = (endCapIndex + 1) % endCapNames.Length;
                Events["NextEndCap"].guiName = endCapNames[nextIndex];
            }

            if (bodyNames != null)
            {
                nextIndex = (bodyIndex + 1) % bodyNames.Length;
                Events["NextBodyType"].guiName = bodyNames[nextIndex];
            }

            if (string.IsNullOrEmpty(centerVestibuleName))
            {
                Events["ToggleCenterVestibule"].guiActiveEditor = false;
                Events["ToggleCenterVestibule"].guiActive       = false;
                Events["ToggleCenterVestibule"].active          = false;
            }
            else
            {
                Events["ToggleCenterVestibule"].guiActiveEditor = true;
                Events["ToggleCenterVestibule"].guiActive       = false;
                Events["ToggleCenterVestibule"].active          = true;
            }

            switch (rackConfiguration)
            {
            case RackConfigurations.None:
                Events["NextRackConfiguration"].guiName = kTwoRacks;
                break;

            case RackConfigurations.Two:
                Events["NextRackConfiguration"].guiName = kThreeRacks;
                break;

            case RackConfigurations.Three:
                Events["NextRackConfiguration"].guiName = kSixRacks;
                break;

            case RackConfigurations.Six:
            default:
                Events["NextRackConfiguration"].guiName = kNoRacks;
                break;
            }

            //Set the visible objects
            SetVisibleObjects();
            if (HighLogic.LoadedSceneIsEditor)
            {
                UpdateResources();
            }
        }