private IEnumerator StartCreateAgents() { AJPHelper.Operation oper = UnitTable.Operation; while (!oper.IsDone) { yield return(null); } int i = 0; int count = UnitTable.Count; UnitRow unitData = null; UserInfoRow user = null; while (i < count) { unitData = UnitTable.ReadOnlyRows[i]; user = Users.GetUserById(unitData.ID_User); Create(unitData, user); i++; yield return(null); } yield break; }
private IEnumerator StartCreateRssWaiting() { AJPHelper.Operation oper = RSSPositionTable.Operation; while (!oper.IsDone) { yield return(null); } //if (!treeInited) //{ // int rssCount = RSSPositionTable.Count; // for (int iter = 0; iter < rssCount; iter++) // { // rssPositionTree.Insert // (RSSPositionTable.ReadOnlyRows[iter].Position.Parse3Int().ToClientPosition()); // } // treeInited = true; //} if (!treeInited) { rssPositionTree.AsyncCreateTree(GetRssPositionEnumerable()); while (!rssPositionTree.IsAsyncCreateComplete) { yield return(null); } treeInited = true; Debugger.Log("quad tree inited"); } isCreateComplete = false; int count = WaitForCreate.Count; //int i = count - 1; while (WaitForCreate.Count > 0 && !isCreateComplete) { Vector3Int pos = WaitForCreate[WaitForCreate.Count - 1].ToSerPosition(); RSS_PositionRow rssData = RSSPositionTable.GetRssAt(pos); if (rssData != null && !Resources.ContainsKey(rssData.ID)) { /// Using pool object for natural resource NaturalResource rs = RssPooling.GetItem(); rs.gameObject.name = "Resource" + rssData.RssType.ToString() + rssData.ID; Vector3 worldPos = MapIns.CellToWorld(rssData.Position.Parse3Int().ToClientPosition()); rs.SetResourceData(rssData, Flag.Owner, worldPos); Resources[rssData.ID] = rs; rs.gameObject.SetActive(true); //Debugger.Log("Created " + rssData.ID); } WaitForCreate.RemoveAt(WaitForCreate.Count - 1); //i--; yield return(null); } isCreateComplete = true; yield break; }