public static void RemovePost(UnityMemoClass memo) { if (memo == null) { return; } if (DisplayedMemo == null) { Debug.LogError(ERROR_SERIOUS); return; } DisplayedMemo.UnityMemoList.Remove(memo); }
public static void PostMemo(UnityMemoClass postMemo) { if (postMemo == null) { return; } if (DisplayedMemo == null) { Debug.LogError(ERROR_SERIOUS); return; } // save memo at category AssetDatabase.StartAssetEditing(); DisplayedMemo.UnityMemoList.Add(postMemo); AssetDatabase.StopAssetEditing(); EditorUtility.SetDirty(DisplayedMemo); AssetDatabase.Refresh(); }
/// <summary> /// display posting area /// </summary> void DisplayPostProcess() { if (Helper.SaveMemoList == null || Helper.DisplayedMemo == null) { return; } EditorGUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true) }); { GUILayout.Box("", new GUILayoutOption[] { GUILayout.Height(2), GUILayout.ExpandWidth(true) }); GUILayout.Space(5); GUILayout.Label((Helper.TEXT_CREATEMEMO_TITLE + Helper.DisplayedMemo.CategoryName).ToMiddleBold()); EditorGUILayout.BeginVertical(); { // Display Date var memoDate = Helper.MemoDate; EditorGUILayout.BeginHorizontal(); { GUILayout.Label(memoDate, GUI.skin.box, new GUILayoutOption[] { GUILayout.Width(150), GUILayout.Height(25) }); postMemoType = EditorGUILayout.Popup(postMemoType, Helper.POSTMEMO_TYPE, GUILayout.Width(100)); ScriptableSingleton <UnityEditorMemoWindowSave> .instance.postMemoType = postMemoType; } EditorGUILayout.EndHorizontal(); GUILayout.Space(5); // Display Draft Undo.IncrementCurrentGroup(); Undo.RecordObject(ScriptableSingleton <UnityEditorMemoWindowSave> .instance, Helper.UNDO_DRAFT); memoText = EditorGUILayout.TextArea(memoText, Helper.TEXTAREA_WORDWRAP_STYLE, new GUILayoutOption[] { GUILayout.MaxHeight(300) }); ScriptableSingleton <UnityEditorMemoWindowSave> .instance.postMemoText = memoText; EditorGUILayout.BeginHorizontal(); { postMemoTex = GUILayout.Toolbar(postMemoTex, Helper.POSTMEMO_TEX, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(150) }); ScriptableSingleton <UnityEditorMemoWindowSave> .instance.postMemoTex = postMemoTex; GUILayout.FlexibleSpace(); // Display Post Button GUI.backgroundColor = Color.cyan; if (GUILayout.Button("Post", new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(100) })) { Undo.RecordObject(Helper.DisplayedMemo, Helper.UNDO_POST); if (!string.IsNullOrEmpty(memoText)) { var memoClass = new UnityMemoClass(memoDate, memoText, postMemoType, postMemoTex); Helper.PostMemo(memoClass); memoText = ""; ScriptableSingleton <UnityEditorMemoWindowSave> .instance.postMemoText = ""; postMemoType = 0; ScriptableSingleton <UnityEditorMemoWindowSave> .instance.postMemoType = 0; postMemoTex = 0; ScriptableSingleton <UnityEditorMemoWindowSave> .instance.postMemoTex = 0; //Scroll Up MemoScrollView = Vector2.zero; GUIUtility.keyboardControl = 0; } else { Debug.LogWarning(Helper.WARNING_MEMO_EMPTY); } } GUI.backgroundColor = Color.white; } EditorGUILayout.EndHorizontal(); GUILayout.Space(5); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); }
public void AddMemo(Charcolle.UnityEditorMemo.UnityMemoClass memo) { UnityMemoList.Add(memo); }
/// <summary> /// drawing a memo /// </summary> void drawMemoContent(UnityMemoClass memo, int memoIdx) { EditorGUILayout.BeginVertical(Helper.GUISKIN_BOX_STYLE); { // Display Memo Date GUI.backgroundColor = Helper.PostMemoTypeColor(( int )memo.Type); var preState = memo.isFold; EditorGUILayout.BeginHorizontal(); { GUILayout.Label(memoIdx.ToString(), Helper.GUISKIN_BOX_STYLE, GUILayout.Height(20)); GUILayout.Label(memo.Date.ToBold(), Helper.GUISKIN_BOX_STYLE, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(20) }); GUI.backgroundColor = Color.white; memo.isFold = GUILayout.Toggle(memo.isFold, "●", "button", new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) }); if (memo.isFold != preState) { GUIUtility.keyboardControl = 0; } } EditorGUILayout.EndHorizontal(); GUI.backgroundColor = Color.white; GUILayout.Space(1); // Display Memo and Emotion EditorGUILayout.BeginHorizontal(); { GUILayout.Space(5); if (memo.Tex != 0 && Helper.POSTMEMO_TEX != null) { EditorGUILayout.BeginVertical(GUILayout.Width(32)); GUILayout.Box(Helper.POSTMEMO_TEX[( int )memo.Tex], GUIStyle.none, new GUILayoutOption[] { GUILayout.Width(32), GUILayout.Height(32) }); EditorGUILayout.EndVertical(); } else { GUILayout.Space(34); } // Display Or Edit Memo if (memo.isFold) { Undo.IncrementCurrentGroup(); Undo.RecordObject(Helper.DisplayedMemo, Helper.UNDO_EDITPOST); memo.Memo = EditorGUILayout.TextArea(memo.Memo, Helper.TEXTAREA_WORDWRAP_STYLE); } else { GUILayout.Label(memo.Memo, Helper.GUISKIN_BOX_STYLE); } } EditorGUILayout.EndHorizontal(); GUILayout.Space(5); // Display Memo Edit Buttons //memo.isFold = EditorGUILayout.Foldout( memo.isFold, "" ); if (memo.isFold) { EditorGUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); memo.Tex = ( UnityMemoTexture )GUILayout.Toolbar(( int )memo.Tex, Helper.POSTMEMO_TEX, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(100) }); memo.Type = ( UnityMemoType )EditorGUILayout.Popup(( int )memo.Type, Helper.POSTMEMO_TYPE, GUILayout.Width(100)); //memo.isEditable = GUILayout.Toggle( memo.isEditable, Helper.EDIT_TEX, "button", new GUILayoutOption[] { GUILayout.Height( 30 ), GUILayout.Width( 30 ) } ); GUILayout.Space(5); GUI.color = Color.red; if (GUILayout.Button("×", new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(30) })) { Undo.RecordObject(Helper.DisplayedMemo, Helper.UNDO_DELETEPOST); Helper.RemovePost(memo); } GUI.color = Color.white; GUILayout.Space(5); } EditorGUILayout.EndHorizontal(); GUILayout.Space(5); } } EditorGUILayout.EndVertical(); }