| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using BansheeEngine;
- namespace BansheeEditor
- {
- internal class DebugWindow : EditorWindow
- {
- private void OnInitialize()
- {
- GUIButton refreshAssembly = new GUIButton("Refresh assembly");
- refreshAssembly.OnClick += RefreshAssembly_OnClick;
- GUIButton compileGame = new GUIButton("Compile game assembly");
- compileGame.OnClick += CompileGame_OnClick;
- GUIButton openColorPicker = new GUIButton("Color picker");
- openColorPicker.OnClick += OpenColorPicker;
- GUILayout horzLayout = GUI.AddLayoutX();
- horzLayout.AddElement(refreshAssembly);
- horzLayout.AddElement(compileGame);
- horzLayout.AddElement(openColorPicker);
- GUIButton testExplicitBtn = new GUIButton("TESTING EXPLICIT");
- testExplicitBtn.Bounds = compileGame.Bounds;
- GUIPanel overlay = GUI.AddPanel(-1);
- overlay.SetWidth(Width);
- overlay.SetHeight(Height);
- overlay.AddElement(testExplicitBtn);
- }
- void RefreshAssembly_OnClick()
- {
- Internal_RefreshAssembly();
- }
- void CompileGame_OnClick()
- {
- CompilerInstance ci = ScriptCompiler.CompileAsync(ScriptAssemblyType.Game, PlatformType.Windows, true, "D:\\AssemblyOutput");
- while (!ci.IsDone)
- {
- Debug.Log("Compiling...");
- Thread.Sleep(50);
- }
- Debug.Log("COMPILATION DONE!");
- for(int i = 0; i < ci.ErrorMessages.Length; i++)
- Debug.Log("ERROR: " + ci.ErrorMessages[i].file + ": " + ci.ErrorMessages[i].line + " - " + ci.ErrorMessages[i].message);
- for (int i = 0; i < ci.WarningMessages.Length; i++)
- Debug.Log("WARNING: " + ci.WarningMessages[i].file + ": " + ci.WarningMessages[i].line + " - " + ci.WarningMessages[i].message);
- }
- void OpenColorPicker()
- {
- ColorPicker.Show();
- }
- void OnEditorUpdate()
- {
- //if (debugSlowDown)
- // Thread.Sleep(5000);
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_RefreshAssembly();
- }
- }
|