public EntitySpawnSelectButton(EntityPrototype entityTemplate, string templateName) { var spriteNameParam = entityTemplate.GetBaseSpriteParamaters().FirstOrDefault(); var spriteName = ""; if (spriteNameParam != null) { spriteName = spriteNameParam.GetValue <string>(); } var objectName = entityTemplate.Name; _associatedTemplate = entityTemplate; _associatedTemplateName = templateName; _sprite = new Sprite(_resourceCache.GetSprite(spriteName)); Font font = _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF"); _name = new TextSprite("Name", font); _name.FillColor = Color.Black; _name.Text = objectName; DrawBackground = true; DrawBorder = true; }
private void PreparePlacement(string templateName) { EntityPrototype prototype = IoCManager.Resolve <IPrototypeManager>().Index <EntityPrototype>(templateName); ComponentParameter spriteParam = prototype.GetBaseSpriteParamaters().FirstOrDefault(); //Will break if states not ordered correctly. var spriteName = spriteParam == null ? "" : spriteParam.GetValue <string>(); Sprite sprite = ResourceCache.GetSprite(spriteName); CurrentBaseSprite = sprite; CurrentBaseSpriteKey = spriteName; CurrentPrototype = prototype; IsActive = true; }
public EntitySpawnSelectButton(EntityPrototype entityTemplate, string templateName, IResourceCache resourceCache) { _resourceCache = resourceCache; var spriteNameParam = entityTemplate.GetBaseSpriteParamaters().FirstOrDefault(); string SpriteName = ""; if (spriteNameParam != null) { SpriteName = spriteNameParam.GetValue <string>(); } string ObjectName = entityTemplate.Name; associatedTemplate = entityTemplate; associatedTemplateName = templateName; objectSprite = _resourceCache.GetSprite(SpriteName); font = _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF").Font; name = new TextSprite("Label" + SpriteName, "Name", font); name.Color = Color4.Black; name.Text = ObjectName; }
public EntitySpawnSelectButton(EntityPrototype entityTemplate, string templateName, IResourceManager resourceManager) { _resourceManager = resourceManager; var spriteNameParam = entityTemplate.GetBaseSpriteParamaters().FirstOrDefault(); string SpriteName = ""; if (spriteNameParam != null) { SpriteName = spriteNameParam.GetValue <string>(); } string ObjectName = entityTemplate.Name; associatedTemplate = entityTemplate; associatedTemplateName = templateName; objectSprite = _resourceManager.GetSprite(SpriteName); font = _resourceManager.GetFont("CALIBRI"); name = new TextSprite("Label" + SpriteName, "Name", font); name.Color = Color.Black; name.Text = ObjectName; }