Exemple #1
0
        public static int Width(uint ascanNum, uint ascanPort, GateType type, ref double width)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].Width;
            double val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get the Width of gate failed", "错误:获得门的宽度失败");
                return(error_code);
            }
            width = val;
            SetGateDAQ.setWidthDictionary(ascanNum, ascanPort, type, width);
            return(error_code);
        }
Exemple #2
0
        public static int DnsBw(uint ascanNum, GateType type, double dnsBw)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].DnsBw;
            double val     = dnsBw;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set the dns Band width failed!", "错误:设置BNS Bandwidth失败!");
            }
            return(error_code);
        }
Exemple #3
0
        /**get gate suppress counter active*/
        public static int ScActive(uint ascanNum, uint ascanPort, GateType type, SuppressCounterActive active)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].ScActive;
            uint val     = (uint)active;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, ascanPort, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set the Active of Suppress Counter failed!", "错误:设置Suppress Counter Active失败!");
            }
            return(error_code);
        }
Exemple #4
0
        public static void setDelayDictionary(uint ascanNum, uint ascanPort, GateType type, double delay)
        {
            SessionInfo info = SessionHardWare.getSessionAttr((int)ascanNum);

            if (info == null)
            {
                return;
            }
            int classNum = (int)info.myHardInfo.ClassicNum;
            int slotNum  = (int)info.myHardInfo.SlotNum;
            int upPort   = (classNum << 16) + (slotNum << 8) + (int)ascanPort;

            switch (type)
            {
            case GateType.I:
                delayForGateI[upPort] = delay;
                break;

            case GateType.A:
                delayForGateA[upPort] = delay;
                break;

            case GateType.B:
                delayForGateB[upPort] = delay;
                break;

            case GateType.C:
                delayForGateC[upPort] = delay;
                break;
            }
        }
Exemple #5
0
        public static int Delay(uint ascanNum, uint ascanPort, GateType type, double delay)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].Delay;
            double val     = delay;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, ascanPort, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set the Delay of gate failed", "错误:设置门的起始位置失败");
                return(error_code);
            }
            setDelayDictionary(ascanNum, ascanPort, type, val);
            return(error_code);
        }
Exemple #6
0
        public static int tofMode(uint ascanNum, uint ascanPort, GateType type, TofMode mode)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].TofMode;
            uint val     = (uint)mode;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, ascanPort, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set TOF Mode failed!", "错误:设置TOF Mode失败!");
            }
            return(error_code);
        }
Exemple #7
0
        public static GateDefinition Get(GateType gateType, Gate gate)
        {
            if (Definitions == null)
            {
                LoadAll();
            }

            var definition = Definitions[gateType];

            foreach (var inputName in definition.Inputs)
            {
                if (!gate.InputAnchors.Any(a => a.Name.Equals(inputName)))
                {
                    throw new InvalidOperationException($"Gate {gateType} has no {inputName} input anchor");
                }
            }

            foreach (var outputName in definition.Outputs)
            {
                if (!gate.OutputAnchors.Any(a => a.Name.Equals(outputName)))
                {
                    throw new InvalidOperationException($"Gate {gateType} has no {outputName} output anchor");
                }
            }

            if (definition.HasState)
            {
                return(definition.New);
            }
            else
            {
                return(definition);
            }
        }
Exemple #8
0
        private void UpdateItemPopupDrawer(GateType gateType)
        {
            switch (gateType)
            {
            case GateType.ScoreGate:
                _itemPopupDrawer = new ItemPopupDrawer(ItemType.Score, false, null);
                _itemPopupLabel  = "Score";
                break;

            case GateType.VirtualItemGate:
                _itemPopupDrawer = new ItemPopupDrawer(ItemType.VirtualItem, false,
                                                       VirtualItemType.VirtualCurrency | VirtualItemType.SingleUseItem);
                _itemPopupLabel = "Virtual Item";
                break;

            case GateType.WorldCompletionGate:
                _itemPopupDrawer = new ItemPopupDrawer(ItemType.World, false, null);
                _itemPopupLabel  = "World";
                break;

            case GateType.PurchasableGate:
                _itemPopupDrawer = new ItemPopupDrawer(ItemType.VirtualItem, false,
                                                       VirtualItemType.LifeTimeItem);
                _itemPopupLabel = "Purchasable Item";
                break;

            default:
                _itemPopupDrawer = null;
                break;
            }
            UpdateSubGatesPopupDrawers();
        }
Exemple #9
0
 public LogicGate(GateType gateType, List <ISignal> inputSignals, ISignal outputSignal)
 {
     this.name         = ".logicGate" + ++gateCount;
     this.gateType     = gateType;
     this.inputSignals = inputSignals;
     this.outputSignal = outputSignal;
 }
Exemple #10
0
        public static int TolMonitorMax(uint ascanNum, uint ascanPort, GateType type, double max)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].TolMonitorMax;
            double val     = max;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, ascanPort, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set Tolerance Monitor Max failed!", "错误:设置Tolerance Monitor Max失败!");
            }
            return(error_code);
        }
Exemple #11
0
        public static int TolMonitorMin(uint ascanNum, uint ascanPort, GateType type, ref double min)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].TolMonitorMax;
            double val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get Tolerance Monitor Min failed!", "错误:获取Tolerance Monitor Min失败!");
            }
            min = val;
            return(error_code);
        }
Exemple #12
0
        public static int Threshold(uint ascanNum, uint ascanPort, GateType type, ref double threshold)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].Threshold;
            double val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet((uint)ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get the Threshold of gate failed", "错误:获得门的高度失败");
            }
            threshold = val;
            return(error_code);
        }
Exemple #13
0
        public static int DtsStep(uint ascanNum, GateType type, double step)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].DtsStep;
            double val     = step;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set the dts Step failed!", "错误:设置BTS step失败!");
            }
            return(error_code);
        }
Exemple #14
0
        public static int Width(uint ascanNum, GateType type, double width)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].Width;
            double val     = width;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set the Width of gate failed", "错误:设置门的宽度失败");
            }
            return(error_code);
        }
Exemple #15
0
 private void cmsItem_CI_amp_Click(object sender, EventArgs e)
 {
     selectedGate            = GateType.CI;  //CI
     gateDataType            = DataType.Amp; //amp
     tChartAscan.Header.Text = "Gate CI — Amp — velocity:" + velocity + "mm/us";
     ResetTchart();
 }
Exemple #16
0
        /**TM suppress counter(TMSc)*/
        public static int TolMonitorSc(uint ascanNum, GateType type, uint cnt)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].TolMonitorSc;
            uint val     = cnt;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set Tolerance Monitor Suppress Counter failed!", "错误:设置Tolerance Monitor Suppress Counter失败!");
            }
            return(error_code);
        }
Exemple #17
0
        /**gate measment mode, pls see MeasMode Enum for part of list*/
        public static int MeasMode(uint ascanNum, uint ascanPort, GateType type, ref MeasMode mode)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].MeasMode;
            uint val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get the Gate measment mode failed!", "错误:获取Gate measment mode失败!");
            }
            mode = (MeasMode)val;
            return(error_code);
        }
Exemple #18
0
        public static int AlarmLogic(uint ascanNum, GateType type, GateAlarmLogic logic)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].AlarmLogic;
            uint val     = (uint)logic;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set the Gate Alarm Logic failed!", "错误:设置Gate Alarm Logic失败!");
            }
            return(error_code);
        }
Exemple #19
0
        public static int AlarmSignalLength(uint ascanNum, uint ascanPort, GateType type, ref GateAlarmSignalLength len)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].AlarmSignalLength;
            uint val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get the Gate alarm signal length failed!", "错误:获取Gate alarm signal length失败!");
            }
            len = (GateAlarmSignalLength)val;
            return(error_code);
        }
Exemple #20
0
        ////public static int AlarmTimeLength(uint ascanNum, uint ascanPort, GateType type, ref GateAlarmSignalLength len)
        //{
        //    int error_code;
        //    int gateNum = (int)type;
        //    uint attr = DaqAttrType.gate[gateNum].AlarmActive;
        //    uint val = (uint)len;

        //    if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
        //    {
        //        error_code = -1;
        //        return error_code;
        //    }

        //    if (type < gateTypeMin || type > gateTypeMax)
        //    {
        //        error_code = -1;
        //        return error_code;
        //    }

        //    error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
        //    if (error_code != (int)PDAQ_ERR.GOOD)
        //    {
        //        MessageShow.show("Error:Get the Gate alarm signal length failed!", "错误:获取Gate alarm signal length失败!");
        //    }
        //    return error_code;
        //}

        public static int AlarmActiveLevel(uint ascanNum, uint ascanPort, GateType type, ref GateAlarmLevel level)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].AlarmActiveLevel;
            uint val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get alarm active level failed!", "错误:获取Alarm active level失败!");
            }
            level = (GateAlarmLevel)val;
            return(error_code);
        }
Exemple #21
0
        private void tolMonitorAccordToGate(GateType gateType, int tolMonitorIndex)
        {
            int    error_code;
            double delay = 0;
            double width = 0;
            double tolMonitorMax;
            double tolMonitorMin;

            error_code = GetGateDAQ.Delay(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref delay);
            if (error_code != 0)
            {
                return;
            }

            error_code = GetGateDAQ.Width(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref width);
            if (error_code != 0)
            {
                return;
            }

            tolMonitorMin = delay;
            tolMonitorMax = delay + width;

            ((NumericUpDown)(Controls.Find("numUpDownMax" + tolMonitorIndex, true)[0])).Text = tolMonitorMax.ToString();
            ((NumericUpDown)(Controls.Find("numUpDownMin" + tolMonitorIndex, true)[0])).Text = tolMonitorMin.ToString();
        }
Exemple #22
0
        /// <summary>
        /// Creates a Gate.
        /// </summary>
        /// <param name="fileName"></param>
        public Gate(Program owner, Vector3 position, Vector3 orientation, int sequenceNr, int type)
        {
            this.owner       = owner;
            this.Position    = position;
            this.Orientation = orientation;
            this.sequenceNr  = sequenceNr;
            this.gateType    = (GateType)type;
            this.Scale       = new Vector3(2, 2, 2);
            LoadMesh("gate1.x");
            x1 = position.X + gateSize * (float)Math.Cos((double)orientation.Y);
            y1 = position.Z - gateSize * (float)Math.Sin((double)orientation.Y);
            x2 = position.X - gateSize * (float)Math.Cos((double)orientation.Y);
            y2 = position.Z + gateSize * (float)Math.Sin((double)orientation.Y);
            lineMesh1.Vertex1 = new Vector3(x1, position.Y, y1);
            lineMesh1.Vertex2 = new Vector3(x1, position.Y + gateHeight, y1);
            lineMesh2.Vertex1 = new Vector3(x2, position.Y, y2);
            lineMesh2.Vertex2 = new Vector3(x2, position.Y + gateHeight, y2);

            /*
             * lineMesh1.Vertex1 = this.Position + new Vector3(3.0f * (float)Math.Cos((double)orientation.Y), 0, -3.0f * (float)Math.Sin((double)orientation.Y));
             * lineMesh1.Vertex2 = this.Position + new Vector3(3.0f * (float)Math.Cos((double)orientation.Y), 10, -3.0f * (float)Math.Sin((double)orientation.Y));
             * lineMesh2.Vertex1 = this.Position + new Vector3(-3.0f * (float)Math.Cos((double)orientation.Y), 0, 3.0f * (float)Math.Sin((double)orientation.Y));
             * lineMesh2.Vertex2 = this.Position + new Vector3(-3.0f * (float)Math.Cos((double)orientation.Y), 10, 3.0f * (float)Math.Sin((double)orientation.Y));
             */
        }
Exemple #23
0
        public static int DtsStart(uint ascanNum, uint ascanPort, GateType type, ref double start)
        {
            int    error_code;
            int    gateNum = (int)type;
            uint   attr    = DaqAttrType.gate[gateNum].DtsStart;
            double val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get the dts Start failed!", "错误:获取BTS start失败!");
            }
            start = val;
            return(error_code);
        }
Exemple #24
0
        public static int ScCounter(uint ascanNum, uint ascanPort, GateType type, ref uint cnt)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].ScCounter;
            uint val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get Suppress Counter failed!", "错误:获取Suppress Counter失败!");
            }
            cnt = val;
            return(error_code);
        }
Exemple #25
0
        public static int DnsActive(uint ascanNum, uint ascanPort, GateType type, ref DNSActive active)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].DnsActive;
            uint val     = 0;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqGet(ascanNum, ascanPort, attr, ref val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Get Dns Active failed!", "错误:获取Dns Active失败!");
            }
            active = (DNSActive)val;
            return(error_code);
        }
Exemple #26
0
        /**get dynamic threld suppression (dts) active*/
        public static int DtsActive(uint ascanNum, GateType type, DTSActive active)
        {
            int  error_code;
            int  gateNum = (int)type;
            uint attr    = DaqAttrType.gate[gateNum].DtsActive;
            uint val     = (uint)active;

            if (ascanNum < ascanNumMin || ascanNum > ascanNumMax)
            {
                error_code = -1;
                return(error_code);
            }

            if (type < gateTypeMin || type > gateTypeMax)
            {
                error_code = -1;
                return(error_code);
            }

            error_code = DAQ.daqSet(ascanNum, attr, val);
            if (error_code != (int)PDAQ_ERR.GOOD)
            {
                MessageShow.show("Error:Set Dts Active failed!", "错误:设置Dts Active失败!");
            }
            return(error_code);
        }
Exemple #27
0
 protected Gate(CellCoordinates[] _coordinates, CellCoordinates[] _inputs, CellCoordinates[] _outputs, GateType _type) : base(GridObjectType.Gate, _coordinates)
 {
     CurrentValues = new int[_outputs.Length];
     Inputs        = _inputs;
     Outputs       = _outputs;
     Type          = _type;
 }
Exemple #28
0
 public Gate(GateType type, Zp quorumIndex, Common.FiniteField.Circuits.Circuit mpcCircuit)
 {
     Debug.Assert(type == GateType.Input || mpcCircuit != null, "Only input gates do not have MPC circuit.");
     Id          = idGen++;
     Type        = type;
     QuorumIndex = quorumIndex.Value;
     MpcCircuit  = mpcCircuit;
 }
Exemple #29
0
 private void cmsItem_C_tof_Click(object sender, EventArgs e)
 {
     selectedGate            = GateType.C;   //C
     gateDataType            = DataType.Tof; //tof
     tChartAscan.Header.Text = "Gate C — Tof — velocity:" + velocity + "mm/us";
     CalTchartY_S(selectedGate);
     ResetTchart();
 }
Exemple #30
0
 private static Guid GateGuid(GateType gateType, int inputCount, bool invertedOutput)
 {
     Tracer.Assert(gateType != GateType.Nop && GateSet.IsValid(gateType, inputCount) && (!invertedOutput || GateSet.HasOutput(gateType)));
     return(new Guid(0, 0, 0, 0, 0, 0, 0, 0,
                     (byte)(int)gateType,
                     (byte)inputCount,
                     (byte)(invertedOutput ? 1 : 0)
                     ));
 }
        protected override void OnTriggerEnter2D(Collider2D collider)
        {
            base.OnTriggerEnter2D(collider);

            switch (collider.tag)
            {
                case "Exit Gate": _gateCenter = collider.transform.position; _activeGateType = GateType.Exit; break;
                case "Warp Gate": _gateCenter = collider.transform.position; _activeGateType = GateType.Warp; break;
            }
        }
Exemple #32
0
        /// <summary>
        /// Composes two gates given the operator as a parameter.
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns>The resulting gate.</returns>
        public static IGate Compose(GateType type, IGate a, IGate b)
        {
            switch(type)
            {
                case GateType.OR:
                    return ComposeOR(a, b);

                case GateType.AND:
                    return ComposeAND(a, b);

                default:
                    throw new ArgumentException();
            }
        }
        public override void EmitBinaryOperator(GateType type)
        {
            switch (type)
            {
                case GateType.AND:
                    Writer.Append(" AND ");
                    break;

                case GateType.OR:
                    Writer.Append(" OR ");
                    break;

                default:
                    throw new InvalidOperationException();
            }
        }
        public override void EmitBinaryOperator(GateType type)
        {
            switch (type)
            {
                case GateType.AND:
                    Writer.Append(" && ");
                    break;

                case GateType.OR:
                    Writer.Append(" || ");
                    break;

                default:
                    throw new Exception("unsupported gate type.");
            }
        }
        public void EnterGate(GateType gateBeingEntered, Vector2 gateCenter)
        {
            if ((gateBeingEntered == GateType.Exit) && (CurrentGame.GameData.GemsCollected < CurrentGame.GameData.GemsRequired))
            {
                if (!_notEnoughGemsPopup.activeInHierarchy)
                {
                    _notEnoughGemsPopup.SetActive(true);
                }
            }
            else
            {
                _gateBeingEntered = gateBeingEntered;
                _gateCenter = gateCenter;

                CurrentGame.GameData.TimerIsFrozen = true;
                SwitchToSequencedAvatar();
                _sequencedAvatarController.SequenceCompleteHandler = CompleteGateEntrySequence;
                _sequencedAvatarAnimator.SetInteger("DeathSequence", 0);
                _sequencedAvatarAnimator.SetBool("ExitingGate", false);
                _sequencedAvatarAnimator.SetBool("EnteringGate", true);
            }
        }
 public override void ValueChanged(object sender, object value)
 {
     if (sender.ToString() == "System.Int32 PowerOutput")
     {
         PowerOutput = int.Parse(value.ToString());
         if (GateOpen)
         {
             foreach (GameObject obj in Outputs)
             {
                 obj.GetComponent<PowerLineScript>().SetPower(PowerOutput,gameObject,dotTile.GetComponent<DotTileScript>().PowerSourceObj);
             }
         }
     }
     print(sender.ToString());
     if (sender.ToString() == "LogicGate+GateType gateType")
     {
         switch (int.Parse(value.ToString()))
         {
             case 0: gateType = GateType.AND;
                 break;
             case 1: gateType = GateType.OR;
                 break;
             case 2: gateType = GateType.XOR;
                 break;
             case 3: gateType = GateType.NOT;
                 break;
             case 4: gateType = GateType.NAND;
                 break;
             case 5: gateType = GateType.NOR;
                 break;
             case 6: gateType = GateType.XNOR;
                 break;
             default:
                 break;
         }
     }
 }
Exemple #37
0
        public void LoadGateSetting(int id)
        {

            MySqlConnection conn = new MySqlConnection(connectionString);
            MySqlCommand cmd = new MySqlCommand(
                "select id, gate_class, gate_type, gate_code, gate_name, image_dir from gates where id=" + id,
                conn);
            conn.Open();
            MySqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                gateId = reader.GetInt64("id");
                int gtClass = reader.GetInt32("gate_class");
                switch (gtClass)
                {
                    case 1:
                        gateClass = GateClass.car;
                        break;
                    case 2:
                        gateClass = GateClass.motor;
                        break;
                }

                int type = reader.GetInt32("gate_type");
                switch (type)
                {
                    case 1:
                        gateType = GateType.gatein;
                        break;
                    case 2:
                        gateType = GateType.gateout;
                        break;
                }
                gateCode = reader.GetString("gate_code");
                gateName = reader.GetString("gate_name");
            }
            reader.Close();

            // get tarif based on gate class 
            string sql = "select id, name, initial_price, extended_price, extended_after from tarifs where id = ";
            switch (gateClass)
            {
                case GateClass.car:
                    sql += currentCarTarifId.ToString();
                    break;
                case GateClass.motor:
                    sql += currentMotorTarifId.ToString();
                    break;
            }
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = sql;
            if (conn.State != System.Data.ConnectionState.Open)
                conn.Open();

            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                tarifId = reader.GetInt32("id");
                tarifName = reader.GetString("name");
                tarifInitial = reader.GetInt64("initial_price");
                tarifExtended = reader.GetInt64("extended_price");
                tarifExtendedHour = reader.GetInt32("extended_after");
            }
            reader.Close();
            conn.Close();
        }
Exemple #38
0
        internal void EmitBinaryOperator(GateType type)
        {
            switch(type)
            {
                case GateType.AND:
                    Append(" && ");
                    break;

                case GateType.OR:
                    Append(" || ");
                    break;

                default:
                    throw new Exception("unsupported gate type.");
            }
        }
 private void OnTriggerExit2D(Collider2D collider)
 {
     if (collider.tag == "Exit Gate")
     {
         _gateCenterX = 0.0f;
         _activeGateType = GateType.None;
     }
 }
 private void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Exit Gate")
     {
         _gateCenterX = collider.transform.position.x;
         _activeGateType = GateType.Exit;
     }
 }
        private void Reset()
        {
            _facingRight = (_transform.localScale.x > 0.0f);
            _verticalMovementState = VerticalMovementState.OnGround;

            _lockMovement = false;
            _isMoving = false;

            _activeGateType = GateType.None;
            _gateCenterX = 0.0f;
            _enteringGate = false;

            _activeTool = null;
        }
Exemple #42
0
        public static IGate Compose(GateType type, IEnumerable<IGate> gates)
        {
            switch (type)
            {
                case GateType.OR:
                    return ComposeOR(gates);

                case GateType.AND:
                    return ComposeAND(gates);

                default:
                    throw new ArgumentException();
            }
        }
Exemple #43
0
 public abstract void EmitBinaryOperator(GateType type);
 private void OnTriggerExit2D(Collider2D collider)
 {
     if ((collider.tag == "Exit Gate") || (collider.tag == "Warp Gate"))
     {
         _gateCenter = Vector2.zero;
         _activeGateType = GateType.None;
     }
 }
        protected override void Reset()
        {
            base.Reset();

            _activeGateType = GateType.None;
            _gateCenter = Vector2.zero;
            _enteringGate = false;
        }