コード例 #1
0
        private void Broadcast(MeasureResult result)
        {
            if (MyAPIGateway.Session == null)
            {
                return;
            }
            var gpsName = FormatResult(result);
            var gps     = new MyGps(new MyObjectBuilder_Gps.Entry
            {
                name        = gpsName,
                DisplayName = gpsName,
                // ReSharper disable once PossibleInvalidOperationException
                coords      = result.EntityCoords,
                showOnHud   = true,
                color       = Color.Purple,
                description = FormatResult(result),
                entityId    = 0,
                isFinal     = false
            });

            //to all online players
            MySession.Static.Players.GetOnlinePlayers().Where(it => it.IsRealPlayer)
            .ForEach(it =>
            {
                var identityId = it.Identity.IdentityId;
                MyAPIGateway.Session.GPS.AddGps(identityId, gps);
                Plugin.AddedGps.AddOrUpdateList(identityId, gps);
            });
        }
コード例 #2
0
 private static string FormatResult(MeasureResult result)
 {
     return($"{result.EntityDisplayName} ({FormatTime(result.MainThreadTimePerTick)})");
 }