public static LTexture LoadTexture(string name) { VaildLoon(); LTexture texture = (LTexture)CollectionUtils.Get(texCaches, name); if (texture == null || texture.isClose) { texture = LPKResource.OpenTexture(fileName, name); texCaches.Add(name, texture); } return(texture); }
public static BMFont LoadBMFont(string name) { VaildLoon(); string newName = FileUtils.GetNoExtensionName(name); BMFont font = (BMFont)CollectionUtils.Get(fontCaches, name); if (font == null || font.IsClose()) { Stream fnt = LPKResource.OpenStream(fileName, name + ".fnt"); Stream img = LPKResource.OpenStream(fileName, name + ".png"); font = new BMFont(fnt, img); fontCaches.Add(name, font); } return(font); }
public override void OnLoad() { images = new LTexture[17]; for (int i = 0; i < 8; i++) { images[i] = new LTexture("assets/" + i + ".jpg"); } string res = "assets/res.lpk"; images[8] = LPKResource.OpenTexture(res, "a0.png"); images[9] = LPKResource.OpenTexture(res, "dot.png"); images[10] = LPKResource.OpenTexture(res, "background.jpg"); images[11] = LPKResource.OpenTexture(res, "role0.png"); images[12] = LPKResource.OpenTexture(res, "role1.png"); images[13] = LPKResource.OpenTexture(res, "role2.png"); images[14] = LPKResource.OpenTexture(res, "win.png"); images[15] = LPKResource.OpenTexture(res, "start.png"); images[16] = LPKResource.OpenTexture(res, "gameover.png"); SetBackground(GetImage(10)); Stage(1); }