PostEvent() public method

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
return void
示例#1
0
文件: RingFilter.cs 项目: leehans/toh
    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);
    }
示例#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);
            }
        }
    }