示例#1
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     if (itemDataInfo.Item != null)
     {
         this.transform.SetParent(this.transform.parent.parent);
         this.transform.position = eventData.position - offset;
         GetComponent <CanvasGroup>().blocksRaycasts = false;
         tooltip.Activate(ItemDataInfo);
     }
 }
示例#2
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        print("Enter Test");
        Item i1 = _item_manager.FetchItemById(4);

        _tooltip.Activate(i1, 1, true);
    }
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (item != null)
     {
         tooltip.Activate(item);
     }
 }
示例#4
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (ItemIsValid())
     {
         tooltip.Activate(item);
     }
 }
示例#5
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        GameObject inventoryCanvas = GameObject.Find("Inventory Canvas");

        tooltip.transform.SetParent(inventoryCanvas.transform);
        tooltip.Activate(item);
    }
示例#6
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        tooltip.Activate(item);

        if (Input.GetKeyDown(KeyCode.F))
        {
        }
    }
示例#7
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (item != null)
     {
         offset = eventData.position - new Vector2(this.transform.position.x, this.transform.position.y);
         tooltip.Activate(item);
     }
 }
示例#8
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (ItemIns == null)
     {
         return;
     }
     _tooltip.Activate(ItemIns);
 }
示例#9
0
 public void OnMouseOver()
 {
     tooltip = GameObject.Find("ItemDatabase").GetComponent <Tooltip>();
     if (townHallLevel == 0 && Time.timeScale > 0.0f)
     {
         tooltip.Activate("Looks like something was built here.\nClick to build!\nCost: " + buildCost);
     }
 }
示例#10
0
 public void OnMouseOver()
 {
     tooltip = GameObject.Find("ItemDatabase").GetComponent <Tooltip>();
     if (Time.timeScale > 0.0f)
     {
         tooltip.Activate(ConstructDataString());
     }
 }
示例#11
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (slot > 9) // Disables tooltip for items in the hotbar(TODO)
     {
         tooltip.Activate(item);
     }
     this.transform.localScale = new Vector3(1.2f, 1.2f, 1);
 }
示例#12
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (TargetResearch == null)
     {
         return;
     }
     _tooltip.Activate(TargetResearch);
 }
示例#13
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        Item item = FetchItem();

        if (item != null)
        {
            tooltip.Activate(item);
        }
    }
示例#14
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        // If the item is in a hot-key slot, don't bother with the tool-tip
        if (HotKeySlot != -1)
        {
            return;
        }

        _tooltip.Activate(Item);
    }
示例#15
0
 public void OnPointerDown(PointerEventData eventData)
 {
     //We place the tooltip right where the player places their finger.
     offset  = eventData.position - new Vector2(this.transform.position.x, this.transform.position.y);
     currPos = Input.mousePosition;
     tooltip.Activate(item);
     if (GameObject.Find("EquipmentHandler").GetComponent <EquipmentHandler>().Equipping)
     {
         GameObject.Find("EquipmentHandler").GetComponent <EquipmentHandler>().SelectorSlot = slot;
     }
 }
示例#16
0
        private void HandleReflect()
        {
            _audioSource.PlayOneShot(ReflectClips[Random.Range(0, ReflectClips.Count)]);
            ReflectTooltip.Activate(_currentBattleAction.Value);

            _reflectValue = _currentBattleAction.Value;

            _currentBattleAction    = null;
            _isPerforming           = false;
            Battle.IsCompletingTurn = false;
            Battle.ChangeTurn();
        }
示例#17
0
        private void HandleShield()
        {
            _audioSource.PlayOneShot(ShieldClips[Random.Range(0, ShieldClips.Count)]);
            ShieldTooltip.Activate(_currentBattleAction.Value);

            _shieldValue = _currentBattleAction.Value;

            _currentBattleAction    = null;
            _isPerforming           = false;
            Battle.IsCompletingTurn = false;
            Battle.ChangeTurn();
        }
示例#18
0
    public void OnPointerEnter(PointerEventData pointerEventData)
    {
        if (tooltip != null)
        {
            tooltip.setObject(gameObject);
            tooltip.Activate(true);

            if (canvasRectTransform == null)
            {
                return;
            }

            Vector3[] worldCorners = new Vector3[4];
            GetComponent <RectTransform>().GetWorldCorners(worldCorners);

            Vector2 localRectTransform;
            RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRectTransform,
                                                                    new Vector2((worldCorners[3].x + worldCorners[0].x) / 2.0f, worldCorners[0].y),
                                                                    pointerEventData.enterEventCamera,
                                                                    out localRectTransform);

            Vector2 newTooltipPos = new Vector2(localRectTransform.x, localRectTransform.y);
            if (localRectTransform.y - tooltipRectTransform.sizeDelta.y < -canvasRectTransform.sizeDelta.y / 2)
            {
                newTooltipPos.y += tooltipRectTransform.sizeDelta.y + GetComponent <RectTransform>().sizeDelta.y;
            }

            if (localRectTransform.x - tooltipRectTransform.sizeDelta.x / 2 < -canvasRectTransform.sizeDelta.x / 2)
            {
                newTooltipPos.x = tooltipRectTransform.sizeDelta.x / 2 - canvasRectTransform.sizeDelta.x / 2;
            }

            if (localRectTransform.x + tooltipRectTransform.sizeDelta.x / 2 > canvasRectTransform.sizeDelta.x / 2)
            {
                newTooltipPos.x = canvasRectTransform.sizeDelta.x / 2 - tooltipRectTransform.sizeDelta.x / 2;
            }

            tooltipRectTransform.localPosition = newTooltipPos;
        }
    }
示例#19
0
    public void MouseEnter()
    {
        if (Global.inventoryManager.dragEnable)
        {
            Global.inventoryManager.endSlot = this;
        }

        if (currentitem == null)
        {
            return;
        }
        tooltip.Activate(currentitem);
    }
示例#20
0
 public void ShowDamageTooltip(int damage)
 {
     DamageTooltip.Activate(damage);
 }
示例#21
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     Debug.Log("Pointer Enter");
     tooltip.Activate(item);
 }
示例#22
0
    // player clicks item in inventory
    public void OnPointerDown(PointerEventData eventData)
    {
        // Android
        if (Application.platform == RuntimePlatform.Android)
        {
            if (item != null)
            {
                // first tap, show item's tooltip
                if (!tapped)
                {
                    tapped = true;
                    tooltip.Activate(item);
                }
                // 2nd tap
                else
                {
                    tapped = false;
                    // give medicine to NPC with second tap
                    for (int i = 0; i < Input.touchCount; ++i)
                    {
                        Touch touch = Input.GetTouch(i);
                        if (touch.phase == TouchPhase.Began)
                        {
                            // iterate through the tapped item's medicines + dosages
                            // and save them to arrays
                            string[] titles  = new string[item.medicine.Count];
                            float[]  dosages = new float[item.medicine.Count];
                            int      j       = 0;
                            foreach (Item it in item.medicine)
                            {
                                titles[j]  = it.Title;
                                dosages[j] = it.currentDosage;
                                j++;
                            }

                            // pass the saved arrays to UIManager
                            // try giving item to NPC first, then try trashing it
                            // both return true if they succeed -> remove item from inventory
                            if (uiManager.giveMed(titles, dosages))
                            {
                                inv.RemoveItem(item.ID);
                                tooltip.Deactivate();
                                break;
                            }
                            else if (uiManager.trashItem())
                            {
                                inv.RemoveItem(item.ID);
                                tooltip.Deactivate();
                                break;
                            }
                        }
                    }
                }
            }
        }
        // same for PC, but without the mobile tapping stuff
        else
        {
            if (item != null)
            {
                string[] titles  = new string[item.medicine.Count];
                float[]  dosages = new float[item.medicine.Count];
                int      j       = 0;
                foreach (Item it in item.medicine)
                {
                    titles[j]  = it.Title;
                    dosages[j] = it.currentDosage;
                    j++;
                }

                if (uiManager.giveMed(titles, dosages))
                {
                    inv.RemoveItem(item.ID);
                    tooltip.Deactivate();
                }
                else if (uiManager.trashItem())
                {
                    inv.RemoveItem(item.ID);
                    tooltip.Deactivate();
                }
                else
                {
                    // show tooltip above mouse cursor's position
                    offset = eventData.position - new Vector2(this.transform.position.x, this.transform.position.y);
                    this.transform.position = eventData.position - offset;
                }
            }
        }
    }
示例#23
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     CardScaling.UpscaleCard(this);
     tooltip.ConstructTooltip(CurrentCard, this.gameObject);
     tooltip.Activate();
 }
示例#24
0
 /*--------------------------------------------------------------------------------------
  * -- FUNCTION:     OnMouseEnter
  * -- DATE:         15/03/2016
  * -- REVISIONS:
  * -- DESIGNER:     Joseph Tam-Huang
  * -- PROGRAMMER:   Joseph Tam-Huang
  * -- INTERFACE:    public void OnMouseEnter()
  * -- RETURNS:  void
  * -- NOTES:
  * -- Enable the tooltip when the mouse pointer hovers over the world item.
  * -----------------------------------------------------------------------------------------*/
 public void OnMouseEnter()
 {
     _tooltip.Activate(item, amount);
 }
示例#25
0
 /*-------------------------------------------------------------------------------------------------
 *  -- FUNCTION:     OnPointerEnter
 *  -- DATE:         17/02/2016
 *  -- REVISIONS:
 *  -- DESIGNER:     Joseph Tam-Huang
 *  -- PROGRAMMER:   Joseph Tam-Huang
 *  -- INTERFACE:    public void OnPointerEnter(PointerEventData eventData)
 *  --                  PointerEventData eventData: The event payload associated with pointer events.
 *  -- RETURNS:  void
 *  -- NOTES:
 *  -- Activates the tooltip when the mouse pointer enters the collider box of the item.
 *  -------------------------------------------------------------------------------------------------*/
 public void OnPointerEnter(PointerEventData eventData)
 {
     _tooltip.Activate(item);
 }
示例#26
0
 private void OnCanInteract()
 {
     Tooltip.Activate(isOpen ? "Close" : "Open", transform, Vector3.zero);
 }
示例#27
0
 private void OnCanInteract()
 {
     Tooltip.Activate(friendlyName, transform, transform.up * tooltipOffset);
 }
示例#28
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     //this is for tooltip, when cursor enter the raycast of an item, the tooltip will appear
     tooltip.Activate(item);
 }
示例#29
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     tooltip.Activate(ConstructDataString());
 }
示例#30
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     tooltip.Activate(this.GetComponent <ItemData>());
 }