Appwarp无法创造空间

时间:2015-10-03 17:27:52

标签: unity3d appwarp

我创建了一个小型单人游戏,我现在正在尝试适应多人游戏。 它基于转,所以我正在使用Appwarp。 我有这个代码,但我得到这行的'空指针异常':

SC_AppWarpKit.CreateTurnBaseRoom("BattleShips", userName, 2, null, 60);

请注意,我没有为AppWarpKit创建游戏对象,在线搜索示例但找不到类似的东西。 出于隐私原因,APIKEY和SECRETKEY是空的。

private string apiKey = "";
private string secretKey = "";
private string email = "@gmail.com";
private string userName = "mrnobody";
private string roomId = "";
private List<string> rooms;
private string opponentName = "";

private bool isMyTurn = false;

void OnEnable()
{
        SC_Listener_App42.onCreatedUserApp42 += onCreatedUserApp42;
        SC_Listener_App42.OnExceptionFromApp42 += OnExceptionFromApp42;

        SC_Listener_AppWarp.onConnectToAppWarp += onConnectToAppWarp;
        SC_Listener_AppWarp.onDisconnectFromAppWarp += onDisconnectFromAppWarp;
        SC_Listener_AppWarp.OnMatchedRooms += OnGetMatchedRoomsDone;
        SC_Listener_AppWarp.OnSubscribeToRoom += onSubscribeToRoom;
        SC_Listener_AppWarp.OnUnSubscribeToRoom += onUnSubscribeToRoom;
        SC_Listener_AppWarp.OnJoinToRoom += OnJoinToRoom;
        SC_Listener_AppWarp.OnLeaveFromRoom += OnLeaveFromRoom;
        SC_Listener_AppWarp.OnCreateRoomDone += OnCreateRoomDone;
        SC_Listener_AppWarp.onGetLiveRoomInfo += OnGetLiveRoomInfo;
        SC_Listener_AppWarp.OnSendPrivateUpdate += OnSendPrivateUpdate;
        SC_Listener_AppWarp.OnStartGameDone += OnStartGameDone;
        SC_Listener_AppWarp.OnStopGameDone += OnStopGameDone;
        SC_Listener_AppWarp.OnRoomCreated += OnRoomCreated;
        SC_Listener_AppWarp.OnUserJoinRoom += OnUserJoinRoom;
        SC_Listener_AppWarp.OnUserLeftRoom += OnUserLeftRoom;
        SC_Listener_AppWarp.OnPrivateUpdateReceived += OnPrivateUpdateReceived;
        SC_Listener_AppWarp.OnPrivateChatReceived += OnPrivateChatReceived;
        SC_Listener_AppWarp.OnGameStarted += OnGameStarted;
        SC_Listener_AppWarp.OnGameStopped += OnGameStopped;
        SC_Listener_AppWarp.OnSendMove += OnSendMove;
        SC_Listener_AppWarp.OnMoveCompleted += OnMoveCompleted;
}

void OnDisable()
{
    SC_Listener_App42.onCreatedUserApp42 -= onCreatedUserApp42;
    SC_Listener_App42.OnExceptionFromApp42 -= OnExceptionFromApp42;

    SC_Listener_App42.OnExceptionFromApp42 -= OnExceptionFromApp42;
    SC_Listener_AppWarp.onConnectToAppWarp -= onConnectToAppWarp;
    SC_Listener_AppWarp.onDisconnectFromAppWarp -= onDisconnectFromAppWarp;
    SC_Listener_AppWarp.OnMatchedRooms -= OnGetMatchedRoomsDone;
    SC_Listener_AppWarp.OnSubscribeToRoom -= onSubscribeToRoom;
    SC_Listener_AppWarp.OnUnSubscribeToRoom -= onUnSubscribeToRoom;
    SC_Listener_AppWarp.OnJoinToRoom -= OnJoinToRoom;
    SC_Listener_AppWarp.OnLeaveFromRoom -= OnLeaveFromRoom;
    SC_Listener_AppWarp.OnCreateRoomDone -= OnCreateRoomDone;
    SC_Listener_AppWarp.onGetLiveRoomInfo -= OnGetLiveRoomInfo;
    SC_Listener_AppWarp.OnSendPrivateUpdate -= OnSendPrivateUpdate;
    SC_Listener_AppWarp.OnStartGameDone -= OnStartGameDone;
    SC_Listener_AppWarp.OnStopGameDone -= OnStopGameDone;
    SC_Listener_AppWarp.OnRoomCreated -= OnRoomCreated;
    SC_Listener_AppWarp.OnUserJoinRoom -= OnUserJoinRoom;
    SC_Listener_AppWarp.OnUserLeftRoom -= OnUserLeftRoom;
    SC_Listener_AppWarp.OnPrivateUpdateReceived -= OnPrivateUpdateReceived;
    SC_Listener_AppWarp.OnPrivateChatReceived -= OnPrivateChatReceived;
    SC_Listener_AppWarp.OnGameStarted -= OnGameStarted;
    SC_Listener_AppWarp.OnGameStopped -= OnGameStopped;
    SC_Listener_AppWarp.OnSendMove -= OnSendMove;
    SC_Listener_AppWarp.OnMoveCompleted -= OnMoveCompleted;

}

void Start () 
{
    SC_App42Kit.App42Init(apiKey,secretKey);
    SC_AppWarpKit.WarpInit(apiKey,secretKey);
    SC_AppWarpKit.CreateTurnBaseRoom("BattleShips", userName, 2, null, 60);
}

在一个单独的DLL文件夹中,我有: App42_Unity3D_SDK_2.9.1.dll AppWarpUnity.dll

请协助。

1 个答案:

答案 0 :(得分:0)

想出来。 确实使用了不正确的DLL并需要更改函数调用:

SC_App42Kit.App42Init(apiKey,secretKey);
    SC_AppWarpKit.WarpInit(apiKey,secretKey);
    SC_AppWarpKit.connectToAppWarp(userName);

创建房间的呼叫等已移至&#39; connectToAppWarp&#39;回调。