internal UISpriteButton(Sprite spr, int spriteFrameIndex) : base(string.Empty, 364, 365) { curSpr = spr; curSpr.FixedSpriteFrame = spriteFrameIndex; img = new UISpriteImage(curSpr); img.X = 2; img.Y = 2; AddComponent(img); }
private void ShowSingleUI() { // Fail-safe if (currentEntities.Length != 1) { return; } SpriteResource res = WarFile.GetSpriteResource(race == Race.Humans ? 360 : 359); SpriteResource resUnit = WarFile.GetSpriteResource(361); Entity ent = currentEntities[0]; UISpriteImage unitFrame = new UISpriteImage(new Sprite(res)); unitFrame.FixedSpriteFrame = ent.Mana > 0 ? 1 : 0; unitFrame.X = 0; unitFrame.Y = 0; AddComponent(unitFrame); UISpriteImage unitIcon = new UISpriteImage(new Sprite(resUnit)); unitIcon.FixedSpriteFrame = ent.IconIndex; unitIcon.X = 4; unitIcon.Y = 4; unitFrame.AddComponent(unitIcon); UILabel nameLabel = new UILabel(currentEntities[0].Name); nameLabel.TextAlign = TextAlignHorizontal.Left; nameLabel.X = 4; nameLabel.Y = unitIcon.Y + unitIcon.Height + 2; unitFrame.AddComponent(nameLabel); UIImage img = new UIImage(null); img.X = 35; img.Y = 20; img.Height = 3; img.BackgroundColor = new Color(0.0f, 1.0f, 0.0f, 1.0f); SetHealthbar(img, ent); unitFrame.AddComponent(img); healthBars.Add(ent, img); }
private void ShowSingleUI() { // Fail-safe if (currentEntities.Length != 1) return; SpriteResource res = WarFile.GetSpriteResource(race == Race.Humans ? 360 : 359); SpriteResource resUnit = WarFile.GetSpriteResource(361); Entity ent = currentEntities[0]; UISpriteImage unitFrame = new UISpriteImage(new Sprite(res)); unitFrame.FixedSpriteFrame = ent.Mana > 0 ? 1 : 0; unitFrame.X = 0; unitFrame.Y = 0; AddComponent(unitFrame); UISpriteImage unitIcon = new UISpriteImage(new Sprite(resUnit)); unitIcon.FixedSpriteFrame = ent.IconIndex; unitIcon.X = 4; unitIcon.Y = 4; unitFrame.AddComponent(unitIcon); UILabel nameLabel = new UILabel(currentEntities[0].Name); nameLabel.TextAlign = TextAlignHorizontal.Left; nameLabel.X = 4; nameLabel.Y = unitIcon.Y + unitIcon.Height + 2; unitFrame.AddComponent(nameLabel); UIImage img = new UIImage(null); img.X = 35; img.Y = 20; img.Height = 3; img.BackgroundColor = new Color(0.0f, 1.0f, 0.0f, 1.0f); SetHealthbar(img, ent); unitFrame.AddComponent(img); healthBars.Add(ent, img); }
internal static UISpriteImage FromSpriteResource(SpriteResource resource) { UISpriteImage res = new UISpriteImage(new UnitSprite(resource)); return(res); }
internal static UISpriteImage FromSpriteResource(string name) { UISpriteImage res = new UISpriteImage(new UnitSprite(WarFile.GetSpriteResource(WarFile.KnowledgeBase.IndexByName(name)))); return(res); }
internal static UISpriteImage FromSpriteResource(SpriteResource resource) { UISpriteImage res = new UISpriteImage(new UnitSprite(resource)); return res; }
internal static UISpriteImage FromSpriteResource(string name) { UISpriteImage res = new UISpriteImage(new UnitSprite(WarFile.GetSpriteResource(WarFile.KnowledgeBase.IndexByName(name)))); return res; }