override public void OnModule(Module module) { EnterNamespace(InternalModule.ScopeFor(module)); VisitTypeDefinitionBody(module); Visit(module.AssemblyAttributes); LeaveNamespace(); }
protected void clearProps() { InternalProp[] props = this.part.internalModel.props.ToArray(); InternalProp prop = null; InternalModule[] internalModules; InternalModule module = null; for (int index = 0; index < props.Length; index++) { prop = props[index]; prop.enabled = false; this.part.internalModel.props.Remove(prop); if (prop.internalModules.Count > 0) { internalModules = prop.internalModules.ToArray(); for (int moduleIndex = 0; moduleIndex < internalModules.Length; moduleIndex++) { module = internalModules[moduleIndex]; prop.internalModules.Remove(module); module.gameObject.DestroyGameObject(); } } prop.internalModules.Clear(); prop.gameObject.DestroyGameObject(); } }
private static void InitializeModuleClassEntity(Module node, ClassDefinition moduleClass) { InternalModule entity = ((InternalModule)node.Entity); if (null != entity) { entity.InitializeModuleClass(moduleClass); } }
/// Sets up an animation for KSP purposes and returns it public static AnimationState SetUpAnimation(string animationName, InternalModule prop, int layer) { Animation animation = prop.internalProp.FindModelAnimators(animationName).First(); AnimationState animationState = animation[animationName]; animationState.speed = 0; animationState.layer = layer; animationState.enabled = true; animationState.wrapMode = WrapMode.ClampForever; animation.Blend(animationName); return(animationState); }
override public void OnModule(Module module) { EnterNamespace(InternalModule.ScopeFor(module)); try { Visit(module.Members); Visit(module.Globals); Visit(module.Attributes); Visit(module.AssemblyAttributes); } finally { LeaveNamespace(); } }
private void RunOnce() { //find internallabel Log.detail("NavUtil: iM look"); InternalModule iM = internalProp.internalModules.First(m => m.GetType() == typeof(InternalLabel)); Log.detail("NavUtil: iM found, casting..."); rwyLabel = (InternalLabel)iM; Log.detail("NavUtil: iM Cast!"); rwyLabel.SetText(NavUtilLib.GlobalVariables.FlightData.currentBodyRunways[NavUtilLib.GlobalVariables.FlightData.rwyIdx].shortID); ranOnce = true; }
private static bool InstantiateHandler(ConfigNode node, InternalModule ourSwitch, out Action <bool> actionCall, out Func <bool> stateCall) { actionCall = null; stateCall = null; var handlerConfiguration = new ConfigNode("MODULE"); node.CopyTo(handlerConfiguration); string moduleName = node.GetValue("name"); string stateMethod = string.Empty; if (node.HasValue("stateMethod")) { stateMethod = node.GetValue("stateMethod"); } InternalModule thatModule = null; foreach (InternalModule potentialModule in ourSwitch.internalProp.internalModules) { if (potentialModule.ClassName == moduleName) { thatModule = potentialModule; break; } } if (thatModule == null) { thatModule = ourSwitch.internalProp.AddModule(handlerConfiguration); } if (thatModule == null) { return(false); } foreach (MethodInfo m in thatModule.GetType().GetMethods()) { if (m.Name == node.GetValue("actionMethod")) { actionCall = (Action <bool>)Delegate.CreateDelegate(typeof(Action <bool>), thatModule, m); } if (!string.IsNullOrEmpty(stateMethod) && m.Name == stateMethod) { stateCall = (Func <bool>)Delegate.CreateDelegate(typeof(Func <bool>), thatModule, m); } } return(actionCall != null); }
private void EnterModuleNamespace(Module module) { EnterNamespace(InternalModule.ScopeFor(module)); }
protected override void CloseCore(DbgDispatcher dispatcher) => InternalModule.Close(dispatcher);
protected CJSJintEngine RegisterInternalModule(InternalModule mod) { ModuleCache.Add(mod.Id, mod); return(this); }
private static bool InstantiateHandler(ConfigNode node, InternalModule ourSwitch, out Action<bool> actionCall, out Func<bool> stateCall) { actionCall = null; stateCall = null; var handlerConfiguration = new ConfigNode("MODULE"); node.CopyTo(handlerConfiguration); string moduleName = node.GetValue("name"); string stateMethod = string.Empty; if (node.HasValue("stateMethod")) stateMethod = node.GetValue("stateMethod"); InternalModule thatModule = null; foreach (InternalModule potentialModule in ourSwitch.internalProp.internalModules) if (potentialModule.ClassName == moduleName) { thatModule = potentialModule; break; } if (thatModule == null) thatModule = ourSwitch.internalProp.AddModule(handlerConfiguration); if (thatModule == null) return false; foreach (MethodInfo m in thatModule.GetType().GetMethods()) { if (m.Name == node.GetValue("actionMethod")) { actionCall = (Action<bool>)Delegate.CreateDelegate(typeof(Action<bool>), thatModule, m); } if (!string.IsNullOrEmpty(stateMethod) && m.Name == stateMethod) { stateCall = (Func<bool>)Delegate.CreateDelegate(typeof(Func<bool>), thatModule, m); } } return actionCall != null; }