private DarkNetTrader InitTrader(DarkNetTraderDef def) { DarkNetTrader newTrder = (DarkNetTrader)Activator.CreateInstance(def.workerClass); newTrder.def = def; newTrder.FirstInit(); return(newTrder); }
public void InitDarkNet() { Traders = new List <DarkNetTrader>(); foreach (var trader in DefDatabase <DarkNetTraderDef> .AllDefs) { DarkNetTrader newTrader = InitTrader(trader); Traders.Add(newTrader); } }
public Dialog_DarkNetTraderCard(DarkNetTrader trader) { doCloseX = true; this.trader = trader; if (trader.def.OverridePortraitWidth == 0) { width = 400; } else { width = trader.def.OverridePortraitWidth; } }
private void DrawTraderInfo(DarkNetTrader trader) { Text.Font = GameFont.Medium; Vector2 textSize = Text.CalcSize(currentTrader.Name); Rect labelRect = new Rect(130, 0, textSize.x, 35); Widgets.Label(labelRect, currentTrader.Name); Rect rect = new Rect(labelRect.x + textSize.x + 5, 0, 24, 24); if (Widgets.ButtonImage(rect, Info, GUI.color)) { Find.WindowStack.Add(new Dialog_DarkNetTraderCard(trader)); } TooltipHandler.TipRegion(rect, "DefTraderInfoTip".Translate()); GUIUtils.DrawLineHorizontal(112, 32, 360, Color.gray); Text.Font = GameFont.Small; }
private void DrawTraderIcon(Rect rect, DarkNetTrader trader) { bool status = trader.Online || trader.OnlineEveryTime; if (Widgets.ButtonImage(rect, status ? trader.IconMenu : trader.IconOfflineMenu)) { currentTrader = trader; } Widgets.DrawHighlightIfMouseover(rect); if (!status) { GUI.color = Color.black; GUI.DrawTexture(rect, StorytellerHighlightTex); GUI.color = Color.white; } if (currentTrader == trader) { GUI.DrawTexture(rect, StorytellerHighlightTex); } }