Beispiel #1
0
        /// <summary>
        /// Creates option buttons when item is clicked.
        /// </summary>
        /// <param name="index"></param>
        public void OnIconClick(int index)
        {
            if (orientation == MenuNavigation.Horizontal)
            {
                watchButtonTransform.position = new Vector2(inventoryButtonsTransform[index].position.x, watchButtonTransform.position.y);
                useButtonTransform.position   = new Vector2(inventoryButtonsTransform[index].position.x, useButtonTransform.position.y);
            }
            else
            {
                watchButtonTransform.position = new Vector2(watchButtonTransform.position.x, inventoryButtonsTransform[index].position.y);
                useButtonTransform.position   = new Vector2(useButtonTransform.position.x, inventoryButtonsTransform[index].position.y - 0.5f);
            }

            RemoveAllListener();
            ActiveOptionButtons(true);

            useButton.onClick.AddListener(()
                                          => OnOptionClicked?.Invoke(this, new OptionClickEventArgs
            {
                ItemIndex = index, Instruction = InventoryController.USE_INSTRUCTION
            }));
            watchButton.onClick.AddListener(()
                                            => OnOptionClicked?.Invoke(this, new OptionClickEventArgs {
                ItemIndex = index, Instruction = InventoryController.WATCH_INSTRUCTION
            }));
        }
Beispiel #2
0
 private void Option_Clicked(ClassToCall classToCall)
 {
     OnOptionClicked?.Invoke(this, new OptionClickEventArgs(classToCall));
 }