public void EnterDungeon(String dungeonName, CardPlayerTransferModel cardPlayer, PlayerCallbackPlayerDelegate _callback) { var playerModel = new PlayerTransferModel(); if (socketState == null) { playerModel.TransferState = PlayerTransferModel.TransferStateType.Error; playerModel.TransferMessage = "没有连接到服务器"; _callback(playerModel); return; } if (Player == null) { playerModel.TransferState = PlayerTransferModel.TransferStateType.Error; playerModel.TransferMessage = "没有登录"; _callback(playerModel); return; } playerModel.TransferRequest = PlayerTransferModel.TransferRequestType.EnterDungeon; playerModel.TransferMessage = dungeonName; playerModel.CardPlayer = cardPlayer; socketState.CallBackFunction = EnterDungeonCallback; NetworkController.Send(socketState, JsonConvert.SerializeObject(playerModel)); NetworkController.getData(socketState); playerCallback = _callback; }
public void Login(String accountName, String password, PlayerCallbackPlayerDelegate _callback) { var playerModel = new PlayerTransferModel(); if (socketState == null) { playerModel.TransferState = PlayerTransferModel.TransferStateType.Error; playerModel.TransferMessage = "没有连接到服务器"; _callback(playerModel); return; } playerModel.AccountName = accountName; playerModel.Password = password; playerModel.TransferRequest = PlayerTransferModel.TransferRequestType.Login; socketState.CallBackFunction = LoginCallback; NetworkController.Send(socketState, JsonConvert.SerializeObject(playerModel)); NetworkController.getData(socketState); playerCallback = _callback; }
public void EnterDungeonRoom(int index, PlayerCallbackPlayerDelegate _callback) { var playerModel = new PlayerTransferModel(); if (socketState == null) { playerModel.TransferState = PlayerTransferModel.TransferStateType.Error; playerModel.TransferMessage = "没有连接到服务器"; _callback(playerModel); return; } if (Player == null) { playerModel.TransferState = PlayerTransferModel.TransferStateType.Error; playerModel.TransferMessage = "没有登录"; _callback(playerModel); return; } if (!Player.EnteredDungeon()) { playerModel.TransferState = PlayerTransferModel.TransferStateType.Error; playerModel.TransferMessage = "没有进入副本"; _callback(playerModel); return; } if (!Player.EnterDungeonRoom(index)) { playerModel.TransferState = PlayerTransferModel.TransferStateType.Error; playerModel.TransferMessage = "无效房间编号"; _callback(playerModel); return; } playerModel.TransferRequest = PlayerTransferModel.TransferRequestType.EnterDungeonRoom; playerModel.TransferMessage = index + ""; socketState.CallBackFunction = EnterDungeonRoomCallback; NetworkController.Send(socketState, JsonConvert.SerializeObject(playerModel)); NetworkController.getData(socketState); playerCallback = _callback; }