/// <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)); } }
/// <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)); } }
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); }
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); }
/// <summary> /// Send paymentItemCommand string to server. /// </summary> /// <param name="paymentItemsCommand"></param> private void SendPaymentItemsMessage(string paymentItemsCommand, int callbackActionType) { Message paymentItemsMessage = new Message(); List <object> dataObject = new List <object>(); dataObject.Add(paymentItemsCommand); paymentItemsMessage.PaymentItemsMessage(dataObject); paymentItemsMessage.Callback = callbackActionType; mClientMessageProcessor.SendMessageToReflector(paymentItemsMessage); }
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); }
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); }
//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); }
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); }
//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); }
/// <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)); } }
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."); } }