private static Texture2D GetTexture(KRPG2 krpg2, string path) { if (Main.netMode == NetmodeID.Server) { throw new Exception("Server attempted to retrieve texture."); } if (!texturesByPath.ContainsKey(path)) { Texture2D texture; try { texture = krpg2.GetTexture(path); } catch (Exception e) { krpg2.LogError($"Could not retrieve texture '{path}'. " + e.ToString()); throw e; } texturesByPath.Add(path, texture); } return(texturesByPath[path]); }
protected BaseGUI() { this.krpg2 = KRPG2.Instance; _guiElements.Add(this); }
public Button(Vector2 position) { krpg2 = (KRPG2)ModLoader.GetMod("KRPG2"); this.position = position; }
public static Texture2D GetGUI(KRPG2 krpg2, string filename) { return(GetTexture(krpg2, PATH_GUI + filename)); }
protected BaseGUI() { this.krpg2 = (KRPG2)ModLoader.GetMod("KRPG2"); _guiElements.Add(this); }