protected override void Awake() { base.Awake(); if (_instance != this) { return; } settings = NetworkSettings.LoadSettings(Application.dataPath + Path.DirectorySeparatorChar + "network_settings"); if (ShowBuild.GetBuildType() == "CONSOLE") { isMaster = false; } isMaster = false; if (isMaster) { Network.InitializeServer(1, 25552, false); } else { Debug.Log("connecting: " + Network.Connect(NetworkController.settings.hostIp, 25552)); Debug.Log("Sono fuori dalla connect"); } }
protected override void Awake() { base.Awake(); //Set app settings from build type string buildType = ShowBuild.GetBuildType(); switch (buildType) { case "DEV": appSettings = new DevAppSettings(); break; case "PRODUCTION": appSettings = new ProductionAppSettings(); break; case "SMALL": appSettings = new SmallAppSettings(); break; case "CUSTOM": case "CONSOLE": try { XmlSerializer ser = new XmlSerializer(typeof(DefaultAppSettings)); TextReader reader = new StreamReader(Application.dataPath + Path.DirectorySeparatorChar + "build_settings"); appSettings = (DefaultAppSettings)ser.Deserialize(reader); } catch (System.Exception e) { appSettings = new DefaultAppSettings(); Debug.Log("error reading custom settings, reverting to default " + e.Message); } break; default: appSettings = new DefaultAppSettings(); break; } //only make keyboard input for console if (buildType != "CONSOLE") { UserInput = InputController.Create(appSettings.inputController); backupInput = InputController.Create(appSettings.inputControllerBackup); } else { UserInput = InputController.Create(typeof(KeyboardInputController)); } AdminInput = InputController.Create(typeof(AdminInputController)) as AdminInputController; //if(buildType != "CONSOLE") Screen.SetResolution(appSettings.xResolution, appSettings.yResolution, appSettings.fullscreen); AdminInput.SwapInputMethod += SwapInputMethod; }
public static void OnPostProcessBuild(BuildTarget target, string path) { Debug.Log("PostProcessing Build.."); string buildNum = ShowBuild.GetBuildNumber(); var buildname = Path.GetFileNameWithoutExtension(path); var targetdir = Directory.GetParent(path); var dataDir = targetdir.FullName + Path.DirectorySeparatorChar + buildname + "_Data" + Path.DirectorySeparatorChar; File.WriteAllText(dataDir + "build", buildNum.ToString()); Debug.Log("Build number set: " + buildNum); }
private static void Build(BuildName type, EditorBuildSettingsScene[] scenes = null, string windowBuildName = null) { string fileName = "JLR_" + type.ToString() + "_" + ShowBuild.GetBuildNumber(); if (windowBuildName != null) { fileName += "_" + windowBuildName; } string savePath = EditorUtility.SaveFilePanel("Save Build", Application.dataPath, fileName, "exe"); Build(type, savePath, scenes, windowBuildName); }
protected override void Awake() { base.Awake(); if (_instance != this) { return; } settings = NetworkSettings.LoadSettings(Application.dataPath + Path.DirectorySeparatorChar + "network_settings"); // Init Transport using default values. NetworkTransport.Init(); // Create a connection config and add a Channel. ConnectionConfig config = new ConnectionConfig(); channelId = config.AddChannel(QosType.Reliable); // Create a topology based on the connection config. HostTopology topology = new HostTopology(config, 10); // Create a host based on the topology we just created, and bind the socket to port 12345. hostId = NetworkTransport.AddHost(topology, 25552); ///changed if (ShowBuild.GetBuildType() == "CONSOLE") { isMaster = false; } if (isMaster) { byte error; connectionId = NetworkTransport.Connect(hostId, NetworkController.settings.clientIp, 25552, 0, out error); Debug.Log(connectionId + ":connection" + hostId + ":hostId" + channelId + ":channelId and ip:\t" + NetworkController.settings.clientIp); Debug.Log(error); sender = sendToClient(2.0f); StartCoroutine(sender); // Network.InitializeServer(1, 25552, false); } else { byte error; connectionId = NetworkTransport.Connect(hostId, NetworkController.settings.hostIp, 25552, 0, out error); Debug.Log(connectionId + ":connection" + hostId + ":hostId" + channelId + ":channelId and ip:\t" + NetworkController.settings.clientIp); Debug.Log(error); //We used to connect to the server in this new case its the other way arround. //Debug.Log("connecting: " + Network.Connect(NetworkController.settings.hostIp, 25552)); } }
public IEnumerator Start() { yield return(new WaitForSeconds(delay)); string buildType = ShowBuild.GetBuildType(); if (loadConsole || buildType == "CONSOLE") { Application.LoadLevel("Console"); } else { AudioController.Instance.PlaySelectMusic(); StartCoroutine(launchScreen.StartSequence(() => AppController.Instance.LoadCarSelect())); } }
public void Start() { string buildType = ShowBuild.GetBuildType(); if (buildType == "CONSOLE") { gameObject.SetActive(false); Destroy(gameObject); return; } tempCachePath = Application.temporaryCachePath; if (RemoteAdminController.Instance == this) { StaticInstance = this; } receivedMessages = new Queue <string>(); debugLog = new Queue <string>(); httpServer = new HttpServer(8087); httpServer.RootPath = Application.streamingAssetsPath + "/Admin"; httpServer.OnGet += (sender, e) => { var req = e.Request; var res = e.Response; var path = req.RawUrl; if (path == "/") { path += "index.html"; } if (path.StartsWith("/Screenshots")) { res.ContentType = "image/jpeg"; res.ContentEncoding = System.Text.Encoding.UTF8; int id = -1; try { char[] p = new char[] { '/' }; id = int.Parse(path.Split(p)[2]); byte[] data = System.IO.File.ReadAllBytes(tempCachePath + "/" + id + ".jpg"); res.WriteContent(data); return; } catch (System.Exception ex) { debugLog.Enqueue("Error loading screenshot " + id + ": " + ex.Message); res.StatusCode = (int)HttpStatusCode.NotFound; res.Abort(); return; } } var content = httpServer.GetFile(path); if (content == null) { res.StatusCode = (int)HttpStatusCode.NotFound; return; } if (path.EndsWith(".html")) { res.ContentType = "text/html"; res.ContentEncoding = System.Text.Encoding.UTF8; } else if (path.EndsWith(".javascript")) { res.ContentType = "text/javascript"; res.ContentEncoding = System.Text.Encoding.UTF8; } else if (path.EndsWith(".css")) { res.ContentType = "text/css"; res.ContentEncoding = System.Text.Encoding.UTF8; } else if (path.EndsWith(".png")) { res.ContentType = "image/png"; res.ContentEncoding = System.Text.Encoding.UTF8; } else if (path.EndsWith(".jpg")) { res.ContentType = "image/jpeg"; res.ContentEncoding = System.Text.Encoding.UTF8; } //httpServer.Log.Debug("writing resonse: " + res.ToString()); res.WriteContent(content); }; //httpServer.Log.File = Application.streamingAssetsPath + "/Admin/http.log"; //httpServer.Log.Level = LogLevel.Debug; httpServer.Start(); server = new WebSocketServer(8088); // server.OnConnect += (sender, e) => { // debugLog.Enqueue("remote client connected"); // }; //server.Log.File = Application.streamingAssetsPath + "/Admin/websocket.log"; //server.Log.Level = LogLevel.Debug; server.AddWebSocketService <AdminScreenSocket>("/api"); server.Start(); Debug.Log("started server"); }
void Start() { buildString = buildString + ShowBuild.GetBuildNumber() + " " + ShowBuild.GetBuildType(); }
private static void BuildConsole() { string savePath = EditorUtility.SaveFilePanel("Save Build", Application.dataPath, "JLR_CONSOLE_" + ShowBuild.GetBuildNumber(), "exe"); BuildConsole(savePath); }
private void BuildAndDropBox() { EditorBuildSettingsScene[] scenes = new EditorBuildSettingsScene[] { new EditorBuildSettingsScene("Assets/Scenes/Loader.unity", true), new EditorBuildSettingsScene("Assets/Scenes/NewCarSelect_2.unity", true), new EditorBuildSettingsScene("Assets/Scenes/Environment_Yosemite.unity", true), new EditorBuildSettingsScene("Assets/Scenes/Environment_PCH.unity", true), new EditorBuildSettingsScene("Assets/Scenes/Environment_SanFrancisco02.unity", true) }; //clear spot for it var path = "Temp/deploy/"; string deployId = "JLR_" + ShowBuild.GetBuildNumber(); FileUtil.DeleteFileOrDirectory(path); Directory.CreateDirectory(path + deployId + "/"); path = path + deployId + "/"; //Debug.Log(path + "JLR_MAIN.exe"); //Debug.Log(path + "JLR_CONSOLE.exe"); BuildConsole(path + "JLR_CONSOLE.exe"); while (!File.Exists(path + "JLR_CONSOLE_Data/BUILD_COMPLETE")) { //waiting } Debug.Log("Start build player"); SetCustomSettings(); Build(BuildName.CUSTOM, path + "JLR_MAIN.exe", scenes, curWindowMode == BuildWindowMode.DEFAULT ? null : curWindowMode.ToString()); while (!File.Exists(path + "JLR_MAIN_Data/BUILD_COMPLETE")) { //waiting } var dbFile = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Dropbox\\info.json"); var dbInfop = JsonUtility.FromJson <DropBoxInfoParent>(File.ReadAllText(dbFile)); Debug.Log("dbpath: " + File.ReadAllText(dbFile)); Debug.Log("DROPBOX: " + dbInfop.personal.path); var proc1 = new System.Diagnostics.ProcessStartInfo(); proc1.UseShellExecute = true; proc1.WorkingDirectory = Directory.GetParent(path).ToString(); var root = Directory.GetParent(Application.dataPath); string dbPath = ""; if (dbInfop.business == null || string.IsNullOrEmpty(dbInfop.business.path)) { dbPath = dbInfop.personal.path; } else { dbPath = dbInfop.business.path; } dbPath = Path.Combine(dbPath, "14015_JLR"); Debug.Log("root:" + root); proc1.FileName = @"cmd.exe"; proc1.Arguments = "/C powershell -File " + root + "/Deploy.ps1 " + dbPath + "/" + deployId + ".zip " + "../" + deployId + "/"; Debug.Log(proc1.Arguments); proc1.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; System.Diagnostics.Process.Start(proc1); }