Ejemplo n.º 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();
            }
        });
    }
Ejemplo n.º 2
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;
        });
    }
Ejemplo n.º 3
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");
        });
    }