public PartMessageListener(Type delegateType, PartRelationship relations = PartRelationship.Self, GameSceneFilter scenes = GameSceneFilter.Any) { if (delegateType == null) throw new ArgumentException("Message argument is null"); if (!delegateType.IsSubclassOf(typeof(Delegate))) throw new ArgumentException("Message is not a delegate type: " + typeof(Delegate).AssemblyQualifiedName + "\n" + Debugging.DumpTypeHeirachy(delegateType)); if (delegateType.GetCustomAttributes(typeof(PartMessageDelegate), true).Length == 0) throw new ArgumentException("Message does not have the PartMessageDelegate attribute"); DelegateType = delegateType; Scenes = scenes; Relations = relations; }
public PartMessageListener(Type delegateType, PartRelationship relations = PartRelationship.Self, GameSceneFilter scenes = GameSceneFilter.Any) { if (delegateType == null) { throw new ArgumentException("Message argument is null"); } if (!delegateType.IsSubclassOf(typeof(Delegate))) { throw new ArgumentException("Message is not a delegate type: " + typeof(Delegate).AssemblyQualifiedName + "\n" + Debugging.DumpTypeHeirachy(delegateType)); } if (delegateType.GetCustomAttributes(typeof(PartMessageDelegate), true).Length == 0) { throw new ArgumentException("Message does not have the PartMessageDelegate attribute"); } DelegateType = delegateType; Scenes = scenes; Relations = relations; }
/// <summary> /// True if the current game scene matches the filter. /// </summary> public static bool IsLoaded(this GameSceneFilter filter) { return((int)(filter & HighLogic.LoadedScene.AsFilter()) != 0); }