using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; public class AllManeger : MonoBehaviour { public queryClosestKnight521 queryClosestKnight521=new queryClosestKnight521(); public ClosestKnight closestKnight521 = new ClosestKnight(); public queryKnightRoomList522 queryKnightRoomList522 = new queryKnightRoomList522(); public KnightRoomBetList knightRoomBetList = new KnightRoomBetList(); public int id;//游戏id public string gameNo;//游戏编号 public int GameSession;//游戏场次 public List horseInfos = new List(); public List snailRiders = new List(); public List KillNos=new List(); public List WinNos = new List(); // Start is called before the first frame update async void Start() { closestKnight521 = await queryClosestKnight521.queryClosestKnight(); id=closestKnight521.Data.GameKnightModel.Id; gameNo = closestKnight521.Data.GameKnightModel.GameNo; GameSession = closestKnight521.Data.GameKnightModel.GameSession; GetHorseInfo521(closestKnight521.Data.GameKnightRoomResponseVoList); GetKillInfo521(closestKnight521.Data.GameKnightModel); AllMove(); InvokeRepeating("Fuck522", 2, 2); } // Update is called once per frame void Update() { } void OnDestroy() { CancelInvoke("Fuck522"); } public void Fuck522(List GameKnightRoomResponseVoList) { foreach (GameKnightRoomResponseVo item in GameKnightRoomResponseVoList) { foreach (HorseInfo horse in horseInfos) { if (horse.HorseNo == item.HorseNo) { horse.numText.text = item.HorseBeansCoin.ToString(); } } } } public void GetHorseInfo521(List GameKnightRoomResponseVoList)//获得马匹的信息 { foreach (GameKnightRoomResponseVo item in GameKnightRoomResponseVoList) { foreach (HorseInfo horse in horseInfos) { if (horse.HorseNo==item.HorseNo) { horse.KnightId = item.KnightId; horse.HorseUserNo = item.HorseUserNo; horse.HorseBeansCoin = item.HorseBeansCoin; horse.numText.text = item.HorseBeansCoin.ToString(); } } } } public void GetKillInfo521(GameKnightModel GameKnightModel)//获取击杀马匹与留存马匹 { Debug.Log("获取击杀马匹与留存马匹"); if (GameKnightModel.HorseNoKill!="") { string[] parts = GameKnightModel.HorseNoKill.Split(","); // 根据 ',' 分割字符串d KillNos = parts.Select(int.Parse).ToList(); foreach (int killno in KillNos) { foreach (HorseInfo horse in horseInfos) { if (horse.HorseNo == killno) { horse.snail.is_die = true; } } } } if (GameKnightModel.HorseNoRemain!="") { string[] parts_2 = GameKnightModel.HorseNoRemain.Split(","); WinNos = parts_2.Select(int.Parse).ToList(); foreach (int winno in WinNos) { foreach (HorseInfo horse in horseInfos) { if (horse.HorseNo == winno) { horse.snail.is_victory = true; } } } } } public void AllMove()//所有蜗牛开跑 { Debug.Log("准备"); foreach (snailRider snail in snailRiders) { Debug.Log("开炮"); snail.startMove(); } } }