void Start()
    {
        // Clear the radial buttons here in start so that the menu has no existing items.
        weaponRadialMenu.RemoveAllRadialButtons();

        // For each of the light weapons...
        for (int i = 0; i < LightWeapons.Length; i++)
        {
            // Assign the information inside the WeaponBase class to the radialButtonInfo to supply to the radial menu.
            LightWeapons[i].radialButtonInfo.name        = LightWeapons[i].name;
            LightWeapons[i].radialButtonInfo.key         = LightWeapons[i].key;
            LightWeapons[i].radialButtonInfo.description = LightWeapons[i].description;
            LightWeapons[i].radialButtonInfo.icon        = LightWeapons[i].weaponIcon;

            // Add a radial button to the menu with the current Light Weapon information.
            weaponRadialMenu.RegisterToRadialMenu(ShowCurrentWeaponInfo, LightWeapons[i].radialButtonInfo);

            // Register this weapon to the dictionary with the current key.
            WeaponDictionary.Add(LightWeapons[i].key, LightWeapons[i]);
        }

        // For each of the Utility weapons...
        for (int i = 0; i < UtilityWeapons.Length; i++)
        {
            // Assign the information inside the WeaponBase class to the radialButtonInfo to supply to the radial menu.
            UtilityWeapons[i].radialButtonInfo.name        = UtilityWeapons[i].name;
            UtilityWeapons[i].radialButtonInfo.key         = UtilityWeapons[i].key;
            UtilityWeapons[i].radialButtonInfo.description = UtilityWeapons[i].description;
            UtilityWeapons[i].radialButtonInfo.icon        = UtilityWeapons[i].weaponIcon;

            // Register this weapon to the dictionary with the current key.
            WeaponDictionary.Add(UtilityWeapons[i].key, UtilityWeapons[i]);
        }

        // For each of the Heavy weapons...
        for (int i = 0; i < HeavyWeapons.Length; i++)
        {
            // Assign the information inside the WeaponBase class to the radialButtonInfo to supply to the radial menu.
            HeavyWeapons[i].radialButtonInfo.name        = HeavyWeapons[i].name;
            HeavyWeapons[i].radialButtonInfo.key         = HeavyWeapons[i].key;
            HeavyWeapons[i].radialButtonInfo.description = HeavyWeapons[i].description;
            HeavyWeapons[i].radialButtonInfo.icon        = HeavyWeapons[i].weaponIcon;

            // Register this weapon to the dictionary with the current key.
            WeaponDictionary.Add(HeavyWeapons[i].key, HeavyWeapons[i]);
        }

        // Subscribe to the On Enabled and On Disabled functions of the radial menu.
        weaponRadialMenu.OnRadialMenuEnabled  += OnRadialMenuEnabled;
        weaponRadialMenu.OnRadialMenuDisabled += OnRadialMenuDisabled;

        // Turn off the background panel game object.
        backgroundPanel.SetActive(false);

        // Configure the horizontal input information for calculations.
        horizontalInputMin = weaponRadialMenu.BasePosition.x - (weaponRadialMenu.GetComponent <RectTransform>().sizeDelta.x / 2);
        horizontalInputMax = weaponRadialMenu.BasePosition.x + (weaponRadialMenu.GetComponent <RectTransform>().sizeDelta.x / 2);
    }
    public void OnPointerUp(PointerEventData eventData)
    {
        // When the pointer is released, get the Ultimate Radial Menu's current button index.
        int index = UltimateRadialMenu.GetUltimateRadialMenu("ItemWheelExample").CurrentButtonIndex;

        // If the index is greater than zero ( meaning that the input was on the radial menu ), and this button information does not currently exist on the menu...
        if (index >= 0 && !usedIndex.Contains(index) && !newRadialButtonInfo.ExistsOnRadialMenu())
        {
            // Update the radial button at the targeted index with this information, and register the ButtonCallback function as the ButtonCallback parameter.
            UltimateRadialMenu.RegisterToRadialMenu("ItemWheelExample", UseItem, newRadialButtonInfo, index);

            // Add this index to the used index list so that other buttons know that this button is taken.
            usedIndex.Add(index);
        }

        // Increase this items count.
        itemCount++;

        // If this button does exist on the radial menu, then update the text of the button.
        if (newRadialButtonInfo.ExistsOnRadialMenu())
        {
            newRadialButtonInfo.UpdateText(itemCount.ToString());
        }

        // Update this transform back to the original position.
        myTransform.localPosition = originalPosition;
    }
예제 #3
0
 private void Start()
 {
     for (int i = 0; i < cubeColors.Length; i++)
     {
         cubeColors[i].buttonInfo.id = i;
         UltimateRadialMenu.RegisterToRadialMenu("ObjectExample", UpdateCubeColor, cubeColors[i].buttonInfo);
     }
 }
예제 #4
0
        /// <summary>
        /// This function is called by the WorldItem that has been picked up.
        /// </summary>
        public void PickupItem(ItemInformation itemInfo)
        {
            // Increase the item count.
            itemInfo.itemCount++;

            // If the item does not exist on the menu already, then add it to the menu.
            if (itemInfo.buttonInfo.ExistsOnRadialMenu() == false)
            {
                radialMenu.RegisterToRadialMenu(UseItem, itemInfo.buttonInfo);
            }

            // Update the button text with the new count of the item.
            itemInfo.buttonInfo.UpdateText(itemInfo.itemCount.ToString());
        }
예제 #5
0
    // https://www.youtube.com/watch?v=KSE3MMRRWiM
    // Start is called before the first frame update
    void Start()
    {
        UltimateRadialMenu.RegisterToRadialMenu("MenuTree", OrderMenu, exampleButton);
        buttonInfo.UpdateText("Order Food");


        RadialContent orderFoodRadial = new RadialContent(new List <string> {
            "Order Food"
        }, 1);
        RadialContent pizzaRadial = new RadialContent(new List <string> {
            "Pizza"
        }, 2);
        RadialContent pizzaSizeRadial = new RadialContent(new List <string> {
            "Small", "Medium", "Large", "X-Large", "Party Size"
        }, 3);
        RadialContent pizzaSauceRadial = new RadialContent(new List <string> {
            "Toppings", "Pizza Sauce", "Cheese"
        }, 4);
        RadialContent sauceToppings = new RadialContent(new List <string> {
            "Pizza Sauce(Light/Normal/Extra)", "BBQ Sauce", "Alfredo Sauce", "Hearty Marinara Sauce", "Ranch Dressing", "Garlic Parmesan Sauce"
        }, 5);
        RadialContent toppingsRadial = new RadialContent(new List <string> {
            "Pepperoni", "Brooklyn Pepperoni", "Sausage", "Beef Crumble", "Ham", "Bacon", "More Toppings"
        }, 6);
        RadialContent toppingsRadialMore = new RadialContent(new List <string> {
            "Chicken", "Anchovy", "Cheddar", "Feta", "Parmesan Asiago", "Provolone"
        }, 7);
        RadialContent paymentRadial = new RadialContent(new List <string> {
            "Deliver Now", "Toggle Purchase Method", "Place Order"
        }, 8);

        // Toggle Purchase method -> (Mastercard / debit card / Credit Card)
        // Place Order -> Order Confirmation
        // Delivery Now -> (Use Geolocation to pick closes pizza store)


        // Creating a strongly typed list of objects that can be accessed by index... Providing us the ability to use search, sort, and manipulate list...
        radialList.Add(new RadialList()
        {
            RadialListName = "orderFoodRadial", RadialListId = 0001
        });
        radialList.Add(new RadialList()
        {
            RadialListName = "pizzaRadial", RadialListId = 0002
        });
        radialList.Add(new RadialList()
        {
            RadialListName = "pizzaSizeRadial", RadialListId = 0003
        });
        radialList.Add(new RadialList()
        {
            RadialListName = "pizzaSauceRadial", RadialListId = 0004
        });
        radialList.Add(new RadialList()
        {
            RadialListName = "sauceToppings", RadialListId = 0005
        });
        radialList.Add(new RadialList()
        {
            RadialListName = "toppingsRadial", RadialListId = 0006
        });
        radialList.Add(new RadialList()
        {
            RadialListName = "toppingsRadialMore", RadialListId = 0007
        });
        radialList.Add(new RadialList()
        {
            RadialListName = "paymentRadial", RadialListId = 0008
        });
        // Write out all the parts in the RadialList.
        // print("This is a line we are writting");

        /*
         *  foreach (RadialList aList in radialList)
         * {
         *  print(aList);
         * }
         *
         */
    }