PostEvent() public méthode

Posts an event specified by name that does not require any parameters. Observers associated with this event will be called.
public PostEvent ( string notificationName ) : void
notificationName string
Résultat void
Exemple #1
0
    private void DisplayRingDropRule()
    {
        // Display message about ring sizes and order
        Parameters p = new Parameters();

        p.PutExtra("message", "Whoops! You can only drop a ring onto a larger one!");
        EventBroadcaster.PostEvent(EventNames.DisplayMessage, p);
    }
Exemple #2
0
    public void HandleOnButtonPressed()
    {
        if (toggleDisabled)
        {
            IsOn          = !IsOn;
            button.colors = IsOn ? defaultNormalColor : disabledNormalColor;

            if (!string.IsNullOrEmpty(eventName))
            {
                Parameters p = new Parameters();
                p.PutExtra("on", IsOn);
                EventBroadcaster.PostEvent(eventName, p);
            }

            if (onButtonToggleEvent != null)
            {
                onButtonToggleEvent.Invoke(IsOn);
            }
        }
    }