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 CheckAutoRefresh() { if (FuncCheckDead.IsDead()) { PropModel.Instance.RefreshCell(); PromptModel.Instance.Pop(LanguageUtil.GetTxt(11404)); Refresh(500); } }