コード例 #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);
 }
コード例 #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));
            }
        }
コード例 #3
0
ファイル: Configure.cs プロジェクト: zajc3w/Kerbalism
        bool initialized;                                   // used to initialize only once


        public override void OnStart(StartState state)
        {
            // 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
            archive = new ReadArchive(cfg);
            archive.load(out count);
            selected = new List <string>(count);
            while (count-- > 0)
            {
                string s; archive.load(out s); selected.Add(s);
            }

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

            // set toggle window button label
            Events["ToggleWindow"].guiName = state == StartState.Editor
      ? Lib.BuildString("Configure <b>", title, "</b>")
      : Lib.BuildString("<b>", title, "</b> details");
        }
コード例 #4
0
        public override void OnStart(StartState state)
        {
            // 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
            archive = new ReadArchive(cfg);
            archive.load(out count);
            selected = new List <string>(count);
            while (count-- > 0)
            {
                string s; archive.load(out s); selected.Add(s);
            }

            // parse previous configuration from string data
            archive = new ReadArchive(prev_cfg);
            archive.load(out count);
            prev_selected = new List <string>(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>();
        }
コード例 #5
0
 public ConfigureResource(ReadArchive archive)
 {
     archive.load(out name);
     archive.load(out amount);
     archive.load(out maxAmount);
 }
コード例 #6
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>();
        }