public CustomSkin(DirectoryInfo Path, string Name, byte bID, FactionSubTypes Faction, Texture2D Albedo, Texture2D Metallic, Texture2D Emissive, Texture2D Preview, Texture2D Button, Texture2D ButtonMini) { this.Path = Path; ID = Name; this.bID = bID; this.Faction = Faction; var preview = Preview != null?SpriteFromImage(Preview) : SpriteFromImage(Albedo); var button = Button != null?SpriteFromImage(Button) : preview; corporationSkinInfo = ScriptableObject.CreateInstance <CorporationSkinInfo>(); corporationSkinInfo.m_SkinUniqueID = bID; corporationSkinInfo.m_Corporation = Faction; corporationSkinInfo.m_SkinTextureInfo = new SkinTextures() { m_Albedo = Albedo, m_Metal = Metallic, m_Emissive = Emissive }; Console.WriteLine(" >Setting Textures"); corporationSkinInfo.m_SkinUIInfo = new CorporationSkinUIInfo() { m_LocalisedString = new LocalisedString() { m_Bank = Name }, m_PreviewImage = preview, m_SkinButtonImage = button, m_SkinMiniPaletteImage = ButtonMini != null?SpriteFromImage(ButtonMini) : button, m_SkinLocked = false }; }
public static string FabricatorFromFactionType(FactionSubTypes faction) { if (FabNameDict.TryGetValue(faction, out string result)) { return(result); } return("gsofab"); }
public BlockPrefabBuilder SetFaction(FactionSubTypes faction) { ThrowIfFinished(); _customBlock.Faction = faction; return(this); }
static void GetSkinData(DirectoryInfo texpack, CustomSkin Update = null) { try { if (!texpack.Exists) { return; } string Name = texpack.Name; int lastindex = Name.LastIndexOf('.'); int firstindex = Name.IndexOf('.'); Console.Write("\nReached " + texpack.Name); string Prefix = Name.Substring(0, firstindex); Console.Write(", Faction:" + Prefix); FactionSubTypes Faction = FactionSubTypes.NULL; try { Faction = (FactionSubTypes)Enum.Parse(TFactionSubTypes, Prefix, true); } catch { if (int.TryParse(Prefix, out var id)) { Faction = (FactionSubTypes)id; } else { Console.WriteLine("Could not find corporation! The valid prefixes are:"); foreach (var name in Enum.GetNames(TFactionSubTypes)) { Console.WriteLine(" " + name); } } } Console.WriteLine(", FactionID:" + (int)Faction); string fpath = Path.Combine(texpack.FullName, "1.png"); Texture2D Albedo = new Texture2D(2, 2); if (File.Exists(fpath)) { Albedo = ImageFromFile(System.IO.File.ReadAllBytes(fpath)); Console.Write("Albedo, "); } else { Console.WriteLine("Couldn't find Albedo (1.png), "); } fpath = Path.Combine(texpack.FullName, "2.png"); Texture2D Metallic = new Texture2D(2, 2); if (File.Exists(fpath)) { Metallic = ImageFromFile(System.IO.File.ReadAllBytes(fpath)); Console.Write("Metallic, "); } else { Console.WriteLine("Couldn't find Metallic (2.png), "); } fpath = Path.Combine(texpack.FullName, "3.png"); Texture2D Emission = new Texture2D(2, 2); if (File.Exists(fpath)) { Emission = ImageFromFile(System.IO.File.ReadAllBytes(fpath)); Console.Write("Emission, "); } else { Console.Write("Couldn't find Emission (2.png), "); } fpath = Path.Combine(texpack.FullName, "preview.png"); Texture2D Preview = null; if (File.Exists(fpath)) { Preview = ImageFromFile(System.IO.File.ReadAllBytes(fpath)); Console.Write("Preview, "); } fpath = Path.Combine(texpack.FullName, "button.png"); Texture2D Button = null; if (File.Exists(fpath)) { Button = ImageFromFile(System.IO.File.ReadAllBytes(fpath)); Console.Write("Button, "); } fpath = Path.Combine(texpack.FullName, "buttonmini.png"); Texture2D ButtonMini = null; if (File.Exists(fpath)) { Button = ImageFromFile(System.IO.File.ReadAllBytes(fpath)); Console.Write("ButtonMini, "); } if (!CustomSkinCounter.ContainsKey(Faction)) { CustomSkinCounter.Add(Faction, 0); } if (Update != null) { Update.UpdateCorporationSkinInfo(Albedo, Metallic, Emission); Update.UpdateSkinUIInfo(Preview, Button, ButtonMini); Console.WriteLine("processing... \nUpdated skin in list!"); } else { CustomSkins.Add(new CustomSkin(texpack, Name, (byte)(255 - CustomSkinCounter[Faction]++), Faction, Albedo, Metallic, Emission, Preview, Button, ButtonMini)); Console.WriteLine("processing... \nAdded skin to list!"); } } catch (Exception E) { Console.WriteLine("\nEXCEPTION! " + E.ToString()); } }
public static void AddMoreInfoToSkin(CorporationSkinInfo skinInfo, int ID, FactionSubTypes faction) { skinInfo.m_SkinUniqueID = ID; skinInfo.m_Corporation = faction; }
public static int Dump() { bool RemoveSecret = !Input.GetKey((UnityEngine.KeyCode) 308); Console.WriteLine("Starting block dump..."); var DUMP = new JObject { { "game_version", SKU.DisplayVersion }, // Display Version { "date", DateTime.Now.ToString() } // Date of dump }; // Create DUMP, which will be outputted to a file var CHUNKS = new JArray(); // Create CHUNKS array // Populate CHUNKS array with resource chunks foreach (ChunkTypes id in Enum.GetValues(typeof(ChunkTypes))) { var ITEM = new JObject() { { "name", StringLookup.GetItemName(ObjectTypes.Chunk, (int)id) }, { "id", (int)id }, { "price", RecipeManager.inst.GetChunkPrice(id) } }; GetRecipe(ITEM, (int)id, ObjectTypes.Chunk); CHUNKS.Add(ITEM); } DUMP.Add("data_chunks", CHUNKS); // Add CHUNKS array to DUMP var DATA = new JArray(); // Create DATA array // Populate DATA array with all blocks int NumExported = 0; foreach (BlockTypes id in Enum.GetValues(typeof(BlockTypes))) { var ITEM = new JObject(); // Create DATA entry TankBlock Block = ManSpawn.inst.GetBlockPrefab(id); if (Block == null) { continue; // Escape if block is empty } GameObject Base = Block.gameObject; if (Base == null) { continue; // Escape if object is empty. Redundant } int grade = ManLicenses.inst.GetBlockTier(id, true); if (RemoveSecret && grade > 127) { continue; } FactionSubTypes corp = ManSpawn.inst.GetCorporation(id); BlockCategories category = ManSpawn.inst.GetCategory(id); // Block name ITEM.Add("block", StringLookup.GetItemName(ObjectTypes.Block, (int)id)); // Resource name ITEM.Add("resource_name", Base.name); // Description ITEM.Add("description", StringLookup.GetItemDescription(ObjectTypes.Block, (int)id)); // ID ITEM.Add("id", (int)id); // Enum ITEM.Add("enum", id.ToString()); // Mass ITEM.Add("mass", Block.m_DefaultMass); // Corp int ITEM.Add("corp_int", (int)corp); // Corp ITEM.Add("corp", StringLookup.GetCorporationName(corp)); // Category int ITEM.Add("category_int", (int)category); // Category ITEM.Add("category", StringLookup.GetBlockCategoryName(category)); // Grade ITEM.Add("grade", grade); // Price ITEM.Add("price", RecipeManager.inst.GetBlockBuyPrice(id, true)); // Rarity ITEM.Add("rarity", Block.BlockRarity.ToString()); // Rarity ITEM.Add("blocklimit_cost", ManBlockLimiter.inst.GetBlockCost(id)); // Health var mdmg = Base.GetComponent <ModuleDamage>(); if (mdmg) // Redundant check { ITEM.Add("health", mdmg.maxHealth); ITEM.Add("fragility", mdmg.m_DamageDetachFragility); // Death Explosion GetExplosionData(ITEM, mdmg.deathExplosion, "DeathExplosion"); } // Damageability var dmgb = Block.GetComponent <Damageable>(); if (dmgb) // Redundant check { ITEM.Add("damageable_type", dmgb.DamageableType.ToString()); ITEM.Add("damageable_type_int", (int)dmgb.DamageableType); } try { // Cells ITEM.Add("cell_count", Block.filledCells.Length); // APs ITEM.Add("ap_count", Block.attachPoints.Length); } catch { } // Recipe GetRecipe(ITEM, (int)id); // FireData GetFireData(ITEM, Base); // ModuleWeapon GetWeaponData(ITEM, Base); // ModuleDrill GetDrillData(ITEM, Base); // ModuleHammer GetHammerData(ITEM, Base); // ModuleEnergyStore GetEnergyData(ITEM, Base); // ModuleFuelTank GetFuelData(ITEM, Base); // ModuleShieldGenerator GetShieldData(ITEM, Base); // ModuleHover GetHoverData(ITEM, Base); // ModuleBooster GetBoosterData(ITEM, Base); // ModuleWheels GetWheelData(ITEM, Base); // Add to DATA DATA.Add(ITEM); NumExported++; } DUMP.Add("data_blocks", DATA); // Add DATA array to DUMPwww System.IO.File.WriteAllText("_Export/BlockInfoDump.json", DUMP.ToString(Newtonsoft.Json.Formatting.Indented)); return(NumExported); }