public static void graphRequest(string graphPath, string httpMethod, Dictionary <string, string> parameters) { if (Application.platform != RuntimePlatform.Android) { return; } parameters = (parameters ?? new Dictionary <string, string>()); if (!FacebookAndroid.isSessionValid()) { FacebookAndroid.babysitRequest(true, delegate { FacebookAndroid._facebookPlugin.Call("graphRequest", new object[] { graphPath, httpMethod, parameters.toJson() }); }); } else { FacebookAndroid._facebookPlugin.Call("graphRequest", new object[] { graphPath, httpMethod, parameters.toJson() }); } }
public static void showDialog(string dialogType, Dictionary <string, string> parameters) { if (Application.platform != RuntimePlatform.Android) { return; } parameters = (parameters ?? new Dictionary <string, string>()); if (!FacebookAndroid.isSessionValid()) { FacebookAndroid.babysitRequest(false, delegate { FacebookAndroid._facebookPlugin.Call("showDialog", new object[] { dialogType, parameters.toJson() }); }); } else { FacebookAndroid._facebookPlugin.Call("showDialog", new object[] { dialogType, parameters.toJson() }); } }
// Full access to any existing or new Facebook dialogs that get added. See Facebooks documentation for parameters and dialog types public static void showDialog(string dialogType, Dictionary <string, string> options) { if (Application.platform == RuntimePlatform.IPhonePlayer) { // if we arent logged in start up the babysitter if (!isSessionValid()) { babysitRequest(false, () => { _facebookShowDialog(dialogType, options.toJson()); }); } else { _facebookShowDialog(dialogType, options.toJson()); } } }
/// <summary> /// <para>name : SendGetItem</para> /// <para>parameter : int</para> /// <para>return : void</para> /// <para>describe : Send get item "notice" message to server - when (int)parameter index.</para> /// </summary> public void SendGetItem(int getWhat) { int getFrom = GetFromType(); if (getFrom.Equals((int)ChatGetItemFrom.Type_None)) { return; } string pno = ((int)SendMessageType.Type_GetItem).ToString(); string from = string.Format("{0}", getFrom.ToString()); string what = string.Format("{0}", getWhat.ToString()); Dictionary <string, string> post = new Dictionary <string, string>(); post.Add("pno", pno); post.Add("From", from); post.Add("What", what); if (ClientDataManager.Instance != null && ClientDataManager.Instance.SessionCode != "") { post.Add("SessionKey", ClientDataManager.Instance.SessionCode); } Send(post.toJson()); }
// Full access to any existing or new Facebook dialogs that get added. See Facebooks documentation for parameters and dialog types public static void showDialog(string dialogType, Dictionary <string, string> options) { if (Application.platform == RuntimePlatform.IPhonePlayer) { _facebookShowDialog(dialogType, options.toJson()); } }
private static void SaveEditedScene(CustomScene scene) { // Write the scene to a file try { string outPath = string.Join(Path.DirectorySeparatorChar.ToString(), new string[] { scene.Owner.DefaultResourcePath, "Scenes", scene.Name, "scene.json" }); // Save all images to a JSON object Dictionary <string, object> jsonObj = scene.ToJsonObj(); foreach (var img in scene.Images) { img.OnSave(jsonObj); } // Write to a file Directory.CreateDirectory(Path.GetDirectoryName(outPath)); File.WriteAllText(outPath, jsonObj.toJson()); // Unset all dirty flags foreach (var img in scene.Images) { img.dirty = false; } scene.dirty = false; } catch (Exception e) { Debug.Log("Failed to save scene to file!"); Debug.LogException(e); } }
// Shows the Facebook share dialog. Valid dictionary keys (from FBLinkShareParams) are: link, name, caption, description, picture, friends (array) public static void showFacebookShareDialog(Dictionary <string, object> parameters) { if (Application.platform == RuntimePlatform.IPhonePlayer) { _facebookShowFacebookShareDialog(parameters.toJson()); } }
// Performs a request for any available Twitter API methods. methodType must be either "get" or "post". path is the // url fragment from the API docs (excluding https://api.twitter.com) and parameters is a dictionary of key/value pairs // for the given method. Path must request .json! See Twitter's API docs for all available methods. public static void performRequest(string methodType, string path, Dictionary <string, string> parameters) { if (Application.platform == RuntimePlatform.IPhonePlayer) { _twitterPerformRequest(methodType, path, parameters != null ? parameters.toJson() : null); } }
// Sets user cookies for the ad session public static void adsSetUserCookies(Dictionary <string, string> cookies) { if (Application.platform == RuntimePlatform.IPhonePlayer) { _flurryAdsSetUserCookies(cookies.toJson()); } }
// Starts up the SDK with the given appId and userData. See VGUserData for allowed values. public static void startWithAppIdAndUserData(string appId, Dictionary <string, object> userData) { if (Application.platform == RuntimePlatform.IPhonePlayer) { _vungleStartWithAppIdAndUserData(appId, userData.toJson()); } }
// Tracks an event with additional metadata public static void trackEventWithMetadata(string eventIdentifier, Dictionary <string, string> metadata) { if (Application.platform == RuntimePlatform.IPhonePlayer) { _chartBoostTrackEventWithMetadata(eventIdentifier, metadata.toJson()); } }
// Tracks an event with a value and additional metadata public static void trackEventWithValueAndMetadata(string eventIdentifier, float value, Dictionary <string, object> metadata) { if (Application.platform == RuntimePlatform.IPhonePlayer) { _chartBoostTrackEventWithValueAndMetadata(eventIdentifier, value, metadata.toJson()); } }
/// <summary> /// <para>name : Disconnect</para> /// <para>parameter : </para> /// <para>return : void</para> /// <para>describe : Disconnect socket and clear connect info.</para> /// </summary> public void Disconnect() { if (tcpSocket == null) { return; } if (tcpSocket.Connected == false) { return; } isUserConnectComplete = false; string pno = ((int)SendMessageType.Type_Disconnect).ToString(); Dictionary <string, string> post = new Dictionary <string, string>(); post.Add("pno", pno); if (ClientDataManager.Instance != null && ClientDataManager.Instance.SessionCode != "") { post.Add("SessionKey", ClientDataManager.Instance.SessionCode); } Send(post.toJson()); }
public void initialise(IBillingServiceCallback callback) { this.callback = callback; if (null == publicKey || publicKey.Equals("[Your key]")) { callback.logError(UnibillError.GOOGLEPLAY_PUBLICKEY_NOTCONFIGURED, publicKey); callback.onSetupComplete(false); return; } var encoder = new Dictionary <string, object>(); encoder.Add("publicKey", this.publicKey); var productIds = new List <string>(); List <object> products = new List <object>(); foreach (var item in db.AllPurchasableItems) { Dictionary <string, object> product = new Dictionary <string, object>(); var id = remapper.mapItemIdToPlatformSpecificId(item); productIds.Add(id); product.Add("productId", id); product.Add("consumable", item.PurchaseType == PurchaseType.Consumable); products.Add(product); } encoder.Add("products", products); var json = encoder.toJson(); rawInterface.initialise(this, json, productIds.ToArray()); }
public override void Purchase(ProductDefinition product, string developerPayload) { m_Bindings.Purchase(product.storeSpecificId, (success, message) => { var dic = message.HashtableFromJson(); if (success) { var transactionId = dic.GetString("GameOrderId"); var storeSpecificId = dic.GetString("ProductId"); if (!string.IsNullOrEmpty(transactionId)) { dic["transactionId"] = transactionId; } if (!string.IsNullOrEmpty(storeSpecificId)) { dic["storeSpecificId"] = storeSpecificId; } if (!product.storeSpecificId.Equals(storeSpecificId)) { m_Logger.LogFormat(LogType.Error, "UDPImpl received mismatching product Id for purchase. Expected {0}, received {1}", product.storeSpecificId, storeSpecificId); } var data = dic.toJson(); unity.OnPurchaseSucceeded(product.storeSpecificId, data, transactionId); } else { if (dic.ContainsKey(k_Errorcode) && Convert.ToInt32(dic[k_Errorcode]) == PURCHASE_PENDING_CODE) { if (null != m_DeferredCallback) { OnPurchaseDeferred(product.storeSpecificId); } return; } PurchaseFailureReason reason = (PurchaseFailureReason)Enum.Parse(typeof(PurchaseFailureReason), k_Unknown); var reasonString = reason.ToString(); var errDic = new Dictionary <string, object> { ["error"] = reasonString }; if (dic.ContainsKey("purchaseInfo")) { errDic["purchaseInfo"] = dic["purchaseInfo"]; } var errData = errDic.toJson(); var pfd = new PurchaseFailureDescription(product.storeSpecificId, reason, message); unity.OnPurchaseFailed(pfd); } }, developerPayload); }
// Performs a request for any available Twitter API methods. methodType must be either "get" or "post". path is the // url fragment from the API docs (excluding https://api.twitter.com) and parameters is a dictionary of key/value pairs // for the given method. See Twitter's API docs for all available methods public static void performRequest( string methodType, string path, Dictionary<string,string> parameters ) { if( Application.platform != RuntimePlatform.Android ) return; string param = parameters != null ? parameters.toJson() : string.Empty; _plugin.Call( "performRequest", methodType, path, param ); }
// Tracks an event with optional meta data public static void trackEvent( string eventIdentifier, double value, Dictionary<string,object> metaData ) { if( Application.platform != RuntimePlatform.Android ) return; metaData = metaData ?? new Dictionary<string,object>(); _plugin.Call( "trackEvent", eventIdentifier, value, metaData.toJson() ); }
// Shows the native Facebook Share Dialog. Valid dictionary keys (from FBShareDialogParams) are: link, name, caption, description, picture, friends (array) public static void showFacebookShareDialog(Dictionary <string, object> parameters) { if (Application.platform != RuntimePlatform.Android) { return; } _facebookPlugin.Call("showFacebookShareDialog", parameters.toJson()); }
// Tracks a custom event with optional parameters public static void tagEvent(string eventName, Dictionary <string, string> parameters = null) { if (Application.platform != RuntimePlatform.Android) { return; } _plugin.Call("tagEvent", eventName, parameters != null ? parameters.toJson() : string.Empty); }
public static void init(string appId, Dictionary <string, string> optionalInMobiParams = null) { if (Application.platform != RuntimePlatform.Android) { return; } _plugin.Call("initialize", appId, optionalInMobiParams != null ? optionalInMobiParams.toJson() : string.Empty); }
// Logs the end of a section public static void endSection(string sectionName, Dictionary <string, string> parameters = null) { if (Application.platform != RuntimePlatform.Android) { return; } _plugin.Call("endSection", sectionName, parameters != null ? parameters.toJson() : string.Empty); }
// Starts a session public static void startSessionManually(Dictionary <string, string> parameters = null) { if (Application.platform != RuntimePlatform.Android) { return; } _plugin.Call("startSessionManually", parameters != null ? parameters.toJson() : string.Empty); }
/// <summary> /// Set the specified val and metadata. /// </summary> /// <param name='val'> /// Value. /// </param> /// <param name='metadata'> /// Metadata. /// </param> public void Set(string val, Dictionary <string, string> metadata) { #if UNITY_ANDROID javaObject.Call("set", val, DictionaryToAndroidHashMap(metadata)); #elif UNITY_IOS && !UNITY_EDITOR string metadataAsJSON = (null != metadata) ? metadata.toJson() : null; _AmazonGCWSSetLatestStringMetadataAsJSON(key, val, metadataAsJSON); #endif }
// Performs a request for any available Twitter API methods. methodType must be either "get" or "post". path is the // url fragment from the API docs (excluding https://api.twitter.com) and parameters is a dictionary of key/value pairs // for the given method. See Twitter's API docs for all available methods public static void performRequest(string methodType, string path, Dictionary <string, string> parameters) { if (Application.platform != RuntimePlatform.Android) { return; } string param = parameters != null?parameters.toJson() : string.Empty; _plugin.Call("performRequest", methodType, path, param); }
public void SetSceneInfo(string scene, Dictionary <string, string> info) { if (info == null) { return; } string key = "scene_" + scene; string str = info.toJson(); KeyValues[key] = str; }
public void LogPackDownload(CustomWorldStructs.RegionPack pack, string executableName) { string divider = "<div>"; string url = $"{CustomWorldMod.crsDBUrl}{pack.name.Replace(" ", "_")}"; Dictionary <string, object> postData = new Dictionary <string, object>(); postData.Add("crs_version", CustomWorldMod.mod.Version); postData.Add("bepinex", CustomWorldMod.usingBepinex); postData.Add("pack_version", pack.version); postData.Add("pack_checksum", pack.checksum); string postDataString = postData.toJson(); //string arguments = $"{url}{divider}\"{packName}\"{divider}{ID}{divider}\" + CustomWorldMod.resourcePath + (signal.Contains("update") ? $"{divider}update" : ""); string arguments = $"<logD>{divider}{url}{divider}{postDataString}"; Log($"Logging succesfuly download, arguments [{arguments}"); try { var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url); request.ContentType = "application/json"; request.Method = "POST"; using (var streamWriter = new StreamWriter(request.GetRequestStream())) { /* * string json = "{\"crsVersion\": \"" + CustomWorldMod.mod.version.ToString() + "\", \n" + * "\"bepinex\": \"" + CustomWorldMod.usingBepinex.ToString() + "\"}"; * CustomWorldMod.Log(json); */ streamWriter.Write(postData.toJson()); } } catch (Exception e) { CustomWorldMod.Log("Mono crashed after request, this is fine :) " + e); } }
public void initialise(IBillingServiceCallback biller) { this.callback = biller; rawSamsung.initialise(this); var encoder = new Dictionary <string, object>(); encoder.Add("mode", config.SamsungAppsMode.ToString()); encoder.Add("itemGroupId", config.SamsungItemGroupId); rawSamsung.getProductList(encoder.toJson()); }
public static void logEvent(string eventName, Dictionary <string, string> parameters, bool isTimed) { if (Application.platform != RuntimePlatform.Android) { return; } if (parameters == null) { Debug.LogError("attempting to call logEvent with null parameters"); return; } if (isTimed) { _plugin.Call("logTimedEventWithParams", eventName, parameters.toJson()); } else { _plugin.Call("logEventWithParams", eventName, parameters.toJson()); } }
public void CreateCharacterComplete() { if (this.AndroidPlugin != null) { this.AndroidPlugin.Call("CreateCharacterComplete", new object[0]); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("action_type", "subscribe"); this.AndroidPlugin.Call("RemarKetingData", new object[] { dictionary.toJson() }); } }
/// <summary> /// Add the specified val and metadata. /// </summary> /// <param name='val'> /// Value. /// </param> /// <param name='metadata'> /// Metadata. /// </param> public void Add(String val, Dictionary <String, String> metadata) { #if UNITY_ANDROID javaObject.Call("add", val, DictionaryToAndroidHashMap(metadata)); #elif UNITY_IOS string metadataAsJSON = null != metadata?metadata.toJson() : null; if (null != addStringWithMetadataToList) { addStringWithMetadataToList(key, val, metadataAsJSON); } #endif }
public void LevelUp(int nLevel) { if (this.AndroidPlugin != null) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("action_type", "complete_level"); dictionary.Add("value", nLevel.ToString()); this.AndroidPlugin.Call("RemarKetingData", new object[] { dictionary.toJson() }); } }
public static void logEvent( string eventName, Dictionary<string,string> parameters, bool isTimed ) { if( Application.platform != RuntimePlatform.Android ) return; if( parameters == null ) { Debug.LogError( "attempting to call logEvent with null parameters" ); return; } if( isTimed ) _plugin.Call( "logTimedEventWithParams", eventName, parameters.toJson() ); else _plugin.Call( "logEventWithParams", eventName, parameters.toJson() ); }
// Full access to any existing or new Facebook dialogs that get added. See Facebooks documentation for parameters and dialog types public static void showDialog( string dialogType, Dictionary<string,string> options ) { if( Application.platform == RuntimePlatform.IPhonePlayer ) _facebookShowDialog( dialogType, options.toJson() ); }
// Sets user cookies for the ad session public static void adsSetUserCookies( Dictionary<string,string> cookies ) { if( Application.platform == RuntimePlatform.IPhonePlayer ) _flurryAdsSetUserCookies( cookies.toJson() ); }
/// <summary> /// Set the specified val and metadata. /// </summary> /// <param name='val'> /// Value. /// </param> /// <param name='metadata'> /// Metadata. /// </param> public void Set(string val, Dictionary<string,string> metadata){ #if UNITY_ANDROID javaObject.Call ("set", val, DictionaryToAndroidHashMap(metadata)); #elif UNITY_IOS string metadataAsJSON = null != metadata ? metadata.toJson() : null; if(null != setNumberWithStringAndMetadata) { setNumberWithStringAndMetadata(key, val, metadataAsJSON); } #endif }
// Shows the Facebook share dialog. Valid dictionary keys (from FBShareDialogParams) are: link, name, caption, description, picture, friends (array) public static void showFacebookShareDialog( Dictionary<string,object> parameters ) { if( Application.platform == RuntimePlatform.IPhonePlayer ) _facebookShowFacebookShareDialog( parameters.toJson() ); }
// Allows you to use any available Facebook Graph API method public static void graphRequest( string graphPath, string httpMethod, Dictionary<string,object> keyValueHash ) { if( Application.platform == RuntimePlatform.IPhonePlayer ) { // convert the Dictionary to JSON string jsonDict = keyValueHash.toJson(); if( jsonDict != null ) { // if we arent logged in start up the babysitter if( !isSessionValid() ) { babysitRequest( true, () => { _facebookGraphRequest( graphPath, httpMethod, jsonDict ); } ); } else { _facebookGraphRequest( graphPath, httpMethod, jsonDict ); } } } }
// Full access to any existing or new Facebook dialogs that get added. See Facebooks documentation for parameters and dialog types public static void showDialog( string dialogType, Dictionary<string,string> options ) { if( Application.platform == RuntimePlatform.IPhonePlayer ) { // if we arent logged in start up the babysitter if( !isSessionValid() ) { babysitRequest( false, () => { _facebookShowDialog( dialogType, options.toJson() ); } ); } else { _facebookShowDialog( dialogType, options.toJson() ); } } }
// Tracks an event with a value and additional metadata public static void trackEventWithValueAndMetadata( string eventIdentifier, float value, Dictionary<string,string> metadata ) { if( Application.platform == RuntimePlatform.IPhonePlayer ) _chartBoostTrackEventWithValueAndMetadata( eventIdentifier, value, metadata.toJson() ); }
/// <summary> /// Add the specified val and metadata. /// </summary> /// <param name='val'> /// Value. /// </param> /// <param name='metadata'> /// Metadata. /// </param> public void Add(String val, Dictionary<String, String> metadata){ #if UNITY_ANDROID javaObject.Call ("add", val, DictionaryToAndroidHashMap(metadata)); #elif UNITY_IOS string metadataAsJSON = null != metadata ? metadata.toJson() : null; if(null != addStringWithMetadataToList) { addStringWithMetadataToList(key,val,metadataAsJSON); } #endif }
/// <summary> /// Set the specified val and metadata. /// </summary> /// <param name='val'> /// Value. /// </param> /// <param name='metadata'> /// Metadata. /// </param> public void Set(string val, Dictionary<string, string> metadata) { #if UNITY_ANDROID javaObject.Call ("set", val, DictionaryToAndroidHashMap(metadata)); #elif UNITY_IOS && !UNITY_EDITOR string metadataAsJSON = (null != metadata) ? metadata.toJson() : null; _AmazonGCWSSetLatestStringMetadataAsJSON(key, val, metadataAsJSON); #endif }
// Full access to any existing or new Facebook dialogs that get added. See Facebooks documentation for parameters and dialog types public static void showDialog( string dialogType, Dictionary<string,string> parameters ) { if( Application.platform != RuntimePlatform.Android ) return; parameters = parameters ?? new Dictionary<string,string>(); if( !isSessionValid() ) babysitRequest( false, () => { _facebookPlugin.Call( "showDialog", dialogType, parameters.toJson() ); } ); else _facebookPlugin.Call( "showDialog", dialogType, parameters.toJson() ); }
// Shows the native Facebook Share Dialog. Valid dictionary keys (from FBShareDialogParams) are: link, name, caption, description, picture, friends (array) public static void showFacebookShareDialog( Dictionary<string,object> parameters ) { if( Application.platform != RuntimePlatform.Android ) return; _facebookPlugin.Call( "showFacebookShareDialog", parameters.toJson() ); }
// Calls a custom Graph API method with the key/value pairs in the Dictionary. Pass in a null dictionary if no parameters are needed. public static void graphRequest( string graphPath, string httpMethod, Dictionary<string,string> parameters ) { if( Application.platform != RuntimePlatform.Android ) return; parameters = parameters ?? new Dictionary<string,string>(); // call off to java land if( !isSessionValid() ) babysitRequest( true, () => { _facebookPlugin.Call( "graphRequest", graphPath, httpMethod, parameters.toJson() ); } ); else _facebookPlugin.Call( "graphRequest", graphPath, httpMethod, parameters.toJson() ); }
// Starts up the SDK with the given appId and userData. See VGUserData for allowed values. public static void startWithAppIdAndUserData( string appId, Dictionary<string,object> userData ) { if( Application.platform == RuntimePlatform.IPhonePlayer ) _vungleStartWithAppIdAndUserData( appId, userData.toJson() ); }
// Performs a request for any available Twitter API methods. methodType must be either "get" or "post". path is the // url fragment from the API docs (excluding https://api.twitter.com) and parameters is a dictionary of key/value pairs // for the given method. Path must request .json! See Twitter's API docs for all available methods. public static void performRequest( string methodType, string path, Dictionary<string,string> parameters ) { if( Application.platform == RuntimePlatform.IPhonePlayer ) _twitterPerformRequest( methodType, path, parameters != null ? parameters.toJson() : null ); }
// Reports an achievement notification the given title and content public static void SendEventWithParam( string eventId, Dictionary<string,string> param) { // Call plugin only when running on real device if( Application.platform == RuntimePlatform.IPhonePlayer ) _sendEventWithParam( eventId , param.toJson()); }