예제 #1
0
        public Slider(LogicCore type, string name, string label, string tip, float min, float max, Func <IMyTerminalBlock, float> cv, Action <IMyTerminalBlock, float> set, Action <IMyTerminalBlock, StringBuilder> disp) : base(type, name, label, tip)
        {
            getCurrentValue = cv;
            setValue        = set;

            displayText = disp;

            minValue = min;
            maxValue = max;
        }
예제 #2
0
 public ControlButton(LogicCore type, string name, string label, string tip, Action <IMyTerminalBlock> ef) : base(type, name, label, tip)
 {
     effect = ef;
 }
예제 #3
0
 protected Control(LogicCore type, string name, string label, string tip)
 {
     id          = "[BLOCKFILTER=" + type.GetType().ToString() + "]" + name;
     displayName = label;
     tooltip     = tip;
 }
예제 #4
0
        public static bool isOptionApplicable(IMyTerminalBlock block, IMyTerminalControl control, LogicCore caller)
        {
            var    lgc  = block.GameLogic.GetAs <LogicCore>();
            string type = lgc != null?lgc.GetType().ToString() : null;

            string seek = getBlockTypeFilter(control);

            //if (seek != null)
            // MyAPIGateway.Utilities.ShowNotification(block.CustomName+" check "+control.Id+" > looking for '"+seek+"', have '"+type);
            return(seek == null || type == seek);
        }
예제 #5
0
 public OnOffButton(LogicCore type, string name, string label, string tip, Func <IMyTerminalBlock, bool> cv, Action <IMyTerminalBlock, bool> set) : base(type, name, label, tip)
 {
     getCurrentValue = cv;
     setValue        = set;
 }
        public static void sendSyncData(LogicCore b)
        {
            Packets type = Packets.NONE;

            if (b is EMP)
            {
                type = Packets.EMP;
            }
            else if (b is HackingBlock)
            {
                type = Packets.HACKING;
            }
            else if (b is CloakingDevice)
            {
                type = Packets.CLOAKING;
            }
            else if (b is DeviceSniffer)
            {
                type = Packets.SNIFFER;
            }
            else if (b is RadarEmitter)
            {
                type = Packets.RADAR;
            }

            if (type != Packets.NONE)
            {
                Packet p = new Packet(type);
                p.writeInt((int)type);
                p.writeLong(b.Entity.EntityId);
                p.mark();
                switch (type)
                {
                case Packets.EMP:
                    sendEMPData(p, b as EMP);
                    break;

                case Packets.HACKING:
                    sendHackData(p, b as HackingBlock);
                    break;

                case Packets.CLOAKING:
                    sendCloakData(p, b as CloakingDevice);
                    break;

                case Packets.SNIFFER:
                    sendSnifferData(p, b as DeviceSniffer);
                    break;

                case Packets.RADAR:
                    sendRadarData(p, b as RadarEmitter);
                    break;
                }
                if (p.changed())
                {
                    p.sendToAll();
                }
                //IO.log("Send a packet to sync "+b+" with ID "+b.Entity.EntityId);
            }
            else
            {
                IO.log("Tried to send a packet to sync an unhandled type " + b + "!!");
            }
        }