コード例 #1
0
ファイル: GooGlueCraft.cs プロジェクト: Jmaster9999/0ct0-GONE
    private void Start()
    {
        tooltipText = tooltip.GetComponent <TextMeshProUGUI>();
        EventTrigger trigger = naniteCraftButton.GetComponent <EventTrigger>();

        EventTrigger.Entry entry = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerDown;
        entry.callback.AddListener((eventData) =>
        {
            if (!CraftingModule.CanCraftConsumable(stationInv, playerInv, playerResourceInv, naniteRecipe))
            {
                return;
            }
            popTextMSG      = $"{naniteRecipe.DisplayName} crafted";
            var pointerData = (PointerEventData)eventData;
            timerDial.transform.position = pointerData.position;
            HoldTimer();
        });

        trigger.triggers.Add(entry);

        entry         = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerUp;
        entry.callback.AddListener((eventData) =>
        {
            ReleaseTimer();
        });
        trigger.triggers.Add(entry);

        entry         = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerEnter;
        entry.callback.AddListener((eventData) =>
        {
            ShowTooltip();
        });
        trigger.triggers.Add(entry);

        entry         = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerExit;
        entry.callback.AddListener((eventData) =>
        {
            HideTooltip();
        });
        trigger.triggers.Add(entry);
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (isCrafting == true)
        {
            UpdateTimer();
        }

        if (contentGroups[0].activeSelf)
        {
            if (currentRecipe != null && CraftingModule.CanCraftConsumable(shipInventory, playerInventory, playerResourceInventory, currentRecipe))
            {
                mainCrafting.canConsumableCraft = true;
            }
            else
            {
                mainCrafting.canConsumableCraft = false;
            }
            mainCrafting.UpdateCraftButton();
        }
        else
        {
            mainCrafting.canConsumableCraft = false;
        }
    }