public void SwitchPos(CoverInfo cellA, CoverInfo cellB) { allCovers[cellA.posY].RemoveAt(cellA.posX); allCovers[cellA.posY].Insert(cellA.posX, cellB); allCovers[cellB.posY].RemoveAt(cellB.posX); allCovers[cellB.posY].Insert(cellB.posX, cellA); }
void xCoverBar_ItemTap(object sender, CoverInfo coverInfo) { int vid = coverInfo.Vid; string page = String.Format("/DetailPage.xaml?vid={0}&programSource=0", vid); NavigationService.Navigate(new Uri(page, UriKind.RelativeOrAbsolute)); }
public ChangeCoverActor(CoverLayer coverLayer, FightCoverItem coverItem, CoverInfo coverInfo) : base() { layer = coverLayer; item = coverItem; info = coverInfo; }
private void CompleteHander() { layer = null; item = null; info = null; OnEnd(); }
public FightCoverItem CreateCoverItem(CoverInfo coverInfo) { if (coverInfo.IsNull()) { return(null); } GameObject item = list.NewItem(); item.name = coverInfo.posX + "_" + coverInfo.posY; FightCoverItem itemCtr = item.AddComponent <FightCoverItem>(); itemCtr.type = type; itemCtr.coverInfo = coverInfo; itemCtr.icon = coverInfo.config.icon; itemCtr.rate = coverInfo.rate; itemCtr.UpdateTip(); PosMgr.SetFightCellPos(item.transform, coverInfo.posX, coverInfo.posY); if (coverInfo.show_type == CoverShowType.hide) { itemCtr.gameObject.transform.localScale = new Vector3(0, 1, 1); } return(itemCtr); }
public bool CanWreck(CoverInfo cover) { if (cover == null) { return(false); } return(cover.CanWreck()); }
public CoverInfo ClearCover(CoverInfo cover) { if (cover != null) { cover.SetConfig(0); } return(cover); }
public void RefreshCell() { safeCount++; if (safeCount > 1000) { safeCount = 0; ConfirmInfo confirmInfo = new ConfirmInfo(LanguageUtil.GetTxt(11602), LanguageUtil.GetTxt(11601), ExitFight, null, false); ConfirmModel.Instance.AddConfirm(confirmInfo); return; } CellModel.Instance.anims = new List <List <CellAnimInfo> > (); List <CellInfo> allElments = new List <CellInfo> (); for (int i = 0; i < BattleModel.Instance.crtBattle.ShowHeight(); i++) { List <CellInfo> xCells = CellModel.Instance.allCells[i]; for (int j = 0; j < xCells.Count; j++) { CellInfo cellInfo = xCells[j]; if (cellInfo.isBlank == false && cellInfo.isMonsterHold == false && cellInfo.config.cell_type == (int)CellType.five) { CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(cellInfo.posY, cellInfo.posX); if (coverInfo.IsNull()) { allElments.Add(cellInfo); } } } } int switchTimes = 0; while (allElments.Count > 1) { int randomA = UnityEngine.Random.Range(0, allElments.Count); CellInfo cellA = allElments[randomA]; allElments.RemoveAt(randomA); int randomB = UnityEngine.Random.Range(0, allElments.Count); CellInfo cellB = allElments[randomB]; allElments.RemoveAt(randomB); switchTimes++; CellModel.Instance.SwitchPos(cellA, cellB); cellA.SwitchPos(cellB); } if (FuncCheckDead.IsDead()) { RefreshCell(); } else { safeCount = 0; } }
public void SwitchPos(CoverInfo coverInfo) { CoverInfo coverCopy = coverInfo.Copy(); coverInfo.posX = posX; coverInfo.posY = posY; posX = coverCopy.posX; posY = coverCopy.posY; }
public bool IsOpen(int posx, int posy) { CoverInfo cover = GetCoverByPos(posy, posx); if (cover == null) { return(true); } return(cover.IsOpen()); }
public bool CanMove(int posx, int posy) { CoverInfo cover = GetCoverByPos(posy, posx); if (cover == null) { return(true); } return(cover.CanMove()); }
public bool AbsorbLine(int posx, int posy) { CoverInfo cover = GetCoverByPos(posy, posx); if (cover == null) { return(false); } return(cover.CanAbsorbLine()); }
public void AddAnim(CoverInfo coverInfo, CellAnimType animationType = CellAnimType.clear) { List <CoverAnimInfo> stepAnims = anims[anims.Count - 1]; CoverAnimInfo animInfo = new CoverAnimInfo(); animInfo.animationType = animationType; animInfo.startFrame = anims.Count; animInfo.coverInfo = coverInfo; stepAnims.Add(animInfo); }
public bool StopSkill(int posx, int posy) { CoverInfo cover = GetCoverByPos(posy, posx); if (cover == null) { return(false); } return(cover.StopSkill()); }
public CoverInfo GetCoverInfo() { CoverInfo coverInfo = new CoverInfo(); coverInfo.inCover = inCover; coverInfo.wallL = tpwe.wallL; coverInfo.wallR = tpwe.wallR; coverInfo.zoomL = tpwe.zoomL; coverInfo.zoomR = tpwe.zoomR; return(coverInfo); }
public List <CoverInfo> Timing() { List <CoverInfo> timerCovers = new List <CoverInfo>(); for (int i = 0; i < allCovers.Count; i++) { List <CoverInfo> xCovers = allCovers[i]; for (int j = 0; j < xCovers.Count; j++) { CoverInfo coverInfo = xCovers[j]; if (coverInfo.IsNull()) { coverInfo.timer = -1; } else if (coverInfo.timer > 0) { coverInfo.timer--; timerCovers.Add(coverInfo); if (coverInfo.timer == 0) { List <CoverInfo> covers = CoverModel.Instance.GetNeighbors(coverInfo); for (int n = 0; n < covers.Count; n++) { CoverInfo cover = covers[n]; if (cover != null) { if (cover.timer == -1) { CellInfo cellInfo = CellModel.Instance.GetCellByPos(cover.posX, cover.posY); if (cellInfo.isBlank == false && cellInfo.config.id == 10001) { } else { cover.SetConfig(coverInfo.config.GetSpecialValue(0)); } } } } coverInfo.SetConfig(0); } } } } return(timerCovers); }
public void RollCut(int cutNum) { crtBattle.RollCut(cutNum); int i; for (i = 0; i < cutNum; i++) { MonsterModel.Instance.allMonsters.RemoveAt(0); FloorModel.Instance.allFloors.RemoveAt(0); CellModel.Instance.allCells.RemoveAt(0); WallModel.Instance.allWalls.RemoveAt(0); CoverModel.Instance.allCovers.RemoveAt(0); } for (i = 0; i < crtBattle.battle_height; i++) { List <MonsterInfo> yMonsters = MonsterModel.Instance.allMonsters[i]; List <FloorInfo> yFloors = FloorModel.Instance.allFloors[i]; List <CellInfo> yCells = CellModel.Instance.allCells[i]; List <List <WallInfo> > yWalls = WallModel.Instance.allWalls[i]; List <CoverInfo> yCovers = CoverModel.Instance.allCovers[i]; for (int j = 0; j < crtBattle.battle_width; j++) { MonsterInfo monsterInfo = yMonsters[j]; monsterInfo.posY -= cutNum; FloorInfo floorInfo = yFloors[j]; floorInfo.posY -= cutNum; CellInfo cellInfo = yCells[j]; cellInfo.posY -= cutNum; List <WallInfo> xWalls = yWalls[j]; for (int n = 0; n < xWalls.Count; n++) { WallInfo wallInfo = xWalls[n]; wallInfo.posY -= cutNum; } CoverInfo coverInfo = yCovers[j]; coverInfo.posY -= cutNum; } } SkillModel.Instance.InitFightingEntitys(); }
public CoverInfo GetCoverInfByRunId(int runId) { for (int i = 0; i < allCovers.Count; i++) { for (int j = 0; j < allCovers[i].Count; j++) { CoverInfo coverInfo = allCovers[i][j]; if (coverInfo.runId == runId) { return(coverInfo); } } } return(null); }
public CoverInfo Copy() { CoverInfo coverInfo = new CoverInfo(); coverInfo.runId = runId; //if (config != null) //{ // coverInfo.config = (config_cover_item)config.Copy(); //} coverInfo.config = config; coverInfo.posX = posX; coverInfo.posY = posY; coverInfo.show_type = show_type; coverInfo.rate = rate; return(coverInfo); }
//是否僵局 public static bool IsDead() { List <List <CellInfo> > allCells = CellModel.Instance.allCells; List <List <CellInfo> > tempAllCells = new List <List <CellInfo> >(); int i; for (i = 0; i < BattleModel.Instance.crtBattle.ShowHeight(); i++) { List <CellInfo> xCells = allCells[i]; tempAllCells.Add(new List <CellInfo>()); for (int j = 0; j < xCells.Count; j++) { CellInfo cellInfo = xCells[j]; if (cellInfo.isBlank == false && cellInfo.isMonsterHold == false && cellInfo.config.line_type > 0) { CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(cellInfo.posY, cellInfo.posX); if (coverInfo.CanLine()) { tempAllCells[i].Add(cellInfo.Copy()); } else { tempAllCells[i].Add(null); } } else { tempAllCells[i].Add(null); } if (cellInfo.isBlank == false && cellInfo.isMonsterHold == false && cellInfo.config.cell_type == (int)CellType.radiate) { if (!RadiateCheck(allCells, cellInfo)) { return(false); } } } } return(RecursiveCheck(tempAllCells)); }
public void UpdateRate() { List <GameObject> items = list.items; for (int i = 0; i < items.Count; i++) { GameObject item = (GameObject)items[i]; if (item == null) { continue; } FightCoverItem cellItemCtr = item.GetComponent <FightCoverItem>(); CoverInfo coverInfo = cellItemCtr.coverInfo; if (coverInfo.show_type != CoverShowType.aways) { coverInfo.rate--; if (coverInfo.rate == 0) { if (coverInfo.show_type == CoverShowType.show) { coverInfo.show_type = CoverShowType.hide; coverInfo.rate = (int)Math.Abs(coverInfo.config.hide_rate); LeanTween.scaleX(cellItemCtr.gameObject, 0, 0.2f); //LeanTween.alpha((RectTransform)cellItemCtr.iconImage.transform, 0.1f, 0.2f); } else { coverInfo.show_type = CoverShowType.show; coverInfo.rate = coverInfo.config.show_rate; LeanTween.scaleX(cellItemCtr.gameObject, 1, 0.2f); //LeanTween.alpha((RectTransform)cellItemCtr.iconImage.transform, 1, 0.2f); } } cellItemCtr.rate = coverInfo.rate; } } }
public override void ShowList() { base.ShowList(); if (BattleModel.Instance.crtBattle == null) { return; } int i; for (i = 0; i < CoverModel.Instance.allCovers.Count; i++) { for (int j = 0; j < CoverModel.Instance.allCovers[0].Count; j++) { CoverInfo coverInfo = CoverModel.Instance.allCovers[i][j]; CreateCoverItem(coverInfo); } } }
public List <CoverInfo> GetNeighbors(CoverInfo centerCover) { List <CoverInfo> neighbors = new List <CoverInfo>(); neighbors.Add(GetCoverByPos(centerCover.posY, centerCover.posX - 1)); neighbors.Add(GetCoverByPos(centerCover.posY, centerCover.posX + 1)); neighbors.Add(GetCoverByPos(centerCover.posY + 1, centerCover.posX)); neighbors.Add(GetCoverByPos(centerCover.posY - 1, centerCover.posX)); if (centerCover.IsHump()) { neighbors.Add(GetCoverByPos(centerCover.posY - 1, centerCover.posX - 1)); neighbors.Add(GetCoverByPos(centerCover.posY - 1, centerCover.posX + 1)); } else { neighbors.Add(GetCoverByPos(centerCover.posY + 1, centerCover.posX - 1)); neighbors.Add(GetCoverByPos(centerCover.posY + 1, centerCover.posX + 1)); } return(neighbors); }
public static void CreateLocalNotifications(CoverInfo item) { TileUpdater notifier = TileUpdateManager.CreateTileUpdaterForApplication(); if (notifier.Setting == NotificationSetting.Enabled) { notifier.EnableNotificationQueue(true); var SquareTemplate = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquarePeekImageAndText04); SquareTemplate.GetElementsByTagName("image")[0].Attributes[1].NodeValue = item.ImageUri;//"ms-appdata:///local/" + item.Name; SquareTemplate.GetElementsByTagName("text")[0].AppendChild(SquareTemplate.CreateTextNode(item.Title)); var WideTemplate = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImageAndText01); WideTemplate.GetElementsByTagName("image")[0].Attributes[1].NodeValue = item.ImageUri; //"ms-appdata:///local/" + item.Name; WideTemplate.GetElementsByTagName("text")[0].AppendChild(WideTemplate.CreateTextNode(item.Title)); //WideTemplate.GetElementsByTagName("text")[1].AppendChild(WideTemplate.CreateTextNode(item.Note)); var node = WideTemplate.ImportNode(SquareTemplate.GetElementsByTagName("binding").Item(0), true); WideTemplate.GetElementsByTagName("visual").Item(0).AppendChild(node); var tileNotification = new TileNotification(WideTemplate); notifier.Update(tileNotification); } }
private void Refresh(int waitmillisecond = 0, List <CellInfo> cells = null, FightStadus fightStadus = FightStadus.prop_refresh) { bool hasRefresh = false; rootAction = new OrderAction(); ParallelAction scale1 = new ParallelAction(); ParallelAction movos = new ParallelAction(); ParallelAction scale2 = new ParallelAction(); if (cells == null) { for (int i = 0; i < CellModel.Instance.allCells.Count; i++) { List <CellInfo> xCells = CellModel.Instance.allCells[i]; for (int j = 0; j < xCells.Count; j++) { CellInfo cellInfo = xCells[j]; CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(cellInfo.posY, cellInfo.posX); if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five && coverInfo.IsNull()) { hasRefresh = true; FightCellItem item = GetItemByRunId(cellInfo.runId); if (fightStadus == FightStadus.changer) { item.transform.localRotation = Quaternion.identity; scale1.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 180), 0.2f)); } else { scale1.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.3f)); } if (fightStadus == FightStadus.changer) { scale2.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 360), 0.2f)); } else { Vector2 toPos = PosUtil.GetFightCellPos(cellInfo.posX, cellInfo.posY); movos.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.1f)); scale2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.3f)); } } } } } else { for (int j = 0; j < cells.Count; j++) { CellInfo cellInfo = cells[j]; if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five) { hasRefresh = true; FightCellItem item = GetItemByRunId(cellInfo.runId); if (fightStadus == FightStadus.changer) { item.transform.localRotation = Quaternion.identity; scale1.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 180), 0.2f)); } else { scale1.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.3f)); } if (fightStadus == FightStadus.changer) { scale2.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 360), 0.2f)); } else { Vector2 toPos = PosUtil.GetFightCellPos(cellInfo.posX, cellInfo.posY); movos.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.1f)); scale2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.3f)); } } } } if (waitmillisecond > 0) { rootAction.AddNode(new WaitActor(waitmillisecond)); } if (hasRefresh) { rootAction.AddNode(new PlaySoundActor("Refresh")); } rootAction.AddNode(scale1); rootAction.AddNode(movos); rootAction.AddNode(scale2); ExecuteAction(fightStadus); }
private void UnlockMonster(bool isJet = false) { List <int> unLockIds = MonsterModel.Instance.UnLock(isJet); MonsterModel.Instance.BackUpUnLockMonster(unLockIds); rootAction = new OrderAction(); for (int j = 0; j < unLockIds.Count; j++) { int monsterRunId = unLockIds[j]; FightMonsterItem monsterItem = monsterLayer.GetItemByRunId(monsterRunId); rootAction.AddNode(new SetLayerActor(monsterItem.transform, effectLayer.transform)); CellInfo monsterCell = new CellInfo(); monsterCell.posX = monsterItem.monsterInfo.posX; monsterCell.posY = monsterItem.monsterInfo.posY; if (isJet) { if (monsterItem.monsterInfo.IsNull()) { CellDirType dirType = WallModel.Instance.GetGapWallDir(monsterCell); int zrotate = PosUtil.GetRotateByDir(dirType); rootAction.AddNode(new RoatateActor((RectTransform)monsterItem.transform, new Vector3(0, 0, zrotate), 0.25f)); } else { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1.15f, 1.15f, 1f), 0.2f)); } } List <CellInfo> releaseList = MonsterModel.Instance.ReleaseList(monsterRunId); if (releaseList.Count > 0) { ParallelAction paralle = new ParallelAction(); for (int i = 0; i < releaseList.Count; i++) { CellInfo cellInfo = releaseList[i]; FightCellItem item = GetItemByRunId(cellInfo.runId); if (item == null) { GameObject itemObj = CreateCellItem(cellInfo); item = itemObj.GetComponent <FightCellItem>(); } OrderAction order = new OrderAction(); order.AddNode(new PlaySoundActor("Refresh")); order.AddNode(new ShowEffectLineActor(effectLayer, cellInfo, monsterCell, monsterItem.monsterInfo.releaseId)); order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f)); order.AddNode(new ChangeCellActor(item, cellInfo, monsterItem.monsterInfo.releaseId)); paralle.AddNode(order); } rootAction.AddNode(paralle); } if (monsterItem.monsterInfo.IsNull()) { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1.25f, 1.25f, 0), 0.15f)); if (j == 0) { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(0, 0, 0), 0.25f)); } else { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(0, 0, 0), 0.15f)); } } else { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1, 1, 1), 0.05f)); CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(monsterItem.monsterInfo.posY, monsterItem.monsterInfo.posX); FightCoverItem coverItem = coverLayer.GetItemByRunId(coverInfo.runId); rootAction.AddNode(new ChangeCoverActor(coverLayer, coverItem, coverInfo)); rootAction.AddNode(new ProgressMonsterActor(monsterItem, monsterItem.monsterInfo.progress)); rootAction.AddNode(new SetLayerActor(monsterItem.transform, monsterLayer.transform)); } } if (isJet) { ExecuteAction(FightStadus.jet_monster); } else { ParallelAction paralleTimer = new ParallelAction(); List <CellInfo> timerCells = CellModel.Instance.Timing(); for (int i = 0; i < timerCells.Count; i++) { CellInfo cellInfo = timerCells[i]; FightCellItem item = GetItemByRunId(cellInfo.runId); if (item != null) { OrderAction order = new OrderAction(); order.AddNode(new PlaySoundActor("Refresh")); order.AddNode(new ChangeCellActor(item, cellInfo)); if (cellInfo.isBlank) { order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.2f)); order.AddNode(new DestroyActor(item.gameObject)); } paralleTimer.AddNode(order); } } List <CoverInfo> timerCovers = CoverModel.Instance.Timing(); for (int i = 0; i < timerCovers.Count; i++) { CoverInfo coverInfo = timerCovers[i]; FightCoverItem item = coverLayer.GetItemByRunId(coverInfo.runId); OrderAction order = new OrderAction(); order.AddNode(new PlaySoundActor("Refresh")); order.AddNode(new ChangeCoverActor(coverLayer, item, coverInfo)); if (coverInfo.IsNull()) { order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.2f)); order.AddNode(new DestroyActor(item.gameObject)); List <CoverInfo> covers = CoverModel.Instance.GetNeighbors(coverInfo); for (int n = 0; n < covers.Count; n++) { CoverInfo cover = covers[n]; if (cover != null) { item = coverLayer.GetItemByRunId(cover.runId); order.AddNode(new ChangeCoverActor(coverLayer, item, cover)); if (cover.config != null) { coverFlowInterrupt = true; } } } } paralleTimer.AddNode(order); } rootAction.AddNode(paralleTimer); if (coverFlowInterrupt) { rootAction.AddNode(new FuncActor(coverLayer.ShowList)); //todo 爆后流动导致多出蜘蛛网 } ExecuteAction(FightStadus.unlock_monster); } }
public void InitFight() { FightModel.Instance.InitFightInfo(); CellInfo.start_x = crtBattle.start_x; MonsterModel.Instance.Destroy(); FloorModel.Instance.Destroy(); CellModel.Instance.Destroy(); WallModel.Instance.Destroy(); CoverModel.Instance.Destroy(); InvadeModel.Instance.Destroy(); int i; for (i = 0; i < crtBattle.battle_height; i++) { List <MonsterInfo> yMonsters = new List <MonsterInfo>(); List <FloorInfo> yFloors = new List <FloorInfo>(); List <CellInfo> yCells = new List <CellInfo>(); List <List <WallInfo> > yWalls = new List <List <WallInfo> >(); List <CoverInfo> yCovers = new List <CoverInfo>(); MonsterModel.Instance.allMonsters.Add(yMonsters); FloorModel.Instance.allFloors.Add(yFloors); CellModel.Instance.allCells.Add(yCells); WallModel.Instance.allWalls.Add(yWalls); CoverModel.Instance.allCovers.Add(yCovers); for (int j = 0; j < crtBattle.battle_width; j++) { BattleCellInfo battleCellInfo = crtBattle.allCells[i][j]; MonsterInfo monsterInfo = new MonsterInfo(); monsterInfo.configId = battleCellInfo.monster_id; monsterInfo.SetConfig(battleCellInfo.monster_id); monsterInfo.posX = j; monsterInfo.posY = i; yMonsters.Add(monsterInfo); FloorInfo floorInfo = new FloorInfo(); floorInfo.SetConfig(battleCellInfo.floor_id); floorInfo.posX = j; floorInfo.posY = i; yFloors.Add(floorInfo); CellInfo cellInfo = new CellInfo(); cellInfo.SetConfig(battleCellInfo.cell_id); cellInfo.posX = j; cellInfo.posY = i; yCells.Add(cellInfo); if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.changer) { cellInfo.changer = cellInfo.config.icon; cellInfo.SetConfig(cellInfo.config.hide_id); cellInfo.originalConfigId = cellInfo.config.hide_id; } if (cellInfo.config != null) { if (cellInfo.config.cell_type == (int)CellType.invade || cellInfo.config.id == 10007) { InvadeModel.Instance.AddInvade(cellInfo); } } CoverInfo coverInfo = new CoverInfo(); coverInfo.SetConfig(battleCellInfo.cover_id); coverInfo.posX = j; coverInfo.posY = i; yCovers.Add(coverInfo); List <WallInfo> xWalls = new List <WallInfo>(); for (int n = 0; n < 3; n++) { WallInfo wallInfo = new WallInfo(); wallInfo.SetConfig(battleCellInfo.walls[n]); wallInfo.posX = j; wallInfo.posY = i; wallInfo.posN = n; xWalls.Add(wallInfo); } yWalls.Add(xWalls); } } MonsterModel.Instance.RandomPos(); MonsterModel.Instance.HoldAll(); HideModel.Instance.LoadHider(); }
private void Backup() { allFloorsBackup = FloorModel.Instance.allFloors; allCellsBackup = CellModel.Instance.allCells; allWallsBackup = WallModel.Instance.allWalls; allCoversBackup = CoverModel.Instance.allCovers; allMonstersBackup = MonsterModel.Instance.allMonsters; lineCellsBackup = CellModel.Instance.lineCells; rollbackCellBackup = CellModel.Instance.rollbackCell; fighting_entitysBackup = SkillModel.Instance.fighting_entitys; FloorModel.Instance.allFloors = new List <List <FloorInfo> >(); CellModel.Instance.allCells = new List <List <CellInfo> >(); WallModel.Instance.allWalls = new List <List <List <WallInfo> > >(); CoverModel.Instance.allCovers = new List <List <CoverInfo> >(); MonsterModel.Instance.allMonsters = new List <List <MonsterInfo> >(); SkillModel.Instance.fighting_entitys = new List <SkillEntityInfo>(); List <List <CellInfo> > allCells = allCellsBackup; int i; for (i = 0; i < allCells.Count; i++) { List <FloorInfo> yFloors = new List <FloorInfo>(); List <CellInfo> yCells = new List <CellInfo>(); List <List <WallInfo> > yWalls = new List <List <WallInfo> >(); List <CoverInfo> yCovers = new List <CoverInfo>(); List <MonsterInfo> yMonsters = new List <MonsterInfo>(); FloorModel.Instance.allFloors.Add(yFloors); CellModel.Instance.allCells.Add(yCells); WallModel.Instance.allWalls.Add(yWalls); CoverModel.Instance.allCovers.Add(yCovers); MonsterModel.Instance.allMonsters.Add(yMonsters); List <CellInfo> xCells = allCells[i]; for (int j = 0; j < xCells.Count; j++) { CellInfo cellInfo = xCells[j]; yCells.Add(cellInfo.Copy()); FloorInfo floorInfo = allFloorsBackup[cellInfo.posY][cellInfo.posX]; yFloors.Add(floorInfo.Copy()); CoverInfo coverInfo = allCoversBackup[cellInfo.posY][cellInfo.posX]; yCovers.Add(coverInfo.Copy()); MonsterInfo monsterInfo = allMonstersBackup[cellInfo.posY][cellInfo.posX]; yMonsters.Add(monsterInfo.Copy()); List <WallInfo> xWalls = new List <WallInfo>(); yWalls.Add(xWalls); for (int n = 0; n < 3; n++) { WallInfo wallInfo = allWallsBackup[cellInfo.posY][cellInfo.posX][n]; xWalls.Add(wallInfo.Copy()); } } } CellModel.Instance.lineCells = new List <CellInfo>(); for (i = 0; i < lineCellsBackup.Count; i++) { CellInfo cellInfo = lineCellsBackup[i]; CellModel.Instance.lineCells.Add(CellModel.Instance.allCells[cellInfo.posY][cellInfo.posX]); } if (rollbackCellBackup == null) { CellModel.Instance.rollbackCell = null; } else { CellModel.Instance.rollbackCell = CellModel.Instance.allCells[rollbackCellBackup.posY][rollbackCellBackup.posX]; } for (i = 0; i < fighting_entitysBackup.Count; i++) { SkillEntityInfo fighting_entity = fighting_entitysBackup[i]; SkillEntityInfo fighting_entityCopy = fighting_entity.Copy(); fighting_entityCopy.cell = CellModel.Instance.allCells[fighting_entityCopy.cell.posY][fighting_entityCopy.cell.posX]; for (int j = 0; j < fighting_entityCopy.controlCells.Count; j++) { CellInfo controlCell = fighting_entityCopy.controlCells[j]; fighting_entityCopy.controlCells[j] = CellModel.Instance.allCells[controlCell.posY][controlCell.posX]; } SkillModel.Instance.fighting_entitys.Add(fighting_entityCopy); } }
//用来排序 public int CompareTo(object obj) { CoverInfo target = obj as CoverInfo; return(runId.CompareTo(target.runId)); }
private static bool RadiateCheck(List <List <CellInfo> > allCells, CellInfo radiateCell) { CellInfo checkCenterInfo = radiateCell; //一轮查找 List <CellInfo> firstRingCells = new List <CellInfo>(); int i; for (i = 0; i < checkList.Count; i++) { Vector2 indexPos; indexPos = FightConst.GetHoleByLevel(checkList[i], checkCenterInfo.IsHump()); Vector2 offsetPos = new Vector2(checkCenterInfo.posX + indexPos.x, checkCenterInfo.posY - indexPos.y); CellInfo checkCell = GetCellByPos(allCells, (int)offsetPos.x, (int)offsetPos.y); if (checkCell != null && checkCell.isBlank == false && checkCell.isMonsterHold == false && (checkCell.config.line_type > 0 || checkCell.config.cell_type == (int)CellType.radiate)) { CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(checkCell.posY, checkCell.posX); if (coverInfo.CanLine()) { if (WallModel.Instance.CanLine(checkCenterInfo, checkCell)) { firstRingCells.Add(checkCell); } } } if (firstRingCells.Count > 1) { for (int j = 0; j < (firstRingCells.Count - 1); j++) { CellInfo checkA = firstRingCells [j]; for (int n = (j + 1); n < firstRingCells.Count; n++) { CellInfo checkB = firstRingCells [n]; if (checkA.IsNeighbor(checkB)) { if (WallModel.Instance.CanLine(checkA, checkB)) { return(false); } } } } } } if (firstRingCells.Count == 0) { return(true); } else { for (int b = 0; b < firstRingCells.Count; b++) { CellInfo checkCenterInfo2 = firstRingCells[b]; //二轮查找 List <CellInfo> secondRingCells = new List <CellInfo>(); for (i = 0; i < checkList.Count; i++) { Vector2 indexPos = FightConst.GetHoleByLevel(checkList[i], checkCenterInfo2.IsHump()); Vector2 offsetPos = new Vector2(checkCenterInfo2.posX + indexPos.x, checkCenterInfo2.posY - indexPos.y); CellInfo checkCell = GetCellByPos(allCells, (int)offsetPos.x, (int)offsetPos.y); if (checkCell != null && checkCell.isBlank == false && checkCell.isMonsterHold == false && checkCenterInfo != checkCell && checkCell.config.line_type == checkCenterInfo.config.line_type) { CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(checkCell.posY, checkCell.posX); if (coverInfo.CanLine()) { if (WallModel.Instance.CanLine(checkCenterInfo2, checkCell)) { secondRingCells.Add(checkCell); } } } if (secondRingCells.Count > 1) { return(false); } } } return(true); } }