Esempio n. 1
0
    public static void TriggerEvent(Details data)
    {
        //Debug.Log("TriggerEvent: GetNextDialogueAction = " + data.GetNextDialogueAction().ToString());
        SenderEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(data.GetNextDialogueAction().ToString(), out thisEvent))
        {
            thisEvent.Invoke(data);
        }

        data.SetDialogueAsComplete(data.GetNextDialogueAction());
    }
Esempio n. 2
0
    public static void StopListening(string eventName, UnityAction <Details> listener)
    {
        if (eventManager == null)
        {
            return;
        }

        SenderEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
        public async Task RTCPSender()
        {
            CancellationToken ct = tokenSender.Token;

            try
            {
                await Task.Run(async() =>
                {
                    while (true)
                    {
                        var handleArray = new WaitHandle[] { ct.WaitHandle };
                        //Waiting on wait handle to signal first
                        var finishedId = WaitHandle.WaitAny(handleArray, 10000);
                        if (finishedId == 0)
                        {
                            // Poll on this property if you have to do
                            // other cleanup before throwing.
                            if (ct.IsCancellationRequested)
                            {
                                // Clean up here, then...
                                //sendBYE();
                                if (_logger.IsDebugEnabled)
                                {
                                    _logger.Debug("RTCP Sender exiting");
                                }

                                ct.ThrowIfCancellationRequested();
                            }
                        }
                        //Transmitions.ReapOldMembers();

                        if (SenderEvent.WaitOne(0) == true)
                        {
                            RTPSessionState[] sessions = null;
                            lock (Sessions)
                            {
                                sessions = Sessions.Values.ToArray();
                            }


                            await SendSRReport(this, sessions);
                        }
                    }
                }, ct);
            }
            catch (Exception ex)
            {
                Console.WriteLine("RTCP Sender exiting");
            }
        }
Esempio n. 4
0
    public static void StartListening(string eventName, UnityAction <Details> listener)
    {
        SenderEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new SenderEvent();
            thisEvent.AddListener(listener);

            instance.eventDictionary.Add(eventName, thisEvent);
        }
    }
Esempio n. 5
0
    void Awake()
    {
        onModifyEvent = new SenderEvent();
        maxShot       = System.Enum.GetValues(typeof(ProjectileKind)).Length;
        ammoCounts    = new int[maxShot + 1];

        // initialize inventory
        ammoCounts[(int)ProjectileKind.cannonBall] = int.MaxValue;
        // uncomment these to get unlimited ammo for the appropriate type for testing
        //ammoCounts[(int)ProjectileKind.acorn] = int.MaxValue;
        //ammoCounts[(int)ProjectileKind.artilleryShell] = int.MaxValue;
        //ammoCounts[(int)ProjectileKind.beetMissile] = int.MaxValue;
        //ammoCounts[(int)ProjectileKind.mushboom] = int.MaxValue;
        //ammoCounts[(int)ProjectileKind.pillarShot] = int.MaxValue;
        //ammoCounts[(int)ProjectileKind.sharkToothCluster] = int.MaxValue;
        //ammoCounts[(int)ProjectileKind.teleportBall] = int.MaxValue;
    }