Ejemplo n.º 1
0
        /// <summary>
        /// Return a specific element from the selection set.
        /// </summary>
        ///
        /// <param name="index">
        /// The zero-based index of the element to be returned.
        /// </param>
        ///
        /// <returns>
        /// An IDomObject.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/get/
        /// </url>

        public IDomObject Get(int index)
        {
            int effectiveIndex = index < 0 ? SelectionSet.Count + index - 1 : index;

            return(effectiveIndex >= 0 && effectiveIndex < SelectionSet.Count ?
                   SelectionSet.ElementAt(effectiveIndex) :
                   null);
        }
Ejemplo n.º 2
0
        private void Scene_SelectionChanged(object sender, EventArgs e)
        {
            //update sceneListView
            sceneListView.Refresh();

            if (scene.SelectedObjects.Count != 0)
            {
                // now we can jump to the object in the scene view list for easy access
                tabControl1.SelectedIndex = 1;

                // now let's get the type so we can jump to the right category
                // since you can select multiple objects, we will just jump to the first one
                SelectionSet set = scene.SelectedObjects;

                if (set.ElementAt(0) is PathPointObj)
                {
                    sceneListView.SetRootList("Paths");
                }
                else
                {
                    AbstractObj obj = set.ElementAt(0) as AbstractObj;

                    switch (obj.mType)
                    {
                    case "AreaObj":
                        sceneListView.SetRootList("Areas");
                        break;

                    case "CameraObj":
                        sceneListView.SetRootList("Camera Areas");
                        break;

                    case "Obj":
                        sceneListView.SetRootList("Objects");
                        break;

                    case "DemoObj":
                        sceneListView.SetRootList("Demos");
                        break;

                    case "GeneralPosObj":
                        sceneListView.SetRootList("Positions");
                        break;

                    case "DebugMoveObj":
                        sceneListView.SetRootList("Debug");
                        break;

                    case "PlanetObj":
                        sceneListView.SetRootList("Gravity");
                        break;

                    case "StartObj":
                        sceneListView.SetRootList("Start");
                        break;

                    case "MapPart":
                        sceneListView.SetRootList("Map Parts");
                        break;
                    }
                }
            }

            //fetch availible properties for selection
            scene.SetupObjectUIControl(objUIControl);
        }