Beispiel #1
0
        void dispatchEvents()
        {
            while (true)
            {
                sEvent evt = new sEvent();
                device.file.call(eControlCode.DQEVENT, ref evt);
                switch (evt.type)
                {
                case eEventType.EndOfStream:
                    eventsSink.onEndOfStream();
                    break;

                case eEventType.SourceChange:
                    if (evt.u.sourceChanges.HasFlag(eSourceChanges.Resolution))
                    {
                        eventsSink.onDynamicResolutionChange();
                    }
                    break;

                default:
                    // Logger.logVerbose( "Received a decoder event: {0}", evt );
                    break;
                }

                if (evt.pending <= 0)
                {
                    // Logger.logVerbose( "Dispatched all events" );
                    break;
                }
                else
                {
                    // Logger.logVerbose( "Dispatched an event, {0} pending ones", evt.pending );
                }
            }
        }
Beispiel #2
0
    public sEvent GenerateEvent()
    {
        EventType eT       = PickEventType();
        sEvent    newEvent = null;

        if (eT.type is RepairHatchEvent)
        {
            RepairStation rS = eT.stations.GetRandomStation() as RepairStation;
            if (rS == null)
            {
                return(null);                                                //means all stations are broken
            }
            newEvent = ScriptableObject.CreateInstance <RepairHatchEvent>(); //new RepairEvent(); // Instantiate<sEvent>(eT.type);
            activeEvents.Add(newEvent);
            (newEvent as RepairHatchEvent).station = rS;
            newEvent.InitiateEvent(this);
            if (rS.location != map.playerLocation)
            {
                diagH.DisplayRepairMessage(newEvent as RepairHatchEvent);
            }
        }
        else if (eT.type is RepairPipeEvent)
        {
            RepairStation rS = eT.stations.GetRandomStation() as RepairStation;
            if (rS == null)
            {
                return(null);                                               //means all stations are broken
            }
            newEvent = ScriptableObject.CreateInstance <RepairPipeEvent>(); //new RepairEvent(); // Instantiate<sEvent>(eT.type);
            activeEvents.Add(newEvent);
            (newEvent as RepairPipeEvent).station = rS;
            newEvent.InitiateEvent(this);
            if (rS.location != map.playerLocation)
            {
                diagH.DisplayRepairMessage(newEvent as RepairPipeEvent);
            }
        }
        else if (eT.type is RepairPumpEvent)
        {
            RepairStation rS = eT.stations.GetRandomStation() as RepairStation;
            if (rS == null)
            {
                return(null);                                               //means all stations are broken
            }
            newEvent = ScriptableObject.CreateInstance <RepairPumpEvent>(); //new RepairEvent(); // Instantiate<sEvent>(eT.type);
            activeEvents.Add(newEvent);
            (newEvent as RepairPumpEvent).station = rS;
            newEvent.InitiateEvent(this);

            if (rS.location != map.playerLocation)
            {
                diagH.DisplayRepairMessage(newEvent as RepairPumpEvent);
            }
        }

        return(newEvent);
    }
Beispiel #3
0
 public void UnsubscribeEvent(sEvent ev)
 {
     activeEvents.Remove(ev);
     Destroy(ev);
     if (!ScriptedDone)
     {
         this.DelayedCall(() => { GenerateScriptedEvent(); }, delayBetweenScripted);
     }
 }
Beispiel #4
0
        protected override void OnWrite(VoidPtr address)
        {
            int off = 0;

            foreach (Event e in _children)
            {
                off += e.Count * 8;
            }

            sParameter *paramAddr = (sParameter *)address;
            sEvent *    eventAddr = (sEvent *)(address + off);

            _rebuildAddr = eventAddr;

            foreach (Event e in _children)
            {
                if (e._name == "FADEF00D" || e._name == "FADE0D8A")
                {
                    continue;
                }
                e._rebuildAddr = eventAddr;
                *eventAddr = new sEvent()
                {
                    _id = e.ID, _nameSpace = e.NameSpace, _numArguments = (byte)e.Count, _unk1 = e._unknown
                };
                if (e.Count > 0)
                {
                    eventAddr->_argumentOffset = (uint)Offset(paramAddr);
                    _lookupOffsets.Add(&eventAddr->_argumentOffset);
                }
                else
                {
                    eventAddr->_argumentOffset = 0;
                }
                eventAddr++;
                foreach (Parameter p in e)
                {
                    p._rebuildAddr = paramAddr;
                    if (p.ParamType != ParamType.Offset)
                    {
                        *paramAddr = new sParameter()
                        {
                            _type = (int)p.ParamType, _data = p.Data
                        }
                    }
                    ;
                    else
                    {
                        MovesetFile.Builder._postProcessNodes.Add(p);
                    }
                    paramAddr++;
                }
            }

            eventAddr++; //Terminate
        }
Beispiel #5
0
    public void GenerateScriptedEvent()
    {
        if (currentScriptedEventIndex >= ScriptedStations.Length)
        {
            NotificationManager.Instance.QueueNotificationMessage("End of Practice Mode\nGood Luck!");
            this.DelayedCall(() => {
                ScriptedDone = true;
                map.ResetSpeed();
            }, 5f);
            return;
        }
        else
        {
            RepairStation rS = ScriptedStations[currentScriptedEventIndex] as RepairStation;
            if (rS == null)
            {
                return;
            }

            sEvent newEvent = null;
            if (rS.GetRepairEventType() == RepairEvent.RepairEventType.Hatch)
            {
                newEvent = ScriptableObject.CreateInstance <RepairHatchEvent>(); //new RepairEvent(); // Instantiate<sEvent>(eT.type);
                activeEvents.Add(newEvent);
                (newEvent as RepairHatchEvent).station = rS;
                newEvent.InitiateEvent(this);

                if (rS.location != map.playerLocation)
                {
                    diagH.DisplayRepairMessage(newEvent as RepairHatchEvent);
                }
            }

            else if (rS.GetRepairEventType() == RepairEvent.RepairEventType.Pipe)
            {
                newEvent = ScriptableObject.CreateInstance <RepairPipeEvent>(); //new RepairEvent(); // Instantiate<sEvent>(eT.type);
                activeEvents.Add(newEvent);
                (newEvent as RepairPipeEvent).station = rS;
                newEvent.InitiateEvent(this);

                if (rS.location != map.playerLocation)
                {
                    diagH.DisplayRepairMessage(newEvent as RepairPipeEvent);
                }
            }

            else if (rS.GetRepairEventType() == RepairEvent.RepairEventType.Pump)
            {
                newEvent = ScriptableObject.CreateInstance <RepairPumpEvent>(); //new RepairEvent(); // Instantiate<sEvent>(eT.type);
                activeEvents.Add(newEvent);
                (newEvent as RepairPumpEvent).station = rS;
                newEvent.InitiateEvent(this);

                if (rS.location != map.playerLocation)
                {
                    diagH.DisplayRepairMessage(newEvent as RepairPumpEvent);
                }
            }


            currentScriptedEventIndex++;
        }
    }
Beispiel #6
0
 public void DetachEvent()
 {
     attachedEvent = null;
     hasEvent      = false;
 }
Beispiel #7
0
 public void AttachEvent(sEvent s)
 {
     attachedEvent = s;
     hasEvent      = true;
 }