Exemplo n.º 1
0
    private void showBestRecords()
    {
        GUI.Box(new Rect(0, 0, 200, 30 * totalInScores), string.Empty);
        AdvancedLabel.Draw(new Rect(10, 10, 200, 200), "<Best Heights>", new NewFontSize(18), new NewColor(Color.white), new NewFontStyle(FontStyle.Italic));

        for (int i = 1; i <= totalInScores; i++)
        {
            float playerScore = PlayerPrefs.GetFloat("Record" + i);

            string labelPlayer = string.Format("~{0}: {1} ·", PlayerPrefs.GetString("Name" + i, textAreaString), playerScore.ToString().Replace(".", "'"));
            AdvancedLabel.Draw(new Rect(10, 10 + (i * 20), 200, 200), labelPlayer, new NewFontSize(15), new NewColor(Color.white), new NewFontStyle(FontStyle.Italic));
        }
    }
Exemplo n.º 2
0
 private void DrawHeader(Rect rect)
 {
     AdvancedLabel.Draw(rect, new AdvancedLabel.Config(Config.headerTittle, Defaults.headerBackgroundStyle, Config.headerTittleFontStyle));
 }
Exemplo n.º 3
0
    void DrawDebugLines()
    {
        GUI.skin = skin;
        float btnHeight = Mathf.Clamp(Screen.height * 0.05f, 32, 200);

        //if(textBackground && Util.DebugLines.Count > 0) //we would want this always, so that we can scroll up and down
        if (Util.Debug.DebugLines.Count > 0 && toogleLines)
        {
            //Log Tag filter
            float swWidth  = Screen.width * debugWindowWidth;
            float swHeight = Screen.height * debugWindowHeight;


            float swWidth2  = Screen.width * debugWindowWidth;
            float swHeight2 = Screen.height * debugWindowHeight;

            //Rect groupRect = new Rect(5, Screen.height - swHeight - ltfHeight - 6 - 6, swWidth, ltfHeight);
            //Rect boxRect = new Rect(2, Screen.height - swHeight - ltfHeight - 9 - 9, swWidth + 6, ltfHeight + 6 + 6); //Box is above

            Rect groupRect = new Rect(10 + swWidth, Screen.height - swHeight - 6, swWidth / 3, swHeight2 - 3);
            Rect boxRect   = new Rect(10 + swWidth, Screen.height - swHeight - 9, swWidth / 3, swHeight2 + 5); // Box is to the right

            if (toogleLabels)
            {
                GUI.Box(boxRect, "", GUI.skin.box);
                GUILayout.BeginArea(groupRect);
                internal_logTagFilterScrollPosition = GUILayout.BeginScrollView
                                                      (
                    internal_logTagFilterScrollPosition//, false, true, GUILayout.Width(swWidth), GUILayout.Height(ltfHeight)
                                                      );
                //we are drawing everything inside a scrollview
                debugLine_GUIstyle.normal.textColor = textColor;
                debugLine_GUIstyle.margin           = new RectOffset(0, 0, 0, 0);
                debugLine_GUIstyle.border           = new RectOffset(0, 0, 0, 0);
                debugLine_GUIstyle.fontSize         = textSize;

                foreach (string tagName in logTagNames)
                {
                    logTagFilterDict[tagName] = GUILayout.Toggle(logTagFilterDict[tagName], tagName);//, GUILayout.Width(swWidth * 0.9f));
                }
                GUILayout.EndScrollView();
                GUILayout.EndArea();
            }

            //Debug lines
            if (internal_previousNumOfLines != Util.Debug.DebugLines.Count && GUIUtility.hotControl == 0)
            {
                internal_debugLinesScrollPosition.y = Mathf.Infinity;
            }
            internal_previousNumOfLines = Util.Debug.DebugLines.Count;


            Rect groupRect2 = new Rect(5, Screen.height - swHeight2 - 6, swWidth2, swHeight2);
            Rect boxRect2   = new Rect(2, Screen.height - swHeight2 - 9, swWidth2 + 6, swHeight2 + 6);
            if (textBackground)
            {
                GUI.Box(boxRect2, "");
            }

            GUILayout.BeginArea(groupRect2);
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Close", GUILayout.Height(btnHeight)))
            {
                toogleLines = false;
            }

            if (GUILayout.Button(toogleLabels ? "Hide Tags" : "Show Tags", GUILayout.Height(btnHeight)))
            {
                toogleLabels = !toogleLabels;
            }
            if (GUILayout.Button("Save Log", GUILayout.Height(btnHeight)))
            {
                LogData();
            }
            if (GUILayout.Button("Clear Log", GUILayout.Height(btnHeight)))
            {
                Util.Debug.ClearLog();
                Util.Debug.Log("Log Cleared", 5);
            }
            GUILayout.EndHorizontal();
            //				GUI.SetNextControlName("DebugLinesScrollView");
            internal_debugLinesScrollPosition = GUILayout.BeginScrollView
                                                (
                internal_debugLinesScrollPosition
                                                );

            //we are drawing everything inside a scrollview
            debugLine_GUIstyle.normal.textColor = textColor;
            debugLine_GUIstyle.margin           = new RectOffset(0, 0, 0, 0);
            debugLine_GUIstyle.border           = new RectOffset(0, 0, 0, 0);
            debugLine_GUIstyle.fontSize         = textSize;
            string _tagName      = "";
            bool   prev_richText = debugLine_GUIstyle.richText;
            Color  tempC;

            foreach (Util.Debug._DebugLine dbl in Util.Debug.DebugLines)
            {
                _tagName = dbl.tag.ToString();
                if (logTagFilterDict.ContainsKey(_tagName) && !logTagFilterDict[_tagName])
                {
                    continue;
                }

                if (dbl.expirationTime <= Time.time)
                {
                    removeDebugLines.Add(dbl);
                }

                debugLine_GUIstyle.richText = true;

                tempC = UtilLogTagColors._Color[Mathf.Max(0, (int)Mathf.Log((int)dbl.tag, 2))];

                //					AdvancedLabel.DrawLayout( string.Format("{0} [{1}] ({2})", dbl.line, tag.ToString(), string.Format("{0:0.000}", dbl.creationTime)));

                AdvancedLabel.DrawLayout(string.Format("<color={0}>{1}</color> <color={2}>[{3}]</color> <color={4}>({5})</color>",
                                                       dbl.color.ToHex(), //line color
                                                       dbl.line,          //line
                                                       tempC.ToHex(),     //line color, //tag color
                                                       _tagName,          //tag
                                                       "white",           //timestamp color
                                                       string.Format("{0:0.000}", dbl.creationTime)), debugLine_GUIstyle);

                //					GUILayout.Label(string.Format("<color={0}>{1}</color> <color={2}>[{3}]</color> <color={4}>({5})</color>",
                //					"#" + Mathf.FloorToInt(dbl.color.r*255).ToString("X2") + Mathf.FloorToInt(dbl.color.g*255).ToString("X2") + Mathf.FloorToInt(dbl.color.b*255).ToString("X2"), //line color
                //					dbl.line, //line
                //					"#" + Mathf.FloorToInt(tempC.r*255).ToString("X2") + Mathf.FloorToInt(tempC.g*255).ToString("X2") + Mathf.FloorToInt(tempC.b*255).ToString("X2"), //line color, //tag color
                //					_tagName, //tag
                //					"white", //timestamp color
                //					string.Format("{0:0.000}", dbl.creationTime)), //timestamp
                //					debugLine_GUIstyle);
            }

            //				StringBuilder _stringer = new StringBuilder();
            //
            //				foreach (Util.Debug._DebugLine dbl in Util.Debug.DebugLines)
            //			    {
            //					_tagName = dbl.tag.ToString();
            //					if(!logTagFilterDict[_tagName])
            //						continue;
            //
            //					if(dbl.expirationTime <= Time.time)
            //						removeDebugLines.Add(dbl);
            //
            //					debugLine_GUIstyle.richText = true;
            //					tempC = UtilLogTagColors._Color[ (int) dbl.tag ];
            //
            //					_stringer.AppendLine
            //					(
            //						string.Format("<color={0}>{1}</color> <color={2}>[{3}]</color> <color={4}>({5})</color>",
            //						"#" + Mathf.FloorToInt(dbl.color.r*255).ToString("X2") + Mathf.FloorToInt(dbl.color.g*255).ToString("X2") + Mathf.FloorToInt(dbl.color.b*255).ToString("X2"), //line color
            //						dbl.line, //line
            //						"#" + Mathf.FloorToInt(tempC.r*255).ToString("X2") + Mathf.FloorToInt(tempC.g*255).ToString("X2") + Mathf.FloorToInt(tempC.b*255).ToString("X2"), //line color, //tag color
            //						_tagName, //tag
            //						"white", //timestamp color
            //						string.Format("{0:0.000}", dbl.creationTime))
            //					);
            //			    }
            //
            //				AdvancedLabel.DrawLayout( _stringer.ToString(), debugLine_GUIstyle );
            debugLine_GUIstyle.richText = prev_richText;
            GUILayout.EndScrollView();

            GUILayout.EndArea();
        }
        else
        {
            if (GUI.Button(new Rect(2, Screen.height - btnHeight, btnHeight, btnHeight), arrow))
            {
                toogleLines = true;
            }
        }
    }