本文整理汇总了C#中BaseEvent.OnSave方法的典型用法代码示例。如果您正苦于以下问题:C# BaseEvent.OnSave方法的具体用法?C# BaseEvent.OnSave怎么用?C# BaseEvent.OnSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseEvent
的用法示例。
在下文中一共展示了BaseEvent.OnSave方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateWrapper
public static BaseEvent CreateWrapper(BaseEvent original, Action<BaseEvent, bool> passthrough, bool ignore_delay)
{
ConfigNode cn = new ConfigNode();
original.OnSave(cn);
Wrapper wrapper = new Wrapper(original, passthrough, ignore_delay);
BaseEvent new_event = new BaseEvent(original.listParent, original.name, wrapper.Invoke);
new_event.OnLoad(cn);
return new_event;
}
示例2: Wrap
public static BaseEvent Wrap(BaseEvent original, Action<BaseEvent> passthrough)
{
ConfigNode cn = new ConfigNode();
original.OnSave(cn);
Wrapper wrapper = new Wrapper(original, passthrough);
BaseEvent new_event = new BaseEvent(original.listParent, original.name,
wrapper.Invoke);
new_event.OnLoad(cn);
return new_event;
}
示例3: CreateWrapper
public static BaseEvent CreateWrapper(BaseEvent original, Action<BaseEvent, bool> passthrough, bool ignoreDelay, KSPEvent kspEvent)
{
// Create a new configuration node and fill this node with the original base event with the values
ConfigNode cn = new ConfigNode();
original.OnSave(cn);
// create the wrapper (used solely for its Invoke() method)
// this class keeps the:
// * pass through event (leading to the ModuleSPU.InvokeEvent() method)
// * the original event (button click event)
// * the ignore delay boolean value (true if the event ignore delay, false otherwise)
EventWrapper wrapper = new EventWrapper(original, passthrough, ignoreDelay);
// Create a new event, its main features are:
// 1. It retains its original base event invokable method: invokable directly through its InvokeOriginalEvent() method [useful for other mods, e.g. kOS]
// 2. Its new invoke() method which is in this wrapper class and decorated with and new KSPEvent category, namely "skip_control" (meaning we have already seen this event).
BaseEvent newEvent = new WrappedEvent(original, original.listParent, original.name, wrapper.Invoke, kspEvent);
// load the original base event values into the new base event
newEvent.OnLoad(cn);
return newEvent;
}