Ejemplo n.º 1
0
 private string ItemPercentage(ResourceItem item)
 {
     return (((currentError * item.ActualError) + 1d) * item.ActualDensity * 100d).ToString("0.00");
 }
Ejemplo n.º 2
0
 internal IEnumerator<YieldInstruction> LoadItems(ConfigNode settings, System.Random random)
 {
     foreach (string type in KRESUtils.types.Values)
     {
         if (KRESUtils.GetRelevantBodies(type).Any(b => b.bodyName == this.Name))
         {
             foreach (ConfigNode data in settings.GetNode(type).GetNode(this.Name).GetNodes("KRES_DATA"))
             {
                 string resourceName = string.Empty;
                 data.TryGetValue("name", ref resourceName);
                 if (!PartResourceLibrary.Instance.resourceDefinitions.Contains(resourceName)) { continue; }
                 if (type == "ore")
                 {
                     string path = Path.Combine(KRESUtils.GetSavePath(), "KRESTextures/" + name + "/" + resourceName + ".png");
                     if (File.Exists(path))
                     {
                         ResourceItem item = new ResourceItem(data, resourceName, this.Name, random);
                         resourceItems.Add(item);
                     }
                 }
                 else if (type == "gas" || type == "liquid")
                 {
                     ResourceItem item = new ResourceItem(data, resourceName, this.Name, type, random);
                     resourceItems.Add(item);
                 }
                 yield return null;
             }
         }
     }
 }
Ejemplo n.º 3
0
 private string ItemError(ResourceItem item)
 {
     return (item.ActualDensity * currentError * 100d).ToString("0.00");
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets a texture that can be viewed from within the debug window.
 /// </summary>
 public void SetTexture(ResourceItem item)
 {
     this.textureImage = item.Map.GetTexture();
     this.textureName = item.Resource.name;
 }