public ShipSprite CreateSprite() { ShipgenState state = new ShipgenState(); ShipSprite res = new ShipSprite(); Apply(state, res); res.FinishCreating(); return(res); }
public override IEnumerable <Gizmo> CompGetGizmosExtra() { yield return(new Command_Action { defaultLabel = "TraderShipsSendAway".Translate(), defaultDesc = "TraderShipsSendAwayDesc".Translate(), action = new Action(SendAway), icon = SendAwayTexture, }); if (tradeRequest != null) { Command_Action command_Action = new Command_Action(); command_Action.defaultLabel = "CommandFulfillTradeOffer".Translate(); command_Action.defaultDesc = "CommandFulfillTradeOfferDesc".Translate(); command_Action.icon = TradeCommandTex; command_Action.action = delegate() { if (tradeRequest == null) { Log.Error("Attempted to fulfill an unavailable request", false); return; } WindowStack windowStack = Find.WindowStack; TaggedString text = "CommandFulfillTradeOfferConfirm".Translate(GenLabel.ThingLabel(tradeRequest.requestedThingDef, null, tradeRequest.requestedCount)); windowStack.Add(Dialog_MessageBox.CreateConfirmation(text, delegate() { FulfillTradeRequest(); }, false, null)); }; if (!tradeRequest.CanFulfillRequest(tradeShip)) { command_Action.Disable("CommandFulfillTradeOfferFailInsufficient".Translate(TradeRequestUtility.RequestedThingLabel(tradeRequest.requestedThingDef, tradeRequest.requestedCount))); } yield return(command_Action); } if (Prefs.DevMode) { yield return(new Command_Action { defaultLabel = "Dev: randomize sprite", action = delegate() { Color color = sprite.color; sprite = Props.shipgen.CreateSprite(); sprite.color = color; sprite.FinishCreating(); }, }); yield return(new Command_Action { defaultLabel = "Dev: randomize color", action = delegate() { sprite.color = ShipSprite.RandomColor(); sprite.FinishCreating(); }, }); } yield break; }