我正在开发 Unity 游戏,android 构建目标。将 SDK 集成到我的游戏中时我遇到问题。 遵循 https://dev.tapjoy.com/en/unity-plugin/Quickstart 文档后 这是我的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TapjoyUnity;
public class TJSCript : MonoBehaviour
{
string sdkKey = "/////////////my code///////";
public Text debugText;
// Start is called before the first frame update
void Start()
{
Tapjoy.OnConnectSuccess += HandleConnectSuccess;
Tapjoy.OnConnectWarning += HandleConnectWarning;
Tapjoy.OnConnectFailed += HandleConnectFailed;
}
// Update is called once per frame
void Update()
{
}
public void ConnectSDK(){
if (!Tapjoy.IsConnected) {
debugText.text = "Connecting SDK";
Debug.Log(sdkKey);
Tapjoy.Connect(sdkKey);
Tapjoy.Connect();
} else{
Debug.Log("SDK Connected");
}
}
public void RequestOfferwall()
{
TJPlacement placement = TJPlacement.CreatePlacement("AppLaunch");
placement.RequestContent();
if (placement.IsContentReady()) {
placement.ShowContent();
}
}
public void HandleConnectSuccess() {
Debug.Log ("Connect Success");
debugText.text = "Connect Success";
// Now that we are connected we can start preloading our placements
TJPlacement p = TJPlacement.CreatePlacement("AppLaunch");
p.RequestContent();
}
void HandleConnectWarning(int code, string message)
{
debugText.text = "Connect Warning " + message;
}
public void HandleConnectFailed(int code, string message){
debugText.text = "Connect Failed " + message;
}
}
C#:无法发送放置,因为 Tapjoy 未成功连接
我尝试测试 Tapjoy 示例代码,但还是一样,无法连接。
如果无法连接,请确保您的 SDK 密钥已从 Tapjoy 门户正确粘贴。您还应该检查您的互联网连接。尝试在 Tapjoy 设置(窗口 > Tapjoy)上启用自动连接并确保将 sdk 密钥也粘贴到其中可能会有所帮助。