コード例 #1
0
 public override void SetPart(TCAPart part)
 {
     base.SetPart(part);
     //remove Module from module title. Maybe drop it altogether from the TechTree?
     button = new GUIContent(part.Title.Replace("Module", "").Trim(),
                             //remove the "Updates TCA (tm)..." sentence.
                             part.Description.Substring(part.Description.IndexOf('.') + 1));
 }
コード例 #2
0
 protected TCAPart(TCAPart part)
 {
     Name        = part.Name;
     Modules     = part.Modules;
     info        = part.info;
     Title       = part.Title;
     Description = part.Description;
 }
コード例 #3
0
        void Awake()
        {
            //register modules
            foreach (var module in ValidModules)
            {
                var meta = new ModuleMeta(module);
                if (!meta.Valid)
                {
                    continue;
                }
                RegisteredModules.Add(module, meta);
            }
            //add inputs
            RegisteredModules.ForEach(m => m.Value.Input.ForEach(inp => add_optional(m.Key, inp)));
            //topo-sort modules
            SortModules();
            //register techtree parts
            foreach (var module in RegisteredModules.Values)
            {
                if (string.IsNullOrEmpty(module.PartName))
                {
                    continue;
                }
                TCAPart part = null;
                if (TechTreeParts.TryGetValue(module.PartName, out part))
                {
                    part.AddModule(module);
                }
                else
                {
                    part = new TCAPart(module.PartName);
                    part.AddModule(module);
                    TechTreeParts.Add(part.Name, part);
                }
            }

                        #if DEBUG
            Utils.Log("\nTCA Modules in the ModulesDatabase:\n{}",
                      RegisteredModules.Aggregate("", (s, t) => s + t.Value + "\n\n"));
            Utils.Log("Pipeline: {}", Pipeline.Aggregate("", (s, t) => s + t.Name + "->"));
            Utils.Log("AP Pipeline: {}", Pipeline.Where(m => m.IsSubclassOf(typeof(AutopilotModule))).Aggregate("", (s, t) => s + t.Name + "->"));
            File.WriteAllText("ModuleDatabase.csv",
                              RegisteredModules.Aggregate("", (s, t) => s + t.Value.ToCSV() + "\n"));
                        #endif
        }
コード例 #4
0
 public virtual void SetPart(TCAPart part)
 {
     this.part = part;
 }