Пример #1
0
        /// <summary>
        /// Adds all our UI for our weapon description
        /// </summary>
        public override void AddInitialUI()
        {
            base.AddInitialUI();

            DebugUtils.AssertNotNull(Weapon);
            DebugUtils.AssertNotNull(Weapon.WeaponData);

            WeaponImage = AddObject(new Image(new Vector2(300, 300), Vector2.Zero, Weapon.WeaponData.TextureAsset)) as Image;
            WeaponImage.Name = "Weapon Image";
            WeaponImage.UsesCollider = false;

            WeaponNameLabel = AddObject(new Label(Weapon.WeaponData.DisplayName, Vector2.Zero)) as Label;
            WeaponNameLabel.Name = "Weapon Name";

            BulletImages = new Image[Weapon.WeaponData.MagazineSize];
            for (int i = 0; i < Weapon.WeaponData.MagazineSize; i++)
            {
                // Fixup position later
                BulletImages[i] = AddObject(new Image(Vector2.Zero, Weapon.WeaponData.BulletThumbnailTextureAsset)) as Image;
                BulletImages[i].UsesCollider = false;
            }

            // Fixup position later
            ReloadingLabel = AddObject(new FlashingLabel(1.5f, "RELOADING", Vector2.Zero)) as FlashingLabel;
            ReloadingLabel.Colour = Color.Red;
            ReloadingLabel.Hide();
        }
 public FlashingTextCommand(string text, Vector2 localPosition, Color labelColour, bool shouldPauseGame = false, float lifeTime = float.MaxValue) :
     base(shouldPauseGame, lifeTime)
 {
     // Create and add to our parent screen here
     Label        = ParentScreen.AddScreenUIObject(new FlashingLabel(text, localPosition), true, true);
     Label.Colour = labelColour;
 }