VoxemeInspector.OnGUI C# (CSharp) Method

OnGUI() public method

public OnGUI ( ) : void
return void
    public void OnGUI()
    {
        if (DrawInspector) {
            inspectorPositionAdjX = inspectorPosition.x;
            inspectorPositionAdjY = inspectorPosition.y;
            if (inspectorPosition.x + inspectorWidth > Screen.width) {
                if (inspectorPosition.y > Screen.height - inspectorMargin) {
                    inspectorPositionAdjX = inspectorPosition.x - inspectorWidth;
                    inspectorPositionAdjY = inspectorPosition.y - inspectorHeight;
                    inspectorRect = new Rect (inspectorPosition.x - inspectorWidth, inspectorPosition.y - inspectorHeight, inspectorWidth, inspectorHeight);
                }
                else
                if (inspectorPosition.y + inspectorHeight > Screen.height) {
                    inspectorPositionAdjX = inspectorPosition.x - inspectorWidth;
                    inspectorRect = new Rect (inspectorPosition.x - inspectorWidth, inspectorPosition.y, inspectorWidth, Screen.height - inspectorPosition.y);
                }
                else {
                    inspectorPositionAdjX = inspectorPosition.x - inspectorWidth;
                    inspectorRect = new Rect (inspectorPosition.x - inspectorWidth, inspectorPosition.y, inspectorWidth, inspectorHeight);
                }
            }
            else
            if (inspectorPosition.y > Screen.height - inspectorMargin) {
                inspectorPositionAdjY = inspectorPosition.y - inspectorHeight;
                inspectorRect = new Rect (inspectorPosition.x, inspectorPosition.y - inspectorHeight, inspectorWidth, inspectorHeight);
            }
            else
            if (inspectorPosition.y + inspectorHeight > Screen.height) {
                inspectorRect = new Rect (inspectorPosition.x, inspectorPosition.y, inspectorWidth, Screen.height - inspectorPosition.y);
            }
            else {
                inspectorRect = new Rect (inspectorPosition.x, inspectorPosition.y, inspectorWidth, inspectorHeight);
            }

        /*#if UNITY_EDITOR || UNITY_STANDALONE
            if (File.Exists (inspectorObject.name + ".xml")) {
                if (!ObjectLoaded (inspectorObject)) {
                    loadedObject = LoadMarkup (inspectorObject);
                    markupCleared = false;
                }
            }
            else {
                if (!markupCleared) {
                    InitNewMarkup ();
                    loadedObject = new VoxML ();
                }
            }
        #endif
        #if UNITY_WEBPLAYER*/
            // Resources load here
            TextAsset markup = Resources.Load (inspectorObject.name) as TextAsset;
            if (markup != null) {
                if (!ObjectLoaded (markup.text)) {
                    loadedObject = LoadMarkup (markup.text);
                    inspectorTitle = inspectorObject.name;
                    markupCleared = false;
                }
            }
            else {
                if (!markupCleared) {
                    InitNewMarkup ();
                    loadedObject = new VoxML ();
                }
            }
        //#endif

            GUILayout.BeginArea (inspectorRect, GUI.skin.window);

            switch (mlEntityType) {
            case	VoxEntity.EntityType.Object:
                DisplayObjectMarkup ();
                break;

            case	VoxEntity.EntityType.Program:
                DisplayProgramMarkup ();
                break;

            case	VoxEntity.EntityType.Attribute:
                DisplayAttributeMarkup ();
                break;

            case	VoxEntity.EntityType.Relation:
                DisplayRelationMarkup ();
                break;

            case	VoxEntity.EntityType.Function:
                DisplayFunctionMarkup ();
                break;

            default:
                break;
            }

            GUILayout.EndArea ();

            Vector2 textDimensions = GUI.skin.label.CalcSize (new GUIContent (inspectorTitle));
            GUI.Label (new Rect (((2 * inspectorPositionAdjX + inspectorWidth) / 2) - textDimensions.x / 2, inspectorPositionAdjY, textDimensions.x, 25), inspectorObject.name);
        }
    }