IMyGps IMyGpsCollection.Create(string name, string description, Vector3D coords, bool showOnHud, bool temporary)
 {
     var gps = new MyGps();
     gps.Name = name;
     gps.Description = description;
     gps.Coords = coords;
     gps.ShowOnHud = showOnHud;
     if (temporary)
         gps.SetDiscardAt();
     else
         gps.DiscardAt = null;
     gps.UpdateHash();
     return gps;
 }
Ejemplo n.º 2
0
        static void AddSuccess(ref AddMsg msg, MyNetworkClient sender)
        {
            MyGps gps=new MyGps();
            gps.Name=msg.Name;
            gps.Description=msg.Description;
            gps.Coords=msg.Coords;
            gps.ShowOnHud=msg.ShowOnHud;
            gps.DiscardAt=null;
            if (!msg.IsFinal)
               gps.SetDiscardAt();
            gps.UpdateHash();
            if (MySession.Static.Gpss.AddPlayerGps(msg.IdentityId, ref gps))
            {//new entry succesfully added
                if (gps.ShowOnHud && msg.IdentityId == MySession.LocalPlayerId)
                    MyHud.GpsMarkers.RegisterMarker(gps);
            }

            var handler = MySession.Static.Gpss.ListChanged;
            if (handler != null)
            {
                handler(msg.IdentityId);
            }
        }
Ejemplo n.º 3
0
        static void OnAddGps(AddMsg msg)
        {
            MyGps gps = new MyGps();
            gps.Name = msg.Name;
            gps.Description = msg.Description;
            gps.Coords = msg.Coords;
            gps.ShowOnHud = msg.ShowOnHud;
            gps.AlwaysVisible = msg.AlwaysVisible;
            gps.DiscardAt = null;
            if (!msg.IsFinal)
                gps.SetDiscardAt();
            gps.UpdateHash();
            if(msg.EntityId > 0)
                gps.SetEntity(MyEntities.GetEntityById(msg.EntityId));
            if (MySession.Static.Gpss.AddPlayerGps(msg.IdentityId, ref gps))
            {//new entry succesfully added
                if (gps.ShowOnHud && msg.IdentityId == MySession.Static.LocalPlayerId)
                    MyHud.GpsMarkers.RegisterMarker(gps);
            }

            var handler = MySession.Static.Gpss.ListChanged;
            if (handler != null)
            {
                handler(msg.IdentityId);
            }
        }