コード例 #1
0
        public static void Main()
        {
            Game.FrameRender += Process;

            _menuPool = new MenuPool();

            mainMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE");
            mainMenu.SetKey(Common.MenuControls.Up, Keys.W);
            mainMenu.SetKey(Common.MenuControls.Down, Keys.S);
            mainMenu.SetKey(Common.MenuControls.Left, Keys.A);
            mainMenu.SetKey(Common.MenuControls.Right, Keys.D);


            _menuPool.Add(mainMenu);

            mainMenu.AddItem(ketchupCheckbox = new UIMenuCheckboxItem("Add ketchup?", false, "Do you wish to add ketchup?"));

            var foods = new List<dynamic>
            {
                "Banana",
                "Apple",
                "Pizza",
                "Quartilicious",
                0xF00D, // Dynamic!
            };
            mainMenu.AddItem(dishesListItem = new UIMenuListItem("Food", foods, 0));
            mainMenu.AddItem(cookItem = new UIMenuItem("Cook!", "Cook the dish with the appropiate ingredients and ketchup."));

            var menuItem = new UIMenuItem("Go to another menu.");
            mainMenu.AddItem(menuItem);
            cookItem.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            cookItem.SetRightBadge(UIMenuItem.BadgeStyle.Tick);

            var carsModel = new List<dynamic>
            {
                "Adder",
                "Bullet",
                "Police",
                "Police2",
                "Asea",
                "FBI",
                "FBI2",
                "Firetruk",
                "Ambulance",
                "Rhino",
            };
            carsList = new UIMenuListItem("Cars Models", carsModel, 0);
            mainMenu.AddItem(carsList);

            spawnCar = new UIMenuItem("Spawn Car");
            mainMenu.AddItem(spawnCar);

            coloredItem = new UIMenuColoredItem("Color!", System.Drawing.Color.Red, System.Drawing.Color.Blue);
            mainMenu.AddItem(coloredItem);


            mainMenu.RefreshIndex();

            mainMenu.OnItemSelect += OnItemSelect;
            mainMenu.OnListChange += OnListChange;
            mainMenu.OnCheckboxChange += OnCheckboxChange;
            mainMenu.OnIndexChange += OnItemChange;


            newMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE");
            _menuPool.Add(newMenu);
            for (int i = 0; i < 35; i++)
            {
                newMenu.AddItem(new UIMenuItem("PageFiller " + i.ToString(), "Sample description that takes more than one line. Moreso, it takes way more than two lines since it's so long. Wow, check out this length!"));
            }
            newMenu.RefreshIndex();
            mainMenu.BindMenuToItem(newMenu, menuItem);

            while (true)
                GameFiber.Yield();
        }
コード例 #2
0
        public static void Main()
        {
            // Create a fiber to process our menus
            MenusProcessFiber = new GameFiber(ProcessLoop);

            // Create the MenuPool to easily process our menus
            _menuPool = new MenuPool();

            // Create our main menu
            mainMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE");

            // Add our main menu to the MenuPool
            _menuPool.Add(mainMenu);

            // create our items and add them to our main menu
            mainMenu.AddItem(ketchupCheckbox = new UIMenuCheckboxItem("Add ketchup?", false, "Do you wish to add ketchup?"));

            var foods = new List<dynamic>
            {
                "Banana",
                "Apple",
                "Pizza",
                "Quartilicious",
                0xF00D, // Dynamic!
            };
            mainMenu.AddItem(dishesListItem = new UIMenuListItem("Food", foods, 0));
            mainMenu.AddItem(cookItem = new UIMenuItem("Cook!", "Cook the dish with the appropiate ingredients and ketchup."));

            var menuItem = new UIMenuItem("Go to another menu.");
            mainMenu.AddItem(menuItem);
            cookItem.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            cookItem.SetRightBadge(UIMenuItem.BadgeStyle.Tick);

            var carsModel = new List<dynamic>
            {
                "Adder",
                "Bullet",
                "Police",
                "Police2",
                "Asea",
                "FBI",
                "FBI2",
                "Firetruk",
                "Ambulance",
                "Rhino",
            };
            carsList = new UIMenuListItem("Cars Models", carsModel, 0);
            mainMenu.AddItem(carsList);

            spawnCar = new UIMenuItem("Spawn Car");
            mainMenu.AddItem(spawnCar);

            coloredItem = new UIMenuColoredItem("Color!", System.Drawing.Color.Red, System.Drawing.Color.Blue);
            mainMenu.AddItem(coloredItem);

            mainMenu.RefreshIndex();

            mainMenu.OnItemSelect += OnItemSelect;
            mainMenu.OnListChange += OnListChange;
            mainMenu.OnCheckboxChange += OnCheckboxChange;
            mainMenu.OnIndexChange += OnItemChange;

            // Create another menu
            newMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE");
            newMenu.CounterOverride = "Counter Override";
            _menuPool.Add(newMenu); // add it to the menu pool
            for (int i = 0; i < 35; i++) // add items
            {
                newMenu.AddItem(new UIMenuItem("PageFiller " + i.ToString(), "Sample description that takes more than one line. More so, it takes way more than two lines since it's so long. Wow, check out this length!"));
            }
            newMenu.RefreshIndex();
            mainMenu.BindMenuToItem(newMenu, menuItem); // and bind it to an item in our main menu

            // Start our process fiber
            MenusProcessFiber.Start();

            // Continue with our plugin... in this example, hibernate to prevent it from being unloaded
            GameFiber.Hibernate();
        }