Esempio n. 1
0
        private void ConfigureLabels()
        {
            anchorsCount = System.Enum.GetNames(typeof(LabelAnchor)).Length;
            labels       = new DrawableLabel[anchorsCount];

            for (int i = 0; i < anchorsCount; i++)
            {
                labels[i] = new DrawableLabel(canvas.gameObject, (LabelAnchor)i,
                                              new LabelEffect(background, backgroundColor, backgroundPadding),
                                              new LabelEffect(shadow, shadowColor, shadowDistance),
                                              new LabelEffect(outline, outlineColor, outlineDistance),
                                              labelsFont, fontSize, lineSpacing, paddingOffset);
            }
        }
Esempio n. 2
0
        internal void UpdateTexts()
        {
            if (operationMode != OperationMode.Normal)
            {
                return;
            }

            bool anyContentPresent = false;

            if (fpsCounter.Enabled)
            {
                DrawableLabel label = labels[(int)fpsCounter.Anchor];
                if (label.newText.Length > 0)
                {
                    label.newText.Append(new string(NEW_LINE, countersSpacing + 1));
                }
                label.newText.Append(fpsCounter.text);
                label.dirty     |= fpsCounter.dirty;
                fpsCounter.dirty = false;

                anyContentPresent = true;
            }

            if (memoryCounter.Enabled)
            {
                DrawableLabel label = labels[(int)memoryCounter.Anchor];
                if (label.newText.Length > 0)
                {
                    label.newText.Append(new string(NEW_LINE, countersSpacing + 1));
                }
                label.newText.Append(memoryCounter.text);
                label.dirty        |= memoryCounter.dirty;
                memoryCounter.dirty = false;

                anyContentPresent = true;
            }

            if (deviceInfoCounter.Enabled)
            {
                DrawableLabel label = labels[(int)deviceInfoCounter.Anchor];
                if (label.newText.Length > 0)
                {
                    label.newText.Append(new string(NEW_LINE, countersSpacing + 1));
                }
                label.newText.Append(deviceInfoCounter.text);
                label.dirty            |= deviceInfoCounter.dirty;
                deviceInfoCounter.dirty = false;

                anyContentPresent = true;
            }

            if (anyContentPresent)
            {
                for (int i = 0; i < anchorsCount; i++)
                {
                    labels[i].CheckAndUpdate();
                }
            }
            else
            {
                for (int i = 0; i < anchorsCount; i++)
                {
                    labels[i].Clear();
                }
            }
        }