コード例 #1
0
 void ProcessProfiles(PartCategorizer.Category profilesCategory)
 {
     for (int i = profilesCategory.subcategories.Count; i-- > 0;)
     {
         var cat    = profilesCategory.subcategories[i];
         var button = cat.button;
         //Debug.Log ($"[BulkheadProfiles] {button.categoryName} {button.categorydisplayName}");
         BulkheadProfileData bp = null;
         if (bulkheadProfiles.TryGetValue(button.categoryName, out bp))
         {
             SetButtonDisplayName(button, bp.displayName);
             if (bp.icon != null)
             {
                 button.SetIcon(bp.icon);
             }
         }
         else
         {
             // KSP does not set the display name (which is used for
             // the tool tip), so set it to the category name so at
             // least something shows.
             if (string.IsNullOrEmpty(button.categorydisplayName))
             {
                 SetButtonDisplayName(button, button.categoryName);
             }
         }
     }
 }
コード例 #2
0
        IEnumerator LoadBulkheadProfileConfigs()
        {
            var dbase     = GameDatabase.Instance;
            var node_list = dbase.GetConfigNodes("BulkheadProfileDefinition");

            for (int i = 0; i < node_list.Length; i++)
            {
                var node = node_list[i];
                if (node.HasValue("name"))
                {
                    var bp = new BulkheadProfileData(node);
                    configs.Add(bp);
                }
            }
            done    = true;
            configs = null;
            yield return(null);
        }
コード例 #3
0
 public void Add(BulkheadProfileData bp)
 {
     //Debug.Log($"[BulkheadProfileConfigs] Add {bp.name}, {KSPUtil.PrintModuleName (bp.name)}");
     BulkheadProfiles[KSPUtil.PrintModuleName(bp.name)] = bp;
 }