Example #1
0
    // Кнопка играть снова
    public void add_respawn_btn()
    {
        respawn_btn = add_child(typeof(RectButton));
        RectButton respawn_btn_comp = respawn_btn.GetComponent <RectButton>();

        respawn_btn_comp.set_size(new RectSize(160, 47.8f));
        respawn_btn_comp.set_pos(new Vector2(71.7f, 201.6f));
        respawn_btn_comp.btn_bg_alpha = btn_alpha;
        respawn_btn_comp.add_image(new Color(255, 255, 255));

        respawn_btn_comp.on_mouse_down = () => {
            StartCoroutine(Funcs.play_sound(gameObject.transform.parent.gameObject, "btn_click"));
        };

        respawn_btn_comp.btn.onClick.AddListener(() => {
            Display.stats_wnd_close();

            Scene scn   = scene_obj.GetComponent <Scene>();
            scn.is_play = true;
        });
    }
Example #2
0
    // Добавление кнопок смены цвета
    public void add_col_btns()
    {
        blue_col = add_child(typeof(RectButton));
        RectButton blue_col_comp = blue_col.GetComponent <RectButton>();

        blue_col_comp.set_size(new RectSize(104, 74));
        blue_col_comp.set_pos(new Vector2(186, 200));
        blue_col_comp.btn_bg_alpha = btn_alpha;
        blue_col_comp.add_image(new Color(255, 255, 255));

        blue_col_comp.on_mouse_down = () => {
            StartCoroutine(Funcs.play_sound(gameObject.transform.parent.gameObject, "col_select"));
        };

        blue_col_comp.btn.onClick.AddListener(() => {
            set_col(BrushCols.Blue);
        });

        red_col = add_child(typeof(RectButton));
        RectButton red_col_comp = red_col.GetComponent <RectButton>();

        red_col_comp.set_size(new RectSize(104, 74));
        red_col_comp.set_pos(new Vector2(268, 123));
        red_col_comp.btn_bg_alpha = btn_alpha;
        red_col_comp.add_image(new Color(255, 255, 255));

        red_col_comp.on_mouse_down = () => {
            StartCoroutine(Funcs.play_sound(gameObject.transform.parent.gameObject, "col_select"));
        };

        red_col_comp.btn.onClick.AddListener(() => {
            set_col(BrushCols.Red);
        });

        white_col = add_child(typeof(RectButton));
        RectButton white_col_comp = white_col.GetComponent <RectButton>();

        white_col_comp.set_size(new RectSize(104, 74));
        white_col_comp.set_pos(new Vector2(377, 116));
        white_col_comp.btn_bg_alpha = btn_alpha;
        white_col_comp.add_image(new Color(255, 255, 255));

        white_col_comp.on_mouse_down = () => {
            StartCoroutine(Funcs.play_sound(gameObject.transform.parent.gameObject, "col_select"));
        };

        white_col_comp.btn.onClick.AddListener(() => {
            set_col(BrushCols.White);
        });

        yellow_col = add_child(typeof(RectButton));
        RectButton yellow_col_comp = yellow_col.GetComponent <RectButton>();

        yellow_col_comp.set_size(new RectSize(104, 74));
        yellow_col_comp.set_pos(new Vector2(481, 136));
        yellow_col_comp.btn_bg_alpha = btn_alpha;
        yellow_col_comp.add_image(new Color(255, 255, 255));

        yellow_col_comp.on_mouse_down = () => {
            StartCoroutine(Funcs.play_sound(gameObject.transform.parent.gameObject, "col_select"));
        };

        yellow_col_comp.btn.onClick.AddListener(() => {
            set_col(BrushCols.Yellow);
        });

        black_col = add_child(typeof(RectButton));
        RectButton black_col_comp = black_col.GetComponent <RectButton>();

        black_col_comp.set_size(new RectSize(104, 74));
        black_col_comp.set_pos(new Vector2(473, 262));
        black_col_comp.btn_bg_alpha = btn_alpha;
        black_col_comp.add_image(new Color(255, 255, 255));

        black_col_comp.on_mouse_down = () => {
            StartCoroutine(Funcs.play_sound(gameObject.transform.parent.gameObject, "col_select"));
        };

        black_col_comp.btn.onClick.AddListener(() => {
            set_col(BrushCols.Black);
        });

        green_col = add_child(typeof(RectButton));
        RectButton green_col_comp = green_col.GetComponent <RectButton>();

        green_col_comp.set_size(new RectSize(104, 74));
        green_col_comp.set_pos(new Vector2(431, 373));
        green_col_comp.btn_bg_alpha = btn_alpha;
        green_col_comp.add_image(new Color(255, 255, 255));

        green_col_comp.on_mouse_down = () => {
            StartCoroutine(Funcs.play_sound(gameObject.transform.parent.gameObject, "col_select"));
        };

        green_col_comp.btn.onClick.AddListener(() => {
            set_col(BrushCols.Green);
        });
    }