Esempio n. 1
0
        private static void PaintEditing(GlobalID globalID)
        {
            Rect rect = GUILayoutUtility.GetRect(
                0f, 9999f,
                HEIGHT + PADDING,
                HEIGHT + PADDING
                );

            Rect rectInfo = new Rect(
                rect.x,
                rect.y,
                INFO_WIDTH,
                HEIGHT
                );

            Rect rectContent = new Rect(
                rectInfo.x + rectInfo.width,
                rectInfo.y,
                rect.width - INFO_WIDTH - EDIT_WIDTH,
                HEIGHT
                );

            Rect rectEdit = new Rect(
                rectContent.x + rectContent.width,
                rectContent.y,
                EDIT_WIDTH,
                HEIGHT
                );

            if (GUI.Button(rectInfo, "Regen", CoreGUIStyles.GetButtonLeft()))
            {
                if (EditorUtility.DisplayDialog(REGEN_1, REGEN_2, "Yes", "Cancel"))
                {
                    string gid = Guid.NewGuid().ToString("D");
                    SetGID(globalID, gid);
                }
            }

            string prvGid = globalID.GetID();
            string newGid = EditorGUI.TextField(
                rectContent,
                prvGid,
                CoreGUIStyles.GlobalIDText()
                );

            if (prvGid != newGid)
            {
                SetGID(globalID, newGid);
            }

            if (GUI.Button(rectEdit, "Back", CoreGUIStyles.GetButtonRight()))
            {
                IS_EDITING = false;
            }
        }
Esempio n. 2
0
        private static void PaintNormal(GlobalID globalID)
        {
            Rect rect = GUILayoutUtility.GetRect(
                0f, 9999f,
                HEIGHT + PADDING,
                HEIGHT + PADDING
                );

            Rect rectInfo = new Rect(
                rect.x,
                rect.y,
                INFO_WIDTH,
                HEIGHT
                );

            Rect rectContent = new Rect(
                rectInfo.x + rectInfo.width,
                rectInfo.y,
                rect.width - INFO_WIDTH - EDIT_WIDTH,
                HEIGHT
                );

            Rect rectEdit = new Rect(
                rectContent.x + rectContent.width,
                rectContent.y,
                EDIT_WIDTH,
                HEIGHT
                );

            GUI.enabled = false;
            EditorGUI.LabelField(rectInfo, "ID", CoreGUIStyles.GetButtonLeft());
            GUI.enabled = true;


            GUI.enabled = false;
            EditorGUI.LabelField(rectContent, globalID.GetID(), CoreGUIStyles.GetButtonMid());
            GUI.enabled = true;

            if (GUI.Button(rectEdit, "Edit", CoreGUIStyles.GetButtonRight()))
            {
                IS_EDITING = true;
            }
        }