Exemple #1
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 #2
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 #3
0
        private void Init()
        {
            mClientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            IGuiManager guiManager = GameFacade.Instance.RetrieveMediator <RuntimeGuiManager>();

            mInventoryController = new InventoryGuiController(guiManager);
            mPaymentItemsCommand = new PaymentItemsCommand();
        }
Exemple #4
0
        public void ProcessLoginInfo(List <object> loginData)
        {
            Message loginInfoMessage = new Message(MessageType.Connect, MessageSubType.RequestLogin, loginData);

            // Send login info up to reflector
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();

            clientMessageProcessor.SendMessageToReflector(loginInfoMessage);
        }
Exemple #5
0
        public static void GetEntourageList()
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            Message requestFriendsMessage = new Message();

            requestFriendsMessage.Callback = (int)MessageSubType.ReceiveEntourage;
            requestFriendsMessage.FriendsMessage(new List <object>());

            clientMessageProcessor.SendMessageToReflector(requestFriendsMessage);
        }
Exemple #6
0
        public static void RequestEscrow(EscrowType escrowType)
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            Message requestEscrowMessage = new Message();

            requestEscrowMessage.Callback = (int)MessageSubType.ProcessEscrowTransaction;
            List <object> messageData = new List <object>();

            messageData.Add(escrowType);
            requestEscrowMessage.EscrowMessage(messageData);

            clientMessageProcessor.SendMessageToReflector(requestEscrowMessage);
        }
        public static void LeaveRoom(RoomId roomId)
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            Message leaveRoomMessage = new Message();

            leaveRoomMessage.Callback = (int)MessageSubType.LeaveRoom;
            List <object> messageData = new List <object>();

            messageData.Add(roomId);
            leaveRoomMessage.RoomMessage(messageData);

            clientMessageProcessor.SendMessageToReflector(leaveRoomMessage);
        }
        public static void RequestRoomsFromServer(MessageSubType roomRequestType)
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            Message requestRoomsMessage = new Message();

            requestRoomsMessage.Callback = (int)MessageSubType.RequestRooms;
            List <object> messageData = new List <object>();

            messageData.Add(roomRequestType);
            requestRoomsMessage.RoomMessage(messageData);

            clientMessageProcessor.SendMessageToReflector(requestRoomsMessage);
        }
Exemple #9
0
        public static void GetFriendsList(long facebookAccountId, string sessionKey)
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            Message requestFriendsMessage = new Message();

            requestFriendsMessage.Callback = (int)MessageSubType.ReceiveFriends;
            List <object> messageData = new List <object>();

            messageData.Add(facebookAccountId);
            messageData.Add(sessionKey);
            requestFriendsMessage.FriendsMessage(messageData);

            clientMessageProcessor.SendMessageToReflector(requestFriendsMessage);
        }
Exemple #10
0
        //public static void JoinRoom(RoomId newRoomIdToJoin, MessageSubType roomRequestType)
        //{
        //    ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy<ClientMessageProcessor>();
        //    Message joinRoomMessage = new Message();
        //    joinRoomMessage.Callback = (int)MessageSubType.JoinRoom;
        //    List<object> messageData = new List<object>();
        //    messageData.Add(newRoomIdToJoin);
        //    messageData.Add(roomRequestType);
        //    joinRoomMessage.RoomMessage(messageData);

        //    clientMessageProcessor.SendMessageToReflector(joinRoomMessage);
        //}

        public static void CreateRoom(string roomName, RoomType roomType)
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            Message createRoomMessage = new Message();

            createRoomMessage.Callback = (int)MessageSubType.CreateRoom;
            List <object> messageData = new List <object>();

            messageData.Add(roomName);
            messageData.Add(roomType);
            messageData.Add(PrivacyLevel.Private);
            createRoomMessage.RoomMessage(messageData);
            clientMessageProcessor.SendMessageToReflector(createRoomMessage);
        }
Exemple #11
0
        public static void SwitchRoom(RoomId newRoomIdToJoin, MessageSubType roomRequestType)
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            Message switchRoomMessage = new Message();

            switchRoomMessage.Callback = (int)MessageSubType.SwitchRoom;
            List <object> messageData = new List <object>();

            messageData.Add(newRoomIdToJoin);
            messageData.Add(roomRequestType);
            switchRoomMessage.RoomMessage(messageData);

            clientMessageProcessor.SendMessageToReflector(switchRoomMessage);
        }
Exemple #12
0
        //this is not used yet, however this iteration i have tasks related to this - matt
        public static void SearchRooms(string searchString, int startIndex, int blockSize)
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();
            Message searchRoomMessage = new Message();

            searchRoomMessage.Callback = (int)MessageSubType.SearchRooms;
            List <object> messageData = new List <object>();

            messageData.Add(searchString);
            messageData.Add(startIndex);
            messageData.Add(blockSize);
            searchRoomMessage.RoomMessage(messageData);

            clientMessageProcessor.SendMessageToReflector(searchRoomMessage);
        }
Exemple #13
0
        /// <summary>
        /// Log an event with one label/data pair.
        /// </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 LogNoMixPanel(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);
            }
            else
            {
                Console.WriteLine(String.Format("Warning: EventLogger not ready to log {0}, {1}, {2}, {3}", categoryName, eventName, optLabel, optData));
            }
        }
Exemple #14
0
        public void SaveUserProperties()
        {
            ClientMessageProcessor clientMessageProcessor = GameFacade.Instance.RetrieveProxy <ClientMessageProcessor>();

            if (clientMessageProcessor != null)
            {
                List <object> saveUserPropertiesMessageData = new List <object>();
                saveUserPropertiesMessageData.Add(mUserProperties);

                Message saveUserPropertiesMessage = new Message();
                saveUserPropertiesMessage.Callback = (int)MessageSubType.SaveUserProperties;
                saveUserPropertiesMessage.AccountMessage(saveUserPropertiesMessageData);

                clientMessageProcessor.SendMessageToReflector(saveUserPropertiesMessage);
            }
            else
            {
                throw new Exception("Unable to get ClientMessageProcessor mediator.");
            }
        }