コード例 #1
0
 override public void OnModule(Module module)
 {
     EnterNamespace(InternalModule.ScopeFor(module));
     VisitTypeDefinitionBody(module);
     Visit(module.AssemblyAttributes);
     LeaveNamespace();
 }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        private static void InitializeModuleClassEntity(Module node, ClassDefinition moduleClass)
        {
            InternalModule entity = ((InternalModule)node.Entity);

            if (null != entity)
            {
                entity.InitializeModuleClass(moduleClass);
            }
        }
コード例 #4
0
        /// 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);
        }
コード例 #5
0
 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();
     }
 }
コード例 #6
0
        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;
        }
コード例 #7
0
        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);
        }
コード例 #8
0
ファイル: MacroExpander.cs プロジェクト: yantrabuddhi/boo
 private void EnterModuleNamespace(Module module)
 {
     EnterNamespace(InternalModule.ScopeFor(module));
 }
コード例 #9
0
ファイル: DbgModuleImpl.cs プロジェクト: zz110/dnSpy
 protected override void CloseCore(DbgDispatcher dispatcher) => InternalModule.Close(dispatcher);
コード例 #10
0
 protected CJSJintEngine RegisterInternalModule(InternalModule mod)
 {
     ModuleCache.Add(mod.Id, mod);
     return(this);
 }
コード例 #11
0
        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;
        }