OSDN Git Service
(root)
/
automap
/
automap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d00adf6
)
Added Notation feature
author
melchior
<melchior@users.osdn.me>
Sun, 16 Feb 2020 23:10:22 +0000
(18:10 -0500)
committer
melchior
<melchior@users.osdn.me>
Sun, 16 Feb 2020 23:10:22 +0000
(18:10 -0500)
Automap/Data/CommandData.cs
patch
|
blob
|
history
Automap/Data/RunState.cs
patch
|
blob
|
history
Automap/Subsystems/AutomapGUIDialog.cs
patch
|
blob
|
history
Automap/Subsystems/AutomapSystem.cs
patch
|
blob
|
history
diff --git
a/Automap/Data/CommandData.cs
b/Automap/Data/CommandData.cs
index
c87c358
..
88ebe3a
100644
(file)
--- a/
Automap/Data/CommandData.cs
+++ b/
Automap/Data/CommandData.cs
@@
-21,6
+21,9
@@
namespace Automap
[ProtoMember(2)]
private List<DelegateState> DelegatesFlags;
[ProtoMember(2)]
private List<DelegateState> DelegatesFlags;
+ [ProtoMember(3)]
+ public string Notation { get; set; }
+
//POI Delegate list {enabled/Disable}, color?
//Other params...? Tick rate?
//Choose : Renderer(s)
//POI Delegate list {enabled/Disable}, color?
//Other params...? Tick rate?
//Choose : Renderer(s)
diff --git
a/Automap/Data/RunState.cs
b/Automap/Data/RunState.cs
index
55311b3
..
f37b28d
100644
(file)
--- a/
Automap/Data/RunState.cs
+++ b/
Automap/Data/RunState.cs
@@
-1,11
+1,15
@@
using System;
namespace Automap
{
using System;
namespace Automap
{
+ /// <summary>
+ /// Command Type
+ /// </summary>
public enum RunState : byte
{
Stop = 0x00,
Run = 0x01,
Snapshot = 0x02,
public enum RunState : byte
{
Stop = 0x00,
Run = 0x01,
Snapshot = 0x02,
+ Notation = 0x03,
}
}
}
}
diff --git
a/Automap/Subsystems/AutomapGUIDialog.cs
b/Automap/Subsystems/AutomapGUIDialog.cs
index
898c6a0
..
ad8d8b3
100644
(file)
--- a/
Automap/Subsystems/AutomapGUIDialog.cs
+++ b/
Automap/Subsystems/AutomapGUIDialog.cs
@@
-11,6
+11,7
@@
namespace Automap
{
public const string _automapControlPanelKey = "automapControlPanelKey";
private const string _statusTextKey = @"txtStatus";
{
public const string _automapControlPanelKey = "automapControlPanelKey";
private const string _statusTextKey = @"txtStatus";
+ private const string _noteTextKey = @"edtNote";
private ILogger Logger;
private ILogger Logger;
@@
-48,7
+49,7
@@
namespace Automap
bgBounds.BothSizing = ElementSizing.FitToChildren;
bgBounds.WithChildren(textBounds);
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;
toggleBounds.fixedHeight = 24;
toggleBounds.fixedWidth = 64;
@@
-56,6
+57,14
@@
namespace Automap
txtStatusBounds.fixedHeight = 16;
txtStatusBounds.percentWidth = 1;
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)
this.SingleComposer = capi.Gui.CreateCompo("automapControlPanel", dialogBounds)
.AddShadedDialogBG(bgBounds)
@@
-63,6
+72,8
@@
namespace Automap
.AddStaticText("Configure Automap settings:", CairoFont.WhiteDetailText( ), textBounds)
.AddToggleButton("Run", CairoFont.ButtonText( ), RunToggle, toggleBounds, "btnRun")
.AddDynamicText("Idle.", CairoFont.WhiteSmallText( ).WithFontSize(12), EnumTextOrientation.Left, txtStatusBounds, _statusTextKey)
.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)
.Compose( );
//Controls for ALL Block & Entity Designators (Enable/Disable)
@@
-105,6
+116,18
@@
namespace Automap
capi.Event.PushEvent(AutomapSystem.AutomapCommandEventKey, cmd);
}
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)
{
private void AutomapStatusMsg(string eventName, ref EnumHandling handling, IAttribute data)
{
diff --git
a/Automap/Subsystems/AutomapSystem.cs
b/Automap/Subsystems/AutomapSystem.cs
index
6f022a2
..
b4656be
100644
(file)
--- a/
Automap/Subsystems/AutomapSystem.cs
+++ b/
Automap/Subsystems/AutomapSystem.cs
@@
-495,11
+495,14
@@
namespace Automap
jsonWriter.Write("NonAirBlocks : {0},", shard.NonAirBlocks);
//TODO: Heightmap
//TODO: Rock-ratio
jsonWriter.Write("NonAirBlocks : {0},", shard.NonAirBlocks);
//TODO: Heightmap
//TODO: Rock-ratio
- jsonWriter.Write("}],");
- //TODO: POIs
+ jsonWriter.Write("}],");
}
jsonWriter.Write("]);\n\n");
}
jsonWriter.Write("]);\n\n");
- jsonWriter.Flush( );
+
+ //TODO: POIs
+
+
+ jsonWriter.Flush( );
}
}
}
}
@@
-692,6
+695,18
@@
namespace Automap
}
}
+ 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)
{
private void CommandListener(string eventName, ref EnumHandling handling, IAttribute data)
{
@@
-716,6
+731,11
@@
namespace Automap
//Snapshot starts a second thread/process...
break;
//Snapshot starts a second thread/process...
break;
+
+ case RunState.Notation:
+ //Add to POI list where player location
+ AddNote(cmdData.Notation);
+ break;
}
}
}
}
@@
-723,12
+743,12
@@
namespace Automap
if (CurrentState != cmdData.State) {
CurrentState = cmdData.State;
AwakenCartographer(0.0f);
if (CurrentState != cmdData.State) {
CurrentState = cmdData.State;
AwakenCartographer(0.0f);
+ }
#if DEBUG
ClientAPI.TriggerChatMessage($"Automap commanded to: {cmdData.State} ");
#endif
#if DEBUG
ClientAPI.TriggerChatMessage($"Automap commanded to: {cmdData.State} ");
#endif
- }
-
+
}
}