private void DrawStateLabel(PlayMakerFSM fsm)
    {
        if (PlayMakerGUI.stateLabelStyle == null || Math.Abs(this.initLabelScale - this.labelScale) > 0.1f)
        {
            this.InitLabelStyle();
        }
        if (Camera.get_main() == null)
        {
            return;
        }
        if (fsm.get_gameObject() == Camera.get_main())
        {
            return;
        }
        if (fsm.get_gameObject() == PlayMakerGUI.labelGameObject)
        {
            PlayMakerGUI.fsmLabelIndex += 1f;
        }
        else
        {
            PlayMakerGUI.fsmLabelIndex   = 0f;
            PlayMakerGUI.labelGameObject = fsm.get_gameObject();
        }
        string text = PlayMakerGUI.GenerateStateLabel(fsm);

        if (string.IsNullOrEmpty(text))
        {
            return;
        }
        Vector2 vector = default(Vector2);

        PlayMakerGUI.labelContent.set_text(text);
        Vector2 vector2 = PlayMakerGUI.stateLabelStyle.CalcSize(PlayMakerGUI.labelContent);

        vector2.x = Mathf.Clamp(vector2.x, 10f * this.labelScale, 200f * this.labelScale);
        if (this.GUITextureStateLabels && fsm.GuiTexture != null)
        {
            vector.x = fsm.get_gameObject().get_transform().get_position().x *(float)Screen.get_width() + fsm.GuiTexture.get_pixelInset().get_x();
            vector.y = fsm.get_gameObject().get_transform().get_position().y *(float)Screen.get_height() + fsm.GuiTexture.get_pixelInset().get_y();
        }
        else
        {
            if (this.GUITextStateLabels && fsm.GuiText != null)
            {
                vector.x = fsm.get_gameObject().get_transform().get_position().x *(float)Screen.get_width();
                vector.y = fsm.get_gameObject().get_transform().get_position().y *(float)Screen.get_height();
            }
            else
            {
                if (this.filterLabelsWithDistance)
                {
                    float num = Vector3.Distance(Camera.get_main().get_transform().get_position(), fsm.get_transform().get_position());
                    if (num > this.maxLabelDistance)
                    {
                        return;
                    }
                }
                if (Camera.get_main().get_transform().InverseTransformPoint(fsm.get_transform().get_position()).z <= 0f)
                {
                    return;
                }
                vector    = Camera.get_main().WorldToScreenPoint(fsm.get_transform().get_position());
                vector.x -= vector2.x * 0.5f;
            }
        }
        vector.y = (float)Screen.get_height() - vector.y - PlayMakerGUI.fsmLabelIndex * 15f * this.labelScale;
        Color backgroundColor = GUI.get_backgroundColor();
        Color color           = GUI.get_color();
        int   num2            = 0;

        if (fsm.Fsm.ActiveState != null)
        {
            num2 = fsm.Fsm.ActiveState.ColorIndex;
        }
        Color color2 = PlayMakerPrefs.Colors[num2];

        GUI.set_backgroundColor(new Color(color2.r, color2.g, color2.b, 0.5f));
        GUI.set_contentColor(Color.get_white());
        GUI.Label(new Rect(vector.x, vector.y, vector2.x, vector2.y), text, PlayMakerGUI.stateLabelStyle);
        GUI.set_backgroundColor(backgroundColor);
        GUI.set_color(color);
    }