private static void AddDropPort(GameObject gameObject, LogicPorts.Port defaultOutputPort) { var inputPorts = new[] { new LogicPorts.Port(DropPortID, new CellOffset(0, 0), "Drops contents when active", "Drops contents", null, true, LogicPortSpriteType.Input) }; var outputPorts = new[] { defaultOutputPort }; GeneratedBuildings.RegisterLogicPorts(gameObject, inputPorts, outputPorts); }
public static void Postfix(GameObject go, LogicPorts.Port ___OUTPUT_PORT) { AddDropPort(go, ___OUTPUT_PORT); }
private void LogicCardPort(HoverTextDrawer hoverTextDrawer, string properName, LogicPorts ports, LogicPorts.Port port, bool isInput) { hoverTextDrawer.BeginShadowBar(false); LocString defaultName; int portState; string fmt; if (isInput) { defaultName = UI.LOGIC_PORTS.PORT_INPUT_DEFAULT_NAME; portState = ports.GetInputValue(port.id); fmt = UI.TOOLS.GENERIC.LOGIC_INPUT_HOVER_FMT; } else { defaultName = UI.LOGIC_PORTS.PORT_OUTPUT_DEFAULT_NAME; portState = ports.GetOutputValue(port.id); fmt = UI.TOOLS.GENERIC.LOGIC_OUTPUT_HOVER_FMT; } string desc = port.displayCustomName ? port.description : defaultName.text; hoverTextDrawer.DrawText(fmt.Replace("{Port}", desc.ToUpper()).Replace("{Name}", properName), __this.Styles_BodyText.Standard); hoverTextDrawer.NewLine(26); bool portConnected = ports.IsPortConnected(port.id); TextStyleSetting textStyleSetting; if (portConnected) { textStyleSetting = ((portState == 1) ? __this.Styles_LogicActive.Selected : __this.Styles_LogicSignalInactive); } else { textStyleSetting = __this.Styles_LogicActive.Standard; } hoverTextDrawer.DrawIcon((portState == 1 && portConnected) ? __this.iconActiveAutomationPort : __this.iconDash, textStyleSetting.textColor, 18, 2); hoverTextDrawer.DrawText(port.activeDescription, textStyleSetting); hoverTextDrawer.NewLine(26); TextStyleSetting textStyleSetting2; if (portConnected) { textStyleSetting2 = ((portState == 0) ? __this.Styles_LogicStandby.Selected : __this.Styles_LogicSignalInactive); } else { textStyleSetting2 = __this.Styles_LogicStandby.Standard; } hoverTextDrawer.DrawIcon((portState == 0 && portConnected) ? __this.iconActiveAutomationPort : __this.iconDash, textStyleSetting2.textColor, 18, 2); hoverTextDrawer.DrawText(port.inactiveDescription, textStyleSetting2); hoverTextDrawer.EndShadowBar(); }