/// <summary> /// Pops up conformation GUI before navigating the browser to the buy cash page. /// </summary> /// <param name="title"></param> /// <param name="message"></param> /// <param name="onOk">The string param is the Javascript call result</param> /// <param name="onCancel"></param> public static void GoToBuyCashPage(string title, string message, Action <string> onOk, Hangout.Shared.Action onCancel) { ConfigManagerClient configManager = GameFacade.Instance.RetrieveProxy <ConfigManagerClient>(); if (configManager.GetBool("purchase_page_enabled", true)) { // Popup confirm List <object> args = new List <object>(); args.Add(title); args.Add(message); Hangout.Shared.Action okcb = delegate() { HandleBuyCashOk(onOk); }; args.Add(okcb); args.Add(onCancel); args.Add(Translation.NEED_CASH_BUTTON); GameFacade.Instance.SendNotification(GameFacade.SHOW_CONFIRM, args); GameFacade.Instance.SendNotification(GameFacade.GET_CASH_GUI_OPENED); } else { // Popup coming soon dialog List <object> args = new List <object>(); args.Add(title); args.Add(Translation.NEED_CASH_TEXT_COMING_SOON); GameFacade.Instance.SendNotification(GameFacade.SHOW_DIALOG, args); GameFacade.Instance.SendNotification(GameFacade.GET_CASH_GUI_OPENED); } }
override public void Execute(INotification notification) { GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.Log("RequestConnectionCommand.Execute", LogLevel.Info); ConfigManagerClient configManager = GameFacade.Instance.RetrieveProxy <ConfigManagerClient>(); ConnectionProxy connectionProxy = GameFacade.Instance.RetrieveProxy <ConnectionProxy>(); connectionProxy.SetConfiguration(configManager); if (Application.isEditor || configManager.GetBool("override_boss_server", false)) { GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.Log("RequestConnectionCommand, using in editor settings, connection ip " + connectionProxy.IpAddress + " port " + connectionProxy.Port, LogLevel.Info); GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>().Connect(connectionProxy.IpAddress, connectionProxy.Port); Console.Log("connection ip " + connectionProxy.IpAddress + " port " + connectionProxy.Port); } else { string resolvedPath = connectionProxy.WebServicesBaseUrl + "/Boss/GetStateServer"; GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.Log("RequestConnectionCommand boss server path = " + resolvedPath, LogLevel.Info); GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>().CallToService(resolvedPath, delegate(XmlDocument serverDocument) { //Expected format: //<ConnectTo> // <StateServer Ip="64.106.173.25" Port="8000" Population="0" /> //</ConnectTo> XmlElement serverNode = (XmlElement)serverDocument.SelectSingleNode("/ConnectTo/StateServer"); string ipAddress = serverNode.GetAttribute("Ip"); int port = int.Parse(serverNode.GetAttribute("Port")); GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.Log("Connecting to state server at " + ipAddress + ":" + port, LogLevel.Info); Console.WriteLine("Connecting to state server at " + ipAddress + ":" + port); GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>().Connect(ipAddress, port); }); } }
/// <summary> /// Handle initial entry into the game. Put user in a default location based on their if they are a first time user, /// and their entry point into the client from the web /// </summary> private void HandleInitialEntryToGame() { UserAccountProxy userAccountProxy = GameFacade.Instance.RetrieveProxy <UserAccountProxy>(); bool isFirstTimeUser = false; Console.WriteLine("User properties " + userAccountProxy.ToString()); if (!userAccountProxy.TryGetAccountProperty <bool>(UserAccountProperties.FirstTimeUser, ref isFirstTimeUser)) { Console.WriteLine("First time user property not set, assume it our first time in"); isFirstTimeUser = true; } ConfigManagerClient configManager = GameFacade.Instance.RetrieveProxy <ConfigManagerClient>(); bool returnUsersStartMinigame = configManager.GetBool("return_users_start_minigame", true); if (isFirstTimeUser) { ConnectionProxy connectionProxy = GameFacade.Instance.RetrieveProxy <ConnectionProxy>(); switch (connectionProxy.WebEntryPointId) { case FunnelGlobals.PUBLIC_LOBBY: RoomManagerProxy roomManager = GameFacade.Instance.RetrieveProxy <RoomManagerProxy>(); roomManager.JoinLastRoom(); break; case FunnelGlobals.FASHION_MINIGAME: SendNotification(GameFacade.SWITCHING_TO_FASHION_MINI_GAME); break; default: throw new Exception("Unexpected entry point received: " + connectionProxy.WebEntryPointId); } // Set firstTimeUser property to false userAccountProxy.SetAccountProperty <bool>(UserAccountProperties.FirstTimeUser, false); } else { if (returnUsersStartMinigame) { SendNotification(GameFacade.SWITCHING_TO_FASHION_MINI_GAME); } else { Console.WriteLine("Not a First time user go to room"); // Returning user. Go to default room RoomManagerProxy roomManager = GameFacade.Instance.RetrieveProxy <RoomManagerProxy>(); roomManager.JoinLastRoom(); } } }