public static void OpenBrowser (AirConsole controller, string startUpPath) {
// set the root path for webserver
webserver.SetPath (startUpPath);
webserver.Start ();
if (controller != null && controller.enabled) {
if (controller.controllerHtml != null) {
string sourcePath = Path.Combine (Directory.GetCurrentDirectory (), AssetDatabase.GetAssetPath (controller.controllerHtml));
string targetPath = Path.Combine (Directory.GetCurrentDirectory (), "Assets" + Settings.WEBTEMPLATE_PATH + "/controller.html");
// rename index.html to screen.html
File.Copy (sourcePath, targetPath, true);
if (controller.browserStartMode != StartMode.NoBrowserStart) {
string url = AirConsole.GetUrl (controller.browserStartMode) + "http://" + GetLocalAddress () + ":" + Settings.webServerPort + "/";
// add port info if starting the unity editor version
if (startUpPath.Contains (Settings.WEBTEMPLATE_PATH)) {
url += "?unity-editor-websocket-port=" + Settings.webSocketPort + "&unity-plugin-version=" + Settings.VERSION;
}
Application.OpenURL (url);
} else {
AirConsole.instance.ProcessJS ("{action:\"onReady\", code:\"0\", devices:[], server_time_offset: 0, device_id: 0, location: \"\" }");
}
} else {
EditorUtility.DisplayDialog ("AirController", "Please link a controller file to the AirController object.", "ok");
Debug.Break ();
}
}
}