public override void DrawProperties(BloxEditorWindow ed, BloxBlockEd bdi) { //Debug.Log("DrawProperties"); if (bdi.b.paramBlocks == null) { bdi.b.paramBlocks = new BloxBlock[0]; } Debug_Block debug_Block = (Debug_Block)bdi.b; EditorGUILayout.PrefixLabel(Debug_BlockDrawer.GC_Message); debug_Block.message = EditorGUILayout.TextField(debug_Block.message); debug_Block.logType = (Debug_Block.DebugBlockLogType)EditorGUILayout.EnumPopup((Enum)(object)debug_Block.logType); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(Debug_BlockDrawer.GC_Add, plyEdGUI.Styles.MiniButtonLeft, GUILayout.Width(30f))) { ArrayUtility.Add <BloxBlockEd>(ref bdi.paramBlocks, (BloxBlockEd)null); ArrayUtility.Add <BloxBlock>(ref bdi.b.paramBlocks, (BloxBlock)null); GUI.changed = true; } GUI.enabled = (bdi.paramBlocks.Length != 0); if (GUILayout.Button(Debug_BlockDrawer.GC_Remove, plyEdGUI.Styles.MiniButtonRight, GUILayout.Width(30f))) { ArrayUtility.RemoveAt <BloxBlockEd>(ref bdi.paramBlocks, bdi.paramBlocks.Length - 1); ArrayUtility.RemoveAt <BloxBlock>(ref bdi.b.paramBlocks, bdi.b.paramBlocks.Length - 1); GUI.changed = true; } GUI.enabled = true; GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); GUILayout.Label(Debug_BlockDrawer.GC_Info, plyEdGUI.Styles.WordWrappedLabel); }
public override bool CreateBlockCodeStatements(BloxBlockEd bdi, CodeStatementCollection statements) { Debug_Block debug_Block = (Debug_Block)bdi.b; string text = "UnityEngine.Debug."; if (((bdi.paramBlocks != null) ? bdi.paramBlocks.Length : 0) != 0) { switch (debug_Block.logType) { case Debug_Block.DebugBlockLogType.Log: text += "LogFormat"; break; case Debug_Block.DebugBlockLogType.Warning: text += "WarningFormat"; break; case Debug_Block.DebugBlockLogType.Error: text += "ErrorFormat"; break; } CodeExpression[] array = new CodeExpression[bdi.paramBlocks.Length + 1]; string text2 = debug_Block.message; for (int i = 0; i < bdi.paramBlocks.Length; i++) { text2 = text2 + ((i == 0) ? " " : ", ") + "{" + i + "}"; array[i + 1] = (BloxScriptGenerator.CreateBlockCodeExpression(bdi.paramBlocks[i], null) ?? new CodePrimitiveExpression("null")); } array[0] = new CodePrimitiveExpression(text2); statements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression(null, text, array))); return(true); } switch (debug_Block.logType) { case Debug_Block.DebugBlockLogType.Log: text += "Log"; break; case Debug_Block.DebugBlockLogType.Warning: text += "Warning"; break; case Debug_Block.DebugBlockLogType.Error: text += "Error"; break; } CodeExpression[] parameters = new CodeExpression[1] { new CodePrimitiveExpression(debug_Block.message) }; statements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression(null, text, parameters))); return(true); }