コード例 #1
0
    void Update()
    {
        latk.clicked = Input.GetButton("Fire2");

        if (Input.GetButtonDown("Fire3") || Input.GetKeyDown(KeyCode.P))
        {
            latk.inputPlay();
        }

        if (Input.GetButtonDown("Jump"))
        {
            latk.inputFrameBack();
        }

        if (Input.GetButtonDown("Fire1"))
        {
            latk.inputFrameForward();
        }

        if (!blockStickHMax && Input.GetAxis("Horizontal") >= stickThreshold)
        {
            blockStickHMax = true;
            if (latk.layerList[latk.currentLayer].frameList.Count > 0)
            {
                latk.inputShowFrames();
            }
        }
        else if (blockStickHMax && Input.GetAxis("Horizontal") < stickThreshold)
        {
            blockStickHMax = false;
        }

        if (!blockStickHMin && Input.GetAxis("Horizontal") <= -stickThreshold)
        {
            blockStickHMin = true;
            if (latk.layerList[latk.currentLayer].frameList.Count > 0)
            {
                latk.inputHideFrames();
            }
        }
        else if (blockStickHMin && Input.GetAxis("Horizontal") > -stickThreshold)
        {
            blockStickHMin = false;
        }
    }
コード例 #2
0
    void OnGUI()
    {
        if (showButtons)
        {
            string isOn = "";

            if (menuCounter == 1)
            {
                // 1-1.
                Rect writeButton = new Rect(BUTTON_GAP_X, Screen.height - (1 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = latk.showOnionSkin ? "Off" : "On";
                if (GUI.Button(writeButton, FONT_SIZE + "Write" + "</size>"))
                {
                    latk.armWriteFile = true;
                }

                // 1-2.
                Rect undoButton = new Rect(BUTTON_GAP_X, Screen.height - (2 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = latk.showOnionSkin ? "Off" : "On";
                if (GUI.Button(undoButton, FONT_SIZE + "Undo" + "</size>"))
                {
                    latk.inputEraseLastStroke();
                }

                // 1-3.
                Rect onionButton = new Rect(BUTTON_GAP_X, Screen.height - (3 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                isOn = latk.showOnionSkin ? "Off" : "On";
                if (GUI.Button(onionButton, FONT_SIZE + "Onion Skin " + isOn + "</size>"))
                {
                    latk.inputOnionSkin();
                }

                // 1-4.
                Rect copyFrameButton = new Rect(BUTTON_GAP_X, Screen.height - (4 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
                if (GUI.Button(copyFrameButton, FONT_SIZE + "Copy Frame" + "</size>"))
                {
                    latk.inputNewFrameAndCopy();
                }

                // 1-5.
                Rect newFrameButton = new Rect(BUTTON_GAP_X, Screen.height - (5 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
                if (GUI.Button(newFrameButton, FONT_SIZE + "New Frame" + "</size>"))
                {
                    latk.inputNewFrame();
                }

                // 1-6.
                Rect playButton = new Rect(BUTTON_GAP_X, Screen.height - (6 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                isOn = latk.isPlaying ? "Stop" : "Play";
                if (GUI.Button(playButton, FONT_SIZE + isOn + "</size>"))
                {
                    //if (!latk.isPlaying && !playButtonBlock) {
                    latk.inputPlay();
                    //playButtonBlock = true;
                    //} else {
                    //latk.inputFrameBack(); // this is simpler than solving with script execution order
                    //playButtonBlock = false;
                    //}
                }

                // 1-7.
                Rect rewButton = new Rect(BUTTON_GAP_X, Screen.height - (7 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X / 2f, BUTTON_SIZE_Y);
                //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
                if (GUI.Button(rewButton, FONT_SIZE + "<|" + "</size>"))
                {
                    latk.inputFrameBack();
                }

                Rect ffButton = new Rect(BUTTON_GAP_X + (BUTTON_SIZE_X / 2f), Screen.height - (7 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X / 2f, BUTTON_SIZE_Y);
                //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
                if (GUI.Button(ffButton, FONT_SIZE + "|>" + "</size>"))
                {
                    latk.inputFrameForward();
                }
            }
            else if (menuCounter == 2)
            {
                // 2-7.
                Rect readButton = new Rect(BUTTON_GAP_X, Screen.height - (7 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
                //isOn = latk.showOnionSkin ? "Off" : "On";
                if (GUI.Button(readButton, FONT_SIZE + "Read" + "</size>"))
                {
                    latk.armReadFile = true;
                }
            }

            // 8.
            Rect menuButton = new Rect(BUTTON_GAP_X, Screen.height - (8 * (BUTTON_SIZE_Y - BUTTON_GAP_X)), BUTTON_SIZE_X, BUTTON_SIZE_Y);
            //isOn = m_arCameraPostProcess.enabled ? "Off" : "On";
            if (GUI.Button(menuButton, FONT_SIZE + "MENU " + menuCounter + "</size>"))
            {
                menuCounter++;
                if (menuCounter > menuCounterMax)
                {
                    menuCounter = 1;
                }
            }
        }
    }