IEnumerator StartLoadGrid() { yield return(null); //while (StackSectorsUpdating.Count > 0) //{ // yield return null; // if (IsReloadGridMap) // yield return null; // string sector = StackSectorsUpdating.Pop(); // Debug.Log("************ RefreshGrid " + sector); // IsReloadGridMap = true; // RefreshGrid(sector); // yield return null; //} foreach (var cell in m_listCellsGridMap) { if (IsReloadGridMap) { yield return(null); } CellGridMapController sector = cell.GetSector(); IsReloadGridMap = true; RefreshGrid(sector.X, sector.Y); yield return(null); } }
//UpdateSprite() public void RefreshGrid(string sector) { if (Storage.Instance.IsLoadingWorld) { return; } ////#fix mem //Vector2 posSector = Helper.GetPositByField(sector); //ReloadCellGrid((int)posSector.x, (int)posSector.y); //for (int i = m_listCellsGridMap.Count - 1; i >= 0; i--) //{ // if (m_listCellsGridMap[i] == null) // { // m_listCellsGridMap.RemoveAt(i); // } //} GameObject cellMap = m_listCellsGridMap.Find(p => p.name == "MapGridCell" + sector); if (cellMap == null) { Debug.Log("###### RefreafGrid cellMap==null"); IsReloadGridMap = false; return; } CellGridMapController cellMapController = cellMap.GetComponent <CellGridMapController>(); if (cellMapController == null) { Debug.Log("###### RefreafGrid cellMapController == null"); IsReloadGridMap = false; return; } cellMapController.Refresh(); }
public static CellGridMapController GetSector(this GameObject cellMap) { CellGridMapController cellMapController = cellMap.GetComponent <CellGridMapController>(); return(cellMapController); }