public static void HandleNewProductForAll() { foreach (KeyValuePair <int, ProductManagementScreen> s in ProductManagementScreen.GetAll()) { s.Value.HandleNewProduct(); } }
public static void HandleMessage(SFSObject msgObj) { if (msgObj.ContainsKey("js")) { int id = msgObj.GetInt("id"); for (int i = 0; i < screens.Count; ++i) { if (screens[i].bssId == id && !screens[i].bTex.isWebViewBusy()) { screens[i].ExecuteRemoteJavaScript(msgObj.GetUtfString("js")); return; } } Debug.LogError("Didn't find page: " + msgObj.GetInt("id") + " or webView was busy, did not execute js"); } if (msgObj.ContainsKey("pl")) { foreach (KeyValuePair <int, NewProductInvestmentsScreen> s in NewProductInvestmentsScreen.GetAll()) { s.Value.Refresh(); } ProductManagementScreen.HandleNewProductForAll(); } }
public void OnRoomVariablesUpdate(BaseEvent evt) { Room evtRoom = (Room)evt.Params["room"]; if (room != null && room != evtRoom) { Debug.LogError("Got OnRoomVariablesUpdate for wrong room?"); } room = evtRoom; ArrayList changedVars = (ArrayList)evt.Params["changedVars"]; foreach (string varName in changedVars) { if (varName.StartsWith("cat")) { HandleTabMsg(room, varName); } if (varName.StartsWith("prdurl")) { ProductManagementScreen.HandleRoomVariable(varName, room.GetVariable(varName).GetStringValue()); } } if (room.ContainsVariable("product")) { productMgr.HandleMessageObject(room.GetVariable("product").GetSFSObjectValue()); } }
public static void HandleRoomVariable(string varName, string url) { int id = -1; if (int.TryParse(varName.Substring(("prdurl").Length), out id)) { ProductManagementScreen prodScreen = GetAll()[id]; prodScreen.HandleNewURL(url); } else { Debug.LogError("Bad id from " + varName); } }
private void HandleLaunchProduct(JSValue[] args) { UpdateServerWithProductLaunch(); ProductManagementScreen.HandleNewProductForAll(); }
public void InitSim(string overrideSimType = "") { string companyName = ""; switch (playMode) { case SimPlayMode.SINGLE_PLAYER: // until Industry Masters releases single player for more types of sims simType = (overrideSimType == "") ? "uimx_sustain" : overrideSimType; if (room != null && room.ContainsVariable("company")) { companyName = room.GetVariable("company").GetStringValue(); if (room.ContainsVariable("starttime")) { string startTimeStr = room.GetVariable("starttime").GetStringValue(); DateTime startTime = MsgStringToDateTime(startTimeStr); Debug.Log("Sim was started: " + startTime.ToString()); if (forceNewGame || DateTime.UtcNow.Subtract(startTime).TotalHours >= 1.0) { Debug.Log("Last business simulation finished, start a new one"); // start a new game companyName = GetUniqueCompanyName(); SetNewCompanyName(companyName); forceNewGame = false; } } else { Debug.LogError("room needs to have a starttime variable setup on the server"); } } else { Debug.LogError("Shouldn't get here -- Need to create a company variable via the server interface!!!"); // create a company name -- this won't be persistent though, it dies when this user disconnects companyName = GetUniqueCompanyName(); SetNewCompanyName(companyName); } AutoLogin(companyName); break; case SimPlayMode.MULTI_PLAYER: gameID = TeamInfo.Inst.GetBizSimGameId(CommunicationManager.CurrentTeamID); simType = (overrideSimType == "") ? TeamInfo.Inst.GetSimType(CommunicationManager.CurrentTeamID) : overrideSimType; simType = string.IsNullOrEmpty(simType) ? "uimx_sustain" : simType; companyName = GetMultiplayerTeamName(); AutoLogin(companyName); break; case SimPlayMode.DEMO: simType = (overrideSimType == "") ? "uimx_sustain" : overrideSimType; AutoLogin("Demo"); break; case SimPlayMode.ADMIN_PLAYER: Debug.LogError("Admin Player is not currently implemented"); break; } SetupSimType(simType); // update current tabs for (int i = 0; room != null && i < productMgr.NumProducts; ++i) { if (room.ContainsVariable("cat" + i)) { HandleTabMsg(room, "cat" + i); } } for (int i = 0; i < ProductManagementScreen.GetAll().Count; ++i) { string varName = "prdurl" + i; if (room != null && room.ContainsVariable(varName)) { ProductManagementScreen screen = ProductManagementScreen.GetAll()[i]; string url = (screen.Initialized) ? BizSimScreen.GetStageItemURL(screen.StageItem) : room.GetVariable(varName).GetStringValue(); screen.HandleNewURL(url); if (overrideSimType != "") { ProductManagementScreen.GetAll()[i].UpdateServerWithNewURL(url); } } } MainCameraController.Inst.snapCamMakesPlayersInvisible = true; }