本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}