Example #1
0
        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]);
        }
Example #2
0
        protected BaseGUI()
        {
            this.krpg2 = KRPG2.Instance;

            _guiElements.Add(this);
        }
Example #3
0
 public Button(Vector2 position)
 {
     krpg2         = (KRPG2)ModLoader.GetMod("KRPG2");
     this.position = position;
 }
Example #4
0
 public static Texture2D GetGUI(KRPG2 krpg2, string filename)
 {
     return(GetTexture(krpg2, PATH_GUI + filename));
 }
Example #5
0
 protected BaseGUI()
 {
     this.krpg2 = (KRPG2)ModLoader.GetMod("KRPG2");
     _guiElements.Add(this);
 }