public bool TryGetItemDetails(DentEntity itemEntity, out ReadOnlyItemDetails details) { details = default; return(dentBank.TryGetOutput(itemEntity, out var output) && EntityManager.HasComponent <ItemTargetAssetIdComponent>(output) && itemManager.TryGetDetails(EntityManager.GetSharedComponentData <ItemTargetAssetIdComponent>(output).Value.FullString, out details)); }
public Task <Entity> CallAndStoreLater(DentEntity dent, bool forceUpdate = false) { if (!forceUpdate && map.TryGetValue(dent, out var entity)) { taskMap.Remove(dent); return(Task.FromResult(entity)); } if (taskMap.TryGetValue(dent, out var existing)) { return(existing); } var task = World.GetExistingSystem <GameHostConnector>() .RpcClient.SendRequest <GetDentComponentsRpc, GetDentComponentsRpc.Response>(new GetDentComponentsRpc() { Dent = dent }); return(taskMap[dent] = storeTask(task, dent)); }
public Task <Entity> CallAndStoreLater(DentEntity itemEntity, bool forceUpdate = false) { return(dentBank.CallAndStoreLater(itemEntity, forceUpdate)); }
public bool TryGetOutput(DentEntity itemEntity, out Entity output) { return(map.TryGetValue(itemEntity, out output)); }
public void StoreOutput(DentEntity itemEntity, Entity output) { map[itemEntity] = output; }
private async Task <Entity> storeTask(Task <GetDentComponentsRpc.Response> parent, DentEntity dent) { await UniTask.SwitchToMainThread(); var response = await parent; var output = EntityManager.CreateEntity(); foreach (var kvp in response.ComponentTypeToJson) { var type = kvp.Key; var json = kvp.Value; Debug.LogError(type + ", " + json); switch (type) { case "PataNext.Core.ItemDetails": EntityManager.AddSharedComponentData(output, new ItemTargetAssetIdComponent { Value = JsonConvert.DeserializeObject <ItemDetails>(json).Asset }); break; case "PataNext.Core.MissionDetails": { var missionDetails = JsonConvert.DeserializeObject <MissionDetails>(json); MissionDetailsComponent component; component.Path = missionDetails.Path; component.Scenar = missionDetails.Scenar; component.Name = missionDetails.Name; component.Path.Compute(); component.Scenar.Compute(); EntityManager.AddSharedComponentData(output, component); break; } } } StoreOutput(dent, output); return(output); }