Example #1
0
    public ExamineButton(ExamineVerb verb)
    {
        Margin = new Thickness(Thickness, Thickness, Thickness, Thickness);

        SetOnlyStyleClass(StyleClassExamineButton);

        Verb = verb;

        if (verb.Disabled)
        {
            Disabled = true;
        }

        ToolTip = verb.Message;

        Icon = new TextureRect
        {
            SetWidth  = ElementWidth,
            SetHeight = ElementHeight
        };

        if (verb.IconTexture != null)
        {
            var icon = new SpriteSpecifier.Texture(new ResourcePath(verb.IconTexture));

            Icon.Texture = icon.Frame0();
            Icon.Stretch = TextureRect.StretchMode.KeepAspectCentered;

            AddChild(Icon);
        }
    }
        public override void Initialize()
        {
            base.Initialize();

            for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
            {
                var gasPrototype = _prototypeManager.Index <GasPrototype>(i.ToString());
                GasPrototypes[i] = gasPrototype;

                if (string.IsNullOrEmpty(gasPrototype.GasOverlaySprite) && !string.IsNullOrEmpty(gasPrototype.GasOverlayTexture))
                {
                    _gasOverlays[i] = new SpriteSpecifier.Texture(new ResourcePath(gasPrototype.GasOverlayTexture));
                }

                if (!string.IsNullOrEmpty(gasPrototype.GasOverlaySprite) && !string.IsNullOrEmpty(gasPrototype.GasOverlayState))
                {
                    _gasOverlays[i] = new SpriteSpecifier.Rsi(new ResourcePath(gasPrototype.GasOverlaySprite), gasPrototype.GasOverlayState);
                }
            }
        }
Example #3
0
        static Atmospherics()
        {
            var protoMan = IoCManager.Resolve <IPrototypeManager>();

            GasPrototypes = new GasPrototype[TotalNumberOfGases];
            GasOverlays   = new SpriteSpecifier[TotalNumberOfGases];

            for (var i = 0; i < TotalNumberOfGases; i++)
            {
                var gasPrototype = protoMan.Index <GasPrototype>(i.ToString());
                GasPrototypes[i] = gasPrototype;

                if (string.IsNullOrEmpty(gasPrototype.GasOverlaySprite) && !string.IsNullOrEmpty(gasPrototype.GasOverlayTexture))
                {
                    GasOverlays[i] = new SpriteSpecifier.Texture(new ResourcePath(gasPrototype.GasOverlayTexture));
                }

                if (!string.IsNullOrEmpty(gasPrototype.GasOverlaySprite) && !string.IsNullOrEmpty(gasPrototype.GasOverlayState))
                {
                    GasOverlays[i] = new SpriteSpecifier.Rsi(new ResourcePath(gasPrototype.GasOverlaySprite), gasPrototype.GasOverlayState);
                }
            }
        }
Example #4
0
 public static Texture GetTexture(this SpriteSpecifier.Texture texSpecifier, IResourceCache cache)
 {
     return(cache
            .GetResource <TextureResource>(SharedSpriteComponent.TextureRoot / texSpecifier.TexturePath)
            .Texture);
 }