예제 #1
0
    public void Click()
    {
        GameObject    eventTrigger = GameObject.FindGameObjectWithTag("Menu.Trigger");
        MenuLoader    ml           = eventTrigger.GetComponent <MenuLoader>();
        DataStructure dt;

        dt.color = color.posibleColor;
        Color a;

        Debug.Log(dt.color);
        switch (dt.color)
        {
        case ColorPicker.PossibleColor.Red:
            a = Color.red;
            break;

        case ColorPicker.PossibleColor.Green:
            a = Color.green;
            break;

        case ColorPicker.PossibleColor.Yellow:
            a = Color.yellow;
            break;

        case ColorPicker.PossibleColor.Orange:
            a = Color.Lerp(Color.red, Color.yellow, .5f);
            break;

        case ColorPicker.PossibleColor.Blue:
            a = Color.blue;
            break;

        case ColorPicker.PossibleColor.Cyan:
            a = Color.cyan;
            break;

        case ColorPicker.PossibleColor.White:
            a = Color.white;
            break;

        case ColorPicker.PossibleColor.Black:
            a = Color.black;
            break;

        case ColorPicker.PossibleColor.Gray:
            a = Color.gray;
            break;

        default:
            a = Color.white;
            break;
        }
        dt.colorUI = a;
        dt.text    = input.text;
        ml.AddItem(dt);
        field.Close();
    }
예제 #2
0
    void Click()
    {
        Text txt = text.GetComponent <Text>();

        if (txt.text.Equals("Add"))
        {
            int width  = Screen.width;
            int height = Screen.height;
            if (popupVis == null || !popupVis.activeSelf)
            {
                popupVis = Instantiate <GameObject>(popup);
            }
            RectTransform rt2 = popupVis.GetComponent <RectTransform>();
            popupVis.transform.SetParent(printer.transform);
            //rt.sizeDelta = new Vector2(width / 4, (float)height / 1.5f);
            //rt.transform.position = new Vector3(width / 2, height / 2);
        }
        else
        {
            MenuLoader ml = GetComponent <MenuLoader>();
            for (var i = 0; i < 4; i++)
            {
                System.Array A = System.Enum.GetValues(typeof(ColorPicker.PossibleColor));
                ColorPicker.PossibleColor posibleColor = (ColorPicker.PossibleColor)A.GetValue(UnityEngine.Random.Range(0, A.Length));
                Color a;
                switch (posibleColor)
                {
                case ColorPicker.PossibleColor.Red:
                    a = Color.red;
                    break;

                case ColorPicker.PossibleColor.Green:
                    a = Color.green;
                    break;

                case ColorPicker.PossibleColor.Yellow:
                    a = Color.yellow;
                    break;

                case ColorPicker.PossibleColor.Orange:
                    a = Color.Lerp(Color.red, Color.yellow, .5f);
                    break;

                case ColorPicker.PossibleColor.Blue:
                    a = Color.blue;
                    break;

                case ColorPicker.PossibleColor.Cyan:
                    a = Color.cyan;
                    break;

                case ColorPicker.PossibleColor.White:
                    a = Color.white;
                    break;

                case ColorPicker.PossibleColor.Black:
                    a = Color.black;
                    break;

                case ColorPicker.PossibleColor.Gray:
                    a = Color.gray;
                    break;

                default:
                    a = Color.white;
                    break;
                }
                DataStructure dt;
                dt.color   = posibleColor;
                dt.colorUI = a;
                dt.text    = "Test";
                ml.AddItem(dt);
            }
            ml.Refresh();
        }
        txt.text = "Add";
    }