Beispiel #1
0
        public ScreenLog()
        {
            Debug.log_event += new Debug.call_on_log(intercepted_log); // subscribe to the EVENT by supplying the handler with a METHOD matching the DELEGATE

            register(Event.render, this.render);
            register(Event.tick, this.tick);

            font = Graphics.default_font;
            active = true;
            if (Graphics.layers.Count > 0)
                draw_layer = Graphics.layers[Graphics.layers.Count - 1];

            fade_time = (int)(1f * Application.ticks_per_second);
            total_time = 2 * fade_time;
        }
Beispiel #2
0
        private void render()
        {
            if (!active) return;

            float y = Graphics.screen_h - 40f;
            if (font == null) font = Graphics.default_font;
            Graphics.current_font = font;
            Graphics.current_layer = draw_layer;
            for (int i = notifications.Count - 1 ; i >= 0; i--)
            {
                y -= font.v_spacing;
                var spr = Graphics.add_text(20f, y, notifications[i].text);
                if (i == 0) spr.set_alpha((alpha_multiplier * time_left / fade_time).choke(0f, alpha_multiplier));
                else        spr.set_alpha(alpha_multiplier);
            }
        }