public UIGachaBox( float xpos, float ypos, float wide = -1f, float high = -1f, bool rare = false, UIMenu openOnClose = null) : base("", xpos, ypos, wide, high) { this._openOnClose = openOnClose; this._rare = rare; this._duckCoin = new SpriteMap("duckCoin", 18, 18); this._duckCoin.CenterOrigin(); Graphics.fade = 1f; this._frame = new Sprite("unlockFrame"); this._frame.CenterOrigin(); this._furni = new Sprite("furni/tub"); this._furni.center = new Vec2((float)(this._furni.width / 2), (float)this._furni.height); this._star = new Sprite("prettyStar"); this._star.CenterOrigin(); this._font = new BitmapFont("biosFontUI", 8, 7); this._fancyFont = new FancyBitmapFont("smallFontGacha"); this._gachaEgg = new SpriteMap("gachaEgg", 44, 36); bool flag = false; if (Rando.Int(10) == 5) { flag = true; } this._contains = UIGachaBox.GetRandomFurniture(this._rare ? Rarity.VeryVeryRare : Rarity.Common, 1, flag ? 0.75f : (this._rare ? 0.75f : 1f), true)[0]; this._rareCapsule = this._contains.rarity >= Rarity.VeryVeryRare; if (this._rareCapsule) { this._gachaEgg.frame = 36; } else { this._gachaEgg.frame = Rando.Int(2) * 12; if (Rando.Int(1000) == 1) { this._gachaEgg.frame += 9; } else if (Rando.Int(500) == 1) { this._gachaEgg.frame += 6; } else if (Rando.Int(100) == 1) { this._gachaEgg.frame += 3; } } this._gachaEgg.CenterOrigin(); }
public static Furniture GetRandomFurniture(int minRarity) => UIGachaBox.GetRandomFurniture(minRarity, 1)[0];
public UIGachaBoxNew( float xpos, float ypos, float wide = -1f, float high = -1f, bool rare = false, UIMenu openOnClose = null) : base("", xpos, ypos, wide, high) { this._openOnClose = openOnClose; this._rare = rare; this._duckCoin = new SpriteMap("duckCoin", 18, 18); this._duckCoin.CenterOrigin(); this._gachaMachine = new Sprite("arcade/gotcha/machine"); this._gachaMachine.CenterOrigin(); this._gachaGlass = new Sprite("arcade/gotcha/glass"); this._gachaGlass.CenterOrigin(); this._gachaDoor = new Sprite("arcade/gotcha/door"); this._gachaDoor.CenterOrigin(); this._gachaTwister = new Sprite("arcade/gotcha/twister"); this._gachaTwister.CenterOrigin(); this._gachaBall = new SpriteMap("arcade/gotcha/balls", 40, 42); this._gachaBall.CenterOrigin(); this._gachaTwisterShadow = new Sprite("arcade/gotcha/twisterShadow"); this._gachaTwisterShadow.CenterOrigin(); this._whiteCircle = new Sprite("furni/whiteCircle"); this._whiteCircle.CenterOrigin(); this._coin = new SpriteMap("arcade/gotcha/coin", 22, 22); this._coin.CenterOrigin(); this._coinSlot = new Sprite("arcade/gotcha/coinSlot"); this._coinSlot.CenterOrigin(); this._rainbow = new Sprite("arcade/rainbow"); Graphics.fade = 1f; this._frame = new Sprite("unlockFrame"); this._frame.CenterOrigin(); this._furni = new Sprite("furni/tub"); this._furni.center = new Vec2((float)(this._furni.width / 2), (float)this._furni.height); this._star = new Sprite("prettyStar"); this._star.CenterOrigin(); this._font = new BitmapFont("biosFontUI", 8, 7); this._fancyFont = new FancyBitmapFont("smallFontGacha"); this._gachaEgg = new SpriteMap("gachaEgg", 44, 36); this._capsule = new SpriteMap("arcade/egg", 40, 23); this._capsule.CenterOrigin(); this._capsuleBorder = new SpriteMap("arcade/eggBorder", 66, 65); this._capsuleBorder.CenterOrigin(); this._rare = false; this.numGenerate = MonoMain.core.gachas; this.numGenerateRare = MonoMain.core.rareGachas; for (int index = 0; index < this.numGenerate; ++index) { Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.Common, 1, gacha: true)[0]; furniture.ballRot = Rando.Float(360f); furniture.rareGen = false; this.prizes.Add(furniture); } for (int index = 0; index < this.numGenerateRare; ++index) { Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.VeryVeryRare, 1, 0.4f, true).OrderBy <Furniture, int>((Func <Furniture, int>)(x => - x.rarity)).ElementAt <Furniture>(0); furniture.ballRot = Rando.Float(360f); furniture.rareGen = true; this.prizes.Add(furniture); } for (int index = 0; index < 3; ++index) { Furniture furniture = UIGachaBox.GetRandomFurniture(Rarity.Common, 1, gacha: true)[0]; furniture.ballRot = Rando.Float(360f); furniture.rareGen = false; this.prizes.Add(furniture); } this.LoadNextPrize(); this._gachaEgg.CenterOrigin(); }