/// <summary> /// Call in Plugin.Load /// </summary> /// <param name="sprite">The button's sprite, null for kill button</param> public GameplayButton(Sprite sprite, HudPosition position) { Index = Buttons.Count; Position = position ?? throw new ArgumentNullException(nameof(position), "Position cannot be null."); Position.Offset += new Vector2(EdgeOffsetX, EdgeOffsetY); Buttons.Add(this); if (sprite) { UpdateSprite(sprite); } CreateButton(); Events.HudUpdated += HudUpdate; }
/// <summary> /// Call in Plugin.Load /// </summary> /// <param name="imageData">Encoded image data</param> public GameplayButton(byte[] imageData, HudPosition position) : this(CreateSprite(imageData ?? throw new ArgumentNullException(nameof(imageData), $"An image asset is required.")), position)
/// <summary> /// Call in Plugin.Load /// </summary> /// <param name="imageData">Encoded image data</param> public CooldownButton(byte[] imageData, HudPosition position, float cooldown, float effectDuration = 0F, float initialCooldown = 0F) : base(imageData, position) { Setup(cooldown, effectDuration, initialCooldown); }
/// <summary> /// Call in Plugin.Load /// </summary> /// <param name="imageEmbededResourcePath">Path to embedded resource containing an image</param> public CooldownButton(string imageEmbededResourcePath, HudPosition position, float cooldown, float effectDuration = 0F, float initialCooldown = 0F) : this(GetBytesFromEmbeddedResource(Assembly.GetCallingAssembly(), imageEmbededResourcePath), position, cooldown, effectDuration, initialCooldown) { }
/// <summary> /// Call in Plugin.Load /// </summary> /// <param name="sprite">The button's sprite, null for kill button</param> public CooldownButton(Sprite sprite, HudPosition position, float cooldown, float effectDuration = 0F, float initialCooldown = 0F) : base(sprite, position) { Setup(cooldown, effectDuration, initialCooldown); }