containerTypeUpdated() public method

public containerTypeUpdated ( ContainerDefinition container, ContainerModifier newType, bool updateSymmetry = false ) : void
container ContainerDefinition
newType ContainerModifier
updateSymmetry bool
return void
Example #1
0
        private static void addWindowContainerTypeControls(ContainerDefinition container)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Select a container type:");
            GUILayout.Label("Current Type: " + container.currentModifier.name);
            GUILayout.EndHorizontal();
            ContainerModifier[] mods = container.modifiers;
            ContainerModifier   mod;
            int len   = mods.Length;
            int index = 0;

            GUILayout.BeginHorizontal();
            for (int i = 0; i < len; i++)
            {
                mod = mods[i];
                if (!mod.isAvailable(module))
                {
                    continue;
                }
                if (index > 0 && index % 4 == 0)
                {
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                }
                if (GUILayout.Button(mod.title, GUILayout.Width(175)))
                {
                    module.containerTypeUpdated(container, mod, true);
                }
                index++;
            }
            GUILayout.EndHorizontal();
        }
Example #2
0
        public void containerTypeUpdated(ContainerDefinition container, ContainerModifier newType, bool updateSymmetry = false)
        {
            container.setModifier(newType);
            updatePartStats();

            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    SSTUVolumeContainer mod  = p.GetComponent <SSTUVolumeContainer>();
                    ContainerDefinition def2 = mod.getContainer(container.name);
                    ContainerModifier   mod2 = def2.internalGetModifier(newType.name);
                    mod.containerTypeUpdated(def2, mod2, false);
                }
            }
        }