/// <summary> /// 移动自己的单位 /// </summary> /// <param name="originalCtral"></param> /// <param name="movepointctrl"></param> /// <param name="armyCard"></param> /// <param name="armyPrefab"></param> private void moveArmy(ref MapPointCtrl originalCtral, ref MapPointCtrl movepointctrl, CardDto armyCard, ref GameObject armyPrefab) { if (armyCard.MoveType == ArmyMoveType.LAND) { //如果是陆地单位 //设置陆地单位 //movepointctrl.SetLandArmy(armyPrefab); movepointctrl.MoveLandArmy(ref armyPrefab, armyCard.Race, armyCard.Name, true); //movepointctrl.LandArmyRace = armyCard.Race; //movepointctrl.LandArmyName = armyCard.Name; //移除原来地块上的兵种 removeArmy(ref originalCtral, armyCard); //向服务器发送消息 mapMoveDto.Change(originalCtral.mapPoint, movepointctrl.mapPoint, armyCard.MoveType); socketMsg.Change(OpCode.FIGHT, FightCode.MAP_ARMY_MOVE_CREQ, mapMoveDto); Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); } else if (armyCard.MoveType == ArmyMoveType.SKY) { //如果是飞行单位 //设置飞行单位 //movepointctrl.SetSkyArmy(armyPrefab); movepointctrl.MoveSkyArmy(ref armyPrefab, armyCard.Race, armyCard.Name, true); //movepointctrl.SkyArmyRace = armyCard.Race; //movepointctrl.SkyArmyName = armyCard.Name; //移除原来地块上的兵种 removeArmy(ref originalCtral, armyCard); //向服务器发送消息 mapMoveDto.Change(originalCtral.mapPoint, movepointctrl.mapPoint, armyCard.MoveType); socketMsg.Change(OpCode.FIGHT, FightCode.MAP_ARMY_MOVE_CREQ, mapMoveDto); Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); } }
public void Change(MapPointCtrl originalPointctral, MapPointCtrl mapPointCtrl, CardDto cardDto, GameObject armyPrefab) { OriginalMappointCtral = originalPointctral; this.mapPointCtrl = mapPointCtrl; this.cardDto = cardDto; this.armyPrefab = armyPrefab; }
/// <summary> /// 获取防御和攻击兵种的信息 /// </summary> private void getArmy(out ArmyCtrl defenseCtrl, out OtherArmyCtrl attackCtrl, MapAttackDto mapAttackDto) { //镜像对称 int totalX = 12; int totalZ = 8; MapPoint attackpoint = new MapPoint(totalX - mapAttackDto.AttacklMapPoint.X, totalZ - mapAttackDto.AttacklMapPoint.Z); MapPoint defensepoint = new MapPoint(totalX - mapAttackDto.DefenseMapPoint.X, totalZ - mapAttackDto.DefenseMapPoint.Z);; int attackmovetype = mapAttackDto.AttackMoveType; int defensemovetype = mapAttackDto.DefenseMoveType; MapPointCtrl attackPointCtrl = null; MapPointCtrl defensePointCtrl = null; //OtherArmyCtrl attackCtrl; //ArmyCtrl defenseCtrl; foreach (var item in MapManager.mapPointCtrls) { if (item.mapPoint.X == attackpoint.X && item.mapPoint.Z == attackpoint.Z) { attackPointCtrl = item; } else if (item.mapPoint.X == defensepoint.X && item.mapPoint.Z == defensepoint.Z) { defensePointCtrl = item; } if (attackPointCtrl != null && defensePointCtrl != null) { break; } } if (attackmovetype == ArmyMoveType.LAND && attackPointCtrl.LandArmy != null) { attackCtrl = attackPointCtrl.LandArmy.GetComponent <OtherArmyCtrl>(); } else if (attackmovetype == ArmyMoveType.SKY && attackPointCtrl.SkyArmy != null) { attackCtrl = attackPointCtrl.SkyArmy.GetComponent <OtherArmyCtrl>(); } else { attackCtrl = null; } if (defensemovetype == ArmyMoveType.LAND && defensePointCtrl.LandArmy != null) { defenseCtrl = defensePointCtrl.LandArmy.GetComponent <ArmyCtrl>(); } else if (defensemovetype == ArmyMoveType.SKY && defensePointCtrl.SkyArmy != null) { defenseCtrl = defensePointCtrl.SkyArmy.GetComponent <ArmyCtrl>(); } else { defenseCtrl = null; } }
/// <summary> /// 选择防御兵种 /// </summary> /// <returns></returns> private IEnumerator selectDenfenseArmy() { if (clickMapPointCtrl == null) { yield break; } if (armyCtrl.armyState.MoveType == ArmyMoveType.LAND && clickMapPointCtrl.LandArmy != null) { //如果攻击方是陆地单位 if (clickMapPointCtrl.LandArmy != armyCtrl.ArmyPrefab) { //如果攻击的不是自己 defenseArmy = clickMapPointCtrl.LandArmy.GetComponent <OtherArmyCtrl>(); } } else if (armyCtrl.armyState.MoveType == ArmyMoveType.SKY && clickMapPointCtrl != null && clickMapPointCtrl.LandArmy != null && clickMapPointCtrl.SkyArmy != null) { if (clickMapPointCtrl.SkyArmy != armyCtrl.ArmyPrefab) { //如果攻击方是飞行单位,且地图点上同时有陆地和飞行单位 MapPointCtrl mapPointCtrl = clickMapPointCtrl; Dispatch(AreoCode.UI, UIEvent.SHOW_SELECT_ATTACK_PANEL, true); yield return(new WaitUntil(isSetDefenseArmyType)); //打开面板后会清空选择的地图点控制器 clickMapPointCtrl = mapPointCtrl; if (defenseArmyType == ArmyMoveType.LAND) { defenseArmy = clickMapPointCtrl.LandArmy.GetComponent <OtherArmyCtrl>(); } else if (defenseArmyType == ArmyMoveType.SKY) { defenseArmy = clickMapPointCtrl.SkyArmy.GetComponent <OtherArmyCtrl>(); } defenseArmyType = -1; } } else if (armyCtrl.armyState.MoveType == ArmyMoveType.SKY && clickMapPointCtrl.LandArmy != null) { //如果攻击方位飞行单位,且地图点上只有陆地单位 if (armyCtrl.ArmyPrefab != clickMapPointCtrl.SkyArmy) { defenseArmy = clickMapPointCtrl.LandArmy.GetComponent <OtherArmyCtrl>(); } } else if (armyCtrl.armyState.MoveType == ArmyMoveType.SKY && clickMapPointCtrl.SkyArmy != null) { //如果攻击方位飞行单位,且地图点上只有飞行单位 if (armyCtrl.ArmyPrefab != clickMapPointCtrl.SkyArmy) { defenseArmy = clickMapPointCtrl.SkyArmy.GetComponent <OtherArmyCtrl>(); } } }
/// <summary> /// 兵种移动 /// </summary> private void Move() { if (Input.GetMouseButtonDown(0) && isSelect && iscanMove) { if (!EventSystem.current.IsPointerOverGameObject()) { //如果不在UI上 Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; bool isCollider = Physics.Raycast(ray, out hit, 1000, LayerMask.GetMask("MapPoint")); if (isCollider) { //List<MapPointCtrl> canMovePointCtrls = GetCanMoveMapPoint(); canMovePointCtrls = GetCanMoveMapPoint(); MapPointCtrl movePointctrl = hit.collider.gameObject.GetComponent <MapPointCtrl>(); if (canMove(canMovePointCtrls, movePointctrl)) { //如果可以移动 //移动 moveMessage.Change(ArmymapPointCtrl, movePointctrl, ArmyCard, ArmyPrefab); Dispatch(AreoCode.MAP, MapEvent.MOVE_MY_ARMY, ref moveMessage); //将颜色变为原来的 setMappointCtrlColor(canMovePointCtrls); //改变所在所在地图点控制器 ArmymapPointCtrl = movePointctrl; mapPoint = movePointctrl.mapPoint; //更新单位所在地图点 armyState.Position = movePointctrl.mapPoint; //更新可攻击点 canAttckPoint = MapAttackType.Instance.GetAttakRange(armyState); canAttckPointCtrls.Clear();//清空原先可攻击点 foreach (var point in canAttckPoint) { foreach (var item in MapManager.mapPointCtrls) { if (item.mapPoint.X == point.X && item.mapPoint.Z == point.Z) { canAttckPointCtrls.Add(item); break; } } } //移动完后无需再屏蔽 foreach (var item in MyArmyCtrlManager.Instance.CardCtrllist) { item.canBeSeletced = true;//所有单位可交互 } //本回合不能再移动 CanturnMove = false; } } } } }
private void removeArmy(ref MapPointCtrl Originalpointctrl, CardDto armyCard) { if (armyCard.MoveType == ArmyMoveType.LAND) { //陆地单位 Originalpointctrl.RemoveLandArmy(); } else if (armyCard.MoveType == ArmyMoveType.SKY) { Originalpointctrl.RemoveSkyArmy(); } }
public void Init(CardDto cardDto, MapPointCtrl mapPointCtrl, GameObject armyPrefab) { ArmyCard = cardDto; ArmymapPointCtrl = mapPointCtrl; mapPoint = ArmymapPointCtrl.mapPoint; ArmyPrefab = armyPrefab; //renderer = ArmyPrefab.gameObject.GetComponent<Renderer>(); setArmyState(cardDto); armyState.Position = mapPoint; canAttckPoint = MapAttackType.Instance.GetAttakRange(armyState); foreach (var point in canAttckPoint) { foreach (var item in MapManager.mapPointCtrls) { if (item.mapPoint.X == point.X && item.mapPoint.Z == point.Z) { canAttckPointCtrls.Add(item); break; } } } //canAttckPoint = GetAttakRange(armyState); if (armyState.Class == ArmyClassType.Ordinary) { //如果是普通兵种 canAttack = true; //isAttack = false; //isShowAttackButton = true; } else { //其他兵种 canAttack = false; //isAttack = false; } }
/// <summary> /// 判断选择的地图点控制器是否为空 /// </summary> /*private System.Func<bool> isclickMapPointCtrlnull = * () => * { * if(clickMapPointCtrl != null) * { * return true; * } * return false; * }; * * private System.Func<bool> isArmycanAttack = * () => * { * if(armyCtrl.Attack(clickMapPointCtrl, clickMapPointCtrl.gameObject.GetComponent<OtherArmyCtrl>())) * { * return true; * } * return false; * };*/ /// <summary> /// 获取点击的地图点控制器 /// </summary> /// <returns></returns> private MapPointCtrl GetMapPointCtrl() { if (Input.GetMouseButtonDown(0)) { if (!EventSystem.current.IsPointerOverGameObject()) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; bool isCollider = Physics.Raycast(ray, out hit, 1000, LayerMask.GetMask("MapPoint")); if (isCollider) { MapPointCtrl mapPointCtrl = hit.collider.GetComponent <MapPointCtrl>(); //StartCoroutine(selectDenfenseArmy()); return(mapPointCtrl); } } } return(null); }
/// <summary> /// 判断兵种是否可以向指定地图点移动 /// </summary> /// <param name="canMovePointCtrls"></param> /// <param name="movePointctrl"></param> /// <returns></returns> private bool canMove(List <MapPointCtrl> canMovePointCtrls, MapPointCtrl movePointctrl) { bool canmove = false; foreach (var item in canMovePointCtrls) { if (movePointctrl.mapPoint.X == item.mapPoint.X && movePointctrl.mapPoint.Z == item.mapPoint.Z) { if (ArmyCard.MoveType == ArmyMoveType.LAND && item.LandArmy == null) { //如果是陆地单位,且要移动到的地图点没有陆地单位 canmove = true; } else if (ArmyCard.MoveType == ArmyMoveType.SKY && item.SkyArmy == null) { //如果是飞行单位,且要移动到的地图点没有飞行点位 canmove = true; } break; } } return(canmove); }
/// <summary> /// 处理其他人的兵种移动 /// </summary> /// <param name="mapMoveDto"></param> private void processMoveOtherArmy(MapMoveDto mapMoveDto) { //镜像对称 int totalX = 12; int totalZ = 8; int Originalx = mapMoveDto.OriginalMapPoint.X; int Originalz = mapMoveDto.OriginalMapPoint.Z; int MoveX = mapMoveDto.MoveMapPoint.X; int MoveZ = mapMoveDto.MoveMapPoint.Z; int OtherOriginalx = totalX - Originalx; int OtherOriginalz = totalZ - Originalz;//对方兵种真实位置 int OtherMoveX = totalX - MoveX; int OtherMoveZ = totalZ - MoveZ; MapPointCtrl OriginalPointCtrl = null; MapPointCtrl MovePointCtrl = null; GameObject Army = null; OtherArmyCtrl otherArmyCtrl = null; foreach (var item in MapManager.mapPointCtrls) { if (item.mapPoint.X == OtherOriginalx && item.mapPoint.Z == OtherOriginalz) { OriginalPointCtrl = item; } else if (item.mapPoint.X == OtherMoveX && item.mapPoint.Z == OtherMoveZ) { MovePointCtrl = item; } if (OriginalPointCtrl != null && MovePointCtrl != null) { break; } } //fixbug已解决 只通过坐标选择了敌方单位 foreach (var item in OtherArmyCtrlManager.OtherArmyCtrlList) { if (item.transform.position.x == OtherOriginalx && item.transform.position.z == OtherOriginalz && item.armyState.MoveType == mapMoveDto.MoveType) { Army = item.gameObject; otherArmyCtrl = Army.GetComponent <OtherArmyCtrl>(); } } if (mapMoveDto.MoveType == ArmyMoveType.LAND) { //如果是陆地单位 OriginalPointCtrl.RemoveLandArmy(); MovePointCtrl.MoveLandArmy(ref Army, otherArmyCtrl.armyState.Race, otherArmyCtrl.armyState.Name, false); otherArmyCtrl.Move(MovePointCtrl.mapPoint, MovePointCtrl); } else if (mapMoveDto.MoveType == ArmyMoveType.SKY) { OriginalPointCtrl.RemoveSkyArmy(); MovePointCtrl.MoveSkyArmy(ref Army, otherArmyCtrl.armyState.Race, otherArmyCtrl.armyState.Name, false); otherArmyCtrl.Move(MovePointCtrl.mapPoint, MovePointCtrl); } }
public MapMoveMessage(MapPointCtrl mapPointCtrl, CardDto cardDto, GameObject armyPrefab) { this.mapPointCtrl = mapPointCtrl; this.cardDto = cardDto; this.armyPrefab = armyPrefab; }
/// <summary> /// 初始化兵种属性 /// </summary> /// <param name="race"></param> /// <param name="name"></param> public void Init(int race, int name, MapPointCtrl mapPointCtrl) { isSelect = false; setArmyState(race, name); OtherMapPintctrl = mapPointCtrl; }
public void Move(MapPoint mapPoint, MapPointCtrl mapPointCtrl) { armyState.Position = mapPoint; OtherMapPintctrl = mapPointCtrl; }
// Update is called once per frame void Update() { clickMapPointCtrl = GetMapPointCtrl(); //StartCoroutine(selectDenfenseArmy()); }
public bool Attack(MapPointCtrl defensemapPointCtrl, OtherArmyCtrl defenseArmy) { if (defenseArmy == null) { return(false); } bool canAttackPoint = false; //是否能攻击地图点上的兵种 int attackSpace = ArmyMoveType.NONE; //攻击陆地1 攻击飞行2 if (defenseArmy.armyState.Name == defensemapPointCtrl.LandArmyName) { attackSpace = ArmyMoveType.LAND; } else { attackSpace = ArmyMoveType.SKY; } if (canAttack) { //如果能攻击 foreach (var item in canAttckPoint) { if (item.X == defensemapPointCtrl.mapPoint.X && item.Z == defensemapPointCtrl.mapPoint.Z) { //canAttack = true; canAttackPoint = true; break; } } if (canAttackPoint && attackSpace == ArmyMoveType.LAND) { //如果攻击陆地兵种 //改变状态 //isAttack = true; //isShowAttackButton = false; canAttack = false; //TODO 播放攻击动画 //向服务器发送攻击消息 attackDto.Change(mapPoint, defensemapPointCtrl.mapPoint, armyState.MoveType, defenseArmy.armyState.MoveType); socketMsg.Change(OpCode.FIGHT, FightCode.ARMY_ATTACK_CREQ, attackDto); Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); return(true); } else if (canAttackPoint && attackSpace == ArmyMoveType.SKY) { //如果攻击飞行兵种 //改变状态 canAttack = false; //isShowAttackButton = false; //TODO 播放攻击动画 //向服务器发送攻击消息 attackDto.Change(mapPoint, defensemapPointCtrl.mapPoint, armyState.MoveType, defenseArmy.armyState.MoveType); socketMsg.Change(OpCode.FIGHT, FightCode.ARMY_ATTACK_CREQ, attackDto); Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); return(true); } } return(false); }
/// <summary> /// 处理设置其他人放置兵种 /// </summary> /// <param name="mapPointDto"></param> private void processSetOtherArmy(MapPointDto mapPointDto) { //镜像对称 int totalX = 12; int totalZ = 8; int x = mapPointDto.mapPoint.X; int z = mapPointDto.mapPoint.Z; int otherx = totalX - x; int otherz = totalZ - z;//对方兵种真实位置 MapPointCtrl mapPointCtrl = null; GameObject prefab; foreach (var item in MapManager.mapPointCtrls) { if (item.mapPoint.X == otherx && item.mapPoint.Z == otherz) { mapPointCtrl = item; break; } } //fixbug 放置第二个单位时会额外放置第一个单位 if (mapPointCtrl) { //传送的地图数据陆地单位不为空,且该地块上单位为空 if (mapPointDto.LandArmyRace != -1 && mapPointCtrl.LandArmyRace == -1) { //陆地单位 mapPointCtrl.mapPoint.X = otherx; mapPointCtrl.mapPoint.Z = otherz; mapPointCtrl.LandArmyRace = mapPointDto.LandArmyRace; mapPointCtrl.LandArmyName = mapPointDto.LandArmyName; setArmyPrefab(mapPointCtrl.LandArmyRace, mapPointCtrl.LandArmyName, out prefab); GameObject army = mapPointCtrl.SetLandArmy(prefab, false); //初始化敌方兵种信息 army.gameObject.GetComponent <OtherArmyCtrl>().Init(mapPointDto.LandArmyRace, mapPointDto.LandArmyName, mapPointCtrl); army.gameObject.GetComponent <OtherArmyCtrl>().armyState.Position = new Protocol.Constants.Map.MapPoint(otherx, otherz); //army.gameObject.GetComponent<OtherArmyCtrl>().armyState.CanFly = false; army.gameObject.GetComponent <OtherArmyCtrl>().armyState.MoveType = ArmyMoveType.LAND; mapPointCtrl.UpdateLandArmy(army); //向其他人添加兵种 Dispatch(AreoCode.ARMY, ArmyEvent.ADD_OTHER_ARMY, army); } if (mapPointDto.SkyArmyRace != -1 && mapPointCtrl.SkyArmyRace == -1) { //飞行单位 mapPointCtrl.mapPoint.X = otherx; mapPointCtrl.mapPoint.Z = otherz; mapPointCtrl.SkyArmyRace = mapPointDto.SkyArmyRace; mapPointCtrl.SkyArmyName = mapPointDto.SkyArmyName; setArmyPrefab(mapPointCtrl.SkyArmyRace, mapPointCtrl.SkyArmyName, out prefab); GameObject army = mapPointCtrl.SetSkyArmy(prefab, false); //初始化敌方兵种信息 army.gameObject.GetComponent <OtherArmyCtrl>().Init(mapPointDto.SkyArmyRace, mapPointDto.SkyArmyName, mapPointCtrl); army.gameObject.GetComponent <OtherArmyCtrl>().armyState.Position = new Protocol.Constants.Map.MapPoint(otherx, otherz); army.gameObject.GetComponent <OtherArmyCtrl>().armyState.MoveType = ArmyMoveType.SKY; mapPointCtrl.UpdateSkyArmy(army); Dispatch(AreoCode.ARMY, ArmyEvent.ADD_OTHER_ARMY, army); } } }
/// <summary> /// 地图上设置兵种 /// </summary> private void Build() { if (Input.GetMouseButtonDown(0)) { if (!EventSystem.current.IsPointerOverGameObject()) { //没有点在UI上 Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; /*bool hasArmy = Physics.Raycast(ray, out hit, 1000, LayerMask.GetMask("MyArmy")); * Queue<Collider> colliders = new Queue<Collider>(); * while (hasArmy) * { * Collider collider = hit.collider.GetComponent<Collider>(); * collider.enabled = false; * colliders.Enqueue(collider); * hasArmy = Physics.Raycast(ray, out hit, 1000, LayerMask.GetMask("MapPoint")); * }*/ bool isCollider = Physics.Raycast(ray, out hit, 1000, LayerMask.GetMask("MapPoint")); if (isCollider) { turnDelegate.Invoke(ref TurnCount);//获取回合数 MapPointCtrl mapPointCtrl = hit.collider.GetComponent <MapPointCtrl>(); if (selectArmyCard != null && armyPrefab != null) { if (selectArmyCard.Class == ArmyClassType.Hero && hit.collider.tag != "BossStart") { //如果是英雄单位只能箭头处 Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "英雄单位只能箭头处"); return; } else if (selectArmyCard.Class != ArmyClassType.Hero && hit.collider.tag == "BossStart") { Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "非英雄单位不能箭头处"); return; } if (TurnCount <= 1) { if (hit.collider.tag != "StartAreo" && hit.collider.tag != "Winline" && hit.collider.tag != "BossStart") { //如果第一回合不在屯兵区放置 Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "初始阶段只能后三排"); return; } } else { if (hit.collider.tag != "StartAreo" && hit.collider.tag != "Winline" && hit.collider.tag != "BossStart" && hit.collider.tag != "FeatureArea") { Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "只能放置在后五排"); return; } } switch (selectArmyCard.MoveType) { case ArmyMoveType.LAND: //陆地单位 if (mapPointCtrl.HasLandArmy()) { Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "此处已有陆地单位"); return; } //放置陆地单位 GameObject army; army = mapPointCtrl.SetLandArmy(armyPrefab, true); mapPointCtrl.LandArmyRace = selectArmyCard.Race; mapPointCtrl.LandArmyName = selectArmyCard.Name; //向我的兵种控制器集合添加兵种管理器 ArmyCtrl armyctrl = army.GetComponent <ArmyCtrl>(); armyctrl.Init(selectArmyCard, mapPointCtrl, army); armyctrl.armyState.MoveType = (ushort)selectArmyCard.MoveType; //更新地图点控制器 mapPointCtrl.UpdateLandArmy(army); myArmyCtrls.Add(armyctrl); //向发送发送出牌消息,让其他人消除卡牌 socketMsg.Change(OpCode.FIGHT, FightCode.DEAL_ARMYCARD_CREQ, selectArmyCard); Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); //移除卡牌 Dispatch(AreoCode.CHARACTER, CharacterEvent.REMOVE_MY_CARDS, selectArmyCard); //向服务器发送消息 pointDto.Change(mapPointCtrl.mapPoint, mapPointCtrl.LandArmyRace, mapPointCtrl.LandArmyName, mapPointCtrl.SkyArmyRace, mapPointCtrl.SkyArmyName); socketMsg.Change(OpCode.FIGHT, FightCode.MAP_SET_ARMY_CREQ, pointDto); Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); //向发送发送出牌消息,让其他人消除卡牌 //socketMsg.Change(OpCode.FIGHT, FightCode.DEAL_CARD_CREQ, "出牌请求"); //socketMsg.Change(OpCode.FIGHT, FightCode.DEAL_ARMYCARD_CREQ, selectArmyCard); //Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); break; case ArmyMoveType.SKY: if (mapPointCtrl.HasSkyArmy()) { Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "此处已有飞行单位"); return; } //放置飞行单位 army = mapPointCtrl.SetSkyArmy(armyPrefab, true); //mapPointCtrl.SkyArmyCard = selectArmyCard; mapPointCtrl.SkyArmyRace = selectArmyCard.Race; mapPointCtrl.SkyArmyName = selectArmyCard.Name; //向我的兵种控制器集合添加兵种管理器 armyctrl = army.GetComponent <ArmyCtrl>(); armyctrl.Init(selectArmyCard, mapPointCtrl, army); armyctrl.armyState.MoveType = (ushort)selectArmyCard.MoveType; //更新地图点控制器 mapPointCtrl.UpdateSkyArmy(army); myArmyCtrls.Add(armyctrl); //向发送发送出牌消息,让其他人消除卡牌 socketMsg.Change(OpCode.FIGHT, FightCode.DEAL_ARMYCARD_CREQ, selectArmyCard); Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); //移除卡牌 Dispatch(AreoCode.CHARACTER, CharacterEvent.REMOVE_MY_CARDS, selectArmyCard); //向服务器发送消息 pointDto.Change(mapPointCtrl.mapPoint, mapPointCtrl.LandArmyRace, mapPointCtrl.LandArmyName, mapPointCtrl.SkyArmyRace, mapPointCtrl.SkyArmyName); socketMsg.Change(OpCode.FIGHT, FightCode.MAP_SET_ARMY_CREQ, pointDto); Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg); /*//向发送发送出牌消息,让其他人消除卡牌 * socketMsg.Change(OpCode.FIGHT, FightCode.DEAL_ARMYCARD_CREQ, selectArmyCard); * Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg);*/ break; } /*while(colliders.Count != 0) * { * colliders.Dequeue().enabled = true; * }*/ foreach (var item in MyArmyCtrlManager.Instance.CardCtrllist) { item.canBeSeletced = true;//所有单位可交互 } } } } } }