示例#1
0
    /// <summary>
    /// This method shows either the consumable pop up or interactive pop up.
    /// </summary>
    /// <param name="interactive">The object to check what type of interactive
    ///                           it is and showing the correct pop up menu
    ///                           corresponding to it, of type Interactive</param>
    public void ShowPopup(Interactive interactive)
    {
        HideAllPopUp(); // Hiding any shown popup

        // Condition to check if no interactive menus are shown,
        // If there not shown only then show the pop up dialogs
        if (!UIShopController.Instance.IsMenuShown)
        {
            if (interactive as Item)               // Checking if the interactive is item
            {
                if (interactive as ConsumableItem) // Checking if consumable item
                {
                    // Showing consumable details
                    ConsumableItemPopup
                    .ShowMenu(((ConsumableItem)(interactive)).ObjectName,
                              ((ConsumableItem)(interactive)).GetDescription());
                }
                else if (interactive as WeaponItem) // Checking if weapon item
                {
                    // Showing weapon detials
                    ConsumableItemPopup
                    .ShowMenu(((WeaponItem)(interactive)).ObjectName,
                              ((WeaponItem)(interactive)).GetDescription());
                }
                else if (interactive as WearableItem) // Checking if wearable item
                {
                    // Showing wearable details
                    ConsumableItemPopup
                    .ShowMenu(((WearableItem)(interactive)).ObjectName,
                              ((WearableItem)(interactive)).GetDescription());
                }
                else if (interactive as UpgradableItem) // Checking if upgradable item
                {
                    // Showing upgradable details
                    ConsumableItemPopup
                    .ShowMenu(((UpgradableItem)(interactive)).ObjectName,
                              ((UpgradableItem)(interactive)).GetDescription());
                }
                else // Is only item
                {
                    // Showing item details
                    ConsumableItemPopup
                    .ShowMenu(((Item)(interactive)).ObjectName,
                              ((Item)(interactive)).GetDescription());
                }
            }
            else // Interactive is not item
            {
                if (interactive as ShopInteractive) // Checking if shop
                {
                    // Showing shop details
                    InteractivePopup
                    .ShowMenu(((ShopInteractive)(interactive)).ObjectName,
                              ((ShopInteractive)(interactive)).GetDescription());
                }
                else // Is only interactive
                {
                    // Showing interactive details
                    InteractivePopup
                    .ShowMenu(interactive.ObjectName,
                              interactive.GetDescription());
                }
            }
        }
    }