示例#1
0
 public Working(string name, Vector3D?ps, string desc, SlimProfilerEntry spe)
 {
     Name        = name;
     Position    = ps;
     Description = desc;
     Profiler    = spe;
 }
示例#2
0
 public void AcceptPhysicsCluster(BoundingBoxD cluster, SlimProfilerEntry spe)
 {
     if (Type != ProfilerRequestType.Physics)
     {
         return;
     }
     Accept("Cluster", cluster.Center, "Radius=" + cluster.HalfExtents.Length().ToString(DistanceFormat), spe);
 }
示例#3
0
        public void AcceptGrid(long id, SlimProfilerEntry spe)
        {
            if (Type != ProfilerRequestType.Grid)
            {
                return;
            }
            var grid = MyEntities.GetEntityById(id) as MyCubeGrid;

            Accept(grid?.DisplayName ?? "Unknown", grid?.PositionComp.WorldAABB.Center, "ID=" + id, spe);
        }
示例#4
0
        public void AcceptScript(long id, SlimProfilerEntry spe)
        {
            if (Type != ProfilerRequestType.Scripts)
            {
                return;
            }
            var block = MyEntities.GetEntityById(id) as MyProgrammableBlock;

            Accept($"{block?.CustomName?.ToString() ?? "Unknown"} on {block?.CubeGrid?.DisplayName ?? "Unknown"}", block?.PositionComp.WorldAABB.Center,
                   "ID=" + id, spe);
        }
示例#5
0
        public void AcceptBlockType(Type type, SlimProfilerEntry spe)
        {
            if (Type != ProfilerRequestType.BlockType)
            {
                return;
            }
            var name = type.Name;

            if (name.StartsWith(TypePrefix))
            {
                name = name.Substring(TypePrefix.Length);
            }
            Accept(name, null, "", spe);
        }
示例#6
0
        public void AcceptMod(MyModContext mod, SlimProfilerEntry spe)
        {
            if (Type != ProfilerRequestType.Mod)
            {
                return;
            }
            var desc = mod.ModName ?? mod.ModId ?? mod.ModPath ?? "Unknown Mod";

            if (mod == MyModContext.BaseGame)
            {
                desc = "Base Game";
            }
            Accept(desc, null, "", spe);
        }
示例#7
0
        public void AcceptBlockDefinition(MyCubeBlockDefinition def, SlimProfilerEntry spe)
        {
            if (Type != ProfilerRequestType.BlockDef)
            {
                return;
            }
            var name = def.Id.TypeId.ToString();

            if (name.StartsWith(TypePrefix))
            {
                name = name.Substring(TypePrefix.Length);
            }
            name += "/" + def.Id.SubtypeName;
            Accept(name, null, "", spe);
        }
示例#8
0
        public void AcceptSessionComponent(Type type, SlimProfilerEntry spe)
        {
            if (Type != ProfilerRequestType.Session)
            {
                return;
            }
            var mod  = ModLookupUtils.GetMod(type);
            var name = type.Name;

            if (name.StartsWith(TypePrefix))
            {
                name = name.Substring(TypePrefix.Length);
            }
            Accept(name, null, "From " + (mod?.ModName ?? "SE"), spe);
        }
示例#9
0
        public void AcceptFaction(long id, SlimProfilerEntry spe)
        {
            if (Type != ProfilerRequestType.Faction)
            {
                return;
            }
            if (id == 0)
            {
                Accept("No Faction", null, null, spe);
                return;
            }

            var faction = MySession.Static.Factions?.TryGetFactionById(id);

            Accept(faction?.Tag ?? "Unknown", null, "ID=" + id, spe);
        }
示例#10
0
        public void AcceptPlayer(long id, SlimProfilerEntry spe)
        {
            if (Type != ProfilerRequestType.Players)
            {
                return;
            }
            if (id == 0)
            {
                Accept("Nobody", null, null, spe);
                return;
            }

            var identity    = MySession.Static.Players.TryGetIdentity(id);
            var faction     = MySession.Static.Factions.TryGetPlayerFaction(id);
            var factionDesc = faction != null ? "[" + faction.Tag + "]" : "";

            Accept($"{identity?.DisplayName ?? "Unknown"} {factionDesc}", null, "ID=" + id, spe);
        }
示例#11
0
        public bool Add(SlimProfilerEntry target)
        {
            if (target == null || !target.IsActive)
            {
                return(false);
            }
            switch (_count++)
            {
            case 0:
                _entry0 = target;
                return(true);

            case 1:
                _entry1 = target;
                return(true);

            case 2:
                _entry2 = target;
                return(true);

            case 3:
                _entry3 = target;
                return(true);

            case 4:
                _entry4 = target;
                return(true);

            case 5:
                _entry5 = target;
                return(true);

            default:
                return(false);
            }
        }
示例#12
0
 private void Accept(string name, Vector3D?pos, string desc, SlimProfilerEntry entry)
 {
     entry.PushProfiler(ProfilerData._currentTick);
     _entries.Add(new Working(name, pos, desc, entry));
 }