示例#1
0
    // Events
    public void OnWidgetEvent(WidgetEvent widgetEvent)
    {
        switch (widgetEvent.EventType)
        {
        case WidgetEvent.eEventType.buttonClick:
        {
            if (widgetEvent.EventSource == m_logoutButton)
            {
                GameWorldController.OnLogoutClicked();
            }

            if (widgetEvent.EventSource == m_firstEventButton)
            {
                GameWorldController.OnFirstEventClicked();
            }

            if (widgetEvent.EventSource == m_previousEventButton)
            {
                GameWorldController.OnPreviousEventClicked();
            }

            if (widgetEvent.EventSource == m_playPauseEventButton)
            {
                GameWorldController.OnPlayPauseClicked();
            }

            if (widgetEvent.EventSource == m_nextEventButton)
            {
                GameWorldController.OnNextEventClicked();
            }

            if (widgetEvent.EventSource == m_lastEventButton)
            {
                GameWorldController.OnLastEventClicked();
            }
        } break;

        case WidgetEvent.eEventType.mouseClick:
        {
            if (m_foregroundObjectTiles != null && widgetEvent.EventSource == m_foregroundObjectTiles)
            {
                WidgetEvent.MouseClickEventParameters eventParameters =
                    widgetEvent.EventParameters as WidgetEvent.MouseClickEventParameters;
                GameWorldController.OnCharacterMoveToRequest(eventParameters.localX, eventParameters.localY);
            }
        } break;

        case WidgetEvent.eEventType.mouseOver:
        case WidgetEvent.eEventType.mouseOut:
        case WidgetEvent.eEventType.mouseMove:
        {
            // Forward mouse events on to the overlay view for cursor updates
            GameWorldController.OverlayController.View.OnWidgetEvent(widgetEvent);
        } break;
        }
    }