Beispiel #1
0
 public ConfigureModule(ReadArchive archive)
 {
     archive.Load(out type);
     archive.Load(out id_field);
     archive.Load(out id_value);
     archive.Load(out id_index);
 }
Beispiel #2
0
        public ConfigureSetup(ReadArchive archive)
        {
            // load basic data
            archive.Load(out name);
            archive.Load(out desc);
            archive.Load(out tech);
            archive.Load(out cost);
            archive.Load(out mass);

            // load modules
            int count;

            archive.Load(out count);
            modules = new List <ConfigureModule>(count);
            while (count-- > 0)
            {
                modules.Add(new ConfigureModule(archive));
            }

            // load resources
            archive.Load(out count);
            resources = new List <ConfigureResource>(count);
            while (count-- > 0)
            {
                resources.Add(new ConfigureResource(archive));
            }
        }
Beispiel #3
0
 public ConfigureResource(ReadArchive archive)
 {
     archive.Load(out name);
     archive.Load(out amount);
     archive.Load(out maxAmount);
 }
Beispiel #4
0
        public override void OnStart(StartState state)
        {
            // don't break tutorial scenarios
            if (Lib.DisableScenario(this))
            {
                return;
            }

            // parse all setups from string data
            var archive = new ReadArchive(data);
            int count;

            archive.Load(out count);
            setups = new List <ConfigureSetup>(count);
            while (count-- > 0)
            {
                setups.Add(new ConfigureSetup(archive));
            }

            // parse configuration from string data
            // - we avoid corner case when cfg was never set up (because craft was never in VAB)
            selected = new List <string>();
            if (!string.IsNullOrEmpty(cfg))
            {
                archive = new ReadArchive(cfg);
                archive.Load(out count);
                while (count-- > 0)
                {
                    string s; archive.Load(out s); selected.Add(s);
                }
            }

            // parse previous configuration from string data
            // - we avoid corner case when prev_cfg was never set up (because craft was never in VAB)
            prev_selected = new List <string>();
            if (!string.IsNullOrEmpty(prev_cfg))
            {
                archive = new ReadArchive(prev_cfg);
                archive.Load(out count);
                while (count-- > 0)
                {
                    string s; archive.Load(out s); prev_selected.Add(s);
                }
            }

            // default title to part name
            if (title.Length == 0)
            {
                title = Lib.PartName(part);
            }

            // parse crew specs
            reconfigure_cs = new CrewSpecs(reconfigure);

            // set toggle window button label
            Events["ToggleWindow"].guiName = Lib.BuildString("Configure <b>", title, "</b>");

            // only show toggle in flight if this is reconfigurable
            Events["ToggleWindow"].active = Lib.IsEditor() || reconfigure_cs;

            // store configuration changes
            changes = new Dictionary <int, int>();
        }