{
public const string _automapControlPanelKey = "automapControlPanelKey";
private const string _statusTextKey = @"txtStatus";
+ private const string _noteTextKey = @"edtNote";
private ILogger Logger;
bgBounds.BothSizing = ElementSizing.FitToChildren;
bgBounds.WithChildren(textBounds);
- ElementBounds toggleBounds = textBounds.CopyOffsetedSibling(3, 64, 5, 2);
+ ElementBounds toggleBounds = textBounds.CopyOffsetedSibling(0, 72, 5, 2);
toggleBounds.fixedHeight = 24;
toggleBounds.fixedWidth = 64;
txtStatusBounds.fixedHeight = 16;
txtStatusBounds.percentWidth = 1;
+ ElementBounds txtNoteArea = textBounds.CopyOffsetedSibling(20, 42, 1, 6);
+ txtNoteArea.fixedHeight = 24;
+ txtNoteArea.percentWidth = 25;
+
+ ElementBounds btnNoteArea = textBounds.CopyOffsetedSibling(0, 42, 2, 5);
+ btnNoteArea.fixedHeight = 24;
+ btnNoteArea.fixedWidth = 20;
+
this.SingleComposer = capi.Gui.CreateCompo("automapControlPanel", dialogBounds)
.AddShadedDialogBG(bgBounds)
.AddStaticText("Configure Automap settings:", CairoFont.WhiteDetailText( ), textBounds)
.AddToggleButton("Run", CairoFont.ButtonText( ), RunToggle, toggleBounds, "btnRun")
.AddDynamicText("Idle.", CairoFont.WhiteSmallText( ).WithFontSize(12), EnumTextOrientation.Left, txtStatusBounds, _statusTextKey)
+ .AddTextInput(txtNoteArea,null,CairoFont.WhiteMediumText().WithFontSize(16),_noteTextKey)
+ .AddButton("Note:",CreateNote,btnNoteArea,CairoFont.ButtonText())
.Compose( );
//Controls for ALL Block & Entity Designators (Enable/Disable)
capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, cmd);
}
+ private bool CreateNote( )
+ {
+ var noteCmd = new CommandData(RunState.Notation);
+ var txtNote = this.SingleComposer.GetTextInput(_noteTextKey);
+ if (!String.IsNullOrWhiteSpace(txtNote.GetText( ))) {
+ noteCmd.Notation = txtNote.GetText( );
+ txtNote.SetValue(string.Empty);
+
+ capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, noteCmd);
+ }
+ return true;//???
+ }
private void AutomapStatusMsg(string eventName, ref EnumHandling handling, IAttribute data)
{
jsonWriter.Write("NonAirBlocks : {0},", shard.NonAirBlocks);
//TODO: Heightmap
//TODO: Rock-ratio
- jsonWriter.Write("}],");
- //TODO: POIs
+ jsonWriter.Write("}],");
}
jsonWriter.Write("]);\n\n");
- jsonWriter.Flush( );
+
+ //TODO: POIs
+
+
+ jsonWriter.Flush( );
}
}
}
+ private void AddNote(string notation)
+ {
+ var playerNodePoi = new PointOfInterest( ) {
+ Location = ClientAPI.World.Player.Entity.LocalPos.AsBlockPos.Copy(),
+ Notes = notation,
+ Timestamp = DateTimeOffset.UtcNow,
+ };
+
+ this.POIs.AddReplace(playerNodePoi);
+ }
+
+
private void CommandListener(string eventName, ref EnumHandling handling, IAttribute data)
{
//Snapshot starts a second thread/process...
break;
+
+ case RunState.Notation:
+ //Add to POI list where player location
+ AddNote(cmdData.Notation);
+ break;
}
}
if (CurrentState != cmdData.State) {
CurrentState = cmdData.State;
AwakenCartographer(0.0f);
+ }
#if DEBUG
ClientAPI.TriggerChatMessage($"Automap commanded to: {cmdData.State} ");
#endif
- }
-
+
}