コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public Task <Entity> CallAndStoreLater(DentEntity itemEntity, bool forceUpdate = false)
 {
     return(dentBank.CallAndStoreLater(itemEntity, forceUpdate));
 }
コード例 #4
0
 public bool TryGetOutput(DentEntity itemEntity, out Entity output)
 {
     return(map.TryGetValue(itemEntity, out output));
 }
コード例 #5
0
 public void StoreOutput(DentEntity itemEntity, Entity output)
 {
     map[itemEntity] = output;
 }
コード例 #6
0
        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);
        }