public static Texture2D loadTexture(int x, int y, string filename) { try { Texture2D texture = new Texture2D(x, y); texture.LoadImage(loadResourceData(filename)); return(texture); } catch (Exception e) { TLMUtils.doErrorLog("The file could not be read:" + e.Message); } return(null); }
internal static List <string> LoadBasicAssets(ref TransportSystemDefinition definition) { List <string> basicAssetsList = new List <string>(); TLMUtils.doLog("LoadBasicAssets: pre prefab read"); for (uint num = 0u; (ulong)num < (ulong)((long)PrefabCollection <VehicleInfo> .PrefabCount()); num += 1u) { VehicleInfo prefab = PrefabCollection <VehicleInfo> .GetPrefab(num); if (!(prefab == null) && definition.isFromSystem(prefab) && !IsTrailer(prefab)) { basicAssetsList.Add(prefab.name); } } return(basicAssetsList); }
public static string loadResourceString(string name, string prefix = "Klyte.TransportLinesManager.") { name = prefix + name; UnmanagedMemoryStream stream = (UnmanagedMemoryStream)ResourceAssembly.GetManifestResourceStream(name); if (stream == null) { TLMUtils.doErrorLog("Could not find resource: " + name); return(null); } StreamReader read = new StreamReader(stream); return(read.ReadToEnd()); }
public static byte[] loadResourceData(string name, string prefix = "Klyte.TransportLinesManager.") { name = prefix + name; UnmanagedMemoryStream stream = (UnmanagedMemoryStream)ResourceAssembly.GetManifestResourceStream(name); if (stream == null) { TLMUtils.doErrorLog("Could not find resource: " + name); return(null); } BinaryReader read = new BinaryReader(stream); return(read.ReadBytes((int)stream.Length)); }