コード例 #1
0
        void AddLine(ScreenLoggerLine line)
        {
            if (!Application.isPlaying) {
                Logger.LogError("Can not log to screen while application is not playing.");
                return;
            }

            GameObject child = this.AddChild("Line");
            child.transform.Reset();

            GUIText text = child.AddComponent<GUIText>();
            text.pixelOffset = new Vector2(5, 5);
            text.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
            text.fontSize = FontSize;
            text.anchor = TextAnchor.LowerLeft;
            text.alignment = TextAlignment.Left;
            text.color = line.color;
            text.text = line.text;

            StartCoroutine(Fade(text));

            foreach (GUIText t in lines) {
                if (t != null) {
                    t.pixelOffset += new Vector2(0, FontSize);
                }
            }

            lines.Add(text);
            if (lines.Count > MaxLines) {
                RemoveLine(lines[0]);
            }
        }
コード例 #2
0
ファイル: ScreenLogger.cs プロジェクト: Dracir/CodeBlanche
        void AddLine(ScreenLoggerLine line)
        {
            if (!Application.isPlaying)
            {
                Logger.LogError("Can not log to screen while application is not playing.");
                return;
            }

            GameObject child = this.AddChild("Line");

            child.transform.Reset();

            GUIText text = child.AddComponent <GUIText>();

            text.pixelOffset = new Vector2(5, 5);
            text.font        = Resources.GetBuiltinResource <Font>("Arial.ttf");
            text.fontSize    = FontSize;
            text.anchor      = TextAnchor.LowerLeft;
            text.alignment   = TextAlignment.Left;
            text.color       = line.color;
            text.text        = line.text;

            StartCoroutine(Fade(text));

            foreach (GUIText t in lines)
            {
                if (t != null)
                {
                    t.pixelOffset += new Vector2(0, FontSize);
                }
            }

            lines.Add(text);
            if (lines.Count > MaxLines)
            {
                RemoveLine(lines[0]);
            }
        }