当前位置: 首页>>代码示例>>C#>>正文


C# IScene.GetType方法代码示例

本文整理汇总了C#中IScene.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IScene.GetType方法的具体用法?C# IScene.GetType怎么用?C# IScene.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScene的用法示例。


在下文中一共展示了IScene.GetType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddScene

        public void AddScene(IScene scene)
        {
            if (m_scene != null)
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
                return;
            }

            if (!(scene is Scene))
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called with an unrecognized scene type " + scene.GetType());
                return;
            }

            m_scene = (Scene)scene;
            m_location = new Location(m_scene.RegionInfo.RegionHandle);

            StatsManager.RegisterStat(
                new Stat(
                    "InboxPacketsCount",
                    "Number of LL protocol packets waiting for the second stage of processing after initial receive.",
                    "Number of LL protocol packets waiting for the second stage of processing after initial receive.",
                    "",
                    "clientstack",
                    scene.Name,
                    StatType.Pull,
                    MeasuresOfInterest.AverageChangeOverTime,
                    stat => stat.Value = packetInbox.Count,
                    StatVerbosity.Debug));

            // XXX: These stats are also pool stats but we register them separately since they are currently not
            // turned on and off by EnablePools()/DisablePools()
            StatsManager.RegisterStat(
                new PercentageStat(
                    "PacketsReused",
                    "Packets reused",
                    "Number of packets reused out of all requests to the packet pool",
                    "clientstack",
                    m_scene.Name,
                    StatType.Pull,
                    stat => 
                        { PercentageStat pstat = (PercentageStat)stat; 
                          pstat.Consequent = PacketPool.Instance.PacketsRequested; 
                          pstat.Antecedent = PacketPool.Instance.PacketsReused; },
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new PercentageStat(
                    "PacketDataBlocksReused",
                    "Packet data blocks reused",
                    "Number of data blocks reused out of all requests to the packet pool",
                    "clientstack",
                    m_scene.Name,
                    StatType.Pull,
                    stat =>
                        { PercentageStat pstat = (PercentageStat)stat; 
                          pstat.Consequent = PacketPool.Instance.BlocksRequested; 
                          pstat.Antecedent = PacketPool.Instance.BlocksReused; },
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new Stat(
                    "PacketsPoolCount",
                    "Objects within the packet pool",
                    "The number of objects currently stored within the packet pool",
                    "",
                    "clientstack",
                    m_scene.Name,
                    StatType.Pull,
                    stat => stat.Value = PacketPool.Instance.PacketsPooled,
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new Stat(
                    "PacketDataBlocksPoolCount",
                    "Objects within the packet data block pool",
                    "The number of objects currently stored within the packet data block pool",
                    "",
                    "clientstack",
                    m_scene.Name,
                    StatType.Pull,
                    stat => stat.Value = PacketPool.Instance.BlocksPooled,
                    StatVerbosity.Debug));
        
            // We delay enabling pool stats to AddScene() instead of Initialize() so that we can distinguish pool stats by
            // scene name
            if (UsePools)
                EnablePoolStats();

            MainConsole.Instance.Commands.AddCommand(
                "Debug", false, "debug lludp packet",
                 "debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]",
                 "Turn on packet debugging",
                   "If level >  255 then all incoming and outgoing packets are logged.\n"
                 + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
                 + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
                 + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
                 + "If level <=  50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
                 + "If level <= 0 then no packets are logged.\n"
                 + "If --default is specified then the level becomes the default logging level for all subsequent agents.\n"
//.........这里部分代码省略.........
开发者ID:JeffCost,项目名称:opensim,代码行数:101,代码来源:LLUDPServer.cs

示例2: AddScene

        public void AddScene(IScene scene)
        {
            if (m_scene != null)
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
                return;
            }

            if (!(scene is Scene))
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called with an unrecognized scene type " + scene.GetType());
                return;
            }

            m_scene = (Scene)scene;
            m_location = new Location(m_scene.RegionInfo.RegionHandle);
        }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:17,代码来源:LLUDPServer.cs

示例3: AddRegionToModules

        public void AddRegionToModules(IScene scene)
        {
            Dictionary<Type, INonSharedRegionModule> deferredNonSharedModules =
                new Dictionary<Type, INonSharedRegionModule>();

            // We need this to see if a module has already been loaded and
            // has defined a replaceable interface. It's a generic call,
            // so this can't be used directly. It will be used later
            Type s = scene.GetType();
            MethodInfo mi = s.GetMethod("RequestModuleInterface");

            // Scan for, and load, nonshared modules
            List<INonSharedRegionModule> list = new List<INonSharedRegionModule>();
            List<INonSharedRegionModule> m_nonSharedModules = WhiteCoreModuleLoader.PickupModules<INonSharedRegionModule>();
            foreach (INonSharedRegionModule module in m_nonSharedModules)
            {
                Type replaceableInterface = module.ReplaceableInterface;
                if (replaceableInterface != null)
                {
                    MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                    if (mii.Invoke(scene, new object[0]) != null)
                    {
                        MainConsole.Instance.DebugFormat("[REGIONMODULE]: Not loading {0} because another module has registered {1}",
                                          module.Name, replaceableInterface);
                        continue;
                    }

                    deferredNonSharedModules[replaceableInterface] = module;
                    MainConsole.Instance.DebugFormat("[REGIONMODULE]: Deferred load of {0}", module.Name);
                    continue;
                }

                //MainConsole.Instance.DebugFormat("[REGIONMODULE]: Adding scene {0} to non-shared module {1}",
                //                  scene.RegionInfo.RegionName, module.Name);

                // Initialise the module
                module.Initialise(m_simBase.ConfigSource);

                IRegionModuleBaseModules.Add(module);
                list.Add(module);
            }

            // Now add the modules that we found to the scene. If a module
            // wishes to override a replaceable interface, it needs to
            // register it in Initialise, so that the deferred module
            // won't load.
            foreach (INonSharedRegionModule module in list)
            {
                try
                {
                    module.AddRegion(scene);
                }
                catch (Exception ex)
                {
                    MainConsole.Instance.ErrorFormat("[RegionModulesControllerPlugin]: Failed to load module {0}: {1}", module.Name, ex.ToString());
                }
                AddRegionModule(scene, module.Name, module);
            }

            // Same thing for nonshared modules, load them unless overridden
            List<INonSharedRegionModule> deferredlist =
                new List<INonSharedRegionModule>();

            foreach (INonSharedRegionModule module in deferredNonSharedModules.Values)
            {
                // Check interface override
                Type replaceableInterface = module.ReplaceableInterface;
                if (replaceableInterface != null)
                {
                    MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                    if (mii.Invoke(scene, new object[0]) != null)
                    {
                        MainConsole.Instance.DebugFormat("[REGIONMODULE]: Not loading {0} because another module has registered {1}",
                                          module.Name, replaceableInterface);
                        continue;
                    }
                }

                MainConsole.Instance.DebugFormat("[REGIONMODULE]: Adding scene {0} to non-shared module {1} (deferred)",
                                  scene.RegionInfo.RegionName, module.Name);

                try
                {
                    module.Initialise(m_simBase.ConfigSource);
                }
                catch (Exception ex)
                {
                    MainConsole.Instance.ErrorFormat("[RegionModulesControllerPlugin]: Failed to load module {0}: {1}", module.Name, ex.ToString());
                }

                IRegionModuleBaseModules.Add(module);
                list.Add(module);
                deferredlist.Add(module);
            }

            // Finally, load valid deferred modules
            foreach (INonSharedRegionModule module in deferredlist)
            {
//.........这里部分代码省略.........
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:101,代码来源:RegionModulesControllerPlugin.cs

示例4: UnloadSceneAsync

        protected IEnumerator UnloadSceneAsync(IScene sceneRoot)
        {
            var sceneLoader = SceneLoaders.FirstOrDefault(loader => loader.SceneType == sceneRoot.GetType()) ??
                              _defaultSceneLoader;

            Action<float, string> updateDelegate = (v, m) =>
            {
                this.Publish(new SceneLoaderEvent()
                {
                    State = SceneState.Unloading,
                    Progress = v,
                    ProgressMessage = m
                });
            };

            yield return StartCoroutine(sceneLoader.Unload(sceneRoot, updateDelegate));

            this.Publish(new SceneLoaderEvent() {State = SceneState.Unloaded, SceneRoot = sceneRoot});

            LoadedScenes.Remove(sceneRoot);
            Destroy((sceneRoot as MonoBehaviour).gameObject);

            this.Publish(new SceneLoaderEvent() {State = SceneState.Destructed, SceneRoot = sceneRoot});
        }
开发者ID:wang-yichun,项目名称:AnimalStory,代码行数:24,代码来源:SceneManagementService.cs

示例5: AddScene

        public void AddScene(IScene scene)
        {
            if (Scene != null)
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
                return;
            }

            if (!(scene is Scene))
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called with an unrecognized scene type " + scene.GetType());
                return;
            }

            Scene = (Scene)scene;
            m_location = new Location(Scene.RegionInfo.RegionHandle);
                        
            IpahEngine 
                = new JobEngine(
                    string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name), 
                    "INCOMING PACKET ASYNC HANDLING ENGINE");

            OqrEngine 
                = new JobEngine(
                    string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name), 
                    "OUTGOING QUEUE REFILL ENGINE");

            StatsManager.RegisterStat(
                new Stat(
                    "InboxPacketsCount",
                    "Number of LL protocol packets waiting for the second stage of processing after initial receive.",
                    "Number of LL protocol packets waiting for the second stage of processing after initial receive.",
                    "",
                    "clientstack",
                    scene.Name,
                    StatType.Pull,
                    MeasuresOfInterest.AverageChangeOverTime,
                    stat => stat.Value = packetInbox.Count,
                    StatVerbosity.Debug));

            // XXX: These stats are also pool stats but we register them separately since they are currently not
            // turned on and off by EnablePools()/DisablePools()
            StatsManager.RegisterStat(
                new PercentageStat(
                    "PacketsReused",
                    "Packets reused",
                    "Number of packets reused out of all requests to the packet pool",
                    "clientstack",
                    Scene.Name,
                    StatType.Pull,
                    stat => 
                        { PercentageStat pstat = (PercentageStat)stat; 
                          pstat.Consequent = PacketPool.Instance.PacketsRequested; 
                          pstat.Antecedent = PacketPool.Instance.PacketsReused; },
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new PercentageStat(
                    "PacketDataBlocksReused",
                    "Packet data blocks reused",
                    "Number of data blocks reused out of all requests to the packet pool",
                    "clientstack",
                    Scene.Name,
                    StatType.Pull,
                    stat =>
                        { PercentageStat pstat = (PercentageStat)stat; 
                          pstat.Consequent = PacketPool.Instance.BlocksRequested; 
                          pstat.Antecedent = PacketPool.Instance.BlocksReused; },
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new Stat(
                    "PacketsPoolCount",
                    "Objects within the packet pool",
                    "The number of objects currently stored within the packet pool",
                    "",
                    "clientstack",
                    Scene.Name,
                    StatType.Pull,
                    stat => stat.Value = PacketPool.Instance.PacketsPooled,
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new Stat(
                    "PacketDataBlocksPoolCount",
                    "Objects within the packet data block pool",
                    "The number of objects currently stored within the packet data block pool",
                    "",
                    "clientstack",
                    Scene.Name,
                    StatType.Pull,
                    stat => stat.Value = PacketPool.Instance.BlocksPooled,
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new Stat(
                    "OutgoingPacketsQueuedCount",
                    "Packets queued for outgoing send",
                    "Number of queued outgoing packets across all connections",
                    "",
//.........这里部分代码省略.........
开发者ID:Kubwa,项目名称:opensim,代码行数:101,代码来源:LLUDPServer.cs

示例6: AddScene

        public void AddScene(IScene scene)
        {
            if (m_scene != null)
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
                return;
            }

            if (!(scene is Scene))
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called with an unrecognized scene type " + scene.GetType());
                return;
            }

            m_scene = (Scene)scene;
            m_location = new Location(m_scene.RegionInfo.RegionHandle);

            // XXX: These stats are also pool stats but we register them separately since they are currently not
            // turned on and off by EnablePools()/DisablePools()
            StatsManager.RegisterStat(
                new PercentageStat(
                    "PacketsReused",
                    "Packets reused",
                    "Number of packets reused out of all requests to the packet pool",
                    "clientstack",
                    m_scene.Name,
                    StatType.Pull,
                    stat => 
                        { PercentageStat pstat = (PercentageStat)stat; 
                          pstat.Consequent = PacketPool.Instance.PacketsRequested; 
                          pstat.Antecedent = PacketPool.Instance.PacketsReused; },
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new PercentageStat(
                    "PacketDataBlocksReused",
                    "Packet data blocks reused",
                    "Number of data blocks reused out of all requests to the packet pool",
                    "clientstack",
                    m_scene.Name,
                    StatType.Pull,
                    stat =>
                        { PercentageStat pstat = (PercentageStat)stat; 
                          pstat.Consequent = PacketPool.Instance.BlocksRequested; 
                          pstat.Antecedent = PacketPool.Instance.BlocksReused; },
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new Stat(
                    "PacketsPoolCount",
                    "Objects within the packet pool",
                    "The number of objects currently stored within the packet pool",
                    "",
                    "clientstack",
                    m_scene.Name,
                    StatType.Pull,
                    stat => stat.Value = PacketPool.Instance.PacketsPooled,
                    StatVerbosity.Debug));

            StatsManager.RegisterStat(
                new Stat(
                    "PacketDataBlocksPoolCount",
                    "Objects within the packet data block pool",
                    "The number of objects currently stored within the packet data block pool",
                    "",
                    "clientstack",
                    m_scene.Name,
                    StatType.Pull,
                    stat => stat.Value = PacketPool.Instance.BlocksPooled,
                    StatVerbosity.Debug));
        
            // We delay enabling pool stats to AddScene() instead of Initialize() so that we can distinguish pool stats by
            // scene name
            if (UsePools)
                EnablePoolStats();

            MainConsole.Instance.Commands.AddCommand(
                "Debug",
                false,
                "debug lludp start",
                "debug lludp start <in|out|all>",
                "Control LLUDP packet processing.",
                "No effect if packet processing has already started.\n"
                    + "in  - start inbound processing.\n"
                    + "out - start outbound processing.\n"
                    + "all - start in and outbound processing.\n",
                HandleStartCommand);

            MainConsole.Instance.Commands.AddCommand(
                "Debug",
                false,
                "debug lludp stop",
                "debug lludp stop <in|out|all>",
                "Stop LLUDP packet processing.",
                "No effect if packet processing has already stopped.\n"
                    + "in  - stop inbound processing.\n"
                    + "out - stop outbound processing.\n"
                    + "all - stop in and outbound processing.\n",
                HandleStopCommand);

//.........这里部分代码省略.........
开发者ID:TheCoffeeTime,项目名称:Opensim,代码行数:101,代码来源:LLUDPServer.cs

示例7: SetupScene

        public IEnumerator SetupScene(IScene sceneRoot)
        {
            this.Publish(new SceneLoaderEvent()
            {
                State = SceneState.Instantiated,
                SceneRoot = sceneRoot
            });

            //If the scene was loaded via the api (it was queued having some name and settings)
            if (ScenesQueue.Count > 0)
            {
                var sceneQueueItem = ScenesQueue.Dequeue();
                sceneRoot.Name = sceneQueueItem.Name;
                sceneRoot._SettingsObject = sceneQueueItem.Settings;
            }
            //Else, means scene was the start scene (loaded before kernel)
            else
            {
                sceneRoot.Name = Application.loadedLevelName;
            }

            this.Publish(new SceneLoaderEvent()
            {
                State = SceneState.Instantiated,
                SceneRoot = sceneRoot
            });

            Action<float, string> updateDelegate = (v, m) =>
            {
                this.Publish(new SceneLoaderEvent()
                {
                    State = SceneState.Update,
                    Progress = v,
                    ProgressMessage = m
                });
            };

            var sceneLoader = SceneLoaders.FirstOrDefault(loader => loader.SceneType == sceneRoot.GetType()) ??
                              _defaultSceneLoader;

            yield return StartCoroutine(sceneLoader.Load(sceneRoot, updateDelegate));

            LoadedScenes.Add(sceneRoot);

            this.Publish(new SceneLoaderEvent()
            {
                State = SceneState.Loaded,
                SceneRoot = sceneRoot
            });
        }
开发者ID:wang-yichun,项目名称:AnimalStory,代码行数:50,代码来源:SceneManagementService.cs

示例8: AddScene

        public void AddScene(IScene scene)
        {
            if (m_scene != null)
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
                return;
            }

            if (!(scene is Scene))
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called with an unrecognized scene type " + scene.GetType());
                return;
            }

            m_scene = (Scene)scene;
            Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out m_x, out m_y);
        }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:17,代码来源:LLUDPServer.cs

示例9: AddRegionToModules

        public void AddRegionToModules(IScene scene)
        {
            Dictionary<Type, ISharedRegionModule> deferredSharedModules =
                new Dictionary<Type, ISharedRegionModule>();
            Dictionary<Type, INonSharedRegionModule> deferredNonSharedModules =
                new Dictionary<Type, INonSharedRegionModule>();

            // We need this to see if a module has already been loaded and
            // has defined a replaceable interface. It's a generic call,
            // so this can't be used directly. It will be used later
            Type s = scene.GetType();
            MethodInfo mi = s.GetMethod("RequestModuleInterface");

            // This will hold the shared modules we actually load
            List<ISharedRegionModule> sharedlist =
                new List<ISharedRegionModule>();

            // Iterate over the shared modules that have been loaded
            // Add them to the new Scene
            foreach (ISharedRegionModule module in m_sharedInstances)
            {
                try
                {
                    // Here is where we check if a replaceable interface
                    // is defined. If it is, the module is checked against
                    // the interfaces already defined. If the interface is
                    // defined, we simply skip the module. Else, if the module
                    // defines a replaceable interface, we add it to the deferred
                    // list.
                    Type replaceableInterface = module.ReplaceableInterface;
                    if (replaceableInterface != null)
                    {
                        MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                        if (mii.Invoke(scene, new object[0]) != null)
                        {
                            MainConsole.Instance.DebugFormat(
                                "[REGIONMODULE]: Not loading {0} because another module has registered {1}", module.Name,
                                replaceableInterface);
                            continue;
                        }

                        deferredSharedModules[replaceableInterface] = module;
                        //MainConsole.Instance.DebugFormat("[REGIONMODULE]: Deferred load of {0}", module.Name);
                        continue;
                    }

                    //MainConsole.Instance.DebugFormat("[REGIONMODULE]: Adding scene {0} to shared module {1}",
                    //                  scene.RegionInfo.RegionName, module.Name);

                    module.AddRegion(scene);
                    AddRegionModule(scene, module.Name, module);

                    IRegionModuleBaseModules.Add(module);
                    sharedlist.Add(module);
                }
                catch (Exception ex)
                {
                    MainConsole.Instance.Warn("[RegionModulePlugin]: Failed to load plugin, " + ex);
                }
            }

            // Scan for, and load, nonshared modules
            List<INonSharedRegionModule> list = new List<INonSharedRegionModule>();
            List<INonSharedRegionModule> m_nonSharedModules = AuroraModuleLoader.PickupModules<INonSharedRegionModule>();
            foreach (INonSharedRegionModule module in m_nonSharedModules)
            {
                Type replaceableInterface = module.ReplaceableInterface;
                if (replaceableInterface != null)
                {
                    MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                    if (mii.Invoke(scene, new object[0]) != null)
                    {
                        MainConsole.Instance.DebugFormat("[REGIONMODULE]: Not loading {0} because another module has registered {1}",
                                          module.Name, replaceableInterface);
                        continue;
                    }

                    deferredNonSharedModules[replaceableInterface] = module;
                    MainConsole.Instance.DebugFormat("[REGIONMODULE]: Deferred load of {0}", module.Name);
                    continue;
                }

                if (module is ISharedRegionModule) //Don't load IShared!
                {
                    continue;
                }

                //MainConsole.Instance.DebugFormat("[REGIONMODULE]: Adding scene {0} to non-shared module {1}",
                //                  scene.RegionInfo.RegionName, module.Name);

                // Initialise the module
                module.Initialise(m_openSim.ConfigSource);

                IRegionModuleBaseModules.Add(module);
                list.Add(module);
            }

            // Now add the modules that we found to the scene. If a module
//.........这里部分代码省略.........
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:101,代码来源:RegionModulesControllerPlugin.cs

示例10: AutoWireUsingReflection_Simple

        public SimulatorForm AutoWireUsingReflection_Simple(IScene scene, params IRunningDevice[] excludeDevices)
        {
            var fields = scene.GetType().GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            foreach (var field in fields)
            {
                object fieldValue = field.GetValue(scene);
                if (fieldValue == null)
                    continue;

                // Auto-wire
                if (typeof(IRunningDevice).IsInstanceOfType(fieldValue))
                {
                    if (excludeDevices.Contains((IRunningDevice)fieldValue))
                        // Excluded
                        continue;
                }

                else if (field.FieldType.Name.StartsWith("EnumStateMachine") ||
                    field.FieldType.Name.StartsWith("IntStateMachine"))
                {
                    var stateMachine = (Animatroller.Framework.Controller.IStateMachine)fieldValue;

                    var control = AddLabel(stateMachine.Name);
                    if (string.IsNullOrEmpty(stateMachine.CurrentStateString))
                        control.Text = "<idle>";
                    else
                        control.Text = stateMachine.CurrentStateString;

                    stateMachine.StateChangedString += (sender, e) =>
                    {
                        if (PendingClose)
                            return;

                        this.UIThread(delegate
                        {
                            if (string.IsNullOrEmpty(e.NewState))
                                control.Text = "<idle>";
                            else
                                control.Text = e.NewState;
                        });
                    };
                }
                //FIXME
                //else if (field.FieldType == typeof(Animatroller.Framework.Controller.CueList))
                //{
                //    var cueList = (Animatroller.Framework.Controller.CueList)fieldValue;

                //    var control = AddLabel(cueList.Name);

                //    cueList.CurrentCueId.Subscribe(x =>
                //        {
                //            this.UIThread(delegate
                //            {
                //                if (x.HasValue)
                //                    control.Text = x.ToString();
                //                else
                //                    control.Text = "<idle>";
                //            });
                //        });
                //}
            }

            return this;
        }
开发者ID:HakanL,项目名称:animatroller,代码行数:65,代码来源:SimulatorForm.cs

示例11: AutoWireUsingReflection

        public SimulatorForm AutoWireUsingReflection(IScene scene, params IRunningDevice[] excludeDevices)
        {
            AutoWireUsingReflection_Simple(scene, excludeDevices);

            var fields = scene.GetType().GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            foreach (var field in fields)
            {
                object fieldValue = field.GetValue(scene);
                if (fieldValue == null)
                    continue;

                // Auto-wire
                if (typeof(IRunningDevice).IsInstanceOfType(fieldValue))
                {
                    if (excludeDevices.Contains((IRunningDevice)fieldValue))
                        // Excluded
                        continue;
                }

                if (field.GetCustomAttributes(typeof(Animatroller.Framework.SimulatorSkipAttribute), false).Any())
                    continue;

                if (typeof(IPort).IsInstanceOfType(fieldValue))
                    continue;

                if (field.FieldType == typeof(Dimmer3))
                    this.Connect(new Animatroller.Simulator.TestLight(this, (Dimmer3)fieldValue));
                else if (field.FieldType == typeof(ColorDimmer3))
                    this.Connect(new Animatroller.Simulator.TestLight(this, (ColorDimmer3)fieldValue));
                else if (field.FieldType == typeof(StrobeColorDimmer3))
                    this.Connect(new Animatroller.Simulator.TestLight(this, (StrobeColorDimmer3)fieldValue));
                else if (field.FieldType == typeof(StrobeDimmer3))
                    this.Connect(new Animatroller.Simulator.TestLight(this, (StrobeDimmer3)fieldValue));
                else if (field.FieldType == typeof(MovingHead))
                    this.Connect(new Animatroller.Simulator.TestLight(this, (MovingHead)fieldValue));
                //else if (field.FieldType == typeof(Pixel1D))
                //    this.Connect(new Animatroller.Simulator.TestPixel1D((Pixel1D)fieldValue));
                //else if (field.FieldType == typeof(Pixel1D))
                //    this.Connect(new Animatroller.Simulator.TestPixel1D((Pixel1D)fieldValue));
                //else if (field.FieldType == typeof(VirtualPixel1D2))
                //    this.Connect(new Animatroller.Simulator.TestPixel1D((VirtualPixel1D2)fieldValue));
                else if (field.FieldType == typeof(VirtualPixel1D3))
                    this.Connect(new Animatroller.Simulator.TestPixel1D(this, (VirtualPixel1D3)fieldValue));
                else if (field.FieldType == typeof(VirtualPixel2D3))
                    this.Connect(new Animatroller.Simulator.TestPixel2D(this, (VirtualPixel2D3)fieldValue));
                //else if (field.FieldType == typeof(VirtualPixel2D))
                //    this.Connect(new Animatroller.Simulator.TestPixel2D((VirtualPixel2D)fieldValue));
                else if (field.FieldType == typeof(AnalogInput3))
                    this.AddAnalogInput((AnalogInput3)fieldValue);
                else if (field.FieldType == typeof(MotorWithFeedback))
                {
                    // Skip
                    //                    this.AddMotor((MotorWithFeedback)fieldValue);
                }
                else if (field.FieldType == typeof(DigitalInput2))
                {
                    var buttonType = (Animatroller.Framework.SimulatorButtonTypeAttribute)
                        field.GetCustomAttributes(typeof(Animatroller.Framework.SimulatorButtonTypeAttribute), false).FirstOrDefault();

                    if (buttonType != null)
                    {
                        switch (buttonType.Type)
                        {
                            case Framework.SimulatorButtonTypes.FlipFlop:
                                AddDigitalInput_FlipFlop((DigitalInput2)fieldValue, buttonType.ShowOutput);
                                break;

                            case Framework.SimulatorButtonTypes.Momentarily:
                                AddDigitalInput_Momentarily((DigitalInput2)fieldValue);
                                break;
                        }
                    }
                    else
                        AddDigitalInput_Momentarily((DigitalInput2)fieldValue);
                }
                else if (field.FieldType == typeof(DigitalOutput2))
                {
                    this.AddDigitalOutput((DigitalOutput2)fieldValue);
                }
                else if (field.FieldType == typeof(AudioPlayer))
                {
                    // Skip
                }
                else if (field.FieldType == typeof(Animatroller.Framework.Expander.OscServer))
                {
                    // Skip
                }
                else if (field.FieldType == typeof(Animatroller.Framework.Controller.Sequence))
                {
                    // Skip
                }
                else if (field.FieldType == typeof(Animatroller.Framework.Import.LorImport))
                {
                    // Skip
                }
                else if (field.FieldType == typeof(Animatroller.Framework.Import.VixenImport))
                {
                    // Skip
                }
//.........这里部分代码省略.........
开发者ID:HakanL,项目名称:animatroller,代码行数:101,代码来源:SimulatorForm.cs

示例12: AddScene

        public void AddScene(IScene scene)
        {
            if (m_scene != null)
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
                return;
            }

            if (!(scene is Scene))
            {
                m_log.Error("[LLUDPSERVER]: AddScene() called with an unrecognized scene type " + scene.GetType());
                return;
            }

            m_scene = (Scene)scene;
            m_location = new Location(m_scene.RegionInfo.RegionHandle);

            MainConsole.Instance.Commands.AddCommand(
                "Debug",
                false,
                "debug lludp start",
                "debug lludp start <in|out|all>",
                "Control LLUDP packet processing.",
                "No effect if packet processing has already started.\n"
                    + "in  - start inbound processing.\n"
                    + "out - start outbound processing.\n"
                    + "all - start in and outbound processing.\n",
                HandleStartCommand);

            MainConsole.Instance.Commands.AddCommand(
                "Debug",
                false,
                "debug lludp stop",
                "debug lludp stop <in|out|all>",
                "Stop LLUDP packet processing.",
                "No effect if packet processing has already stopped.\n"
                    + "in  - stop inbound processing.\n"
                    + "out - stop outbound processing.\n"
                    + "all - stop in and outbound processing.\n",
                HandleStopCommand);

            MainConsole.Instance.Commands.AddCommand(
                "Debug",
                false,
                "debug lludp pool",
                "debug lludp pool <on|off>",
                "Turn object pooling within the lludp component on or off.",
                HandlePoolCommand);

            MainConsole.Instance.Commands.AddCommand(
                "Debug",
                false,
                "debug lludp status",
                "debug lludp status",
                "Return status of LLUDP packet processing.",
                HandleStatusCommand);
        }
开发者ID:CCIR,项目名称:opensim,代码行数:57,代码来源:LLUDPServer.cs


注:本文中的IScene.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。