// 移动后,更新数据 public int updateCardInfo(stRetMoveGameCardUserCmd cmd) { // 查找后两边更新 if (m_playerArr[(int)EnDZPlayer.ePlayerSelf].updateCardInfo(cmd)) { return 1; } else { m_playerArr[(int)EnDZPlayer.ePlayerEnemy].updateCardInfo(cmd); return 2; } }
public bool updateCardInfo(stRetMoveGameCardUserCmd cmd) { foreach(SceneCardItem item in m_sceneCardList) { if(item.svrCard.qwThisID == cmd.qwThisID) { item.cardArea = (CardArea)cmd.dst.dwLocation; item.svrCard.pos.copyFrom(cmd.dst); cmd.m_sceneCardItem = item; return true; } } return false; }
// 卡牌移动 protected void psstRetMoveGameCardUserCmd(ByteBuffer bu) { stRetMoveGameCardUserCmd cmd = new stRetMoveGameCardUserCmd(); cmd.derialize(bu); if (cmd.success == 1) { // 更新数据 cmd.side = Ctx.m_instance.m_dataPlayer.m_dzData.updateCardInfo(cmd); } UISceneDZ uiSceneDZ = Ctx.m_instance.m_uiSceneMgr.getSceneUI<UISceneDZ>(UISceneFormID.eUISceneDZ); if (uiSceneDZ != null && uiSceneDZ.isVisible()) { uiSceneDZ.psstRetMoveGameCardUserCmd(cmd); } }
public void psstRetMoveGameCardUserCmd(stRetMoveGameCardUserCmd msg) { if (msg.side != 1 && msg.side != 2 && msg.success == 1) { Ctx.m_instance.m_logSys.log(msg.side.ToString()); } // 只有有效值的时候才处理 if (msg.side == 1 || msg.side == 2) { m_sceneDZData.m_sceneDZAreaArr[msg.side - 1].outSceneCardList.removeWhiteCard(); // 将占位的牌移除 if (msg.success == 1) // 如果成功,就放进出牌位置 { m_sceneDZData.m_sceneDZAreaArr[msg.side - 1].psstRetMoveGameCardUserCmd(msg); if ((msg.side - 1) == (int)EnDZPlayer.ePlayerSelf) { m_sceneDZData.m_dragDropData.setCurDragItem(null); } } else // 退回到原来的位置 { m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].moveDragBack(); m_sceneDZData.m_dragDropData.setCurDragItem(null); } } }
// 自己卡牌区域移动, Enemy 走 addSceneCardByItem 这个流程 public void psstRetMoveGameCardUserCmd(stRetMoveGameCardUserCmd msg) { changeSelfSceneCardArea(msg.qwThisID, (CardArea)msg.m_sceneCardItem.svrCard.pos.dwLocation, msg.dst.y); }