Exemple #1
0
 public bool GetPortConnected(LogicGateBase.PortId port)
 {
     if (port == LogicGateBase.PortId.InputTwo && !RequiresTwoInputs)
     {
         return(false);
     }
     return(Game.Instance.logicCircuitManager.GetNetworkForCell(PortCell(port)) != null);
 }
Exemple #2
0
        public int PortCell(LogicGateBase.PortId port)
        {
            switch (port)
            {
            case LogicGateBase.PortId.InputOne:
                return(InputCellOne);

            case LogicGateBase.PortId.InputTwo:
                return(InputCellTwo);

            case LogicGateBase.PortId.OutputOne:
                return(OutputCellOne);

            default:
                return(OutputCellOne);
            }
        }
Exemple #3
0
 public bool TryGetPortAtCell(int cell, out LogicGateBase.PortId port)
 {
     if (cell == InputCellOne)
     {
         port = LogicGateBase.PortId.InputOne;
         return(true);
     }
     if (RequiresTwoInputs && cell == InputCellTwo)
     {
         port = LogicGateBase.PortId.InputTwo;
         return(true);
     }
     if (cell == OutputCellOne)
     {
         port = LogicGateBase.PortId.OutputOne;
         return(true);
     }
     port = LogicGateBase.PortId.InputOne;
     return(false);
 }
Exemple #4
0
        public int GetPortValue(LogicGateBase.PortId port)
        {
            switch (port)
            {
            case LogicGateBase.PortId.InputOne:
                return(GetValueOfLogicEventHandler(inputOne));

            case LogicGateBase.PortId.InputTwo:
                if (RequiresTwoInputs)
                {
                    return(GetValueOfLogicEventHandler(inputTwo));
                }
                return(0);

            case LogicGateBase.PortId.OutputOne:
                return(outputValueOne);

            default:
                return(outputValueOne);
            }
        }
        private void LogicCardGate(HoverTextDrawer hoverTextDrawer, string properName, LogicGate gates, LogicGateBase.PortId portId)
        {
            int  portValue     = gates.GetPortValue(portId);
            bool portConnected = gates.GetPortConnected(portId);

            LogicGate.LogicGateDescriptions.Description portDescription = gates.GetPortDescription(portId);
            hoverTextDrawer.BeginShadowBar(false);

            LocString fmt =
                portId == LogicGateBase.PortId.Output ?
                UI.TOOLS.GENERIC.LOGIC_MULTI_OUTPUT_HOVER_FMT :
                UI.TOOLS.GENERIC.LOGIC_MULTI_INPUT_HOVER_FMT;

            hoverTextDrawer.DrawText(fmt.Replace("{Port}", portDescription.name.ToUpper()).Replace("{Name}", properName), __this.Styles_BodyText.Standard);


            hoverTextDrawer.NewLine(26);
            TextStyleSetting textStyleSetting3;

            if (portConnected)
            {
                textStyleSetting3 = ((portValue == 1) ? __this.Styles_LogicActive.Selected : __this.Styles_LogicSignalInactive);
            }
            else
            {
                textStyleSetting3 = __this.Styles_LogicActive.Standard;
            }
            hoverTextDrawer.DrawIcon((portValue == 1 && portConnected) ? __this.iconActiveAutomationPort : __this.iconDash, textStyleSetting3.textColor, 18, 2);
            hoverTextDrawer.DrawText(portDescription.active, textStyleSetting3);
            hoverTextDrawer.NewLine(26);
            TextStyleSetting textStyleSetting4;

            if (portConnected)
            {
                textStyleSetting4 = ((portValue == 0) ? __this.Styles_LogicStandby.Selected : __this.Styles_LogicSignalInactive);
            }
            else
            {
                textStyleSetting4 = __this.Styles_LogicStandby.Standard;
            }
            hoverTextDrawer.DrawIcon((portValue == 0 && portConnected) ? __this.iconActiveAutomationPort : __this.iconDash, textStyleSetting4.textColor, 18, 2);
            hoverTextDrawer.DrawText(portDescription.inactive, textStyleSetting4);
            hoverTextDrawer.EndShadowBar();
        }