Exemple #1
0
        /// <summary>
        /// Log an event with one label/data pair.  Also sends to mixpanel
        /// </summary>
        /// <param name="categoryName">Category name from LogGlobals</param>
        /// <param name="eventName">Event name from LogGlobals</param>
        /// <param name="optLabel">Label of data being sent, like "price"</param>
        /// <param name="optData">Value of data being sent, like "100"</param>
        public static void Log(string categoryName, string eventName, string optLabel, string optData)
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();

            if (clientMessageProcessor != null)
            {
                List <object> messageData = new List <object>();
                messageData.Add(categoryName);
                messageData.Add(eventName);
                messageData.Add(optLabel);
                messageData.Add(optData);
                Message message = new Message(MessageType.Event, messageData);
                clientMessageProcessor.SendMessageToReflector(message);

                // Send event to mix panel also
                JSDispatcher jsd = new JSDispatcher();

                string mpEvent    = categoryName + "_" + eventName;
                string properties = "";


                if (optLabel != "" && optData != "")
                {
                    properties = "{\"" + optLabel + "\":\"" + optData + "\"}";
                }
                jsd.LogMetricsEvent(mpEvent, properties, delegate(string s) { });
            }
            else
            {
                Console.WriteLine(String.Format("Warning: EventLogger not ready to log {0}, {1}, {2}, {3}", categoryName, eventName, optLabel, optData));
            }
        }
Exemple #2
0
        /// <summary>
        /// Log an event categoryName, eventName and a string of arbitrary data.  Also sends to mixpanel
        /// </summary>
        /// <param name="categoryName">Category name from LogGlobals</param>
        /// <param name="eventName">Event name from LogGlobals</param>
        /// <param name="extraProps">Arbitrary data in JSON format</param>
        public static void Log(string categoryName, string eventName, string extraProps)
        {
            // Test to make sure extraProps is a valid Json string
            LitJson.JsonMapper.ToObject(extraProps);

            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();

            if (clientMessageProcessor != null)
            {
                List <object> messageData = new List <object>();
                messageData.Add(categoryName);
                messageData.Add(eventName);
                messageData.Add("props");
                messageData.Add(extraProps);
                Message message = new Message(MessageType.Event, messageData);
                clientMessageProcessor.SendMessageToReflector(message);

                // Send event to mix panel also
                JSDispatcher jsd = new JSDispatcher();

                string mpEvent = categoryName + "_" + eventName;
                jsd.LogMetricsEvent(mpEvent, extraProps, delegate(string s){});
            }
            else
            {
                Console.WriteLine(String.Format("Warning: EventLogger not ready to log {0}, {1}, {2}, {3}", categoryName, eventName, extraProps));
            }
        }
Exemple #3
0
        private static void HandleBuyCashOk(Action <string> onOk)
        {
            Console.WriteLine("HandleBuyCashOk");

            InventoryProxy inventoryProxy = GameFacade.Instance.RetrieveProxy <InventoryProxy>();
            string         urlParams      = "p=" + inventoryProxy.SecurePaymentInfo;
            JSDispatcher   jsd            = new JSDispatcher();

            jsd.RequestCashStore(urlParams, onOk);
            GameFacade.Instance.SendNotification(GameFacade.GET_CASH_GUI_CLOSED);
        }
Exemple #4
0
        public void InitAndStartup()
        {
            if (Application.isEditor)  // Running on a dev desktop in the editor
            {
                if (!InitFromLocalDisk())
                {
                    throw new System.Exception("Couldn't find a config.json in your search paths.  You need this file to run in development.  Ask Ian for help!");
                }
                GameFacade.Instance.SendNotification(GameFacade.STARTUP_COMMAND);
            }
            else if (Application.absoluteURL.Contains("file://"))  // Running on a dev desktop in the web build
            {
                GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler.StartCoroutine(InitForLocalWebBuild());
            }
            else  // Running in production
            {
                GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.AddReporter(new JSConsole());
                GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.Log("ConfigManagerClient.  Sending js call", LogLevel.Info);
                // Ask javascript for our config info
                JSDispatcher jsd = new JSDispatcher();
                jsd.RequestConfigObject(delegate(string configJSON)
                {
                    configJSON = configJSON.Replace("&quot;", "\"");

                    GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.Log("ConfigManagerClient.  Got response from javascript: " + configJSON, LogLevel.Info);

                    try
                    {
                        // Client should never need knowledge of groups
                        InitFromJSON(configJSON, "{}");
                        GameFacade.Instance.SendNotification(GameFacade.STARTUP_COMMAND);
                    }
                    catch (System.Exception ex)
                    {
                        GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.Log("Unhandled exception: " + ex.ToString(), LogLevel.Error);
                    }
                    finally
                    {
                        GameFacade.Instance.RetrieveMediator <LoggerMediator>().Logger.Flush();
                    }
                });
            }
        }
Exemple #5
0
        public void LogFunnel(string funnelName, uint stepNumber, string stepName, string props)
        {
            JSDispatcher jsd = new JSDispatcher();

            jsd.LogMetricsFunnelStep(funnelName, stepNumber, stepName, props, delegate(string s) { });
        }
Exemple #6
0
        public void LogFunnel(string funnelName, string stepName, string props)
        {
            JSDispatcher jsd = new JSDispatcher();

            jsd.LogMetricsFunnelStep(funnelName, mFunnelNameToFunnel[funnelName][stepName], stepName, props, delegate(string s) { });
        }