Example #1
0
        public UISlot.TooltipData GetTooltip()
        {
            UISlot.TooltipData tooltip = new UISlot.TooltipData();
            tooltip.image    = power.picture;
            tooltip.title    = power.name;
            tooltip.content  = power.description;
            tooltip.content += "\n\nCost: " + power.manaCost;
            if (power.cooldown == 0)
            {
                tooltip.content += "\n No cooldown.";
            }
            else
            {
                tooltip.content += "\nCooldown: ";
                tooltip.content += power.cooldown.ToString() + " ";

                switch (power.cooldownType)
                {
                case NativePowerScriptableObject.CooldownType.Turn:
                    tooltip.content += power.cooldown < 2 ? "turn." : "turns.";
                    break;

                case NativePowerScriptableObject.CooldownType.Combat:
                    tooltip.content += "per combat.";
                    break;

                case NativePowerScriptableObject.CooldownType.Dungeon:
                    tooltip.content += "per dungeon.";
                    break;
                }
            }
            tooltip.show = true;

            return(tooltip);
        }
Example #2
0
    public void Display(CardGameObject card)
    {
        if (card != null && card.ethereal)
        {
            nameText.text = "ETHEREAL " + card.card.name;
        }
        else
        {
            nameText.text = card.card.name;
        }

        Dictionary <string, int> descriptionTags = new Dictionary <string, int>();
        var descriptionParts = card.card.description.Split(FileManager.SeparatorChar);

        if (card.card.description[0] == FileManager.SeparatorChar)
        {
            for (int i = 0; i < descriptionParts.Length; i += 2)
            {
                descriptionTags.Add(descriptionParts[i], i);
            }
        }
        else
        {
            for (int i = 1; i < descriptionParts.Length; i += 2)
            {
                descriptionTags.Add(descriptionParts[i], i);
            }
        }

        foreach (var step in card.card.stepValue)
        {
            if (descriptionTags.ContainsKey(step.descriptionTag.ToString()))
            {
                var actualValue = card.card.abilityStepsWithTargetingData[step.stepIndex].abilityStep.GetValueForIndex(step.valueIndex);

                descriptionParts[descriptionTags[step.descriptionTag.ToString()]] = actualValue;
            }
        }

        descText.text = "";
        foreach (var text in descriptionParts)
        {
            descText.text += text;
        }

        //descText.text = Utility.GetString(card.card.description, card.card., FileManager.SeparatorChar);
        manaCostText.text = card.card.manaCost.ToString();
        typeText.text     = card.card.data.type.ToString();
        image.sprite      = card.card.image;
        tooltip           = GenerateTooltip(card);
    }
Example #3
0
    UISlot.TooltipData GenerateTooltip(CardGameObject card)
    {
        UISlot.TooltipData tooltip = new UISlot.TooltipData();

        if (card.card.tooltip.Trim() == "")
        {
            tooltip.show = false;
            return(tooltip);
        }

        tooltip.title   = card.card.name;
        tooltip.content = card.card.tooltip;
        tooltip.show    = true;

        return(tooltip);
    }
Example #4
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Amiga.UI.SceneSettings sceneSettings = GameManager.Instance.CurrentSceneSettings;
            sceneSettings.HideTopPanel();
        }

        if (GameManager.Instance.GameState != GameManager.State.Dungeon)
        {
            //return;
        }

        if (eventSystem == null)
        {
            eventSystem = FindObjectOfType <EventSystem>();
        }

        PointerEventData pointer = new PointerEventData(eventSystem);

        pointer.position = Input.mousePosition;
        List <RaycastResult> raycastResults = new List <RaycastResult>();

        eventSystem.RaycastAll(pointer, raycastResults);

        if (GameManager.Instance.CurrentSceneSettings == null)
        {
            return;
        }

        if (!(GameManager.Instance.CurrentSceneSettings is Amiga.UI.Dungeon.DungeonDisplay))
        {
            //return;
        }

        //Amiga.UI.Dungeon.InventoryMenu inventoryMenu = ((Amiga.UI.Dungeon.DungeonDisplay)GameManager.Instance.CurrentSceneSettings).inventoryPanel;

        if (Input.GetMouseButton(0))
        {
            if (Input.GetMouseButtonDown(1))
            {
                RotateGrabbedItem();
            }
        }

        foreach (var result in raycastResults)
        {
            if (result.gameObject.GetComponent <ITooltip>() != null)
            {
                ITooltip           tooltippable = result.gameObject.GetComponent <ITooltip>();
                UISlot.TooltipData tooltipData  = tooltippable.GetTooltip();

                tooltip.gameObject.SetActive(tooltipData.show);

                if (tooltipData.show)
                {
                    tooltip.transform.Find("Description").GetComponent <Text>().text  = "<b>" + tooltipData.title + "</b>\n";
                    tooltip.transform.Find("Description").GetComponent <Text>().text += tooltipData.content;
                    tooltip.transform.Find("Image Holder").Find("Image").GetComponent <Image>().sprite = tooltipData.image;
                }

                break;
            }
            else
            {
                tooltip.gameObject.SetActive(false);
            }
        }

        bool itstrue = false;

        foreach (var result in raycastResults)
        {
            if (Input.GetMouseButtonDown(0))
            {
                if (result.gameObject.GetComponent <UISlot>() != null)
                {
                    UISlot grabbable = result.gameObject.GetComponent <UISlot>();

                    GrabItem(grabbable);
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                if (result.gameObject.GetComponent <DroppableArea>() != null)
                {
                    DroppableArea placeable = result.gameObject.GetComponent <DroppableArea>();

                    PlaceItem(placeable);
                }
            }

            /*
             * if (result.gameObject.GetComponent<UISlot>() != null)
             * {
             *      UISlot slot = result.gameObject.GetComponent<UISlot>();
             *
             *      if (slot is EquipmentSlot)
             *      {
             *              //Amiga.UI.Dungeon.EquipmentSlot dSlot = slot as Amiga.UI.Dungeon.EquipmentSlot;
             *
             *              //dSlot.Highlight(true);
             *
             *              /*
             *              if (Input.GetMouseButtonDown(0))
             *              {
             *                      inventoryMenu.GrabItem(dSlot);
             *              }
             *
             *              if (Input.GetMouseButtonUp(0))
             *              {
             *                      inventoryMenu.PlaceItem(dSlot);
             *              }
             *//*
             *      }
             *      else if(slot is Amiga.UI.Inventory.InventorySlot)
             *      {
             *              Amiga.UI.Inventory.InventorySlot iSlot = slot as Amiga.UI.Inventory.InventorySlot;
             *
             *              inventoryMenu.HighlightInventory(iSlot);
             *
             *              itstrue = true;
             *
             *              /*
             *              if (Input.GetMouseButtonDown(0))
             *              {
             *                      inventoryMenu.GrabItem(iSlot);
             *              }
             *
             *              if (Input.GetMouseButtonUp(0))
             *              {
             *                      inventoryMenu.PlaceItem(iSlot);
             *              }
             *//*
             *
             *              break;
             *      }
             * }*/
        }

        if (Input.GetMouseButtonUp(0))
        {
            ReleaseItem();
        }

        /*
         * if (itstrue == false)
         * {
         *      if(GameManager.Instance.CurrentSceneSettings != null && GameManager.Instance.CurrentSceneSettings is Amiga.UI.Dungeon.DungeonDisplay)
         *      {
         *              inventoryMenu.UnhighlightAll();
         *      }
         * }
         */
    }