private bool Button(GUIContentData model) { if (model == null) { return(false); } return(GUILayout.Button(model.Content, model.Style, model.LayoutOptions)); }
private void Init() { if (this.splitterLineTexture != null) { return; } this.entryStyleBackEven = new GUIStyle("CN EntryBackEven"); this.entryStyleBackEven.margin = new RectOffset(0, 0, 0, 0); this.entryStyleBackEven.border = new RectOffset(0, 0, 0, 0); this.entryStyleBackEven.fixedHeight = 0; this.entryStyleBackEven.fixedWidth = 0; this.entryStyleBackEven.richText = true; this.entryStyleBackEven.imagePosition = ImagePosition.ImageLeft; this.entryStyleBackEven.contentOffset = new Vector2(0f, 0f); this.entryStyleBackEven.padding = new RectOffset(10, 0, 0, 0); this.entryStyleBackEven.alignment = TextAnchor.MiddleLeft; this.entryStyleBackOdd = new GUIStyle("CN EntryBackOdd"); this.entryStyleBackOdd.margin = new RectOffset(0, 0, 0, 0); this.entryStyleBackOdd.border = new RectOffset(0, 0, 0, 0); this.entryStyleBackOdd.fixedHeight = 0; this.entryStyleBackOdd.fixedWidth = 0; this.entryStyleBackOdd.richText = true; this.entryStyleBackOdd.imagePosition = ImagePosition.ImageLeft; this.entryStyleBackOdd.contentOffset = new Vector2(0f, 0f); this.entryStyleBackOdd.padding = new RectOffset(10, 0, 0, 0); this.entryStyleBackOdd.alignment = TextAnchor.MiddleLeft; this.splitterLineTexture = new Texture2D(1, 1); this.splitterLineTexture.SetPixel(0, 0, Color.black); this.splitterLineTexture.Apply(); this.detailStyle = new GUIStyle("CN EntryBackOdd"); this.detailStyle.margin = new RectOffset(0, 0, 0, 0); this.detailStyle.border = new RectOffset(5, 5, 5, 5); this.detailStyle.richText = true; this.detailStyle.contentOffset = new Vector2(0f, 0f); this.detailStyle.padding = new RectOffset(5, 5, 5, 5); this.detailStyle.alignment = TextAnchor.UpperLeft; this.detailStyle.fixedWidth = 0; this.detailStyle.wordWrap = true; this.countBadgeStyle = new GUIStyle("CN CountBadge"); this.countBadgeStyle.margin = new RectOffset(0, 0, 0, 0); this.countBadgeStyle.border = new RectOffset(0, 0, 0, 0); this.countBadgeStyle.contentOffset = new Vector2(0f, 0f); this.countBadgeStyle.padding = new RectOffset(3, 3, 3, 3); this.countBadgeStyle.fixedHeight = 0f; this.countBadgeStyle.fixedWidth = 0f; this.countBadgeStyle.alignment = TextAnchor.MiddleCenter; if (this.toolbarSeachTextFieldStyle == null) { this.toolbarSeachTextFieldStyle = new GUIStyle("ToolbarSeachTextField"); } if (this.toolbarSeachCancelButtonStyle == null) { this.toolbarSeachCancelButtonStyle = new GUIStyle("ToolbarSeachCancelButton"); } playToggle = new GUISwitchContentData(false, new GUIContent(Resources.Load <Texture2D>("Icons/play-on"), "Start"), new GUIContent(Resources.Load <Texture2D>("Icons/play-off"), "Stop"), EditorStyles.toolbarButton); clearButton = new GUIContentData(new GUIContent(Resources.Load <Texture2D>("Icons/delete"), "Clear"), EditorStyles.toolbarButton); saveButton = new GUIContentData(new GUIContent(Resources.Load <Texture2D>("Icons/save"), "Save"), EditorStyles.toolbarButton); collapseToggle = new GUISwitchContentData(consoleVM.Collapse, new GUIContent("Collapse", "Collapse"), EditorStyles.toolbarButton); levelIconTextures = new Texture[] { Resources.Load <Texture2D>("Icons/debug"), Resources.Load <Texture2D>("Icons/info"), Resources.Load <Texture2D>("Icons/warn"), Resources.Load <Texture2D>("Icons/error"), Resources.Load <Texture2D>("Icons/fatal") }; levelButtonDatas = new GUISwitchContentData[5]; levelButtonDatas[0] = new GUISwitchContentData(consoleVM.IsLevelShow(Level.DEBUG), new GUIContent(levelIconTextures[0], "Debug"), EditorStyles.toolbarButton); levelButtonDatas[1] = new GUISwitchContentData(consoleVM.IsLevelShow(Level.INFO), new GUIContent(levelIconTextures[1], "Info"), EditorStyles.toolbarButton); levelButtonDatas[2] = new GUISwitchContentData(consoleVM.IsLevelShow(Level.WARN), new GUIContent(levelIconTextures[2], "Warn"), EditorStyles.toolbarButton); levelButtonDatas[3] = new GUISwitchContentData(consoleVM.IsLevelShow(Level.ERROR), new GUIContent(levelIconTextures[3], "Error"), EditorStyles.toolbarButton); levelButtonDatas[4] = new GUISwitchContentData(consoleVM.IsLevelShow(Level.FATAL), new GUIContent(levelIconTextures[4], "Fatal"), EditorStyles.toolbarButton); columnButtonDatas = new GUISwitchContentData[3]; columnButtonDatas[0] = new GUISwitchContentData(consoleVM.IsColumnShow(Columns.TimeStamp), new GUIContent("Time", "Time"), EditorStyles.toolbarButton); columnButtonDatas[1] = new GUISwitchContentData(consoleVM.IsColumnShow(Columns.Thread), new GUIContent("Thread", "Thread"), EditorStyles.toolbarButton); columnButtonDatas[2] = new GUISwitchContentData(consoleVM.IsColumnShow(Columns.Logger), new GUIContent("Logger", "Logger"), EditorStyles.toolbarButton); }