C# Unity WebGL在发布httpWebRequest帖子时失败
这是我第一次玩任何类型的游戏,所以要温柔:)我正在学习Unity+C#。Unity Editor 2019.2.5f1 情况:C# Unity WebGL在发布httpWebRequest帖子时失败,c#,unity3d,httpwebrequest,unity-webgl,C#,Unity3d,Httpwebrequest,Unity Webgl,这是我第一次玩任何类型的游戏,所以要温柔:)我正在学习Unity+C#。Unity Editor 2019.2.5f1 情况: 在游戏结束时,当玩家死亡时,游戏会查看线圈值字符串是否不是“0”。如果为0,则转到非订户场景。如果不是0,则转到“游戏结束”场景,并尝试向xrptipbot地址付款。故障排除导致我对“to”和“amount”进行静态输入,以缩小问题范围。在TshootHttpWebRequest之后,这将恢复为动态解析。 WebGL错误在->返回新WaitForSeconds(3)后弹
在游戏结束时,当玩家死亡时,游戏会查看线圈值字符串是否不是“0”。如果为0,则转到非订户场景。如果不是0,则转到“游戏结束”场景,并尝试向xrptipbot地址付款。故障排除导致我对“to”和“amount”进行静态输入,以缩小问题范围。在TshootHttpWebRequest之后,这将恢复为动态解析。 WebGL错误在->返回新WaitForSeconds(3)后弹出。我还临时删除了SendXRP()部分,因此没有发生错误。因此,这是特定于失败的httpWebRequest,但我无法理解其原因。我在Unity Editor中对此进行了测试,它支付了费用 预期结果
我希望httpWebRequest能够调用xrptipbot服务器并在后台付款 玩家死亡监控脚本
void Update()
{
if (Player == null)
{
StartCoroutine(GameOver());
}
}
IEnumerator GameOver()
{
coil = PlayerPrefs.GetString("lastcoilscore");
yield return new WaitForSeconds(2);
if (coil == "0")
{
SceneManager.LoadScene("NonCoilSubscriber");
}
else
{
SceneManager.LoadScene("Game Over");
}
}
WebGL错误
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
uncaught exception: abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking") at jsStackTrace (Moon Run WebGL nonDev.wasm.framework.unityweb:8:22313)
stackTrace (Moon Run WebGL nonDev.wasm.framework.unityweb:8:22484)
onAbort@https://gamedomain.com/moonrun/Build/UnityLoader.js:4:11047
abort (Moon Run WebGL nonDev.wasm.framework.unityweb:8:494060)
_dlopen (Moon Run WebGL nonDev.wasm.framework.unityweb:8:178189)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[48391]:0xff6df3 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[49657]:0x102e7f1)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28207]:0xbb9025 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28206]:0xbb8f9f)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51225]:0x1082a7a
UnityModule [UnityModule/Module.dynCall_iii] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:467180)
invoke_iii (Moon Run WebGL nonDev.wasm.framework.unityweb:8:341965)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28205]:0xbb8d52 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51244]:0x1082d17)
UnityModule [UnityModule/Module.dynCall_vi] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:478850)
invoke_vi (Moon Run WebGL nonDev.wasm.framework.unityweb:8:364096)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28203]:0xbb8bc8 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28202]:0xbb8b08)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[36732]:0xd7a911 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51221]:0x1082a1e)
UnityModule [UnityModule/Module.dynCall_ii] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:465791)
invoke_ii (Moon Run WebGL nonDev.wasm.framework.unityweb:8:339445)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[36734]:0xd7aa54 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51221]:0x1082a1e)
UnityModule [UnityModule/Module.dynCall_ii] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:465791)
invoke_ii (Moon Run WebGL nonDev.wasm.framework.unityweb:8:339445)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28234]:0xbb9fca (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[34834]:0xd169a2)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[34833]:0xd1685e (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[25972]:0xb31812)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28209]:0xbb922b (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28213]:0xbb9982)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[50641]:0x1057b6e (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[26014]:0xb352ea)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[44595]:0xf060b1 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[24038]:0xaf3c76)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51228]:0x1082ac5
UnityModule [UnityModule/Module.dynCall_iiiii] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:468879)
invoke_iiiii (Moon Run WebGL nonDev.wasm.framework.unityweb:8:345111)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[48985]:0x1013783 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[48314]:0xff3d96)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[4194]:0x1a0270 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[4193]:0x1a019e)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[7685]:0x2c8e75 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[7683]:0x2c8b85)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[7687]:0x2c9079 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[8073]:0x2f65ae)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10434]:0x3f761a (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10151]:0x3d5338)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10151]:0x3d534d (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10143]:0x3d4530)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10137]:0x3d2b6c (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51242]:0x1082cf7)
UnityModule [UnityModule/Module.dynCall_v] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:478193)
browserIterationFunc (Moon Run WebGL nonDev.wasm.framework.unityweb:8:182416)
runIter (Moon Run WebGL nonDev.wasm.framework.unityweb:8:185489)
Browser_mainLoop_runner (Moon Run WebGL nonDev.wasm.framework.unityweb:8:183951)
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
[Serializable]
public class Ilppayment : MonoBehaviour
{
public InputField inputTextArea;
string coil;
public class Values
{
public string to;
public string amount;
public string token;
public bool existingDestination;
}
public void Start()
{
GrabPaymentInfo();
}
public void GrabPaymentInfo()
{
if (PlayerPrefs.GetString("ilpaddress") != null)
{
inputTextArea.text = PlayerPrefs.GetString("ilpaddress");
}
else
{
Debug.Log("Must enter a payment address");
return;
}
// Separation of ILP Address for Payment.
char[] spearator = { '.', ' ', '$', '/' };
Int32 count = 5;
// Using the Method
String[] strlist = inputTextArea.text.Split(spearator,
count, StringSplitOptions.None);
foreach (String s in strlist)
{
Console.WriteLine(s);
}
string service = strlist[1];
//address = strlist[4];
//string to = "xrptipbot://"+ service + "/" + address;
//EXAMPLE : string to = "$coil.xrptipbot.com/643d5f5f-3e5b-4f87-a9b5-8c735d5ea30e "; <-- SEE SPACE
//string amount = PlayerPrefs.GetString("lastxrpscore");
// END - Separation of ILP Address for Payment. - END
string to = "xrptipbot://coil/643d5f5f-3e5b-4f87-a9b5-8c735d5ea30e";
string amount = "0.000001";
Debug.Log("to : " + to);
Debug.Log("amount : " + amount);
Debug.Log("Calling Payment to XRPTipBot");
StartCoroutine(SendXRP(to: to, amount: amount));
}
IEnumerator SendXRP(string to, string amount)
{
yield return new WaitForSeconds(3);
Debug.Log(amount);
Debug.Log("Type Amount : " + amount.GetType());
var data = new Values();
data.to = to;
data.amount = amount;
data.token = "customtoken for payments";
data.existingDestination = true;
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.xrptipbot.com/app/api/action:tip/");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = JsonUtility.ToJson(data
, true);
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
Debug.Log(httpWebRequest);
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
Debug.Log(result);
}
}
}
ilppayment.cs完整代码
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
uncaught exception: abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking") at jsStackTrace (Moon Run WebGL nonDev.wasm.framework.unityweb:8:22313)
stackTrace (Moon Run WebGL nonDev.wasm.framework.unityweb:8:22484)
onAbort@https://gamedomain.com/moonrun/Build/UnityLoader.js:4:11047
abort (Moon Run WebGL nonDev.wasm.framework.unityweb:8:494060)
_dlopen (Moon Run WebGL nonDev.wasm.framework.unityweb:8:178189)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[48391]:0xff6df3 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[49657]:0x102e7f1)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28207]:0xbb9025 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28206]:0xbb8f9f)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51225]:0x1082a7a
UnityModule [UnityModule/Module.dynCall_iii] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:467180)
invoke_iii (Moon Run WebGL nonDev.wasm.framework.unityweb:8:341965)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28205]:0xbb8d52 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51244]:0x1082d17)
UnityModule [UnityModule/Module.dynCall_vi] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:478850)
invoke_vi (Moon Run WebGL nonDev.wasm.framework.unityweb:8:364096)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28203]:0xbb8bc8 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28202]:0xbb8b08)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[36732]:0xd7a911 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51221]:0x1082a1e)
UnityModule [UnityModule/Module.dynCall_ii] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:465791)
invoke_ii (Moon Run WebGL nonDev.wasm.framework.unityweb:8:339445)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[36734]:0xd7aa54 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51221]:0x1082a1e)
UnityModule [UnityModule/Module.dynCall_ii] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:465791)
invoke_ii (Moon Run WebGL nonDev.wasm.framework.unityweb:8:339445)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28234]:0xbb9fca (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[34834]:0xd169a2)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[34833]:0xd1685e (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[25972]:0xb31812)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28209]:0xbb922b (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[28213]:0xbb9982)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[50641]:0x1057b6e (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[26014]:0xb352ea)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[44595]:0xf060b1 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[24038]:0xaf3c76)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51228]:0x1082ac5
UnityModule [UnityModule/Module.dynCall_iiiii] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:468879)
invoke_iiiii (Moon Run WebGL nonDev.wasm.framework.unityweb:8:345111)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[48985]:0x1013783 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[48314]:0xff3d96)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[4194]:0x1a0270 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[4193]:0x1a019e)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[7685]:0x2c8e75 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[7683]:0x2c8b85)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[7687]:0x2c9079 (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[8073]:0x2f65ae)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10434]:0x3f761a (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10151]:0x3d5338)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10151]:0x3d534d (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10143]:0x3d4530)
@blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[10137]:0x3d2b6c (blob:https://gamedomain.com/dc1d1d91-dbf5-4a8d-b814-4efd62da78f5 line 8 > WebAssembly.instantiate:wasm-function[51242]:0x1082cf7)
UnityModule [UnityModule/Module.dynCall_v] (Moon Run WebGL nonDev.wasm.framework.unityweb:8:478193)
browserIterationFunc (Moon Run WebGL nonDev.wasm.framework.unityweb:8:182416)
runIter (Moon Run WebGL nonDev.wasm.framework.unityweb:8:185489)
Browser_mainLoop_runner (Moon Run WebGL nonDev.wasm.framework.unityweb:8:183951)
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
[Serializable]
public class Ilppayment : MonoBehaviour
{
public InputField inputTextArea;
string coil;
public class Values
{
public string to;
public string amount;
public string token;
public bool existingDestination;
}
public void Start()
{
GrabPaymentInfo();
}
public void GrabPaymentInfo()
{
if (PlayerPrefs.GetString("ilpaddress") != null)
{
inputTextArea.text = PlayerPrefs.GetString("ilpaddress");
}
else
{
Debug.Log("Must enter a payment address");
return;
}
// Separation of ILP Address for Payment.
char[] spearator = { '.', ' ', '$', '/' };
Int32 count = 5;
// Using the Method
String[] strlist = inputTextArea.text.Split(spearator,
count, StringSplitOptions.None);
foreach (String s in strlist)
{
Console.WriteLine(s);
}
string service = strlist[1];
//address = strlist[4];
//string to = "xrptipbot://"+ service + "/" + address;
//EXAMPLE : string to = "$coil.xrptipbot.com/643d5f5f-3e5b-4f87-a9b5-8c735d5ea30e "; <-- SEE SPACE
//string amount = PlayerPrefs.GetString("lastxrpscore");
// END - Separation of ILP Address for Payment. - END
string to = "xrptipbot://coil/643d5f5f-3e5b-4f87-a9b5-8c735d5ea30e";
string amount = "0.000001";
Debug.Log("to : " + to);
Debug.Log("amount : " + amount);
Debug.Log("Calling Payment to XRPTipBot");
StartCoroutine(SendXRP(to: to, amount: amount));
}
IEnumerator SendXRP(string to, string amount)
{
yield return new WaitForSeconds(3);
Debug.Log(amount);
Debug.Log("Type Amount : " + amount.GetType());
var data = new Values();
data.to = to;
data.amount = amount;
data.token = "customtoken for payments";
data.existingDestination = true;
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.xrptipbot.com/app/api/action:tip/");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = JsonUtility.ToJson(data
, true);
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
Debug.Log(httpWebRequest);
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
Debug.Log(result);
}
}
}