private void MyOnOperationResponse(Zealm.OperationResponse operationResponse) { lock (myLock) { listAction.Add(() => this.OnOperationResponse(operationResponse)); } }
/// <summary> /// 处理生成怪物消息 - /// </summary> private void HitMonsterPoint(Zealm.OperationResponse operationResponse) { if (operationResponse.ReturnCode == ((short)yuan.YuanPhoton.ReturnCode.Yes)) { int SPID = (int)operationResponse.Parameters[(short)0]; //KDebug.WriteLog( "收到出怪 : SpawnPointID = " + SPID ); //KDebug.Log ("K________returned___SpawnPointID = " + SPID ); for (int i = 0; i < SpawnPoints.Length; i++) { if (SpawnPoints[i].CurrentSpawnPointID == SPID) { int WaveID = (int)operationResponse.Parameters[(short)1]; //判断是普通还是PVP// int[] MonsterIDs = operationResponse.Parameters[(short)2] as int[]; byte[] MonsterStatus = operationResponse.Parameters[(short)3] as byte[]; int[] MonsterMaxHPs = operationResponse.Parameters[(short)4] as int[]; string[] Datas = operationResponse.Parameters[(short)5] as string[]; if (WaveID < 0) { //普通// string[] Data = new string[4]; for (int k = 0; k < MonsterIDs.Length; k++) { Data[0] = "" + MonsterIDs[k]; Data[1] = "" + MonsterStatus[k]; Data[2] = "" + MonsterMaxHPs[k]; Data[3] = Datas[k]; //Debug.Log ( "K________returned___SpawnPointID = " + SPID + " | WaveID = " + WaveID + " | MonsterID = " + MonsterIDs[k] ); SpawnPoints[i].SendMessage("OnMonsterSpawnPointHitted", Data, SendMessageOptions.RequireReceiver); } } else //PVP// { string[] Data = new string[5]; for (int k = 0; k < MonsterIDs.Length; k++) { Data[0] = "" + MonsterIDs[k]; Data[1] = "" + MonsterStatus[k]; Data[2] = "" + MonsterMaxHPs[k]; Data[3] = Datas[k]; Data[4] = "" + WaveID; // Debug.Log ( "K____PVPVPVPVPVPVPVPVPVPVPVP____returned___SpawnPointID = " + SPID + " | WaveID = " + WaveID + " | MonsterID = " + MonsterIDs[k] ); SpawnPoints[i].SendMessage("OnCallMonster", Data, SendMessageOptions.RequireReceiver); } } return; } } } else { if (operationResponse.ReturnCode == ((short)yuan.YuanPhoton.ReturnCode.Error)) { Debug.LogError(operationResponse.DebugMessage); } } }
/** * 处理一个网络包。 * @param segment */ public static void handleNetData(ZMNetData netData) { // Debug.Log("opcode handle -----------------------------------------------------"+netData.type); try { ZMNetData cloneDt = netData.Clone() as ZMNetData; if (netData.type == (short)73) { Debug.Log("2222222222222222222222222222222222 " + System.DateTime.Now.ToString()); } if (netData.isnot == 2) { if (DataHandle != null) { DataHandle(cloneDt); } } if (netData.isnot == 1) { if (DataHandlePhoton != null) { int tryGet = netData.readInt(); if (tryGet == -255) { short mRetrunCode = netData.readShort(); string mDebugMessage = netData.readString(); Dictionary <short, object> dicParms = netData.getMapBO(); Zealm.OperationResponse op = new Zealm.OperationResponse(netData.type, mRetrunCode, dicParms, mDebugMessage); // Debug.Log("+++++++++++++++++++++++++++++++++++++++++++++++++"+op.OperationCode); DataHandlePhoton(op); if (InRoomHandle != null) { InRoomHandle(op); } } } } } catch (System.Exception ex) { Debug.LogError(ex.ToString()); } nextPacket = netData; try{ if (!netData.handled) { netData.reset(); // world.processPacket(); } }catch (Exception e) { //Log.exception(e); }finally{ nextPacket = null; } }
protected override void OnOperationResponse(Zealm.OperationResponse operationResponse) { switch ((OpCode)operationResponse.OperationCode) { #if msp_CombineCommitSpawn case OpCode.HitMonsterPoint: //KDebug.Log("收到出怪消息"); HitMonsterPoint(operationResponse); break; #endif } }
protected override void OnOperationResponse(Zealm.OperationResponse operationResponse) { switch ((OpCode)operationResponse.OperationCode) { case OpCode.Decision: AcceptDecision(operationResponse); break; case OpCode.DecisionFallBack: AcceptFallBack(operationResponse); break; } }
protected override void OnOperationResponse(Zealm.OperationResponse operationResponse) { switch ((OpCode)operationResponse.OperationCode) { case OpCode.DefenceBattleStartCommit: { switch (operationResponse.ReturnCode) { case (short)yuan.YuanPhoton.ReturnCode.Yes: { long diffTime = (long)operationResponse.Parameters[(short)0]; TMC.SendMessage("OnStart", "" + diffTime); } break; case (short)yuan.YuanPhoton.ReturnCode.Error: { Debug.LogError(StaticLoc.Loc.Get(operationResponse.DebugMessage)); } break; } } break; case OpCode.BallCommitDamage: { switch (operationResponse.ReturnCode) { case (short)yuan.YuanPhoton.ReturnCode.Yes: { int damage = (int)operationResponse.Parameters[(short)0]; TMC.SendMessage("OnAcceptHP", "" + damage); } break; case (short)yuan.YuanPhoton.ReturnCode.Error: { Debug.LogError(StaticLoc.Loc.Get(operationResponse.DebugMessage)); } break; } } break; } }
void AcceptFallBack(Zealm.OperationResponse operationResponse) { int[] MonsterIDs = operationResponse.Parameters[0] as int[]; int[] DecisionIDs = operationResponse.Parameters[1] as int[]; string[] Datas = operationResponse.Parameters[2] as string[]; for (int i = 0; i < MonsterIDs.Length; i++) { MonsterNetView m = GetMonsterNetViewByMonsterID(MonsterIDs[i]); if (m != null) { string[] StrData = new string[2]; StrData[0] = "" + DecisionIDs[i]; StrData[1] = Datas[i]; //Debug.Log( "K________OnAccetpDecision : MonsterID = " + MonsterID + " DID = "+StrData[0] + " ; DData = " + StrData[1] ); m.SendMessage("OnAcceptDecision", StrData); //发送消息处理指令// } } }
protected virtual void OnOperationResponse(Zealm.OperationResponse operationResponse) { }