/// <summary> /// Sends the progress. /// </summary> /// <param name="progress">Progress.</param> /// <param name="tags">Tags.</param> public static void SendProgress(Dictionary <string, object> progress, List <object> tags) { string progressString = FuelSDKCommon.Serialize(progress); string tagsString = FuelSDKCommon.Serialize(tags); if (progress == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "sending undefined progress"); } else { if (tags == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "sending progress '" + progressString + "' with undefined tags"); } else { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "sending progress '" + progressString + "' with tags: " + tagsString); } } if (progressString == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "unable to serialize the progress dictionary"); return; } if (!Application.isEditor) { GetFuelSDKPlatform().SendProgress(progressString, tagsString); } }
/// <summary> /// Execs the method. /// </summary> /// <returns><c>true</c>, if method was execed, <c>false</c> otherwise.</returns> /// <param name="method">Method.</param> /// <param name="parameters">Parameters.</param> public static bool ExecMethod(string method, List <object> parameters) { string parametersString = FuelSDKCommon.Serialize(parameters); if (method == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "executing undefined method"); } else { if (parameters == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "executing method '" + method + "' with undefined parameters"); } else { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "executing method '" + method + "' with parameters: " + parametersString); } } bool succeeded = false; if (!Application.isEditor) { succeeded = GetFuelSDKPlatform().ExecMethod(method, parametersString); } return(succeeded); }
public void OnIgniteLeaderBoard(Dictionary <string, object> leaderBoard) { if (leaderBoard == null) { Debug.Log("OnIgniteLeaderBoard - undefined leaderboard"); return; } if (leaderBoard.Count == 0) { Debug.Log("OnIgniteLeaderBoard - empty leaderboard"); return; } string leaderBoardString = FuelSDKCommon.Serialize(leaderBoard); if (leaderBoardString == null) { Debug.Log("OnIgniteLeaderBoard - unable to serialize the leaderboard"); return; } Debug.Log("OnIgniteLeaderBoard - leaderboard: " + leaderBoardString); // process the leaderboard information }
public void OnIgniteQuest(Dictionary <string, object> quest) { if (quest == null) { Debug.Log("OnIgniteQuest - undefined quest"); return; } if (quest.Count == 0) { Debug.Log("OnIgniteQuest - empty quest"); return; } string questString = FuelSDKCommon.Serialize(quest); if (questString == null) { Debug.Log("OnIgniteQuest - unable to serialize the quest"); return; } Debug.Log("OnIgniteQuest - quest: " + questString); // process the quest information }
public void OnSocialInvite(Dictionary <string, string> inviteDetail) { if (inviteDetail == null) { Debug.Log("OnSocialInvite - undefined invite details"); return; } if (inviteDetail.Count == 0) { Debug.Log("OnSocialInvite - empty invite details"); return; } string inviteDetailString = FuelSDKCommon.Serialize(inviteDetail); if (inviteDetailString == null) { Debug.Log("OnSocialInvite - unable to serialize the invite details"); return; } Debug.Log("OnSocialInvite - invite details: " + inviteDetailString); Debug.Log("OnSocialInvite - invoking fake social invite"); // fake social invite StartCoroutine(PerformSocialInvite(inviteDetail)); }
public void OnCompeteTournamentInfo(Dictionary <string, string> tournamentInfo) { if (tournamentInfo == null) { Debug.Log("OnCompeteTournamentInfo - undefined tournamentInfo"); return; } if (tournamentInfo.Count == 0) { Debug.Log("OnCompeteTournamentInfo - empty tournamentInfo"); // can have no tournament info in the case where // no current or future tournament has been // scheduled return; } string tournamentInfoString = FuelSDKCommon.Serialize(tournamentInfo); if (tournamentInfoString == null) { Debug.Log("OnCompeteTournamentInfo - unable to serialize tournament info"); return; } Debug.Log("OnCompeteTournamentInfo - tournament info: " + tournamentInfoString); // compare the tournament start date against the current date to // determine if the tournament is currently running or is scheduled // to run in the future // update game UI with scheduled/running tournament information }
public void OnSocialShare(Dictionary <string, string> shareDetail) { if (shareDetail == null) { Debug.Log("OnSocialShare - undefined share details"); return; } if (shareDetail.Count == 0) { Debug.Log("OnSocialShare - empty share details"); return; } string shareDetailString = FuelSDKCommon.Serialize(shareDetail); if (shareDetailString == null) { Debug.Log("OnSocialShare - unable to serialize the share details"); return; } Debug.Log("OnSocialShare - share details: " + shareDetailString); Debug.Log("OnSocialShare - invoking fake social share"); // fake social share StartCoroutine(PerformSocialShare(shareDetail)); }
public void OnIgniteMission(Dictionary <string, object> mission) { if (mission == null) { Debug.Log("OnIgniteMission - undefined mission"); return; } if (mission.Count == 0) { Debug.Log("OnIgniteMission - empty mission"); return; } string missionString = FuelSDKCommon.Serialize(mission); if (missionString == null) { Debug.Log("OnIgniteMission - unable to serialize the mission"); return; } Debug.Log("OnIgniteMission - mission: " + missionString); // process the mission information }
public void OnUserValues(Dictionary <string, string> conditions, Dictionary <string, string> variables) { if (conditions == null) { Debug.Log("OnUserValues - undefined conditions"); return; } if (conditions.Count == 0) { Debug.Log("OnUserValues - empty conditions"); } string conditionsString = FuelSDKCommon.Serialize(conditions); if (conditionsString == null) { Debug.Log("OnUserValues - unable to serialize conditions"); return; } Debug.Log("OnUserValues - conditions: " + conditionsString); if (variables == null) { Debug.Log("OnUserValues - undefined variables"); return; } if (variables.Count == 0) { Debug.Log("OnUserValues - empty variables"); } string variablesString = FuelSDKCommon.Serialize(variables); if (variablesString == null) { Debug.Log("OnUserValues - unable to serialize variables"); return; } Debug.Log("OnUserValues - variables: " + variablesString); // update game experience depending on the user values (variables) received }
/// <summary> /// FUEL DYNAMICS - SetUserConditions /// /// </summary> /// <returns> /// True if the call to the SDK succeeded. /// </returns> /// <param name="conditions"> /// A dictionary filled with values the SDK needs to use to properly pass the result to the Propeller servers. Examples: score, tournamentID, matchID, etc. /// </param> public static bool SetUserConditions(Dictionary <string, object> conditions) { string userConditions = FuelSDKCommon.Serialize(conditions); if (conditions == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "setting undefined user conditions"); } else { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "setting user conditions: " + userConditions); } bool succeeded = false; if (!Application.isEditor) { succeeded = GetFuelSDKPlatform().SetUserConditions(userConditions); } return(succeeded); }
/// <summary> /// Gets the events. /// </summary> /// <returns><c>true</c>, if events was gotten, <c>false</c> otherwise.</returns> public static bool GetEvents(List <object> eventTags) { string eventTagsString = FuelSDKCommon.Serialize(eventTags); if (eventTags == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "getting events with undefined tags"); } else { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "getting events with tags: " + eventTagsString); } bool succeeded = false; if (!Application.isEditor) { succeeded = GetFuelSDKPlatform().GetEvents(eventTagsString); } return(succeeded); }
public void OnUpdatedUserInfo(Dictionary <string, object> data) { string dataString = FuelSDKCommon.Serialize(data); Debug.Log("OnUpdatedUserInfo - data: " + dataString); }
public void OnCompeteUICompletedWithMatch(Dictionary <string, object> matchInfo) { if (matchInfo == null) { Debug.Log("OnCompeteUICompletedWithMatch - undefined match info"); return; } if (matchInfo.Count == 0) { Debug.Log("OnCompeteUICompletedWithMatch - empty match info"); return; } string matchInfoString = FuelSDKCommon.Serialize(matchInfo); if (matchInfoString == null) { Debug.Log("OnCompeteUICompletedWithMatch - unable to serialize match info"); return; } Debug.Log("OnCompeteUICompletedWithMatch - match info: " + matchInfoString); object tournamentIDObject = matchInfo["tournamentID"]; if (tournamentIDObject == null) { Debug.Log("OnCompeteUICompletedWithMatch - missing expected tournament ID"); return; } if (!(tournamentIDObject is string)) { Debug.Log("OnCompeteUICompletedWithMatch - invalid tournament ID data type: " + tournamentIDObject.GetType().Name); return; } string tournamentID = (string)tournamentIDObject; object matchIDObject = matchInfo["matchID"]; if (matchIDObject == null) { Debug.Log("OnCompeteUICompletedWithMatch - missing expected match ID"); return; } if (!(matchIDObject is string)) { Debug.Log("OnCompeteUICompletedWithMatch - invalid match ID data type: " + matchIDObject.GetType().Name); return; } string matchID = (string)matchIDObject; // Caching match information for later m_tournamentID = tournamentID; m_matchID = matchID; // fake playing a match StartCoroutine(PerformMatch(matchInfo)); }
public void OnVirtualGoodList(string transactionID, List <object> virtualGoods) { if (transactionID == null) { Debug.Log("OnVirtualGoodList - transaction ID: <undefined>"); return; } Debug.Log("OnVirtualGoodList - transaction ID: " + transactionID); m_transactionID = transactionID; if (virtualGoods == null) { Debug.Log("OnVirtualGoodList - virtual good: <undefined_list>"); return; } m_consumedVirtualGoodIDs.Clear(); if (virtualGoods.Count == 0) { Debug.Log("OnVirtualGoodList - virtual good: <empty_list>"); return; } string virtualGoodsString = FuelSDKCommon.Serialize(virtualGoods); if (virtualGoodsString == null) { Debug.Log("OnVirtualGoodList - unable to serialize the virtual good list"); return; } Debug.Log("OnVirtualGoodList - virtual goods: " + virtualGoodsString); bool consumed = true; foreach (object virtualGoodObject in virtualGoods) { Dictionary <string, object> virtualGood = virtualGoodObject as Dictionary <string, object>; if (virtualGood == null) { Debug.Log("OnVirtualGoodList - invalid virtual good data type: " + virtualGoodObject.GetType().Name); consumed = false; break; } object goodIDObject = virtualGood["goodId"]; if (goodIDObject == null) { Debug.Log("OnVirtualGoodList - missing expected virtual good ID"); consumed = false; break; } if (!(goodIDObject is string)) { Debug.Log("OnVirtualGoodList - invalid virtual good ID data type: " + goodIDObject.GetType().Name); consumed = false; break; } string goodID = (string)goodIDObject; // based on the virtual good ID, update the player // inventory with the received virtual good m_consumedVirtualGoodIDs.Add(goodID); } if (!consumed) { foreach (string goodID in m_consumedVirtualGoodIDs) { // revert the currently awarded virtual goods for // this transaction from the player inventory Debug.Log("OnVirtualGoodList - reverting consumed virtual good ID: " + goodID); } m_consumedVirtualGoodIDs.Clear(); } FuelSDK.AcknowledgeVirtualGoods(transactionID, consumed); }
/// <summary> /// Submits the results of the match. You must stuff the match result into a dictionary that will be parsed and passed to the SDK API servers.. /// Current parameters: /// matchID /// tournamentID /// score /// </summary> /// <returns> /// True if the match results were submitted. /// </returns> /// <param name="matchResult"> /// A dictionary filled with values the SDK needs to use to properly pass the result to the API servers. Examples: score, tournamentID, matchID, etc. /// </param> public static bool SubmitMatchResult(Dictionary <string, object> matchResult) { if (matchResult == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "submitting undefined match result"); } else { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "submitting match result: " + FuelSDKCommon.Serialize(matchResult)); } bool succeeded = false; if (!Application.isEditor) { JSONClass matchResultJSON = FuelSDKCommon.toJSONClass(matchResult); if (matchResultJSON == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "unable to coerce match result dictionary into a JSON class"); } else { succeeded = GetFuelSDKPlatform().SubmitMatchResult(matchResultJSON.ToString()); } } if (succeeded) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "match result was submitted"); } else { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "match result was not submitted"); } return(succeeded); }
public void OnIgniteLeaderBoard(Dictionary <string, object> leaderBoard) { if (leaderBoard == null) { Debug.Log("OnIgniteLeaderBoard - undefined leaderboard"); return; } if (leaderBoard.Count == 0) { Debug.Log("OnIgniteLeaderBoard - empty leaderboard"); return; } string leaderBoardString = FuelSDKCommon.Serialize(leaderBoard); if (leaderBoardString == null) { Debug.Log("OnIgniteLeaderBoard - unable to serialize the leaderboard"); return; } Debug.Log("OnIgniteLeaderBoard - leaderboard: " + leaderBoardString); // START PROCESSING - process the leaderboard information if (leaderBoard.ContainsKey("id")) { string Id = Convert.ToString(leaderBoard["id"]); } if (leaderBoard.ContainsKey("progress")) { int Progress = Convert.ToInt32(leaderBoard["progress"]); } if (leaderBoard.ContainsKey("currentUserId")) { string CurrentUserId = Convert.ToString(leaderBoard["currentUserId"]); } if (leaderBoard.ContainsKey("rule")) { Dictionary <string, object> leaderBoardRuleDict = leaderBoard["rule"] as Dictionary <string, object>; if (leaderBoardRuleDict.ContainsKey("id")) { string Id = Convert.ToString(leaderBoardRuleDict["id"]); } if (leaderBoardRuleDict.ContainsKey("variable")) { string Variable = Convert.ToString(leaderBoardRuleDict["variable"]); } if (leaderBoardRuleDict.ContainsKey("kind")) { int Kind = Convert.ToInt32(leaderBoardRuleDict["kind"]); } if (leaderBoardRuleDict.ContainsKey("score")) { int Score = Convert.ToInt32(leaderBoardRuleDict["score"]); } } if (leaderBoard.ContainsKey("leaderList")) { Dictionary <string, object> leaderListDict = leaderBoard["leaderList"] as Dictionary <string, object>; if (leaderListDict.ContainsKey("leaders")) { List <object> leaderList = leaderListDict["leaders"] as List <object>; foreach (object leaderObject in leaderList) { Dictionary <string, object> leaderDict = leaderObject as Dictionary <string, object>; if (leaderDict.ContainsKey("id")) { string Id = Convert.ToString(leaderDict["id"]); } if (leaderDict.ContainsKey("name")) { string Name = Convert.ToString(leaderDict["name"]); } if (leaderDict.ContainsKey("score")) { int Score = Convert.ToInt32(leaderDict["score"]); } if (leaderDict.ContainsKey("rank")) { int Rank = Convert.ToInt32(leaderDict["rank"]); } } } } }
/// <summary> /// Data Receiver /// </summary> /// <param name="message">data</param> private void DataReceiver(string message) { if (m_listener == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "Fuel SDK listener has not been set"); return; } if (message == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "received undefined message"); return; } object messageObject = FuelSDKCommon.Deserialize(message); if (messageObject == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "message could not be deserialized"); return; } Dictionary <string, object> messageDictionary = null; try{ messageDictionary = messageObject as Dictionary <string, object>; if (messageDictionary == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, " message data type: " + messageObject.GetType().Name); return; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, " message data type: " + messageObject.GetType().Name + " error message : " + e.Message); return; } object actionObject; bool keyExists = messageDictionary.TryGetValue("action", out actionObject); if (actionObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "received undefined action for message: " + message); return; } if (!(actionObject is string)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid action data type: " + actionObject.GetType().Name); return; } string action = (string)actionObject; DataReceiverAction dataReceiverAction = DataReceiverAction.none; if (!FuelSDKCommon.TryParseEnum <DataReceiverAction> (action, out dataReceiverAction)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "unsupported action: " + action); return; } object dataObject; keyExists = messageDictionary.TryGetValue("data", out dataObject); if (dataObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "no specific data in the response object for action: " + action); return; } Dictionary <string, object> data = null; try{ data = dataObject as Dictionary <string, object>; if (data == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid data data type" + dataObject.GetType().Name); return; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid data data type" + dataObject.GetType().Name + " error message : " + e.Message); return; } string dataString = FuelSDKCommon.Serialize(data); if (dataString == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "data could not be serialized"); return; } FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "received '" + action + "': " + dataString); switch (dataReceiverAction) { case DataReceiverAction.none: { // noop break; } case DataReceiverAction.fuelSDKVirtualGoodList: { object transactionIDObject; keyExists = data.TryGetValue("transactionID", out transactionIDObject); if (transactionIDObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected transaction ID"); break; } if (!(transactionIDObject is string)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid transaction ID data type: " + transactionIDObject.GetType().Name); break; } string transactionID = (string)transactionIDObject; object virtualGoodsObject; keyExists = data.TryGetValue("virtualGoods", out virtualGoodsObject); if (virtualGoodsObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected virtual goods list"); break; } List <object> virtualGoods = null; try{ virtualGoods = virtualGoodsObject as List <object>; if (virtualGoods == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid virtual goods list data type: " + virtualGoodsObject.GetType().Name); break; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid virtual goods list data type: " + virtualGoodsObject.GetType().Name + " error message : " + e.Message); break; } m_listener.OnVirtualGoodList(transactionID, virtualGoods); break; } case DataReceiverAction.fuelSDKVirtualGoodRollback: { object transactionIDObject; keyExists = data.TryGetValue("transactionID", out transactionIDObject); if (transactionIDObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected transaction ID"); break; } if (!(transactionIDObject is string)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid transaction ID data type: " + transactionIDObject.GetType().Name); break; } m_listener.OnVirtualGoodRollback((string)transactionIDObject); break; } case DataReceiverAction.fuelSDKNotificationEnabled: { object notificationTypeObject; keyExists = data.TryGetValue("notificationType", out notificationTypeObject); if (notificationTypeObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected notification type"); break; } if (!(notificationTypeObject is long)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid notification type data type: " + notificationTypeObject.GetType().Name); break; } int notificationTypeValue = (int)((long)notificationTypeObject); if (!Enum.IsDefined(typeof(NotificationType), notificationTypeValue)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "unsuppported notification type value: " + notificationTypeValue.ToString()); break; } m_listener.OnNotificationEnabled((NotificationType)notificationTypeValue); break; } case DataReceiverAction.fuelSDKNotificationDisabled: { object notificationTypeObject; keyExists = data.TryGetValue("notificationType", out notificationTypeObject); if (notificationTypeObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected notification type"); break; } if (!(notificationTypeObject is long)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid notification type data type: " + notificationTypeObject.GetType().Name); break; } int notificationTypeValue = (int)((long)notificationTypeObject); if (!Enum.IsDefined(typeof(NotificationType), notificationTypeValue)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "unsuppported notification type value: " + notificationTypeValue.ToString()); break; } m_listener.OnNotificationDisabled((NotificationType)notificationTypeValue); break; } case DataReceiverAction.fuelSDKSocialLoginRequest: { object allowCacheObject; keyExists = data.TryGetValue("allowCache", out allowCacheObject); if (allowCacheObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected allow cache flag"); break; } if (!(allowCacheObject is bool)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid allow cache data type: " + allowCacheObject.GetType().Name); break; } bool allowCache = (bool)allowCacheObject; m_listener.OnSocialLogin(allowCache); break; } case DataReceiverAction.fuelSDKSocialInviteRequest: { m_listener.OnSocialInvite(FuelSDKCommon.ToStringDictionary <string, object> (data)); break; } case DataReceiverAction.fuelSDKSocialShareRequest: { m_listener.OnSocialShare(FuelSDKCommon.ToStringDictionary <string, object> (data)); break; } case DataReceiverAction.fuelSDKImplicitLaunchRequest: { object applicationStateObject; keyExists = data.TryGetValue("applicationState", out applicationStateObject); if (applicationStateObject == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected application state"); break; } if (!(applicationStateObject is string)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid application state data type: " + applicationStateObject.GetType().Name); break; } string applicationStateString = (string)applicationStateObject; ApplicationState applicationState = ApplicationState.none; if (!FuelSDKCommon.TryParseEnum <ApplicationState> (applicationStateString, out applicationState)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "unsupported application state: " + applicationStateString); return; } m_listener.OnImplicitLaunch(applicationState); break; } case DataReceiverAction.fuelSDKUserValues: { object conditionsObject; keyExists = data.TryGetValue("dynamicConditions", out conditionsObject); if (conditionsObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected dynamic conditions"); break; } Dictionary <string, object> conditions = null; try{ conditions = conditionsObject as Dictionary <string, object>; if (conditions == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid conditions data type: " + conditionsObject.GetType().Name); break; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid conditions data type: " + conditionsObject.GetType().Name + " error message : " + e.Message); break; } object variablesObject; keyExists = data.TryGetValue("variables", out variablesObject); if (variablesObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected dynamic variables"); break; } Dictionary <string, object> variables = null; try{ variables = variablesObject as Dictionary <string, object>; if (variables == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid variables data type: " + variablesObject.GetType().Name); break; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid variables data type: " + variablesObject.GetType().Name + " error message : " + e.Message); break; } m_listener.OnUserValues(FuelSDKCommon.ToStringDictionary <string, object> (conditions), FuelSDKCommon.ToStringDictionary <string, object> (variables)); break; } case DataReceiverAction.fuelSDKCompeteChallengeCount: { object countObject; keyExists = data.TryGetValue("count", out countObject); if (countObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected challenge count"); break; } if (!(countObject is long)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid challenge count data type: " + countObject.GetType().Name); break; } int count = (int)((long)countObject); m_listener.OnCompeteChallengeCount(count); break; } case DataReceiverAction.fuelSDKCompeteTournamentInfo: { m_listener.OnCompeteTournamentInfo(FuelSDKCommon.ToStringDictionary <string, object> (data)); break; } case DataReceiverAction.fuelSDKCompeteUICompletedExit: { m_listener.OnCompeteUICompletedWithExit(); break; } case DataReceiverAction.fuelSDKCompeteUICompletedMatch: { m_listener.OnCompeteUICompletedWithMatch(data); break; } case DataReceiverAction.fuelSDKCompeteUICompletedFail: { object reasonObject; keyExists = data.TryGetValue("message", out reasonObject); if (reasonObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected failure reason"); break; } if (!(reasonObject is string)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid failure reason data type: " + reasonObject.GetType().Name); break; } string reason = (string)reasonObject; m_listener.OnCompeteUIFailed(reason); break; } case DataReceiverAction.fuelSDKIgniteEvents: { if (!validateDataReceived(dataReceiverAction, data)) { break; } object eventsObject; keyExists = data.TryGetValue("events", out eventsObject); if (eventsObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected event list"); break; } List <object> events = null; try{ events = eventsObject as List <object>; if (events == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid event list data type: " + eventsObject.GetType().Name); break; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid event list data type: " + eventsObject.GetType().Name + " error message : " + e.Message); break; } m_listener.OnIgniteEvents(events); break; } case DataReceiverAction.fuelSDKIgniteLeaderBoard: { if (!validateDataReceived(dataReceiverAction, data)) { break; } object leaderBoardObject; keyExists = data.TryGetValue("leaderBoard", out leaderBoardObject); if (leaderBoardObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected leaderboard data"); break; } Dictionary <string, object> leaderBoard = null; try{ leaderBoard = leaderBoardObject as Dictionary <string, object>; if (leaderBoard == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid leaderboard data type: " + leaderBoardObject.GetType().Name); break; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid leaderboard data type: " + leaderBoardObject.GetType().Name + " error message : " + e.Message); break; } m_listener.OnIgniteLeaderBoard(leaderBoard); break; } case DataReceiverAction.fuelSDKIgniteMission: { if (!validateDataReceived(dataReceiverAction, data)) { break; } object missionObject; keyExists = data.TryGetValue("mission", out missionObject); if (missionObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected mission data"); break; } Dictionary <string, object> mission = null; try{ mission = missionObject as Dictionary <string, object>; if (mission == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid mission data type: " + missionObject.GetType().Name); break; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid mission data type: " + missionObject.GetType().Name + " error message : " + e.Message); break; } m_listener.OnIgniteMission(mission); break; } case DataReceiverAction.fuelSDKIgniteQuest: { if (!validateDataReceived(dataReceiverAction, data)) { break; } object questObject; keyExists = data.TryGetValue("quest", out questObject); if (questObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected quest data"); break; } Dictionary <string, object> quest = null; try{ quest = questObject as Dictionary <string, object>; if (quest == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid quest data type: " + questObject.GetType().Name); break; } }catch (Exception e) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid quest data type: " + questObject.GetType().Name + " error message : " + e.Message); break; } m_listener.OnIgniteQuest(quest); break; } case DataReceiverAction.fuelSDKIgniteJoinEvent: { if (!validateDataReceived(dataReceiverAction, data)) { break; } object eventIDObject; keyExists = data.TryGetValue("eventID", out eventIDObject); if (eventIDObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected event ID"); break; } if (!(eventIDObject is string)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid event ID data type: " + eventIDObject.GetType().Name); break; } string eventID = (string)eventIDObject; object joinStatusObject; keyExists = data.TryGetValue("joinStatus", out joinStatusObject); if (joinStatusObject == null || keyExists == false) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "missing expected join status"); break; } if (!(joinStatusObject is bool)) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.ERROR, "invalid join status data type: " + joinStatusObject.GetType().Name); break; } bool joinStatus = (bool)joinStatusObject; m_listener.OnIgniteJoinEvent(eventID, joinStatus); break; } default: { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.WARN, "unsupported action: " + action); break; } } }
public void OnUserAvatars(Dictionary <string, object> avatars) { string dataString = FuelSDKCommon.Serialize(avatars); Debug.Log("OnUserAvatars - avatars: " + dataString); }
/// <summary> /// Begins an asynchronous operation to indicate login info is complete. /// </summary> /// <param name="loginInfo">Login info.</param> public static void SdkSocialLoginCompleted(Dictionary <string, string> loginInfo) { if (loginInfo == null) { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "social login completed unsuccessfully"); } else { FuelSDKCommon.Log(FuelSDKCommon.LogLevel.DEBUG, "social login completed with login info: " + FuelSDKCommon.Serialize(loginInfo)); } if (!Application.isEditor) { GetFuelSDKPlatform().SdkSocialLoginCompleted(loginInfo); } }