private void showGetTextDialogBox(int windowId)
    {
        GUI.matrix = GenericGUIHandler.getTRS();
        text       = GUI.TextField(new Rect(5, 20, boxWidth - 10, 40), text);
        GUI.matrix = GenericGUIHandler.getTRS();

        if (GUI.Button(new Rect(5, 70, buttonWidth, buttonHeight), "Done"))
        {
            isClicked = false;
            GameObject textPrefab = Instantiate(Resources.Load("Prefabs/Text", typeof(GameObject)), Vector3.zero, Quaternion.identity) as GameObject;
            textPrefab.name = textPrefab.name + count;
            TextMesh textMesh = textPrefab.GetComponent <TextMesh>();
            textMesh.text = text;
            BoxCollider2D coll   = textPrefab.GetComponent <BoxCollider2D>();
            Bounds        bounds = textMesh.renderer.renderer.bounds;
            coll.size = new Vector2(bounds.size.x, bounds.size.y);
            Animator anim = textPrefab.GetComponent <Animator>();
            anim.enabled = false;
            count++;
        }
        if (GUI.Button(new Rect(boxWidth / 2, 70, buttonWidth, buttonHeight), "Cancel"))
        {
            isClicked = false;
        }
    }
Esempio n. 2
0
    void OnGUI()
    {
        if (isClicked)
        {
            GUI.matrix = GenericGUIHandler.getTRS();
//			GUI.Window (0, new Rect (Screen.width / 2 - 118, Screen.height / 2 - 100, 336, 140), showGetTextDialogBox, "Choose Color");
            GUI.Window(0, new Rect(GenericGUIHandler.baseWidth / 2 - boxWidth / 2, GenericGUIHandler.baseHeight / 2 - boxHeight / 2, boxWidth, boxHeight), showGetTextDialogBox, "Choose Color");
        }
    }
Esempio n. 3
0
    private void generateRowOfButtons(int x, int y, int buttonWidth, int buttonHeight)
    {
        int orignalXPosition = x;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Red"))
        {
            hidePallete(Color.red);
        }

        x += buttonWidth + 5;
        setButtonProperties();

        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Yellow"))
        {
            hidePallete(Color.yellow);
        }

        x += buttonWidth + 5;
        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Green"))
        {
            hidePallete(Color.green);
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Blue"))
        {
            hidePallete(Color.blue);
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "White"))
        {
            hidePallete(Color.white);
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Black"))
        {
            hidePallete(Color.black);
        }

        // Second Row
        x  = orignalXPosition;
        y += 55;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Gray"))
        {
            hidePallete(Color.gray);
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Cyan"))
        {
            hidePallete(Color.cyan);
        }

        x += buttonWidth + 5;
        setButtonProperties();

        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Magenta"))
        {
            hidePallete(Color.magenta);
        }

        x += buttonWidth + 5;
        setButtonProperties();

        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Temp"))
        {
            hidePallete(new Color(.5f, .1f, .3f));
        }

        x += buttonWidth + 5;
        setButtonProperties();

        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "White"))
        {
            hidePallete(Color.white);
        }

        x += buttonWidth + 5;
        setButtonProperties();

        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Black"))
        {
            hidePallete(Color.black);
        }
    }
Esempio n. 4
0
 private void showGetTextDialogBox(int windowId)
 {
     GUI.matrix = GenericGUIHandler.getTRS();
     generateRowOfButtons(5, 25, 50, 50);
 }
Esempio n. 5
0
 private void setButtonProperties()
 {
     GUI.matrix = GenericGUIHandler.getTRS();
 }
    private void generateRowOfButtons(int x, int y, int buttonWidth, int buttonHeight)
    {
        int orignalXPosition = x;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Red"))
        {
            mTextMesh.color = Color.red;
            hidePallete();
        }

        x += buttonWidth + 5;
        setButtonProperties();

        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Yellow"))
        {
            mTextMesh.color = Color.yellow;
            hidePallete();
        }

        x += buttonWidth + 5;
        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Green"))
        {
            mTextMesh.color = Color.green;
            hidePallete();
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Blue"))
        {
            mTextMesh.color = Color.blue;
            hidePallete();
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "White"))
        {
            mTextMesh.color = Color.white;
            hidePallete();
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Black"))
        {
            mTextMesh.color = Color.black;
            hidePallete();
        }

        // Second Row
        x  = orignalXPosition;
        y += 55;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Gray"))
        {
            mTextMesh.color = Color.gray;
            hidePallete();
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Cyan"))
        {
            mTextMesh.color = Color.cyan;
            hidePallete();
        }

        x += buttonWidth + 5;
        setButtonProperties();

        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Magenta"))
        {
            hidePallete();
            mTextMesh.color = Color.magenta;
        }

        x += buttonWidth + 5;
        setButtonProperties();

        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Temp"))
        {
            mTextMesh.color = new Color(.5f, .1f, .3f);
            hidePallete();
        }

        x += buttonWidth + 5;
        setButtonProperties();

        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "White"))
        {
            mTextMesh.color = Color.white;
            hidePallete();
        }

        x += buttonWidth + 5;
        setButtonProperties();

        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Black"))
        {
            mTextMesh.color = Color.black;
            hidePallete();
        }

        // Third Row Animations
        x  = orignalXPosition;
        y += 55;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Zoom"))
        {
            Animator anim = mTextMesh.gameObject.GetComponent <Animator>();
            anim.enabled = true;
            if (anim.GetBool("half_rotate"))
            {
                anim.SetBool("half_rotate", false);
            }
            anim.SetBool("start_zoom", true);

            hidePallete();
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Rotat"))
        {
            Animator anim = mTextMesh.gameObject.GetComponent <Animator>();
            anim.enabled = true;
            if (anim.GetBool("start_zoom"))
            {
                anim.SetBool("start_zoom", false);
            }
            anim.SetBool("half_rotate", true);
            hidePallete();
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Reset"))
        {
            Animator anim = mTextMesh.gameObject.GetComponent <Animator>();
            anim.enabled = true;
            if (anim.GetBool("start_zoom"))
            {
                anim.SetBool("start_zoom", false);
            }
            if (anim.GetBool("half_rotate"))
            {
                anim.SetBool("half_rotate", false);
            }
            anim.enabled = false;


            hidePallete();
        }

        x += buttonWidth + 5;

        setButtonProperties();
        if (GUI.Button(new Rect(x, y, buttonWidth, buttonHeight), "Delete"))
        {
            SingleTouchScript singleTouchScript = mTextMesh.GetComponent <SingleTouchScript>();
            singleTouchScript.removeText();
            hidePallete();
        }
    }
    void OnGUI()
    {
        int y = 2;

        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 50, 50), "T"))
        {
            isClicked = true;
        }

        if (isClicked == true)
        {
            GUI.matrix = GenericGUIHandler.getTRS();
            GUI.Window(0, new Rect(GenericGUIHandler.baseWidth / 2 - boxWidth / 2, GenericGUIHandler.baseHeight / 2 - boxHeight / 2, boxWidth, boxHeight), showGetTextDialogBox, "Enter Text");
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 50, 50), "C"))
        {
            GUI.matrix = GenericGUIHandler.getTRS();
            mPenPalleteGUI.showPallete(paitingBoard);
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 50, 50), "+"))
        {
            if (paitingBoard.radius < 40)
            {
                paitingBoard.radius += 5;
            }
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 50, 50), "-"))
        {
            if (paitingBoard.radius > 5)
            {
                paitingBoard.radius -= 5;
            }
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 50, 50), "2"))
        {
            paitingBoard.twoLines = !paitingBoard.twoLines;
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 50, 50), "R"))
        {
            paitingBoard.reset();
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 50, 50), "P"))
        {
            paitingBoard.hardness = 1;
            paitingBoard.isPaint  = true;
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 50, 50), "B"))
        {
//			paitingBoard.hardness = 1000;
            paitingBoard.isPaint = false;
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 100, 50), "Back W"))
        {
            paitingBoard.loadTexture("");
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 100, 50), "Back R"))
        {
            paitingBoard.loadTexture("_red");
        }

        y         += 58;
        GUI.matrix = GenericGUIHandler.getTRS();
        if (GUI.Button(new Rect(2, y, 100, 50), "Back G"))
        {
            paitingBoard.loadTexture("_green");
        }
    }