示例#1
0
        public void OnSceneObjectPicked(object sender, ObjectPickingController.PickingEventArgs e)
        {
            ISceneObject selected = e.SceneObject;

            switch (this.m_mode)
            {
                case ViewMode.eLevelViewer:
                    if(LevelObjectSelected != null)
                    {
                        DrawableLevelObjectInstance dlo = (DrawableLevelObjectInstance)selected;
                        RenderPaneEventArgs args = new RenderPaneEventArgs();
                        args.LevelObjectInstance = dlo.ObjectInstance;
                        LevelObjectSelected(this, args);
                    }

                    break;
                default:
                    break;
            }
        }
示例#2
0
        public void EnableObjectPicking(bool enable)
        {
            // check if picking is enabled already
            IInputListener controller = null;
            m_inputControllers.TryGetValue("object_picker", out controller);

            if (enable)
            {
                if (controller == null)
                {
                    ObjectPickingController picker = new ObjectPickingController();
                    picker.Init(m_scene, device, m_camera);
                    picker.SceneObjectSelected += new ObjectPickingController.SceneObjectSelectedEventHandler(this.OnSceneObjectPicked);

                    AddInputListener(picker, false);
                    m_inputControllers.Add("object_picker", picker);
                }
            }
            else if (controller != null)
            {
                ObjectPickingController picker = (ObjectPickingController)controller;
                picker.SceneObjectSelected -= new ObjectPickingController.SceneObjectSelectedEventHandler(this.OnSceneObjectPicked);

                AddInputListener(controller, true);
                m_inputControllers.Remove("object_picker");
            }
        }