示例#1
0
        private void animationAddCueMenu(IMenuButton button)
        {
            GameObject obj = ((Button)button).gameObject;

            SubMenu subMenu = ((Button)button).gameObject.GetComponent <SubMenu>();

            SceneObject sceneObject = mainController.getCurrentSelection().GetComponent <SceneObject>();

            if (subMenu == null)
            {
                subMenu             = ((Button)button).gameObject.AddComponent <SubMenu>();
                subMenu.DirToExpand = SubMenu.direction.RIGHT;

                GameObject buttonTextPrefab = Resources.Load <GameObject>("VPET/Prefabs/ButtonText");
                // add animation layer buttons
                for (int i = 1; i < 4; ++i)
                {
                    // add animation layer button
                    int layerIndex = i - 1;
                    vpet.IMenuButton animLayerButton = vpet.Elements.MenuButtonToggle();
                    // get toggle state
                    animLayerButton.Toggled = sceneObject.animationLayer == layerIndex;
                    animLayerButton.AddAction(AnimationMode_CueFire_sel, AnimationMode_CueFire_nrm, () => animationLayerToggleCurrentObject(animLayerButton, subMenu, layerIndex));
                    // subMenu.OnMenuOpen.AddListener( () => { print("Check for layer " + layerIndex); animLayerButton.Toggled = animationController.IsCurrentSelectionOnLayer(layerIndex); } );
                    UI.OnUIChanged.AddListener(() => { print("Check for layer " + layerIndex); animLayerButton.Toggled = animationController.IsCurrentSelectionOnLayer(layerIndex); });
                    subMenu.addButton(animLayerButton);

                    // add animation layer id on top (text object)
                    GameObject buttonTextObj = GameObject.Instantiate(buttonTextPrefab);
                    GameObject buttonObj     = ((Button)animLayerButton).gameObject;
                    buttonObj.name = "CueAddButton_" + i.ToString();
                    buttonTextObj.transform.parent        = buttonObj.transform;
                    buttonTextObj.transform.localScale    = new Vector3(1, 1, 1);
                    buttonTextObj.transform.localPosition = new Vector3(0, 0, 0);
                    Text text = buttonTextObj.GetComponent <Text>();
                    if (text != null)
                    {
                        text.text = i.ToString();
                    }
                }
            }

            if (!subMenu.isOpen)
            {
                subMenu.show();
            }
            else
            {
                subMenu.hide();
            }
        }
示例#2
0
        private void animationAddCueMenu(IMenuButton button)
        {
            GameObject obj = ((Button)button).gameObject;

            SubMenu subMenu = ((Button)button).gameObject.GetComponent <SubMenu>();

            if (subMenu == null)
            {
                subMenu             = ((Button)button).gameObject.AddComponent <SubMenu>();
                subMenu.DirToExpand = SubMenu.direction.RIGHT;

                GameObject buttonTextPrefab = Resources.Load <GameObject>("VPET/Prefabs/ButtonText");
                // add animation layer buttons
                for (int i = -1; i < 2; ++i)
                {
                    // add animation layer button
                    int layerIndex = i;
                    vpet.IMenuButton animLayerButton = vpet.Elements.MenuButton();
                    animLayerButton.AddAction(AnimationMode_CueFire_sel, AnimationMode_CueFire_nrm, () => animationLayerAddCurrentObject(subMenu, layerIndex));
                    subMenu.addButton(animLayerButton);

                    // add animation layer id on top (text object)
                    GameObject buttonTextObj = GameObject.Instantiate(buttonTextPrefab);
                    GameObject buttonObj     = ((Button)animLayerButton).gameObject;
                    buttonTextObj.transform.parent        = buttonObj.transform;
                    buttonTextObj.transform.localScale    = new Vector3(1, 1, 1);
                    buttonTextObj.transform.localPosition = new Vector3(0, 0, 0);
                    Text text = buttonTextObj.GetComponent <Text>();
                    if (text != null && i >= 0)
                    {
                        text.text = i.ToString();
                    }
                }
            }

            if (!subMenu.isOpen)
            {
                subMenu.show();
            }
            else
            {
                subMenu.hide();
            }
        }
示例#3
0
        private void animationFireCueMenu(IMenuButton button)
        {
            GameObject obj = ((Button)button).gameObject;

            SubMenu subMenu = ((Button)button).gameObject.GetComponent <SubMenu>();

            if (subMenu == null)
            {
                subMenu             = ((Button)button).gameObject.AddComponent <SubMenu>();
                subMenu.DirToExpand = SubMenu.direction.LEFT;
                subMenu.offset      = new Vector2(UI.ButtonOffset, UI.ButtonOffset);

                GameObject buttonTextPrefab = Resources.Load <GameObject>("VPET/Prefabs/ButtonText");
                // add animation layer buttons
                for (int i = 1; i < 4; ++i)
                {
                    int layerIndex = i - 1;
                    vpet.IMenuButton animLayerButton = vpet.Elements.MenuButton();
                    animLayerButton.AddAction(AnimationMode_CueFire_sel, AnimationMode_CueFire_nrm, () => mainController.AnimationController.playAnimationLayer(layerIndex));
                    subMenu.addButton(animLayerButton);
                    GameObject buttonTextObj = GameObject.Instantiate(buttonTextPrefab);
                    GameObject buttonObj     = ((Button)animLayerButton).gameObject;
                    buttonTextObj.transform.parent        = buttonObj.transform;
                    buttonTextObj.transform.localScale    = new Vector3(1, 1, 1);
                    buttonTextObj.transform.localPosition = new Vector3(0, 0, 0);
                    Text text = buttonTextObj.GetComponent <Text>();
                    if (text != null)
                    {
                        text.text = i.ToString();
                    }
                }
            }

            if (!subMenu.isOpen)
            {
                subMenu.show();
            }
            else
            {
                subMenu.hide();
            }
        }