public HeroHudImage(string name) { this.HeroSprite = new Render.Sprite(ImageLoader.Load(name), new Vector2(0, 0)) { Scale = new Vector2(0.38f, 0.38f), Visible = true, VisibleCondition = delegate { return(HudVariables.ShouldBeVisible); }, }; this.SSSprite = new Render.Sprite(Resources.SSCircle, new Vector2(0, 0)) { Scale = new Vector2(0.38f, 0.38f), Visible = true, }; this.SSText = new Render.Text(new Vector2(0, 0), "", 26, SharpDX.Color.White) { Visible = true, Centered = true }; //image.GrayScale(); HeroSprite.Add(1); SSSprite.Add(2); SSText.Add(3); }
public HeroHudImage(string name) { this.HeroSprite = new Render.Sprite(ImageLoader.Load(name), new Vector2(0, 0)) { Scale = new Vector2(0.38f, 0.38f), Visible = true, VisibleCondition = delegate { return(HudVariables.ShouldBeVisible); }, }; this.SSSprite = new Render.Sprite(Resources.SSCircle, new Vector2(0, 0)) { Scale = new Vector2(0.38f, 0.38f), Visible = true, VisibleCondition = delegate { var heroTracker = SSTrackerModule.Trackers.Values.FirstOrDefault(h => h.Hero.ChampionName.ToLower().Equals(name.ToLower())); if (heroTracker != null) { return(HudVariables.ShouldBeVisible && MenuExtensions.GetItemValue <bool>("dz191.dza.sstracker.hud") && heroTracker.SSTimeFloat >= Variables.MinSSTime); } return(false); }, }; this.SSText = new Render.Text(new Vector2(0, 0), "", 26, SharpDX.Color.White) { Visible = true, TextUpdate = delegate { var heroTracker = SSTrackerModule.Trackers.Values.FirstOrDefault(h => h.Hero.ChampionName.ToLower().Equals(name.ToLower())); return(heroTracker != null ? heroTracker.SSTime : string.Empty); }, VisibleCondition = delegate { var heroTracker = SSTrackerModule.Trackers.Values.FirstOrDefault(h => h.Hero.ChampionName.ToLower().Equals(name.ToLower())); if (heroTracker != null) { return(HudVariables.ShouldBeVisible && MenuExtensions.GetItemValue <bool>("dz191.dza.sstracker.hud") && heroTracker.SSTimeFloat >= Variables.MinSSTime); } return(false); }, Centered = true }; //image.GrayScale(); HeroSprite.Add(1); SSSprite.Add(2); SSText.Add(3); }
public StatsTab() { var heroClass = Dungeon.Hero.ClassName(); var title = new IconTitle(); title.Icon(HeroSprite.Avatar(Dungeon.Hero.heroClass, Dungeon.Hero.Tier())); title.Label(Utils.Format(TxtTitle, Dungeon.Hero.Lvl, heroClass).ToUpper(CultureInfo.CurrentCulture)); title.SetRect(0, 0, WIDTH, 0); Add(title); float pos = title.Bottom(); if (Dungeon.Challenges > 0) { var btnCatalogus = new RedButton(TxtChallenges); btnCatalogus.ClickAction = button => Game.Scene.Add(new WndChallenges(Dungeon.Challenges, false)); btnCatalogus.SetRect(0, pos + Gap, btnCatalogus.ReqWidth() + 2, btnCatalogus.ReqHeight() + 2); Add(btnCatalogus); pos = btnCatalogus.Bottom(); } pos += Gap + Gap; pos = StatSlot(this, TxtStr, Dungeon.Hero.STR.ToString(), pos); pos = StatSlot(this, TxtHealth, Dungeon.Hero.HT.ToString(), pos); pos += Gap; pos = StatSlot(this, TxtDuration, ((int)Statistics.Duration).ToString(), pos); pos += Gap; pos = StatSlot(this, TxtDepth, Statistics.DeepestFloor.ToString(), pos); pos = StatSlot(this, TxtEnemies, Statistics.EnemiesSlain.ToString(), pos); pos = StatSlot(this, TxtGold, Statistics.GoldCollected.ToString(), pos); pos += Gap; pos = StatSlot(this, TxtFood, Statistics.FoodEaten.ToString(), pos); pos = StatSlot(this, TxtAlchemy, Statistics.PotionsCooked.ToString(), pos); pos = StatSlot(this, TxtAnkhs, Statistics.AnkhsUsed.ToString(), pos); }
public override void Create() { Music.Instance.Play(Assets.TUNE, true); Music.Instance.Volume(1f); PixelDungeon.LastClass(Dungeon.Hero.heroClass.Ordinal()); base.Create(); Camera.Main.ZoomTo(defaultZoom + PixelDungeon.Zoom()); Scene = this; _terrain = new Group(); Add(_terrain); _water = new SkinnedBlock(levels.Level.Width * DungeonTilemap.Size, Level.Height * DungeonTilemap.Size, Dungeon.Level.WaterTex()); _terrain.Add(_water); _ripples = new Group(); _terrain.Add(_ripples); _tiles = new DungeonTilemap(); _terrain.Add(_tiles); Dungeon.Level.AddVisuals(this); _plants = new Group(); Add(_plants); foreach (var plant in Dungeon.Level.plants.Values) { AddPlantSprite(plant); } _heaps = new Group(); Add(_heaps); foreach (var heap in Dungeon.Level.heaps.Values) { AddHeapSprite(heap); } _emitters = new Group(); _effects = new Group(); _emoicons = new Group(); _mobs = new Group(); Add(_mobs); foreach (var mob in Dungeon.Level.mobs) { AddMobSprite(mob); if (Statistics.AmuletObtained) { mob.Beckon(Dungeon.Hero.pos); } } Add(_emitters); Add(_effects); _gases = new Group(); Add(_gases); foreach (var blob in Dungeon.Level.Blobs.Values) { blob.Emitter = null; AddBlobSprite(blob); } _fog = new FogOfWar(Level.Width, Level.Height); _fog.UpdateVisibility(Dungeon.Visible, Dungeon.Level.visited, Dungeon.Level.mapped); Add(_fog); Brightness(PixelDungeon.Brightness()); _spells = new Group(); Add(_spells); _statuses = new Group(); Add(_statuses); Add(_emoicons); _hero = new HeroSprite(); _hero.Place(Dungeon.Hero.pos); _hero.UpdateArmor(); _mobs.Add(_hero); Add(new HealthIndicator()); Add(_cellSelector = new CellSelector(_tiles)); var sb = new StatusPane(); sb.Camera = uiCamera; sb.SetSize(uiCamera.CameraWidth, 0); Add(sb); _toolbar = new Toolbar(); _toolbar.Camera = uiCamera; _toolbar.SetRect(0, uiCamera.CameraHeight - _toolbar.Height, uiCamera.CameraWidth, _toolbar.Height); Add(_toolbar); var attack = new AttackIndicator(); attack.Camera = uiCamera; attack.SetPos(uiCamera.CameraWidth - attack.Width, _toolbar.Top() - attack.Height); Add(attack); _log = new GameLog(); _log.Camera = uiCamera; _log.SetRect(0, _toolbar.Top(), attack.Left(), 0); Add(_log); if (Dungeon.Depth < Statistics.DeepestFloor) { GLog.Information(TxtWelcomeBack, Dungeon.Depth); } else { GLog.Information(TxtWelcome, Dungeon.Depth); Sample.Instance.Play(Assets.SND_DESCEND); } switch (Dungeon.Level.feeling) { case Level.Feeling.CHASM: GLog.Warning(TxtChasm); break; case Level.Feeling.WATER: GLog.Warning(TxtWater); break; case Level.Feeling.GRASS: GLog.Warning(TxtGrass); break; } if (Dungeon.Level is RegularLevel && ((RegularLevel)Dungeon.Level).SecretDoors > pdsharp.utils.Random.IntRange(3, 4)) { GLog.Warning(TxtSecrets); } if (Dungeon.NightMode && !Dungeon.BossLevel()) { GLog.Warning(TxtNightMode); } _busy = new BusyIndicator(); _busy.Camera = uiCamera; _busy.X = 1; _busy.Y = sb.Bottom() + 1; Add(_busy); switch (InterlevelScene.mode) { case InterlevelScene.Mode.RESURRECT: WandOfBlink.Appear(Dungeon.Hero, Dungeon.Level.entrance); new Flare(8, 32).Color(0xFFFF66, true).Show(_hero, 2f); break; case InterlevelScene.Mode.RETURN: WandOfBlink.Appear(Dungeon.Hero, Dungeon.Hero.pos); break; case InterlevelScene.Mode.FALL: Chasm.HeroLand(); break; case InterlevelScene.Mode.DESCEND: switch (Dungeon.Depth) { case 1: WndStory.ShowChapter(WndStory.ID_SEWERS); break; case 6: WndStory.ShowChapter(WndStory.ID_PRISON); break; case 11: WndStory.ShowChapter(WndStory.ID_CAVES); break; case 16: WndStory.ShowChapter(WndStory.ID_METROPOLIS); break; case 22: WndStory.ShowChapter(WndStory.ID_HALLS); break; } if (Dungeon.Hero.IsAlive && Dungeon.Depth != 22) { Badge.ValidateNoKilling(); } break; } Camera.Main.Target = _hero; //var m = new string[Level.Width]; //var b = new StringBuilder(); //for (var i = 0; i < Level.passable.Length; i++) //{ // var cx = i % Level.Width; // var cy = i / Level.Width; // if (i == Dungeon.Hero.pos) // { // m[cx] += "H"; // continue; // } // if (Level.passable[i]) // m[cx] += "."; // else // m[cx] += "#"; //} //foreach (var s in m) // b.AppendLine(s); //Debug.WriteLine(b); //for (var i = 0; i < Dungeon.Level.mapped.Length; i++) // Dungeon.Level.mapped[i] = true; FadeIn(); }
protected override void CreateChildren() { _shield = new NinePatch(Assets.STATUS, 80, 0, 30 + 18, 0); Add(_shield); var touchArea = new TouchArea(0, 1, 30, 30); touchArea.ClickAction = touch => { var sprite = Dungeon.Hero.Sprite; if (!sprite.Visible) { Camera.Main.FocusOn(sprite); } GameScene.Show(new WndHero()); }; Add(touchArea); _btnMenu = new MenuButton(); Add(_btnMenu); _avatar = HeroSprite.Avatar(Dungeon.Hero.heroClass, _lastTier); Add(_avatar); _blood = new Emitter(); _blood.Pos(_avatar); _blood.Pour(BloodParticle.Factory, 0.3f); _blood.AutoKill = false; _blood.On = false; Add(_blood); _compass = new Compass(Dungeon.Level.exit); Add(_compass); _hp = new Image(Assets.HP_BAR); Add(_hp); _exp = new Image(Assets.XP_BAR); Add(_exp); _level = new BitmapText(PixelScene.font1x); _level.Hardlight(0xFFEBA4); Add(_level); _depth = new BitmapText(Dungeon.Depth.ToString(CultureInfo.InvariantCulture), PixelScene.font1x); _depth.Hardlight(0xCACFC2); _depth.Measure(); Add(_depth); Dungeon.Hero.Belongings.CountIronKeys(); _keys = new BitmapText(PixelScene.font1x); _keys.Hardlight(0xCACFC2); Add(_keys); _danger = new DangerIndicator(); Add(_danger); _loot = new LootIndicator(); Add(_loot); _buffs = new BuffIndicator(Dungeon.Hero); Add(_buffs); }
public override void Update() { base.Update(); var health = (float)Dungeon.Hero.HP / Dungeon.Hero.HT; if (Math.Abs(health) < 0.0001) { _avatar.Tint(0x000000, 0.6f); _blood.On = false; } else if (health < 0.25f) { _avatar.Tint(0xcc0000, 0.4f); _blood.On = true; } else { _avatar.ResetColor(); _blood.On = false; } _hp.Scale.X = health; _exp.Scale.X = (Width / _exp.Width) * Dungeon.Hero.Exp / Dungeon.Hero.MaxExp(); if (Dungeon.Hero.Lvl != _lastLvl) { if (_lastLvl != -1) { var emitter = Recycle <Emitter>(); emitter.Revive(); emitter.Pos(27, 27); emitter.Burst(Speck.Factory(Speck.STAR), 12); } _lastLvl = Dungeon.Hero.Lvl; _level.Text(_lastLvl.ToString()); _level.Measure(); _level.X = PixelScene.Align(27.0f - _level.Width / 2); _level.Y = PixelScene.Align(27.5f - _level.BaseLine() / 2); } var k = IronKey.CurDepthQuantity; if (k != _lastKeys) { _lastKeys = k; _keys.Text(_lastKeys.ToString()); _keys.Measure(); _keys.X = Width - 8 - _keys.Width - 18; } var tier = Dungeon.Hero.Tier(); if (tier == _lastTier) { return; } _lastTier = tier; _avatar.Copy(HeroSprite.Avatar(Dungeon.Hero.heroClass, tier)); }