示例#1
0
        public void StartOwnMenu()
        {
            // creating option functions
            List <object> optionFns = new List <object>();

            List <Object> obj = new List <Object>();

            for (int i = 0; i < objects.Length; i++)
            {
                obj.Add(objects[i]);
            }

            List <CustomColor> listColors = new List <CustomColor>(colors);

            optionFns.Add(name);
            optionFns.Add(obj);
            optionFns.Add(mainCamera);
            optionFns.Add(listColors);
            optionFns.Add(new Saver(this));
            optionFns.Add(new SceneExit());

            // starting menu
            ListMenu <object> menu = new ListMenu <object>(name, options, optionFns);

            menu.EngageMenu();

            // user might have chanched stuff; would be hard to figure out exactly what so just update everything
            TheyMoved(objects);

            // restoring some possibly changed variables back to this class
            objects = obj.ToArray();
            colors  = listColors.ToArray();
        }
示例#2
0
        public Tuple <ICreatable, Ref <string> > Create()
        {
            Component newComponent = null;

            string[] options = new string[]
            {
                "Mesh",
                "Controls",
                "Camera"
            };

            ListMenu <Component> menu = new ListMenu <Component>("Choose a component to add", options, false, true);
            int chosenObject          = menu.EngageMenu();

            switch (chosenObject)
            {
            case 0:
                newComponent = new Mesh();
                break;

            case 1:
                newComponent = new Controls();
                break;

            case 2:
                newComponent = new Camera();
                break;

            default: return(null);
            }

            return(new Tuple <ICreatable, Ref <string> >(newComponent, newComponent.name));
        }
示例#3
0
        static void EngagingBaseMenu()
        {
            string[] options = new string[]
            {
                "Choose scene",
                "Set scenes path",
                "Set prefabs path",
                "Controls help"
            };

            List <object> optionFns = new List <object>();

            Ref <string> scenesPath  = new Ref <string>(HolderClass.scenesPath);
            Ref <string> prefabsPath = new Ref <string>(HolderClass.prefabsPath);

            optionFns.Add(new List <Scene>());
            optionFns.Add(scenesPath);
            optionFns.Add(prefabsPath);
            optionFns.Add("testing");

            while (true)
            {
                ListMenu <object> menu = new ListMenu <object>(new Ref <string>("Main menu"), options, optionFns);
                menu.EngageMenu();

                HolderClass.prefabsPath = prefabsPath.value;
                HolderClass.scenesPath  = scenesPath.value;
            }
        }
示例#4
0
        public override void StartOwnMenu()
        {
            List <object> optionFns = new List <object>();
            Ref <float>   fov       = new Ref <float>(viewingAngle);

            optionFns.Add(name);
            optionFns.Add(fov);

            ListMenu <object> menu = new ListMenu <object>(name, names, optionFns);

            menu.EngageMenu();

            viewingAngle = fov.value;
        }
示例#5
0
        void DoThings(List <Polygon> polygons)
        {
            string title = "Polygons";

            Ref <string>[] names = new Ref <string> [polygons.Count];
            for (int i = 0; i < polygons.Count; i++)
            {
                names[i] = polygons[i].name;
            }

            // just starting the menu
            ListMenu <Polygon> menu = new ListMenu <Polygon>(title, names, polygons, true);

            menu.EngageMenu();
        }
示例#6
0
        void DoThings(List <Component> components)
        {
            string title = "Components";

            Ref <string>[] names = new Ref <string> [components.Count];
            for (int i = 0; i < components.Count; i++)
            {
                names[i] = components[i].name;
            }

            // just starting the menu
            ListMenu <Component> menu = new ListMenu <Component>(title, names, components, true);

            menu.EngageMenu();
        }
示例#7
0
        /// <summary>
        /// For when you wanna choose from a list of objects
        /// </summary>
        /// <param name="objects"></param>
        void DoThings(List <Object> objects)
        {
            string title = "Parented objects";

            Ref <string>[] names = new Ref <string> [objects.Count];
            for (int i = 0; i < objects.Count; i++)
            {
                names[i] = objects[i].name;
            }

            // just starting the menu
            ListMenu <Object> menu = new ListMenu <Object>(title, names, objects, true);

            menu.EngageMenu();
        }
示例#8
0
        void DoThings(List <Vector3> vector3s)
        {
            string title = "Points";

            Ref <string>[] names = new Ref <string> [vector3s.Count];
            for (int i = 0; i < vector3s.Count; i++)
            {
                names[i] = vector3s[i].name;
            }

            // just starting the menu
            ListMenu <Vector3> menu = new ListMenu <Vector3>(title, names, vector3s, true);

            menu.canAddDelete = true;
            menu.EngageMenu();
        }
示例#9
0
        void DoThings(List <CustomColor> colors)
        {
            string title = "Colors";

            // get color names
            Ref <string>[] names = new Ref <string> [colors.Count];
            for (int i = 0; i < colors.Count; i++)
            {
                names[i] = colors[i].name;
            }

            // start menu
            ListMenu <CustomColor> menu = new ListMenu <CustomColor>(title, names, colors);

            menu.canAddDelete = false;
            menu.EngageMenu();
        }
示例#10
0
        public void StartOwnMenu()
        {
            List <object> optionFns = new List <object>();

            optionFns.Add(name);
            optionFns.Add(new Ref <float>(x));
            optionFns.Add(new Ref <float>(y));
            optionFns.Add(new Ref <float>(z));

            ListMenu <object> menu = new ListMenu <object>(new Ref <string>("Vector3"), options, optionFns);

            menu.EngageMenu();

            x = ((Ref <float>)optionFns[1]).value;
            y = ((Ref <float>)optionFns[2]).value;
            z = ((Ref <float>)optionFns[3]).value;
        }
示例#11
0
        public Tuple <ICreatable, Ref <string> > Create()
        {
            Object newObject = null;

            string[] prefabs = HolderClass.FileNames(HolderClass.prefabsPath);
            string[] options = new string[prefabs.Length + 1];
            options[0] = "\\empty\\";

            for (int i = 0; i < prefabs.Length; i++)
            {
                options[i + 1] = prefabs[i];
            }

            ListMenu <Object> menu = new ListMenu <Object>("Choose object to add", options, false, true);
            int chosenObject       = menu.EngageMenu();

            // nothing chosen so just quit
            if (chosenObject == -1)
            {
                return(null);
            }
            // empty chosen so just create one
            if (chosenObject == 0)
            {
                newObject = new Object();
                return(new Tuple <ICreatable, Ref <string> >(newObject, newObject.name));
            }

            // might have chosen importable object, in that case, import it
            if (options[chosenObject].Length >= 4)
            {
                string cut = options[chosenObject].Substring(options[chosenObject].Length - 4);
                if (cut == ".txt" || cut == ".obj")
                {
                    newObject       = ObjImporter.Import(HolderClass.prefabsPath + "\\" + options[chosenObject]);
                    newObject.moved = true;
                    return(new Tuple <ICreatable, Ref <string> >(newObject, newObject.name));
                }
            }

            // load up the selected object the normal way
            newObject       = HolderClass.Loader <Object>(HolderClass.prefabsPath + "\\" + options[chosenObject]);
            newObject.moved = true;
            return(new Tuple <ICreatable, Ref <string> >(newObject, newObject.name));
        }
示例#12
0
        public void StartOwnMenu()
        {
            // creating options
            List <object> optionFns = new List <object>();

            optionFns.Add(name);
            optionFns.Add(r);
            optionFns.Add(g);
            optionFns.Add(b);

            // starting menu
            ListMenu <object> menu = new ListMenu <object>(name, names, optionFns);

            menu.EngageMenu();

            r.value = r.value % 256;
            g.value = g.value % 256;
            b.value = b.value % 256;

            UpdateColor();
        }
示例#13
0
        public override void StartOwnMenu()
        {
            // creating options
            List <object>  optionFns = new List <object>();
            List <Polygon> pol       = new List <Polygon>();

            for (int i = 0; i < polygons.Length; i++)
            {
                pol.Add(polygons[i]);
            }

            optionFns.Add(name);
            optionFns.Add(pol);

            // starting menu
            ListMenu <object> menu = new ListMenu <object>(name, names, optionFns);

            menu.EngageMenu();

            // restoring possibly changed variables
            polygons = pol.ToArray();
        }
示例#14
0
        public override void StartOwnMenu()
        {
            // creating options
            List <object> optionFns = new List <object>();
            Ref <int>     Type      = new Ref <int>(type);
            Ref <float>   speed     = new Ref <float>(baseSpeed);
            Ref <float>   angle     = new Ref <float>(baseAngle);

            optionFns.Add(name);
            optionFns.Add(Type);
            optionFns.Add(speed);
            optionFns.Add(angle);

            // starting menu
            ListMenu <object> menu = new ListMenu <object>(name, names, optionFns);

            menu.EngageMenu();

            // restoring possibly changed variables
            type      = Type.value;
            baseSpeed = speed.value;
            baseAngle = angle.value;
        }
示例#15
0
        public void StartOwnMenu()
        {
            // preparing function for each f'n name
            List <object> optionFns = new List <object>();


            List <Object> obj = new List <Object>();

            for (int i = 0; i < children.Length; i++)
            {
                obj.Add(children[i]);
            }

            List <Component> comp = new List <Component>();

            for (int i = 0; i < components.Length; i++)
            {
                comp.Add(components[i]);
            }

            optionFns.Add(name);
            optionFns.Add(position);
            optionFns.Add(quatRotation);
            optionFns.Add(scale);
            optionFns.Add(comp);
            optionFns.Add(obj);
            optionFns.Add(new Saver(this));

            // creating a menu
            ListMenu <object> menu = new ListMenu <object>(name, names, optionFns);

            menu.EngageMenu();

            // restoring some possibly changed variables back to this class
            children   = obj.ToArray();
            components = comp.ToArray();
        }
示例#16
0
        void DoThings(List <Scene> scenes)
        {
            Ref <string> title = new Ref <string>("Scenes");

            // find scene names in their folder
            List <string> sceneNames = new List <string>(HolderClass.FileNames(HolderClass.scenesPath));

            string[] backup = sceneNames.ToArray();
            scenes.Clear();

            ListMenu <string> menu = new ListMenu <string>(title, sceneNames.ToArray(), sceneNames, true, true);
            int chosenScene        = menu.EngageMenu();

            for (int i = 0; i < backup.Length; i++)
            {
                if (!sceneNames.Contains(backup[i]))
                {
                    File.Delete(HolderClass.scenesPath + "\\" + backup[i]);
                }
            }

            if (chosenScene == -1)
            {
                return;
            }
            if (chosenScene == -2)
            {
                Scene newScene = (Scene) new SceneFactory().Create().Item1;
                Program.MainCycle(newScene);
                return;
            }

            Scene loadedScene = HolderClass.Loader <Scene>(HolderClass.scenesPath + "\\" + sceneNames[chosenScene]);

            Program.MainCycle(loadedScene);
        }
示例#17
0
        public void StartOwnMenu()
        {
            // creating options
            List <object> optionFns = new List <object>();

            List <Vector3> points = new List <Vector3>(localPoints);
            Ref <CharInfo> o      = new Ref <CharInfo>(edges);
            Ref <CharInfo> f      = new Ref <CharInfo>(fill);

            optionFns.Add(name);
            optionFns.Add(points);
            optionFns.Add(o);
            optionFns.Add(f);

            // starting menu
            ListMenu <object> menu = new ListMenu <object>(name, names, optionFns);

            menu.EngageMenu();

            // restoring possibly changed variables
            localPoints = points.ToArray();
            edges       = o.value;
            fill        = f.value;
        }