本文整理匯總了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;
}