Skip to content

Commit

Permalink
feat(#418): Переделать метод получения списка созданных объектов на к…
Browse files Browse the repository at this point in the history
…оллектор
  • Loading branch information
avkviring committed Aug 23, 2023
1 parent d7ad760 commit 19d26b9
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions client/Unity/Packages/games.cheetah.client/Runtime/Reader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Games.Cheetah.Client.Codec;
using Games.Cheetah.Client.Types.Command;
using Games.Cheetah.Client.Types.Field;
Expand Down Expand Up @@ -33,12 +32,23 @@ public Reader(NetworkClient client, CodecRegistry codecRegistry)
/**
* Получить объекты с сервера, создание которых завершилось в текущем Update
*/
public void CollectCreatedObjectsInCurrentUpdate(ushort template, IList<NetworkObjectConstructor> result)
{
foreach (var (key, value) in createdObjectsInUpdate)
{
if (value.NetworkObject.Template == template)
{
result.Add(value);
}
}
}

[Obsolete]
public IList<NetworkObjectConstructor> GetCreatedObjectsInCurrentUpdate(ushort template)
{
return createdObjectsInUpdate
.Where(it => it.Value.NetworkObject.Template == template)
.Select(it => it.Value)
.ToList();
var result = new List<NetworkObjectConstructor> ();
CollectCreatedObjectsInCurrentUpdate(template, result);
return result;
}

/**
Expand Down

0 comments on commit 19d26b9

Please sign in to comment.