コード例 #1
0
 public void SetupMouseEnterActionButton(EventTrigger trigger, DispensaryActionRoundButton button, string tooltip)
 {
     EventTrigger.Entry entry = new EventTrigger.Entry();
     entry.eventID = EventTriggerType.PointerEnter;
     entry.callback.AddListener((eventData) => { button.Magnify(); });
     trigger.triggers.Add(entry);
 }
コード例 #2
0
 public void SetupMouseExitActionButton(EventTrigger trigger, DispensaryActionRoundButton button)
 {
     EventTrigger.Entry entry = new EventTrigger.Entry();
     entry.eventID = EventTriggerType.PointerExit;
     entry.callback.AddListener((eventData) => { button.Restore(); });
     trigger.triggers.Add(entry);
 }
コード例 #3
0
    public void CreateActionButtons()
    {
        int   counter     = 0;
        float buttonWidth = undoButtonPrefab.button.image.rectTransform.rect.width;
        float padding     = buttonWidth / 8;

        foreach (ToInstantiate obj in toInstantiate)
        {
            DispensaryActionRoundButton newButton = Instantiate(obj.prefab);
            newButton.gameObject.SetActive(true);
            EventTrigger buttonTrigger = newButton.button.GetComponent <EventTrigger>();
            SetupMouseEnterActionButton(buttonTrigger, newButton, obj.identifier);
            SetupMouseExitActionButton(buttonTrigger, newButton);
            newButton.button.transform.SetParent(transform, false);
            newButton.button.image.rectTransform.anchoredPosition = new Vector2(-(buttonWidth + padding) * counter, 0);
            newButton.OffScreen();
            counter++;
            buttons.Add(newButton);
        }
    }
コード例 #4
0
 public ToInstantiate(DispensaryActionRoundButton prefab_, string identifier_)
 {
     prefab     = prefab_;
     identifier = identifier_;
 }