Map note. Storage for map notes
Example #1
0
 /// <summary>
 /// Saves the note when player has completed writing
 /// </summary>
 public void OnNoteComplete()
 {
     InteractionMode = MapInteractionNormal;
     if (MapNoteInput.text.TrimEnd() == "")
     {//destroy the text box as nothing has been created
         Destroy(mapNoteCurrent.gameObject);
     }
     else
     {
         //System.Guid guid = System.Guid.NewGuid();
         MapNote newmapnote = new MapNote((int)pos.x, (int)(pos.y + 100f), MapNoteInput.text);
         mapNoteCurrent.GetComponent <ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
         GameWorldController.instance.AutoMaps[MapNo].MapNotes.Add(newmapnote);
         mapNoteCurrent.GetComponent <MapNoteId>().guid = newmapnote.guid;
     }
     InteractionMode           = MapInteractionNormal;
     caretAdjustment           = Vector2.zero;
     UWHUD.instance.CursorIcon = UWHUD.instance.MapQuill;
 }
Example #2
0
 private void OnMapMarkerAdded(BasePlayer player, MapNote note)
 {
     if (player == null || note == null || player.isMounted || !player.IsAlive())
     {
         return;
     }
     if (config.admins == true)
     {
         if (player.IsAdmin)
         {
             TP(player, note);
         }
     }
     else
     {
         if (player.IPlayer.HasPermission(permUse))
         {
             TP(player, note);
         }
     }
 }
Example #3
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Replace MAP_SERVICE_TOKEN with token from bing maps dev center
            MyMap.MapServiceToken = "MAP_SERVICE_TOKEN";

            // Use the device's Geolocator to find it's physical location
            Geopoint myPoint;

            if (e.Parameter == null)
            {
                // Add
                isViewing = false;

                var locator = new Geolocator();
                locator.DesiredAccuracyInMeters = 50;

                /*   Add Location capability in the Package.appxmanifest file   */
                var position = await locator.GetGeopositionAsync();

                myPoint = position.Coordinate.Point;
            }
            else
            {
                // View or Delete
                isViewing = true;

                mapNote           = (MapNote)e.Parameter;
                titleTextBox.Text = mapNote.Title;
                noteTextBox.Text  = mapNote.Note;
                addButton.Content = "Delete";

                var myPosition = new BasicGeoposition();
                myPosition.Latitude  = mapNote.Latitude;
                myPosition.Longitude = mapNote.Longitude;

                myPoint = new Geopoint(myPosition);
            }
            await MyMap.TrySetViewAsync(myPoint, 10D);
        }
 public RustPlayerMapMarkerAddingEvent(
     RustPlayer player,
     MapNote mapNote) : base(player)
 {
     MapNote = mapNote;
 }
Example #5
0
        private object?OnMapMarkerRemove(BasePlayer player, MapNote note)
        {
            var @event = new RustPlayerMapMarkerRemovingEvent(new RustPlayer(player), note);

            return(EmitCancellableReturnsObject(@event));
        }
Example #6
0
        private void OnMapMarkerAdded(BasePlayer player, MapNote note)
        {
            var @event = new RustPlayerMapMarkerAddedEvent(new RustPlayer(player), note);

            Emit(@event);
        }
    public void InitAutoMap(int LevelNo, char[] lev_ark)
    {
        MapNotes    = new List <MapNote>();
        thisLevelNo = LevelNo;
        long automapAddress      = 0;
        long automapNotesAddress = 0;
        long AUTOMAP_EOF_ADDRESS = 0;

        for (int au = 0; au <= AutomapNoteAddresses.GetUpperBound(0); au++)
        {
            AutomapNoteAddresses[au] = DataLoader.getValAtAddress(lev_ark, ((au + 36) * 4) + 2, 32);
        }

        automapAddress      = DataLoader.getValAtAddress(lev_ark, ((LevelNo + 27) * 4) + 2, 32);
        automapNotesAddress = DataLoader.getValAtAddress(lev_ark, ((LevelNo + 36) * 4) + 2, 32);

        AUTOMAP_EOF_ADDRESS = getNextAutomapBlock(LevelNo, lev_ark);                        // DataLoader.getValAtAddress(lev_ark,((LevelNo+1+36) * 4) + 2 ,32);


        //Load Automap info
        if (automapAddress != 0)
        {
            switch (_RES)
            {
            case GAME_UW1:
            {
                int z = 0;
                for (int y = 0; y <= TileMap.TileMapSizeY; y++)
                {
                    for (int x = 0; x <= TileMap.TileMapSizeX; x++)
                    {
                        short val = (short)DataLoader.getValAtAddress(lev_ark, automapAddress + z, 8);
                        //The automap contains one byte per tile, in the same order as the
                        //level tilemap. A valid value in the low nybble means the tile is displayed
                        //on the map. Valid values are the same as tile types:
                        Tiles[x, y].tileType    = (short)(val & 0xf);
                        Tiles[x, y].DisplayType = (short)((val >> 4) & 0xf);

                        z++;
                    }
                }
                break;
            }
            }
        }

        if ((automapNotesAddress != 0) && (AUTOMAP_EOF_ADDRESS <= lev_ark.GetUpperBound(0)))
        {
            //long EOF_ADDRESS= lev_ark.GetUpperBound(0);

            while (automapNotesAddress < AUTOMAP_EOF_ADDRESS)
            {
                string NoteText = "";
                bool   terminated = false;
                int    PosX = 0; int PosY = 0;
                PosX = (int)DataLoader.getValAtAddress(lev_ark, automapNotesAddress + 0x32, 16);
                PosY = (int)DataLoader.getValAtAddress(lev_ark, automapNotesAddress + 0x34, 16);
                for (int c = 0; c <= 0x31; c++)
                {
                    if ((lev_ark[automapNotesAddress + c].ToString() != "\0") && (!terminated))
                    {
                        NoteText += lev_ark[automapNotesAddress + c];
                    }
                    else
                    {
                        terminated = true;
                    }
                }
                if (NoteText == "")
                {
                    break;
                }
                if ((PosY <= 200) && (PosX <= 320))
                {
                    MapNote newmapnote = new MapNote();
                    newmapnote.PosX = PosX;
                    newmapnote.PosY = PosY;
                    //newmapnote.NotePosition=new Vector2((float)PosX,(float)PosY-100f);
                    newmapnote.NoteText = NoteText;
                    newmapnote.guid     = System.Guid.NewGuid();
                    GameWorldController.instance.AutoMaps[LevelNo].MapNotes.Add(newmapnote);
                }
                else
                {
                    break;
                }


                automapNotesAddress += 54;
            }
        }
    }
 public void OnNoteComplete()
 {
     InteractionMode=MapInteractionNormal;
             if (MapNoteInput.text.TrimEnd()=="")
             {//destroy the text box as nothing has been created
                     Destroy(mapNoteCurrent.gameObject);
             }
             else
             {
                 System.Guid guid = System.Guid.NewGuid();
                 MapNote newmapnote = new MapNote();
                 newmapnote.NotePosition=pos;
                 newmapnote.NoteText= MapNoteInput.text;
                 newmapnote.guid=guid;
                 mapNoteCurrent.GetComponent<ContentSizeFitter>().horizontalFit= ContentSizeFitter.FitMode.PreferredSize;
                 //mapNoteCurrent.GetComponent<ContentSizeFitter>().SetLayoutHorizontal();
                 GameWorldController.instance.Tilemap.MapNotes[MapNo].Add(newmapnote);
                 mapNoteCurrent.GetComponent<MapNoteId>().guid= guid;
             }
             InteractionMode=MapInteractionNormal;
             caretAdjustment= Vector2.zero;
             UWHUD.instance.CursorIcon=UWHUD.instance.MapQuill;
 }