public override string ToString()
        {
#if NET_DOTS
            if (TypeIndex == 0)
            {
                return("None");
            }

            var            info = TypeManager.GetTypeInfo(TypeIndex);
            FixedString512 ns   = default;
            ns.Append(info.Debug.TypeName);

            if (IsBuffer)
            {
                ns.Append(" [B]");
            }
            if (AccessModeType == AccessMode.Exclude)
            {
                ns.Append(" [S]");
            }
            if (AccessModeType == AccessMode.ReadOnly)
            {
                ns.Append(" [RO]");
            }

            return(ns.ToString());
#else
            var name = GetManagedType().Name;
            if (IsBuffer)
            {
                return($"{name} [B]");
            }
            if (AccessModeType == AccessMode.Exclude)
            {
                return($"{name} [S]");
            }
            if (AccessModeType == AccessMode.ReadOnly)
            {
                return($"{name} [RO]");
            }
            if (TypeIndex == 0)
            {
                return("None");
            }
            return(name);
#endif
        }
Exemplo n.º 2
0
        protected override void OnUpdate()
        {
            if (!HasSingleton <CoopMission>())
            {
                return;
            }

            var singleton = GetSingletonEntity <CoopMission>();

            if (EntityManager.TryGetComponentData(singleton, out ExecutingMissionData executing))
            {
                if (!dentBank.TryGetOutput(executing.Target, out var output))
                {
                    dentBank.CallAndStoreLater(executing.Target);
                }
                else
                {
                    var data = EntityManager.GetSharedComponentData <MissionDetailsComponent>(output);
                    var str  = new FixedString512();
                    unsafe
                    {
                        const int resPathTypePlusProtocolLength = 5;
                        fixed(char *ptr = data.Path.FullString)
                        {
                            str.Append((byte *)ptr + resPathTypePlusProtocolLength, sizeof(char) * (ushort)(data.Path.FullString.Length - resPathTypePlusProtocolLength));
                        }
                    }

                    var switchMap = !HasSingleton <ExecutingMapData>();
                    if (!switchMap && !GetSingleton <ExecutingMapData>().Key.Equals(str))
                    {
                        switchMap = true;
                    }

                    if (switchMap)
                    {
                        EntityManager.AddComponentData(EntityManager.CreateEntity(), new RequestMapLoad {
                            Key = str
                        });
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                EntityManager.SetEnabled(popupEntity, !EntityManager.GetEnabled(popupEntity));
            }
        }