本文整理汇总了C#中EventTriggerType类的典型用法代码示例。如果您正苦于以下问题:C# EventTriggerType类的具体用法?C# EventTriggerType怎么用?C# EventTriggerType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventTriggerType类属于命名空间,在下文中一共展示了EventTriggerType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddEventTrigger
private void AddEventTrigger(EventTrigger evTrig, UnityAction<BaseEventData> action, EventTriggerType triggerType)
{
EventTrigger.TriggerEvent triggerEvent = new EventTrigger.TriggerEvent();
triggerEvent.AddListener((eventData) => action(eventData));
EventTrigger.Entry entry = new EventTrigger.Entry() { callback = triggerEvent, eventID = triggerType };
evTrig.triggers.Add(entry);
}
示例2: AddPointerEnterTrigger
private void AddPointerEnterTrigger(EventTrigger evTrig, EventTriggerType triggerType)
{
EventTrigger.TriggerEvent triggerEvent = new EventTrigger.TriggerEvent();
AddEventTrigger(evTrig, d => OnPointerEnter(d, evTrig.gameObject), EventTriggerType.PointerEnter);
EventTrigger.Entry entry = new EventTrigger.Entry() { callback = triggerEvent, eventID = triggerType };
evTrig.triggers.Add(entry);
}
示例3: AddListener
private void AddListener(EventTriggerType type, UnityEngine.Events.UnityAction<BaseEventData> call)
{
EventTrigger.Entry entry = new EventTrigger.Entry();
entry.eventID = type;
entry.callback.AddListener(call);
this.trigger.triggers.Add(entry);
}
示例4: AddEventTrgger
void AddEventTrgger( UnityAction action, EventTriggerType triggerType )
{
EventTrigger.TriggerEvent trigger = new EventTrigger.TriggerEvent();
trigger.AddListener( (eventData) => action());
EventTrigger.Entry entry = new EventTrigger.Entry() { callback = trigger, eventID = triggerType };
eventTrigger.triggers.Add(entry);
}
示例5: AddEventTrigger
private void AddEventTrigger(EventTriggerType type, UnityAction<BaseEventData> action)
{
EventTrigger.Entry entry;
entry = new EventTrigger.Entry();
entry.eventID = type;
entry.callback.AddListener(action);
trigger.triggers.Add(entry);
}
示例6: AddListener
public static void AddListener(this UIBehaviour uiBehaviour, EventTriggerType eventID, UnityAction<BaseEventData> callback)
{
var entry = new EventTrigger.Entry();
entry.eventID = eventID;
entry.callback.AddListener(callback);
var eventTriggers = (uiBehaviour.GetComponent<EventTrigger>() ?? uiBehaviour.gameObject.AddComponent<EventTrigger>()).triggers;
eventTriggers.Add(entry);
}
示例7: AddTriggerEvent
public static void AddTriggerEvent(GameObject g, EventTriggerType type, UnityAction<BaseEventData> action)
{
EventTrigger trigger = g.AddComponent<EventTrigger>();
trigger.triggers = new List<EventTrigger.Entry>();
EventTrigger.Entry entry = new EventTrigger.Entry();
entry.eventID = type;
entry.callback.AddListener(action);
trigger.triggers.Add(entry);
}
示例8: AddEventTrigger
// ------------------ Constants and statics
// ------------------ Events
// ------------------ Serialized fields and properties
// ------------------ Non-serialized fields
// ------------------ Methods
public static void AddEventTrigger(EventTrigger eventTrigger, UnityAction unityAction, EventTriggerType eventTriggerType)
{
EventTrigger.TriggerEvent triggerEvent = new EventTrigger.TriggerEvent();
triggerEvent.AddListener((eventData) => unityAction()); // ignore event data
EventTrigger.Entry entry = new EventTrigger.Entry() { callback = triggerEvent, eventID = eventTriggerType };
eventTrigger.triggers.Add(entry);
}
示例9: AddEventTrigger
// Use listener that uses additional argument
private void AddEventTrigger(UnityAction<Toggle> action, EventTriggerType triggerType, Toggle toggle)
{
// Create a nee TriggerEvent and add a listener
EventTrigger.TriggerEvent trigger = new EventTrigger.TriggerEvent();
trigger.AddListener((eventData) => action(toggle)); // pass additonal argument to the listener
// Create and initialise EventTrigger.Entry using the created TriggerEvent
EventTrigger.Entry entry = new EventTrigger.Entry() { callback = trigger, eventID = triggerType };
// Add the EventTrigger.Entry to delegates list on the EventTrigger
eventTrigger.delegates.Add(entry);
}
示例10: AddEventTrigger
// Use listener that uses the BaseEventData passed to the Trigger
private void AddEventTrigger(UnityAction<BaseEventData> action, EventTriggerType triggerType)
{
// Create a nee TriggerEvent and add a listener
EventTrigger.TriggerEvent trigger = new EventTrigger.TriggerEvent();
trigger.AddListener((eventData) => action(eventData)); // capture and pass the event data to the listener
// Create and initialise EventTrigger.Entry using the created TriggerEvent
EventTrigger.Entry entry = new EventTrigger.Entry() { callback = trigger, eventID = triggerType };
// Add the EventTrigger.Entry to delegates list on the EventTrigger
eventTrigger.triggers.Add(entry);
}
示例11: AddClickToGameObject
public static void AddClickToGameObject(GameObject gameObject, UnityAction action, EventTriggerType triggerType)
{
var eventTrigger = gameObject.AddComponent<EventTrigger>();
eventTrigger.triggers = new List<EventTrigger.Entry>();
AddEventTrigger(eventTrigger, action, triggerType);
}
示例12: RemoveAllListeners
public static void RemoveAllListeners(this UIBehaviour uiBehaviour, EventTriggerType eventID)
{
var eventTrigger = uiBehaviour.GetComponent<EventTrigger>();
if (eventTrigger == null)
return;
eventTrigger.triggers.RemoveAll(listener => listener.eventID == eventID);
}
示例13: Trigger
internal override void Trigger(int Direction, EventTriggerType TriggerType, TrainManager.Train Train, int CarIndex) {
if (TriggerType == EventTriggerType.Camera) {
if (Direction < 0) {
BackgroundManager.TargetBackground = this.PreviousBackground;
} else if (Direction > 0) {
BackgroundManager.TargetBackground = this.NextBackground;
}
}
}
示例14: Trigger
override internal void Trigger(int Direction, EventTriggerType TriggerType, TrainManager.Train Train, int CarIndex) {
if (TriggerType == EventTriggerType.Camera) {
if (Direction < 0) {
World.TargetBackground = this.PreviousBackground;
World.TargetBackgroundCountdown = World.TargetBackgroundDefaultCountdown;
} else if (Direction > 0) {
World.TargetBackground = this.NextBackground;
World.TargetBackgroundCountdown = World.TargetBackgroundDefaultCountdown;
}
}
}
示例15: Execute
private void Execute(EventTriggerType id, BaseEventData eventData)
{
if (_triggers == null)
return;
int index = 0;
for (int count = _triggers.Count; index < count; ++index)
{
t_OnEventTrigger.Entry entry = _triggers[index];
if (entry.EventID == id)
entry.ActivateTrigger(eventData);
}
}