private bool ShowSwitchList(List <CellInfo> cells, CellInfo centerCell) { selectDepth = 1; list.ClearList(); bool hasSwitch = false; int i; List <Vector2> switchPoss = new List <Vector2> (); for (i = 0; i < cells.Count; i++) { CellInfo cellInfo = cells[i]; if (cellInfo != null) { bool isCoverOpen = CoverModel.Instance.IsOpen(cellInfo.posX, cellInfo.posY); if (cellInfo.isBlank == false && cellInfo.isMonsterHold == false && cellInfo.config.cell_type == (int)CellType.five && cellInfo.configId != centerCell.configId && isCoverOpen) { CreateSelectItem(cellInfo.posX, cellInfo.posY, true); hasSwitch = true; switchPoss.Add(new Vector2(cellInfo.posX, cellInfo.posY)); } } } for (i = 0; i < CellModel.Instance.allCells.Count; i++) { List <CellInfo> cellXs = CellModel.Instance.allCells[i]; for (int j = 0; j < cellXs.Count; j++) { bool has = false; CellInfo cellInfo = cellXs[j]; for (int n = 0; n < switchPoss.Count; n++) { Vector2 switchPos = switchPoss[n]; if ((int)switchPos.x == cellInfo.posX && cellInfo.posY == (int)switchPos.y) { has = true; break; } } if (has == false) { PropTouchItem itemCtr = CreateSelectItem(j, i, false); if (j == centerCell.posX && i == centerCell.posY) { itemCtr.Select(); } } } } return(hasSwitch); }
private void CreatBrushs(CellInfo centerCell) { selectDepth = 1; list.ClearList(); List <int> posIndexs = new List <int>() { 5, 6, 2, 3 }; if (centerCell.posX < 1) { posIndexs = new List <int>() { 1, 2, 3, 4 }; if (centerCell.posY < 1) { posIndexs = new List <int>() { 3, 4, 12, 13 }; } if (centerCell.posY >= (BattleModel.Instance.crtBattle.ShowHeight() - 1)) { posIndexs = new List <int>() { 1, 2, 7, 8 }; } } else if (centerCell.posX >= (BattleModel.Instance.crtBattle.ShowWidth() - 1)) { posIndexs = new List <int>() { 1, 6, 5, 4 }; if (centerCell.posY < 1) { posIndexs = new List <int>() { 14, 13, 5, 4 }; } if (centerCell.posY >= (BattleModel.Instance.crtBattle.ShowHeight() - 1)) { posIndexs = new List <int>() { 1, 6, 7, 18 }; } } else { if (centerCell.posY < 1) { posIndexs = new List <int>() { 14, 12, 5, 3 }; } if (centerCell.posY >= (BattleModel.Instance.crtBattle.ShowHeight() - 1)) { posIndexs = new List <int>() { 2, 6, 8, 18 }; } } List <int> controlIds = new List <int>() { 10101, 10102, 10103, 10104, 10105 }; List <Vector2> brushPoss = new List <Vector2> (); for (int i = 0; i < posIndexs.Count; i++) { int posIndex = posIndexs[i]; Vector2 offsetPos; if (centerCell.IsHump()) { if (posIndex >= FightConst.RING_HUMP[0].Count) { offsetPos = FightConst.RING_HUMP[1][posIndex - FightConst.RING_HUMP[0].Count]; } else { offsetPos = FightConst.RING_HUMP[0][posIndex]; } } else { if (posIndex >= FightConst.RING_VALLEY[0].Count) { offsetPos = FightConst.RING_VALLEY[1][posIndex - FightConst.RING_VALLEY[0].Count]; } else { offsetPos = FightConst.RING_VALLEY[0][posIndex]; } } int controlId = 0; for (int j = 0; j < controlIds.Count; j++) { int tempId = controlIds[j]; if (tempId != centerCell.configId) { controlId = tempId; controlIds.RemoveAt(j); break; } } brushPoss.Add(CreateBrushItem(centerCell.posX, centerCell.posY, (int)offsetPos.x, (int)offsetPos.y, controlId)); } for (int i = 0; i < CellModel.Instance.allCells.Count; i++) { List <CellInfo> cellXs = CellModel.Instance.allCells[i]; for (int j = 0; j < cellXs.Count; j++) { bool has = false; CellInfo cellInfo = cellXs[j]; for (int n = 0; n < brushPoss.Count; n++) { Vector2 brushPos = brushPoss[n]; if ((int)brushPos.x == cellInfo.posX && cellInfo.posY == (int)brushPos.y) { has = true; break; } } if (has == false) { PropTouchItem itemCtr = CreateSelectItem(j, i, false); if (j == centerCell.posX && i == centerCell.posY) { itemCtr.Select(); } } } } }