using System.IO; using System.Reflection; using UnityEngine; namespace MSCO { /// /// MSCO-Logo (branding/logo-128.png, als Ressource in die DLL eingebettet): /// Symbol im MSCO-Launcher (Hauptmenü) und in Overlays. /// public static class Branding { const string LogoResource = "MSCO.logo.png"; static byte[] logoPng; static Texture2D logoTexture; public static byte[] LogoPng { get { if (logoPng != null) return logoPng; using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(LogoResource)) { if (s == null) return logoPng = new byte[0]; var data = new byte[s.Length]; int read = 0; while (read < data.Length) read += s.Read(data, read, data.Length - read); logoPng = data; } return logoPng; } } /// Logo als Textur für OnGUI (nur im Hauptthread verwenden). public static Texture2D LogoTexture { get { if (logoTexture != null) return logoTexture; if (LogoPng.Length == 0) return null; logoTexture = new Texture2D(2, 2, TextureFormat.ARGB32, false); logoTexture.LoadImage(LogoPng); logoTexture.filterMode = FilterMode.Bilinear; logoTexture.hideFlags = HideFlags.HideAndDontSave; return logoTexture; } } } }