示例#1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        int i = eventData.clickCount;

        if (i == 2)
        {
            if (this.item.Type == "Food")
            {
                if (this.amount > 1)
                {
                    this.amount -= 1;
                    this.transform.GetChild(0).GetComponent <Text> ().text = this.amount.ToString();
                    playerdata.healthbar.value += 10;
                }
                else
                {
                    Destroy(this.gameObject);
                    playerdata.healthbar.value += 10;
                }
            }
            else
            {
                playerdata.silver += (this.item.Value * this.amount);
                Destroy(this.gameObject);
                tooltip.Deactivate();
            }
        }
    }
示例#2
0
    public void OnPointerDown(PointerEventData eventData)
    {
        offset = eventData.position - new Vector2(this.transform.position.x, this.transform.position.y);

        if (Input.GetMouseButtonDown(1))
        {
            if (inv.UseItem(item))
            {
                tooltip.Deactivate();
            }
        }
    }
示例#3
0
    //Optional : split this funcion into two - update subscript AND remove items, for the sake of optimisation
    public void Update_subscript_and_remove_items(int slot_location, ref List <Item> item, ref List <GameObject> slots, ref int number)
    {
        ItemData data = slots [slot_location].transform.GetChild(0).GetComponent <ItemData> ();

        if (data.amount > 2)
        {
            number--;
            data.transform.GetChild(0).GetComponent <Text> ().text = data.amount.ToString();
        }
        else if (data.amount > 1)
        {
            number--;
            data.transform.GetChild(0).GetComponent <Text> ().text = "";
        }
        else
        {
            Use_Consumable(ref item, slot_location);
            item [slot_location] = new Item();
            Destroy(slots [slot_location].transform.GetChild(0).transform.GetChild(0).GetComponent <Text>());
            Destroy(slots [slot_location].transform.GetChild(0).GetComponent <LayoutElement>());
            Destroy(slots [slot_location].transform.GetChild(0).GetComponent <Image>());
            Destroy(slots [slot_location].transform.GetChild(0).gameObject);
            tooltip.Deactivate();
        }
        Use_Consumable(ref item, slot_location);
    }
示例#4
0
    //Mostly temp
    void Update()
    {
        if (Input.GetKey(KeyCode.Mouse1))
        {
            if (items[SelectedSlot] as UsableItem != null)
            {
                UsableItem activeItem = (UsableItem)items[SelectedSlot];
                if (activeItem.Activate())
                {
                    if (activeItem.RemoveAfterUse)
                    {
                        RemoveItem(SelectedSlot);
                    }
                }
            }
            else
            {
                //raytest
                //All this has to move to like player or something
                Ray          ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit2D hit = Physics2D.GetRayIntersection(ray);
                if (hit)
                {
                    if (hit.collider != null)
                    {
                        GameObject obj = hit.transform.gameObject;
                        if (obj.tag == "Clickable")
                        {
                            obj.GetComponent <Plant>().OnCast();
                            //Need a series of classes for objects in world, with on clicked() etc.
                        }
                    }
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            inventoryPanel.SetActive(!inventoryPanel.activeSelf);
            tooltip.Deactivate();
        }

        if (Input.GetKeyDown(KeyCode.Q))
        {
            //Drop selected item
            DropItem(SelectedSlot);
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            updateSelectedSlot(SelectedSlot + 1);
        }
        if (Input.GetKeyDown(KeyCode.O))
        {
            updateSelectedSlot(SelectedSlot - 1);
        }

        //Input for selected slot in toolbar
        items[SelectedSlot].WhileSelected();
    }
示例#5
0
 public void MouseExit()
 {
     tooltip.Deactivate();
     if (Global.inventoryManager.dragEnable)
     {
         Global.inventoryManager.endSlot = null;
     }
 }
示例#6
0
 public void OnPointerExit(PointerEventData eventData)
 {
     if (ItemIns == null)
     {
         return;
     }
     _tooltip.Deactivate();
 }
示例#7
0
 public void OnPointerExit(PointerEventData eventData)
 {
     if (TargetResearch == null)
     {
         return;
     }
     _tooltip.Deactivate();
 }
示例#8
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.I))
     {
         inventoryPanel.SetActive(!inventoryPanel.activeInHierarchy);
         tooltip.Deactivate();
     }
 }
示例#9
0
        public void ClearBuffs()
        {
            ShieldTooltip.Deactivate();
            ReflectTooltip.Deactivate();

            _shieldValue  = 0;
            _reflectValue = 0;
        }
示例#10
0
    public void OnPointerExit(PointerEventData eventData)
    {
        // If the item is in a hot-key slot, don't bother with the tool-tip
        if (HotKeySlot != -1)
        {
            return;
        }

        _tooltip.Deactivate();
    }
示例#11
0
    /*--------------------------------------------------------------------------------------
     * -- FUNCTION:     Update
     * -- DATE:         05/03/2016
     * -- REVISIONS:    27/03/2016 - Add gurad to prevent mulitple unique items from being
     * --                           picked up at once.
     * -- DESIGNER:     Joseph Tam-Huang
     * -- PROGRAMMER:   Joseph Tam-Huang
     * -- INTERFACE:    void Update()
     * -- RETURNS:  void
     * -- NOTES:
     * -- If the 'F' key is pressed while the player is in the world item object's collider box,
     * -- an message is sent to the server to signal a pick up event.
     * -- Cannot pick up more than one item even when their collider boxes overlap.
     * -----------------------------------------------------------------------------------------*/
    void Update()
    {
        // Manually pick up items that are not autolootable
        if (_trigger_entered && !autolootable && Input.GetKeyDown(KeyCode.F))
        {
            if (Inventory.instance.CheckIfItemCanBeAdded(item.stackable, item.id))
            {
                int player_id = GameData.MyPlayer.PlayerID;
                List <Pair <string, string> > msg = new List <Pair <string, string> >();

                if (!GameData.ItemCollided)
                {
                    GameData.ItemCollided = true;
                    _first_collision      = true;
                }

                if (_first_collision)
                {
                    _first_collision = false;
                    if (_world_item_manager == null)
                    {
                        Debug.Log("[ERROR] WorldItemData's Update says _world_item_manager is null");
                        return;
                    }
                    msg = _world_item_manager.CreatePickupItemNetworkMessage(world_item_id, player_id, item.id, amount);
                    NetworkingManager.send_next_packet(DataType.Item, (int)ItemUpdate.Pickup, msg, Protocol.TCP);
                    StartCoroutine(NeverReceivedPickupMessageBack());

                    // Pretend that a pickup event was received
                    if (Application.platform != RuntimePlatform.LinuxPlayer)
                    {
                        StartCoroutine(WorldItemManager.Instance.WaitSmallDelayBeforeReceivePickupPacket(WorldItemManager.Instance.ConvertListToJSONClass(msg)));
                    }
                }
                _tooltip.Deactivate();
            }
            else
            {
                StartCoroutine(Inventory.instance.DisplayInventoryFullError());
            }
        }
    }
示例#12
0
 public void TogglePanel()
 {
     if (inventoryPanel.activeSelf)
     {
         tooltip.Deactivate();
         inventoryPanel.SetActive(false);
     }
     else
     {
         inventoryPanel.SetActive(true);
     }
 }
示例#13
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.I))
     {
         if (inventoryPanel.activeSelf)
         {
             tooltip.Deactivate();
             inventoryPanel.SetActive(false);
         }
         else
         {
             inventoryPanel.SetActive(true);
         }
     }
 }
示例#14
0
    // ReSharper disable once UnusedMember.Local
    private void Update()
    {
        // Update player stats
        var playerStats = _playerControllerScript.characterStats;

        HealthText.text         = playerStats.Health.ToString();
        StaminaText.text        = playerStats.Stamina.ToString();
        DefenseText.text        = playerStats.Defense.ToString();
        CritChanceText.text     = playerStats.CritChance.ToString(CultureInfo.InvariantCulture);
        CritMultiplierText.text = playerStats.CritMultiplier.ToString(CultureInfo.InvariantCulture);
        MaxForceResistText.text =
            playerStats.MaxForceResistence.ToString(CultureInfo.InvariantCulture);

        if (Input.GetKeyDown(KeyCode.I))
        {
            InventoryPanel.SetActive(!InventoryPanel.activeSelf);

            if (!InventoryPanel.activeSelf)
            {
                _tooltip.Deactivate();
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            UseHotKeyItem(0);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            UseHotKeyItem(1);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            UseHotKeyItem(3);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            UseHotKeyItem(4);
        }

        // If the effect is alive, follow the player
        if (_itemEffect != null)
        {
            _itemEffect.transform.position = _player.transform.position;
        }
    }
示例#15
0
    void Start()
    {
        inventoryPanel = GameObject.Find("InventoryPanel");
        slotPanel      = inventoryPanel.transform.Find("SlotPanel").gameObject;
        inventoryPanel.SetActive(false);

        tooltip = GameObject.Find("Tooltip").GetComponent <Tooltip>();
        tooltip.Deactivate();

        toolbarPanel     = GameObject.Find("ToolbarPanel");
        toolbarSlotPanel = toolbarPanel.transform.Find("ToolbarSlots").gameObject;

        inventorySlot = Resources.Load <GameObject>("Prefabs/UI/Slot");
        inventoryItem = Resources.Load <GameObject>("Prefabs/UI/Item");

        for (int i = 0; i < toolbarSlotAmount; i++)
        {
            items.Add(new Item());
            slots.Add(Instantiate(inventorySlot, toolbarSlotPanel.transform));
            slots[i].GetComponent <ItemSlot>().index = i;
        }

        for (int i = 0; i < slotAmount; i++)
        {
            items.Add(new Item());
            slots.Add(Instantiate(inventorySlot, slotPanel.transform));
            slots[i + toolbarSlotAmount].GetComponent <ItemSlot>().index = i + toolbarSlotAmount;
        }

        updateSelectedSlot(0);

        //Load somme items for testing
        AddItem(4);
        AddItem(0);
        AddItem(6);
        AddItem(6);
        AddItem(6);
        AddItem(5);
        AddItem(66);
        AddItem(67);
        AddItem(67);
        AddItem(67);
        AddItem(67);
        AddItem(67);
    }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Tab) && !invAct)
     {
         invc.SetActive(true);
         invAct    = true;
         c.a       = 0.8f;
         dim.color = c;
     }
     else if (Input.GetKeyDown(KeyCode.Tab) && invAct)
     {
         invc.SetActive(false);
         invAct = false;
         tooltip.Deactivate();
         c.a       = 0;
         dim.color = c;
     }
 }
示例#17
0
        /// <summary>
        /// 给对象添加TooltipTrigger脚本
        /// </summary>
        /// <param name="_tTrans">要添加Trigger的对象</param>
        /// <returns>TooltipTrigger脚本</returns>
        public static T AddComponent <T>(this GameObject _uGameObject, ETooltipStyle _eStyle) where T : UTooltipTrigger
        {
            T tmpTrigger = null;

            //将类型转为字符串并根据‘_’标识符切割
            string StyleName        = _eStyle.ToString().Split('_')[1];
            string TriggerStylePath = UPath.UTooltipStyle + StyleName;

            if (_uGameObject.GetComponent <T>() == null)
            {
                tmpTrigger = _uGameObject.AddComponent <T>();
                ResNode stylePerfabe = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, TriggerStylePath);

                TooltipStyle InstanceTooltipStyle = stylePerfabe.InstanceMainRes <TooltipStyle>();
                TooltipStyle tooltipStyle         = null;
                if (!UTooltipManager.Instance.Tooltips.ContainsKey(InstanceTooltipStyle.TooltipID))
                {
                    tooltipStyle      = InstanceTooltipStyle;
                    tooltipStyle.name = tooltipStyle.name;
                    tooltipStyle.transform.SetParent(UTooltipManager.Instance.TooltipContainer.transform, false);
                    Tooltip newTooltip = new Tooltip()
                    {
                        GameObject = tooltipStyle.gameObject
                    };
                    newTooltip.Initialize();
                    newTooltip.Deactivate();
                    UTooltipManager.Instance.Tooltips.Add(tooltipStyle.TooltipID, newTooltip);
                }
                else
                {
                    tooltipStyle = UTooltipManager.Instance.Tooltips[InstanceTooltipStyle.TooltipID].TooltipStyle;
                    var temp = InstanceTooltipStyle.gameObject;
                    stylePerfabe.DestroyInstanceRes(ref temp);
                }

                tmpTrigger.tooltipStyle = tooltipStyle;
            }
            else
            {
                tmpTrigger = _uGameObject.GetComponent <T>();
            }

            return(tmpTrigger);
        }
示例#18
0
 /// <summary>
 /// Use when the user open the in game inventory.
 /// </summary>
 public void OnLaunch()
 {
     if (gameObject.activeInHierarchy)
     {
         //The inventory is open, so we want to close it
         //GameObject inv = GameObject.Find ("Inventory");
         Tooltip tooltip = gameObject.transform.parent.gameObject.GetComponentInChildren <Tooltip> ();
         tooltip.Deactivate();
         gameObject.SetActive(false);
         OptionMenuClick.UnPauseGame();
     }
     else
     {
         //The inventory is close, so we want to open it
         gameObject.SetActive(true);
         OptionMenuClick.PauseGame();
     }
     //TODO : unlock cursor
 }
示例#19
0
 public void OnPointerExit(PointerEventData eventData)
 {
     //this is for tooltip, when cursor exit the raycast of an item, the tooltip wil disappear
     tooltip.Deactivate();
 }
示例#20
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I))
        {
            inventoryPanel.SetActive(!inventoryPanel.activeSelf);
            if (inventoryPanel.activeSelf)
            {
                slots[currentHighlight].GetComponent <Outline>().enabled = false;
                thePlayer.canMove = false;
                currentHighlight  = 0;
                slots[currentHighlight].GetComponent <Outline>().enabled = true;
            }
        }

        if (inventoryPanel.activeSelf)
        {
            if (slots[currentHighlight].transform.childCount != 0)
            {
                tooltip.Activate(currentHighlight);
            }
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                slots[currentHighlight].GetComponent <Outline>().enabled = false;
                tooltip.Deactivate();
                currentHighlight = CalculateHighlight(1);
                slots[currentHighlight].GetComponent <Outline>().enabled = true;// Debug.Log(currentHighlight);
                if (slots[currentHighlight].transform.childCount != 0)
                {
                    tooltip.Activate(currentHighlight);
                }
            }
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                slots[currentHighlight].GetComponent <Outline>().enabled = false;
                tooltip.Deactivate();
                currentHighlight = CalculateHighlight(-1);
                slots[currentHighlight].GetComponent <Outline>().enabled = true;// Debug.Log(currentHighlight);
                if (slots[currentHighlight].transform.childCount != 0)
                {
                    tooltip.Activate(currentHighlight);
                }
            }
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                slots[currentHighlight].GetComponent <Outline>().enabled = false;
                tooltip.Deactivate();
                currentHighlight = CalculateHighlight(-3);
                slots[currentHighlight].GetComponent <Outline>().enabled = true;// Debug.Log(currentHighlight);
                if (slots[currentHighlight].transform.childCount != 0)
                {
                    tooltip.Activate(currentHighlight);
                }
            }
            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                slots[currentHighlight].GetComponent <Outline>().enabled = false;
                tooltip.Deactivate();
                currentHighlight = CalculateHighlight(3);
                slots[currentHighlight].GetComponent <Outline>().enabled = true;// Debug.Log(currentHighlight);
                if (slots[currentHighlight].transform.childCount != 0)
                {
                    tooltip.Activate(currentHighlight);
                }
            }
        }
        else if (!theDM.dialogActive && !theKM.keyboardActive)
        {
            thePlayer.canMove = true;
        }
    }
示例#21
0
    void handleInput()
    {
        if ((Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) || (Input.GetMouseButtonDown(0)))
        {
            if (!isMouseOverUI())
            {
                if (tooltip.enabled)
                {
                    tooltip.Deactivate();
                }
            }

            RaycastHit hit2;
            //Layer masks
            LayerMask layerMask    = (1 << 8) | (1 << 11);
            LayerMask layerMaskNpc = (1 << 9) | (1 << 10);
            Ray       ray          = new Ray();
            //for unity editor
#if UNITY_EDITOR || UNITY_STANDALONE
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            //for touch device
#elif (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8)
            ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
#endif

            /*
             * Prioritize raycast hit on npc, so that when npc is sitting
             * or sleeping you hit the npc instead of the object they are on
             */
            RaycastHit[] rays;
            rays = Physics.RaycastAll(ray, 10000.0f, layerMaskNpc);
            List <RaycastHit> hits = new List <RaycastHit>();
            bool npcwashit         = false;
            movingToTarget = false;
            if (rays.Length > 0)
            {
                if (!isMouseOverUI())
                {
                    anim.StopAll();
                    pickingup = false;
                    foreach (RaycastHit hit in rays)
                    {
                        //object who booked the object.
                        GameObject temp = objManager.isObjectBooked(hit.transform.gameObject);
                        if (hit.transform.tag != "NPC" && temp == null)
                        {
                            hits.Add(hit);
                            continue;
                        }
                        else
                        {
                            npcwashit = true;
                            if ((target == hit.transform.gameObject) || (temp != null && target == temp))
                            {
                                nextDestination = new Vector3(target.transform.position.x, target.transform.position.y, target.transform.position.z);
                                moveTo(nextDestination);
                                followNpc = true;
                            }
                            else
                            {
                                disableTarget();
                                if (temp != null && temp != gameObject)
                                {
                                    target = temp;
                                }
                                else
                                {
                                    target = hit.transform.gameObject;
                                }
                                interaction.setTarget(target);
                                outlineGameObjectRecursive(target.transform, Shader.Find("Outlined/Silhouetted Diffuse"));
                            }
                            if (sitting)
                            {
                                sitting = false;
                                objManager.unbookObject(interaction.getCurrentChair());
                            }
                            if (sleeping)
                            {
                                sleeping = false;
                                objManager.unbookObject(interaction.getBed());
                            }
                        }
                    }
                    //if ther was now npc's hit, take the first hit object
                    if (!npcwashit)
                    {
                        hit2 = hits[0];
                        if (target == hit2.transform.gameObject)
                        {
                            if (sitting)
                            {
                                sitting = false;
                                objManager.unbookObject(interaction.getCurrentChair());
                            }
                            if (sleeping)
                            {
                                sleeping = false;
                                objManager.unbookObject(interaction.getBed());
                            }

                            if (target.tag == "Chair" || target.tag == "QueueChair" || target.tag == "Chair2")
                            {
                                if (objManager.bookTargetObject(target, gameObject))
                                {
                                    interaction.setCurrentChair(interaction.getTarget());
                                    if (target.tag == "Chair2")
                                    {
                                        nextDestination = interaction.getDestToTargetObjectSide(1, 16.0f);
                                        moveTo(nextDestination);
                                    }
                                    else
                                    {
                                        nextDestination = interaction.getDestToTargetObjectSide(0, 16.0f);
                                        moveTo(nextDestination);
                                    }
                                    sitting = true;
                                    disableMoveIndicator();
                                }
                            }
                            else if (target.tag == "Bed")
                            {
                                if (objManager.bookTargetObject(target, gameObject))
                                {
                                    interaction.setBookedBed(interaction.getTarget());
                                    nextDestination = interaction.getDestToTargetObjectSide(1, 16.0f);
                                    moveTo(nextDestination);
                                    sleeping = true;
                                    disableMoveIndicator();
                                }
                            }
                            else if (target.tag == "PickupItemFloor" || target.tag == "PickupItem")
                            {
                                interaction.setTarget(target);
                                pickingup       = true;
                                nextDestination = target.transform.position;
                                moveTo(nextDestination);
                                disableMoveIndicator();
                            }
                            else if (target.tag == "MedCabinet" || target.tag == "Computer" || target.tag == "TrashCan" || target.tag == "CoffeeMachine")
                            {
                                interaction.setTarget(target);
                                nextDestination = target.transform.position;
                                moveTo(nextDestination);
                                disableMoveIndicator();
                                movingToTarget = true;
                            }
                        }
                        else
                        {
                            if (sitting || interaction.getCurrentChair() != null)
                            {
                                sitting = false;
                                objManager.unbookObject(interaction.getCurrentChair());
                            }
                            if (sleeping || interaction.getBed() != null)
                            {
                                sleeping = false;
                                objManager.unbookObject(interaction.getBed());
                            }
                            /*Disable target*/
                            disableTarget();
                            GameObject temp = objManager.isObjectBooked(hit2.transform.gameObject);
                            if (temp != null)
                            {
                                target = temp;
                            }
                            else
                            {
                                //set new target
                                target = hit2.transform.gameObject;
                            }
                            interaction.setTarget(target);
                            //outline the object
                            outlineOnlyParent(target.transform, Shader.Find("Outlined/Silhouetted Diffuse"));
                        }
                    }
                }
            }
            //check if the ray hits floor collider
            else if (Physics.Raycast(ray, out hit2, 10000.0f, layerMask))
            {
                if (!isMouseOverUI())
                {
                    anim.StopAll();
                    pickingup = false;
                    if (interaction.getCurrentChair() != null)
                    {
                        objManager.unbookObject(interaction.getCurrentChair());
                    }
                    if (interaction.getBed() != null)
                    {
                        objManager.unbookObject(interaction.getBed());
                    }
                    //get position of hit and move there
                    Vector3 pos = new Vector3(hit2.point.x, 0, hit2.point.z);
                    enableMoveIndicator(pos);
                    nextDestination = pos;
                    moveTo(nextDestination);
                    if (sitting == true)
                    {
                        sitting = false;
                        objManager.unbookObject(target);
                    }
                    if (sleeping == true)
                    {
                        sleeping = false;
                        objManager.unbookObject(target);
                    }
                    if (followNpc)
                    {
                        followNpc = false;
                    }
                }
            }
            //check if the ray hits targetableobjects collider
        }
    }
示例#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 OnPointerExit(PointerEventData eventData)
 {
     tooltip.Deactivate();
     this.transform.localScale = new Vector3(1, 1, 1);
 }
示例#24
0
 public void OnMouseExit()
 {
     tooltip = GameObject.Find("ItemDatabase").GetComponent <Tooltip>();
     tooltip.Deactivate();
 }
示例#25
0
 public void OnPointerUp(PointerEventData eventData)
 {
     //When player lifts their finger, don't show tooltip
     tooltip.Deactivate();
 }
示例#26
0
 public void OnPointerExit(PointerEventData eventData)
 {
     Debug.Log("OnPointerExit");
     tooltip.Deactivate();
 }
示例#27
0
 /// <summary>
 ///  activates the tooltip when the mouse exits the itemData
 /// </summary>
 /// <param name="eventData">Event data.</param>
 void IPointerExitHandler.OnPointerExit(PointerEventData eventData)
 {
     tooltip.Deactivate();
 }
示例#28
0
 public void OnPointerExit(PointerEventData eventData)
 {
     CardScaling.DownscaleCard(this);
     tooltip.Deactivate();
 }
示例#29
0
 public void OnPointerExit(PointerEventData eventData)
 {
     tooltip.Deactivate();
 }
示例#30
0
 public void OnPointerExit(PointerEventData eventData)
 {
     tooltip.Deactivate();
     Cursor.visible = false;
     mouseCursor.spriteRenderer.enabled = true;
 }