// -----------------------------------------------------------------------------------------

    // Adds an Event Type Out port on the Core Node
    /// <summary>
    /// Adds an In port on the Tranzmit Node
    /// </summary>
    /// <param name="node">The Tranzmit Node</param>
    /// <param name="eventName">The associated event</param>
    /// <returns>The Generated Port</returns>
    private Port Port_Add_Tranzmit_OUT(Tranzmit_Node node, Tranzmit.EventNames eventName)
    {
        // OUT
        var outPort = Port_Generate_TRANZMIT_Out(node, Direction.Output);

        outPort.portName  = eventName.ToString();;
        outPort.portColor = SilentColor.PropertyValue;
        node.outputContainer.Add(outPort);

        return(outPort);
    }
    // -----------------------------------------------------------------------------------------

    /// <summary>
    /// Adds an Out port on the Tranzmit Node
    /// </summary>
    /// <param name="node">The Tranzmit Node</param>
    /// <param name="eventName">The associated event</param>
    /// <returns>The Generated Port</returns>
    private Port Port_Add_Tranzmit_IN(Tranzmit_Node node, Tranzmit.EventNames eventName)
    {
        // IN
        var inPort = Port_Generate_TRANZMIT_In(node, Direction.Input);

        inPort.portName  = eventName.ToString();;
        inPort.portColor = SilentColor.PropertyValue;
        node.inputContainer.Add(inPort);

        return(inPort);
    }
Exemple #3
0
 public void SendSecretFound(bool SecretFound = true, Tranzmit.EventNames eventName = Tranzmit.EventNames.SecretFound)
 {
     if (Tranzmit != null)
     {
         // BROADCAST!
         Tranzmit.BroadcastEvent(eventName, this, SecretFound);
     }
     else
     {
         Debug.Log("No Instance of Tranzmit has been found!");
     }
 }
Exemple #4
0
 public void SendPlayerStats(Tranzmit.EventNames eventName = Tranzmit.EventNames.PlayerStats)
 {
     if (Tranzmit != null)
     {
         // BROADCAST!
         Tranzmit.BroadcastEvent(eventName, this, PlayerStatsTestData);
     }
     else
     {
         Debug.Log("No Instance of Tranzmit has been found!");
     }
 }
Exemple #5
0
 public void SendDamage(float damage = 42, Tranzmit.EventNames eventName = Tranzmit.EventNames.Damage)
 {
     if (Tranzmit != null)
     {
         // BROADCAST!
         Tranzmit.BroadcastEvent(eventName, this, damage);
     }
     else
     {
         Debug.Log("No Instance of Tranzmit has been found!");
     }
 }
 public void EventDeleted(Tranzmit.EventNames eventName)
 {
     Generate();
 }
    // -----------------------------------------------------------------------------------------

    // This section deals with events recieved from Tranzmit.

    public void EventAdded(Tranzmit.EventNames eventName)
    {
        Generate();
    }
Exemple #8
0
        // -----------------------------------------------------------------------------------------

        /// <summary>
        /// Seperate function to deal with the actual creation of the Debug Log entry.
        /// </summary>
        /// <returns>The new generated log entry.</returns>
        public LogEntry GenerateLogEntry(object source, Tranzmit.DeliveryStatuses status, List <Tranzmit.Errors> errors, Tranzmit.EventNames eventName, Type requiredDataType, Type providedDataType, Tranzmit.EventData.TranzmitDelegate tranzmitDelegate)
        {
            var entry = new LogEntry();

            entry.Status           = status;
            entry.Errors           = errors;
            entry.TranzmitEvent    = eventName;
            entry.RequiredDataType = requiredDataType;
            entry.ProvidedDataTypes.Add(providedDataType);
            entry.Broadcasters.Add(source, new ButtonData()
            {
                EventCount = 0
            });

            var subscribers = Tranzmit.GetSubscribersInSentEvent(tranzmitDelegate);

            foreach (object subscriber in subscribers)
            {
                entry.Subscribers.Add(subscriber, new ButtonData());
            }

            return(entry);
        }
Exemple #9
0
        // -----------------------------------------------------------------------------------------

        /// <summary>
        /// The business end of Tranzmit Debug. When Tranzmit ATTEMPTS to send an event, it also broadacasts information about it. This is sent regadless of whether the requested Tranzmit Event was valid and sent.
        /// It creates and saves the associated data. Notice that we store the button information in here. This allows for more eficient updating of the Graphview.
        /// </summary>
        /// <param name="source">The object that requested for a Tranzmit event to be sent. Can be Null</param>
        /// <param name="status">A basic 'Success' or 'Failed' output.</param>
        /// <param name="errors">A list of Enums that will show ALL issues (if any) with the Tranzmit Event Send request.</param>
        /// <param name="eventName">The name of the Tranzmit Event.</param>
        /// <param name="requiredDataType">The data type specified by the user when they configured the Tranzmit Event.</param>
        /// <param name="providedDataType">The type of data the user actually attached to the event. Can be Null.</param>
        /// <param name="tranzmitDelegate">The Event/Delegate of the Tranzmit Event.</param>
        public void EventSent(object source, Tranzmit.DeliveryStatuses status, List <Tranzmit.Errors> errors, Tranzmit.EventNames eventName, Type requiredDataType, Type providedDataType, Tranzmit.EventData.TranzmitDelegate tranzmitDelegate)
        {
            // This will be assigned to later on, and allows for cleaner code and less if statements etc
            Dictionary <Tranzmit.EventNames, List <LogEntry> > saveLocation = null;

            // Allocate the Dicitonary to use
            if (status == Tranzmit.DeliveryStatuses.Success)
            {
                saveLocation = Success;
            }
            else
            {
                saveLocation = Failed;
            }

            // Deal with potential NULL source
            if (source == null)
            {
                // We have to give it something!
                source = NullSourceObject;
            }

            // CREATE NEW EVENT LOGS FIRST - WILL APPLY TOTAL TO SUBSCRIBERS AND BROADCASTERS AFTER (BELOW)
            // NEW ENTRY INTO LIST - AS EVENT NAME NOT FOUND
            if (!saveLocation.ContainsKey(eventName))
            {
                var newLogEntry = GenerateLogEntry(source, status, errors, eventName, requiredDataType, providedDataType, tranzmitDelegate);
                saveLocation.Add(eventName, new List <LogEntry>()
                {
                    newLogEntry
                });

                Tranzmit.Broadcast_Tranzmit_Log_Update(newLogEntry);
            }
            else // EXISTING EVENT - We now Compare the ERRORS list - If no match found create a new entry based on ERRRORS
            {
                // Null if not match found
                var foundLog = ReturnFirstLogEntryWithMatchingErrorsList(saveLocation[eventName], errors);

                // NEW ERRORS LIST
                if (foundLog == null)
                {
                    var newLogEntry = GenerateLogEntry(source, status, errors, eventName, requiredDataType, providedDataType, tranzmitDelegate);
                    saveLocation[eventName].Add(newLogEntry);
                    Tranzmit.Broadcast_Tranzmit_Log_Update(newLogEntry);
                }
            }

            // SUBSCRIBERS - We update subscribers in case new ones have been added through code at some point.
            //...and also add to the count if they already exist
            var currentSubscribers = Tranzmit.GetSubscribersInSentEvent(tranzmitDelegate);

            // SUBSCRIBERS
            if (saveLocation.ContainsKey(eventName))
            {
                var foundLog = ReturnFirstLogEntryWithMatchingErrorsList(saveLocation[eventName], errors);

                if (foundLog != null)
                {
                    foreach (object o in currentSubscribers)
                    {
                        if (foundLog.Subscribers.ContainsKey(o))
                        {
                            foundLog.Subscribers[o].EventCount++;
                        }
                        else
                        {
                            foundLog.Subscribers.Add(o, new ButtonData()
                            {
                                EventCount = 0
                            });
                        }
                    }

                    Tranzmit.Broadcast_Tranzmit_Log_Update(foundLog);
                }
            }

            // BROADCASTERS
            if (saveLocation.ContainsKey(eventName))
            {
                var foundLog = ReturnFirstLogEntryWithMatchingErrorsList(saveLocation[eventName], errors);

                if (foundLog != null)
                {
                    if (foundLog.Broadcasters.ContainsKey(source))
                    {
                        foundLog.Broadcasters[source].EventCount++;
                    }
                    else
                    {
                        foundLog.Broadcasters.Add(source, new ButtonData()
                        {
                            EventCount = 1
                        });
                    }

                    Tranzmit.Broadcast_Tranzmit_Log_Update(foundLog);
                }
            }
        }
Exemple #10
0
        // -----------------------------------------------------------------------------------------

        /// <summary>
        /// A built-in Tranzmit Event sent by Tranzmit when an Event has been removed from the Tranzmit Events Dictionary.
        /// When recieved, Tranzmit Debug will auto remove an debug data associated with the Event Name.
        /// </summary>
        /// <param name="eventName">The name of the event that was removed from Tranzmit.Events</param>
        public void EventDeleted(Tranzmit.EventNames eventName)
        {
            Remove_Debug_Data_For_Deleted_Event_Type_ENUM();
            Remove_Debug_Data_For_Deleted_Event_Type_In_TRANZMIT();
        }
Exemple #11
0
        // -----------------------------------------------------------------------------------------

        /// <summary>
        /// A built-in Tranzmit Event sent by Tranzmit when an Event has been added to the Tranzmit Events Dictionary.
        /// </summary>
        /// <param name="eventName">The name of the event that was added to Tranzmit.Events</param>
        public void EventAdded(Tranzmit.EventNames eventName)
        {
            // Currently Unused.
        }