Exemple #1
0
    // Добавление кнопки выбора цвета
    public void add_col_sel_btn()
    {
        col_sel_btn = add_child(typeof(RectButton), "SelColorBtn");
        RectButton col_sel_comp = col_sel_btn.GetComponent <RectButton>();

        col_sel_comp.set_size(new RectSize(128, 85));
        col_sel_comp.set_pos(new Vector2(0, get_size().height - 64 - 40));
        col_sel_comp.set_icon(Scene.get_sprite("col_sel_btn"));

        col_sel_comp.on_mouse_enter = () => {
            col_sel_comp.set_icon(Scene.get_sprite("col_sel_enter"));
        };

        col_sel_comp.on_mouse_exit = () => {
            col_sel_comp.set_icon(Scene.get_sprite("col_sel_btn"));
        };

        col_sel_comp.btn.onClick.AddListener(() => {
            StartCoroutine(Funcs.play_sound(gameObject, "btn_click"));

            if (Display.color_wnd == null)
            {
                Display.color_wnd_open();
            }
            else
            {
                Display.color_wnd_close();
            }
        });
    }
Exemple #2
0
    // Кнопка выкл музыки
    public void add_sound_btn()
    {
        sound_btn = add_child(typeof(RectButton));
        RectButton sound_btn_comp = sound_btn.GetComponent <RectButton>();

        sound_btn_comp.set_size(new RectSize(64, 64));
        sound_btn_comp.set_pos(new Vector2(720, 20));
        sound_btn_comp.set_icon(Scene.get_sprite("play_sound"));

        sound_btn_comp.btn.onClick.AddListener(() => {
            StartCoroutine(Funcs.play_sound(gameObject, "btn_click"));

            Scene.toggle_music(scene_obj, "game_music");
        });
    }
Exemple #3
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;
        });
    }
Exemple #4
0
    // Добавление кнопки Старт
    public void add_start_btn()
    {
        start_btn = add_child(typeof(RectButton), "StartBtn");
        RectButton start_btn_comp = start_btn.GetComponent <RectButton>();

        start_btn_comp.set_size(new RectSize(256, 211));
        start_btn_comp.set_pos(new Vector2(get_size().width / 2 - 128, get_size().height - 180));
        start_btn_comp.set_icon(Scene.get_sprite("start_btn"));

        start_btn_comp.on_mouse_down = () => {
            start_btn_comp.set_icon(Scene.get_sprite("start_btn_down"));

            StartCoroutine(Funcs.play_sound(gameObject, "btn_click"));
        };

        start_btn_comp.btn.onClick.AddListener(() => {
            Display.menu_wnd_close();

            Scene scn   = scene_obj.GetComponent <Scene>();
            scn.is_play = true;
        });
    }
Exemple #5
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);
        });
    }