private void Start() { this._serverEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, (ushort)BoltRuntimeSettings.instance.debugStartPort); this._clientEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, 0); BoltConfig configCopy = BoltRuntimeSettings.instance.GetConfigCopy(); configCopy.connectionTimeout = 60000000; configCopy.connectionRequestTimeout = 500; configCopy.connectionRequestAttempts = 1000; if (!string.IsNullOrEmpty(BoltRuntimeSettings.instance.debugStartMapName)) { if (BoltDebugStartSettings.startServer) { BoltLauncher.StartServer(this._serverEndPoint, configCopy); } else if (BoltDebugStartSettings.startClient) { BoltLauncher.StartClient(this._clientEndPoint, configCopy); } BoltDebugStartSettings.PositionWindow(); } if (BoltNetwork.isClient || !BoltNetwork.isServer) { } }
void Start() { #if UNITY_EDITOR_OSX Process p = new Process(); p.StartInfo.FileName = "osascript"; p.StartInfo.Arguments = @"-e 'tell application """ + UnityEditor.PlayerSettings.productName + @""" activate end tell'"; p.Start(); #endif BoltRuntimeSettings settings = BoltRuntimeSettings.instance; _serverEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, (ushort)settings.debugStartPort); _clientEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, 0); BoltConfig cfg; cfg = settings.GetConfigCopy(); cfg.connectionTimeout = 60000000; cfg.connectionRequestTimeout = 500; cfg.connectionRequestAttempts = 1000; if (string.IsNullOrEmpty(settings.debugStartMapName) == false) { if (BoltDebugStartSettings.DebugStartIsServer) { BoltLog.Warn("Starting as SERVER"); BoltLauncher.StartServer(_serverEndPoint, cfg); } else if (BoltDebugStartSettings.DebugStartIsClient) { BoltLog.Warn("Starting as CLIENT"); BoltLauncher.StartClient(_clientEndPoint, cfg); } else if (BoltDebugStartSettings.DebugStartIsSinglePlayer) { BoltLog.Warn("Starting as SINGLE PLAYER"); BoltLauncher.StartSinglePlayer(cfg); } BoltDebugStartSettings.PositionWindow(); } else { BoltLog.Error("No map found to start from"); } }
private static bool Window(IntPtr hWnd, IntPtr lParam) { int num = -1; int id = Process.GetCurrentProcess().Id; BoltDebugStartSettings.GetWindowThreadProcessId(new HandleRef(BoltDebugStartSettings.handle, hWnd), out num); if (num == id) { BoltDebugStartSettings.unityHandle = new HandleRef(BoltDebugStartSettings.handle, hWnd); return(false); } return(true); }
public static void PositionWindow() { if (BoltDebugStartSettings.startClient || BoltDebugStartSettings.startServer) { if (BoltDebugStartSettings.< > f__mg$cache0 == null) { BoltDebugStartSettings.< > f__mg$cache0 = new BoltDebugStartSettings.EnumWindowsProc(BoltDebugStartSettings.Window); } BoltDebugStartSettings.EnumWindows(BoltDebugStartSettings.< > f__mg$cache0, IntPtr.Zero); if (BoltDebugStartSettings.unityHandle.Wrapper != null) { int width = Screen.width; int height = Screen.height; int x = 0; int y = 0; int systemMetrics = BoltDebugStartSettings.GetSystemMetrics(0); int systemMetrics2 = BoltDebugStartSettings.GetSystemMetrics(1); if (BoltDebugStartSettings.startServer) { x = systemMetrics / 2 - width / 2; y = systemMetrics2 / 2 - height / 2; } else { int num = BoltDebugStartSettings.windowIndex % 4; if (num != 1) { if (num != 2) { if (num == 3) { x = systemMetrics - width; y = systemMetrics2 - height; } } else { y = systemMetrics2 - height; } } else { x = systemMetrics - width; } } BoltDebugStartSettings.SetWindowPos(BoltDebugStartSettings.unityHandle.Handle, BoltDebugStartSettings.HWND.Top, x, y, width, height, BoltDebugStartSettings.SWP.NOSIZE); } } }
void Start() { #if UNITY_EDITOR_OSX Process p = new Process(); p.StartInfo.FileName = "osascript"; p.StartInfo.Arguments = @"-e 'tell application """ + UnityEditor.PlayerSettings.productName + @""" activate end tell'"; p.Start(); #endif UdpEndPoint _serverEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, (ushort)BoltRuntimeSettings.instance.debugStartPort); UdpEndPoint _clientEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, 0); BoltConfig cfg; cfg = BoltRuntimeSettings.instance.GetConfigCopy(); cfg.connectionTimeout = 60000000; cfg.connectionRequestTimeout = 500; cfg.connectionRequestAttempts = 1000; if (string.IsNullOrEmpty(BoltRuntimeSettings.instance.debugStartMapName) == false) { if (BoltDebugStartSettings.startServer) { BoltLauncher.StartServer(_serverEndPoint, cfg); BoltNetwork.LoadScene(BoltRuntimeSettings.instance.debugStartMapName); } else if (BoltDebugStartSettings.startClient) { BoltLauncher.StartClient(_clientEndPoint, cfg); BoltNetwork.Connect(_serverEndPoint); } BoltDebugStartSettings.PositionWindow(); } else { BoltLog.Error("No map found to start from"); } if (!BoltNetwork.isClient && !BoltNetwork.isServer) { BoltLog.Error("failed to start debug mode"); } }
public static void PositionWindow() { if (BoltDebugStartSettings.startClient || BoltDebugStartSettings.startServer) { BoltDebugStartSettings.EnumWindows(new BoltDebugStartSettings.EnumWindowsProc(BoltDebugStartSettings.Window), IntPtr.Zero); if (BoltDebugStartSettings.unityHandle.Wrapper != null) { int width = Screen.width; int height = Screen.height; int x = 0; int y = 0; int systemMetrics = BoltDebugStartSettings.GetSystemMetrics(0); int systemMetrics2 = BoltDebugStartSettings.GetSystemMetrics(1); if (BoltDebugStartSettings.startServer) { x = systemMetrics / 2 - width / 2; y = systemMetrics2 / 2 - height / 2; } else { switch (BoltDebugStartSettings.windowIndex % 4) { case 1: x = systemMetrics - width; break; case 2: y = systemMetrics2 - height; break; case 3: x = systemMetrics - width; y = systemMetrics2 - height; break; } } BoltDebugStartSettings.SetWindowPos(BoltDebugStartSettings.unityHandle.Handle, BoltDebugStartSettings.HWND.Top, x, y, width, height, BoltDebugStartSettings.SWP.NOSIZE); } } }