Пример #1
0
    // OnGUI is called once per frame
    void OnGUI()
    {
        if (timer < msg_speed)
        {
            timer++;
        }
        else
        {
            if (characters < message.Length)
            {
                characters++;
            }
            else
            {
                parent.Finish();
            }
            timer = 0;
        }
        if (usebox != new Rect(0, 0, 0, 0))
        {
            if (hasname)
            {
                GUI.DrawTexture(new Rect(usebox.x, usebox.y - 25, usebox.width, usebox.height), tex);
                GUI.Label(new Rect(usebox.x, usebox.y - 29, usebox.width, usebox.height), name, style);
            }

            GUI.DrawTexture(usebox, tex);
            GUI.Label(usebox, message.Substring(0, characters), style);

            if (draw_prompt && p_tex != null)
            {
                GUI.DrawTexture(new Rect(usebox.x + usebox.width - p_tex.width - 10, usebox.y + usebox.height - p_tex.height - 10, p_tex.width, p_tex.height), p_tex);
            }
        }
        else
        {
            if (hasname)
            {
                GUI.DrawTexture(new Rect(usebox.x, usebox.y - 25, usebox.width, usebox.height), tex);
                GUI.Label(new Rect(usebox.x, usebox.y - 29, usebox.width, usebox.height), name, style);
            }

            GUI.DrawTexture(usebox, tex);
            GUI.Label(new Rect(10, 10, 100, 50), message.Substring(0, characters), style);
            if (draw_prompt && p_tex != null)
            {
                GUI.DrawTexture(new Rect(usebox.x + usebox.width - p_tex.width - 10, usebox.y + usebox.height - p_tex.height - 10, p_tex.width, p_tex.height), p_tex);
            }
        }
    }