diff --git a/GameData/DMagicUtilities/CapCom/CapCom.version b/GameData/DMagicUtilities/CapCom/CapCom.version index 4e65cae..7d406e9 100644 --- a/GameData/DMagicUtilities/CapCom/CapCom.version +++ b/GameData/DMagicUtilities/CapCom/CapCom.version @@ -1,7 +1,7 @@ { "NAME":"CapCom Mission Control On The Go", "URL":"https://raw.githubusercontent.com/DMagic1/CapCom/master/GameData/DMagicUtilities/CapCom/CapCom.version", - "DOWNLOAD":"http://spacedock.info/mod/131/CapCom%20-%20Mission%20Control%20On%20The%20Go/download/2.7", + "DOWNLOAD":"http://spacedock.info/mod/131/CapCom%20-%20Mission%20Control%20On%20The%20Go/download/2.8", "GITHUB":{ "USERNAME":"DMagic1", "REPOSITORY":"CapCom", @@ -11,21 +11,21 @@ "MAJOR":1, "MINOR":0, "PATCH":2, - "BUILD":7 + "BUILD":8 }, "KSP_VERSION":{ "MAJOR":1, - "MINOR":3, - "PATCH":0 + "MINOR":4, + "PATCH":1 }, "KSP_VERSION_MIN":{ "MAJOR":1, - "MINOR":3, + "MINOR":4, "PATCH":0 }, "KSP_VERSION_MAX":{ "MAJOR":1, - "MINOR":3, + "MINOR":4, "PATCH":8 } } \ No newline at end of file diff --git a/Source/CapCom.cs b/Source/CapCom.cs index 0f1e8ed..7118550 100644 --- a/Source/CapCom.cs +++ b/Source/CapCom.cs @@ -83,47 +83,88 @@ protected override void Awake() if (!textureLoaded) { textureLoaded = true; - - Texture original = null; - + foreach (Texture2D t in Resources.FindObjectsOfTypeAll()) { - if (t.name == "SpriteAtlasTexture-MissionControl (Group 0)-1024x1024-fmt5") - { - LogFormatted("Texture Found..."); - original = t; - break; - } - } + if (t.name == "missc_btn_acceptcontract_normal") + CapComSkins.acceptButtonNormal = t; + else if (t.name == "missc_btn_acceptcontract_over") + CapComSkins.acceptButtonHover = t; + else if (t.name == "missc_btn_acceptcontract_disabled") + CapComSkins.acceptButtonInactive = t; + else if (t.name == "missc_btn_acceptcontract_active") + CapComSkins.acceptButtonActive = t; + else if (t.name == "missc_btn_cancelcontract_normal") + CapComSkins.cancelButtonNormal = t; + else if (t.name == "missc_btn_cancelcontract_over") + CapComSkins.cancelButtonHover = t; + else if (t.name == "missc_btn_cancelcontract_disabled") + CapComSkins.cancelButtonInactive = t; + else if (t.name == "missc_btn_cancelcontract_active") + CapComSkins.cancelButtonActive = t; + else if (t.name == "missc_btn_declinecontract_normal") + CapComSkins.declineButtonNormal = t; + else if (t.name == "missc_btn_declinecontract_over") + CapComSkins.declineButtonHover = t; + else if (t.name == "missc_btn_declinecontract_disabled") + CapComSkins.declineButtonInactive = t; + else if (t.name == "missc_btn_declinecontract_active") + CapComSkins.declineButtonActive = t; + else if (t.name == "missc_listitem_true") + { + Texture2D newT = new Texture2D(77, 50); - if (original == null) - { - LogFormatted("Error loading Mission Control Center Texture atlas; some CapCom UI elements will not appear correctly"); - return; - } + var rt = RenderTexture.GetTemporary(t.width, t.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB, 1); + + Graphics.Blit(t, rt); - Texture2D missionControlTexture = new Texture2D(original.width, original.height); + RenderTexture.active = rt; - var rt = RenderTexture.GetTemporary(original.width, original.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB, 1); + newT.ReadPixels(new Rect(0, 0, t.width, t.height), 0, 0); - Graphics.Blit(original, rt); + RenderTexture.active = null; + RenderTexture.ReleaseTemporary(rt); - RenderTexture.active = rt; + rt = null; - missionControlTexture.ReadPixels(new Rect(0, 0, original.width, original.height), 0, 0); + newT.Apply(); - RenderTexture.active = null; - RenderTexture.ReleaseTemporary(rt); + var pix = newT.GetPixels(0, 0, 77, 50); - rt = null; + CapComSkins.titleButtonOnLeft = new Texture2D(77, 50); + CapComSkins.titleButtonOnLeft.SetPixels(pix); + CapComSkins.titleButtonOnLeft.Apply(); + } + else if (t.name == "missc_listitem_false") + { + Texture2D newT = new Texture2D(77, 50); - original = null; + var rt = RenderTexture.GetTemporary(t.width, t.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB, 1); - missionControlTexture.Apply(); + Graphics.Blit(t, rt); - CapComSkins.texturesFromAtlas(missionControlTexture); + RenderTexture.active = rt; - Destroy(missionControlTexture); + newT.ReadPixels(new Rect(0, 0, t.width, t.height), 0, 0); + + RenderTexture.active = null; + RenderTexture.ReleaseTemporary(rt); + + rt = null; + + newT.Apply(); + + var pix = newT.GetPixels(0, 0, 77, 50); + + CapComSkins.titleButtonOffLeft = new Texture2D(77, 50); + CapComSkins.titleButtonOffLeft.SetPixels(pix); + CapComSkins.titleButtonOffLeft.Apply(); + } + else if (t.name == "missc_logo_bg") + CapComSkins.flagTex = t; + } + + CapComSkins.atlasStyles(); } CapComSkins.currentFlag = GameDatabase.Instance.GetTexture(HighLogic.CurrentGame.flagURL, false); @@ -143,8 +184,8 @@ protected override void Awake() default: version = ainfoV.InformationalVersion; break; } } - - protected override void Start() + + protected override void Start() { instance = this; diff --git a/Source/CapComSkins.cs b/Source/CapComSkins.cs index 37b3cab..c55f8f1 100644 --- a/Source/CapComSkins.cs +++ b/Source/CapComSkins.cs @@ -418,7 +418,7 @@ internal static void texturesFromAtlas(Texture2D atlas) atlasStyles(); } - private static void atlasStyles() + public static void atlasStyles() { acceptButton = new GUIStyle(CC_SkinsLibrary.DefUnitySkin.button); acceptButton.padding = new RectOffset(0, 0, 0, 0); diff --git a/Source/Framework/CC_MonoBehaviourExtended.cs b/Source/Framework/CC_MonoBehaviourExtended.cs index aa0095e..cb04e98 100644 --- a/Source/Framework/CC_MonoBehaviourExtended.cs +++ b/Source/Framework/CC_MonoBehaviourExtended.cs @@ -413,7 +413,7 @@ internal static void LogFormatted_DebugOnly(String Message, params object[] strP internal static void LogFormatted(String Message, params object[] strParams) { Message = String.Format(Message, strParams); // This fills the params into the message - String strMessageLine = String.Format("{0},{2},{1}", + String strMessageLine = String.Format("{2},{0},{1}", DateTime.Now, Message, _AssemblyName); // This adds our standardised wrapper to each line UnityEngine.Debug.Log(strMessageLine); // And this puts it in the log diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index 3be73bf..6b05aea 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -21,9 +21,9 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("64f03873-36c9-4580-9b03-4a236465a892")] -[assembly: AssemblyVersion("1.0.2.7")] -[assembly: AssemblyFileVersion("1.0.2.7")] -[assembly: AssemblyInformationalVersion("v2.7")] -[assembly: KSPAssembly("CapCom", 2, 7)] -[assembly: KSPAssemblyDependency("Progress Parser", 0, 8)] -[assembly: KSPAssemblyDependency("Contract Parser", 0, 7)] +[assembly: AssemblyVersion("1.0.2.8")] +[assembly: AssemblyFileVersion("1.0.2.8")] +[assembly: AssemblyInformationalVersion("v2.8")] +[assembly: KSPAssembly("CapCom", 2, 8)] +[assembly: KSPAssemblyDependency("Progress Parser", 0, 9)] +[assembly: KSPAssemblyDependency("Contract Parser", 0, 8)]