当前位置: 首页>>代码示例>>C#>>正文


C# IEvent.GetData方法代码示例

本文整理汇总了C#中IEvent.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# IEvent.GetData方法的具体用法?C# IEvent.GetData怎么用?C# IEvent.GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEvent的用法示例。


在下文中一共展示了IEvent.GetData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleEvent

    public bool HandleEvent(IEvent @event)
    {
        //Debug.LogWarning("change scene event");

        var sceneChangeEvent = @event as SceneChangeEvent;
        if (sceneChangeEvent == null)
        {
            Debug.LogError("SceneChangeEvent is null");
            return true;
        }

        var data = @event.GetData() as string;
        if (data == null)
        {
            Debug.LogError("data is null");
            return true;
        }

        try
        {
            this.currentScene = (SceneNames)Enum.Parse(typeof(SceneNames), data, ignoreCase: true);
            //Debug.LogWarning("change scene to " + this.currentScene );
        }
        catch
        {
            //Debug.Log("unable to parse");
            // do nothing
        }

        return true;
    }
开发者ID:Archanium,项目名称:ngj,代码行数:31,代码来源:DisableDrunkEffect.cs

示例2: HandleEvent

    public bool HandleEvent(IEvent @event)
    {
        var sceneChangeEvent = @event as SceneChangeEvent;
        if (sceneChangeEvent == null)
        {
            return true;
        }

        var data = @event.GetData() as string;
        if (data == null)
        {
            return true;
        }

        try
        {
            this.currentScene = (SceneNames)Enum.Parse(typeof(SceneNames), data, ignoreCase: true);
        }
        catch
        {
            // do nothing
        }

        return true;
    }
开发者ID:Archanium,项目名称:ngj,代码行数:25,代码来源:NeonlightRandomBigBuzz.cs

示例3: PlayerLockEvent

    bool IEventListener.HandleEvent(IEvent e)
    {
        if (e.GetName() == "SceneChangeEvent")
        {
            this.index = int.Parse(e.GetData() as string);
            var scene = (SceneNames)this.index;
            var offset = CameraXOffsetAttribute.GetOffset(scene);
            //print (this.index);
            EventManager.instance.AddListener(this as IEventListener, "FadeEvent");
            EventManager.instance.QueueEvent(new PlayerLockEvent());
            EventManager.instance.QueueEvent(new FadeOutEvent(2));
            if (index < endSceneStart)
            {
                this.TransformPlayer(offset);
            }

        }
        if (e.GetName() == "FadeEvent")
        {
            if (bool.TrueString == e.GetData() as string)
            {
                var scene = (SceneNames)this.index;
                var offset = CameraXOffsetAttribute.GetOffset(scene);
                this.TransformCamera(offset);
                EventManager.instance.QueueEvent(new FadeInEvent(2));
            }
            else if (bool.FalseString == e.GetData() as string)
            {
                EventManager.instance.DetachListener(this as IEventListener, "FadeEvent");
                EventManager.instance.QueueEvent(new PlayerUnlockEvent());

                if (index == endSceneStart)
                {
                    this.shown = true;
                }
            }
        }

        return true;
    }
开发者ID:Archanium,项目名称:ngj,代码行数:40,代码来源:SceneChanger.cs

示例4: HandleEvent

        /// <summary>
        /// EventManager callback.
        /// </summary>
        public bool HandleEvent(IEvent evnt)
        {
            string eventName = evnt.GetName ();
            object eventData = evnt.GetData ();

            if (eventName == onSnapName) {

                GuessDropped (eventData as GameObject);
            } else if (eventName == onMoveName) {
                // ignore
            } else if (eventName == snapOnEnterName) {
                // ignore
            } else if (eventName == snapOnExitName) {

                GuessVacate (eventData as GameObject);

            } else {
                Debug.LogWarning ("Unexpected Event in BC: " + eventName);
                return false;
            }
            return true;
        }
开发者ID:CalPolyGameDevelopment,项目名称:ettell,代码行数:25,代码来源:LevelManager.cs

示例5:

 bool IEventListener.HandleEvent(IEvent evt)
 {
     float val = 0f;
     float.TryParse(evt.GetData() as string, out val);
     if(evt.GetName() == "FadeOutEvent") {
         this.FadeOut (val);
     } else {
         this.FadeIn (val);
     }
     return true;
 }
开发者ID:Archanium,项目名称:ngj,代码行数:11,代码来源:Fader.cs


注:本文中的IEvent.GetData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。