Beispiel #1
0
 public void MakeHover(ClickMenuItem item)
 {
     if (OnItemHovered != null)
     {
         OnItemHovered.Invoke(item);
     }
 }
Beispiel #2
0
 public void MakeSelection(ClickMenuItem item)
 {
     if (OnItemSelected != null)
     {
         OnItemSelected.Invoke(item);
     }
 }
Beispiel #3
0
 private void OnItemSelected(ClickMenuItem item)
 {
     if (item == null || item.id == -1)
     {
         audioBack.Play();
     }
     else
     {
         audioSelect.Play();
     }
 }
        private void OnItemSelected(ClickMenuItem item)
        {
            int id = (item ? item.id : -1);

            switch (id)
            {
            case 7:     // crossarm
                thingkingAudio.Play();
                target.SetTrigger("Crossarm");
                break;

            case 8:     // dance
                danceAudio.Play();
                target.SetTrigger("Dance");
                break;

            case 9:     // death
                deathAudio.Play();
                target.SetTrigger("Death");
                break;

            case 10:     // sit
                thingkingAudio.Play();
                target.SetTrigger("Sit");
                break;

            case 3:     // happy
                happyAudio.Play();
                sc.changeNormal();
                break;

            case 4:     // sad
                sadAudio.Play();
                sc.changeSad();
                break;

            case 5:     // laugh
                laughAudio.Play();
                sc.changeHappy();
                break;

            case 6:     // angry
                angryAudio.Play();
                sc.changeAngry();
                break;
            }
        }
Beispiel #5
0
        /// Called to make this icon visible and interactable
        public void Initialize(ClickMenuRoot root, ClickMenuIcon _parentMenu, AssetTree.Node node,
                               Vector3 _menuCenter, float scale, Vector3 offset)
        {
            string name = (node == null ? "Back " : ((ClickMenuItem)node.value).toolTip);

            gameObject.name = name + " Item";
            parentMenu      = _parentMenu;
            startPosition   = transform.position;
            startScale      = transform.localScale;
            menuRoot        = root;
            menuNode        = node;
            menuCenter      = _menuCenter;
            menuOrientation = transform.rotation;
            menuScale       = scale;
            localOffset     = offset;
            background      = null;
            if (node != null)
            {
                // Set foreground icon
                menuItem = (ClickMenuItem)node.value;
                spriteRenderer.sprite = menuItem.icon;

                // Set background icon
                if (menuItem.background)
                {
                    background = new GameObject(name + " Item Background");
                    background.transform.parent        = transform.parent;
                    background.transform.localPosition = transform.localPosition + transform.forward * BACKGROUND_PUSH;
                    background.transform.localRotation = transform.localRotation;
                    background.transform.localScale    = transform.localScale;
                    backgroundSpriteRenderer           = background.AddComponent <SpriteRenderer>();
                    backgroundSpriteRenderer.sprite    = menuItem.background;
                }

                // Set tooltip text
                tooltip                                = Instantiate(tooltipPrefab);
                tooltip.name                           = name + " Tooltip";
                tooltip.transform.parent               = transform.parent;
                tooltip.transform.localPosition        = menuCenter;
                tooltip.transform.localRotation        = menuOrientation;
                tooltip.transform.localScale           = transform.localScale * TOOLTIP_SCALE;
                tooltip.GetComponent <TextMesh>().text = menuItem.toolTip.Replace('\\', '\n');
                tooltipRenderer                        = tooltip.GetComponent <MeshRenderer>();
                SetTooltipAlpha(0.0f);
            }
            else
            {
                // This is a back button
                spriteRenderer.sprite = root.backIcon;
                isBackButton          = true;
            }

            pieBackground   = null;
            pieMeshRenderer = null;
            if (root.pieMaterial)
            {
                pieBackground = new GameObject(name + " Pie Background");
                pieBackground.transform.SetParent(transform.parent, false);
                pieBackground.transform.localPosition = transform.localPosition;
                pieBackground.transform.localRotation = transform.localRotation;
                pieBackground.transform.localScale    = transform.localScale;
                pieBackground.AddComponent <MeshFilter>().sharedMesh = sharedMesh;
                pieMeshRenderer = pieBackground.AddComponent <MeshRenderer>();
                pieMeshRenderer.sharedMaterial = root.pieMaterial;
                pieStartColor = root.pieMaterial.GetColor("_Color");
            }

            parentMenu.childMenus.Add(this);
            StartFade(FadeState.Shown);
            SetButtonTransparency(0.0f);
            SetPieMeshTransparency(0.0f, 0.0f);
        }
Beispiel #6
0
        private void OnItemSelected(ClickMenuItem item)
        {
            int id = (item ? item.id : -1);

            switch (id)
            {
            // Brushes
            case 1:
                SetBrushPencil();
                break;

            case 2:
                SetBrushPen();
                break;

            case 3:
                SetBrushMarker();
                break;

            case 4:
                SetBrushRoller();
                break;

            case 5:
                SetBrushEraser();
                break;

            // Colors
            case 10:
                SetMaterial(red);
                break;

            case 11:
                SetMaterial(orange);
                break;

            case 12:
                SetMaterial(yellow);
                break;

            case 13:
                SetMaterial(green);
                break;

            case 14:
                SetMaterial(blue);
                break;

            case 15:
                SetMaterial(purple);
                break;

            case 16:
                SetMaterial(white);
                break;

            case 17:
                SetMaterial(black);
                break;

            // Undo
            case 20:
                Undo();
                break;

            // Painting
            case 30:
                Save();
                break;

            case 31:
                Load();
                break;

            case 32:
                Clear();
                break;
            }
        }
Beispiel #7
0
 private void OnItemHovered(ClickMenuItem item)
 {
     audioHover.Play();
 }