Ludeon Forums

Ludeon Forums

  • May 27, 2020, 06:03:16 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Modding request: make TexButton public, not internal  (Read 47 times)

LWM

  • Colonist
  • ***
  • Posts: 913
  • Little White Mouse
    • View Profile
Modding request: make TexButton public, not internal
« on: May 22, 2020, 11:36:15 PM »

Verse.TexButton is an internal class.  If it were a public class, then modders could more easily match the look of the vanilla game.

Modders can get around this by keeping a static Texture2D and using Harmony (or reflection):
Code: [Select]
        static MyThingThatNeedsTexture_StaticConstructor () {
            Drop=(Texture2D)HarmonyLib.AccessTools.Field(HarmonyLib.AccessTools
                .TypeByName("Verse.TexButton"), "Drop").GetValue(null);
        }
        private static Texture2D Drop; // == TexButton.Drop
But that is not elegant and adds unnecessary clutter to mods.

Thank you for the consideration!
« Last Edit: May 23, 2020, 01:25:01 PM by LWM »
Logged