This commit is contained in:
parent
9c688d363f
commit
3b505141e6
3 changed files with 43 additions and 917 deletions
|
@ -21,18 +21,20 @@ namespace Sledgemapper.UI
|
|||
{
|
||||
private AuthenticateResponse _authResponse;
|
||||
private readonly CommunicationManager CommunicationManager;
|
||||
private readonly State _state;
|
||||
private readonly Settings _settings;
|
||||
private Texture2D _eye;
|
||||
private Texture2D _location;
|
||||
public MainWidget(CommunicationManager communicationManager, State state, Settings settings)
|
||||
private State _state;
|
||||
private Settings _settings;
|
||||
private GameWindow _window;
|
||||
|
||||
private readonly CachedContent _cachedContent;
|
||||
public MainWidget(CommunicationManager communicationManager, State state, Settings settings, CachedContent cachedContent, GameWindow window)
|
||||
{
|
||||
BuildUI();
|
||||
_eye = Content.Load<Texture2D>("eye");
|
||||
_location = Content.Load<Texture2D>("location");
|
||||
|
||||
CommunicationManager = communicationManager;
|
||||
_state = state;
|
||||
_settings = settings;
|
||||
_cachedContent = cachedContent;
|
||||
_window = window;
|
||||
MenuConnectLogin.Selected += OnMenuConnectLoginSelected;
|
||||
MenuConnectSync.Selected += OnMenuConnectSyncSelected;
|
||||
MenuFileLoad.Selected += OnMenuFileLoadSelected;
|
||||
|
@ -564,8 +566,8 @@ namespace Sledgemapper.UI
|
|||
var note = CommunicationManager.SessionData.Notes.Values.ElementAt(i);
|
||||
var item = new NoteListItem();
|
||||
item.LblNoteText.Text = $"{note.ToString()} - {note.Text}";
|
||||
item.BtnNoteCenter.Image = new TextureRegion(_location);
|
||||
item.BtnNoteView.Image = new TextureRegion(_eye);
|
||||
item.BtnNoteCenter.Image = new TextureRegion(_cachedContent.Location);
|
||||
item.BtnNoteView.Image = new TextureRegion(_cachedContent.Eye);
|
||||
item.BtnNoteCenter.Click += (s, e) => { CenterOnTile(note.X, note.Y); };
|
||||
item.BtnNoteView.Click += (s, e) => { EditNote(note); window.Close(); };
|
||||
content.StackNotesList.AddChild(item);
|
||||
|
@ -582,12 +584,12 @@ namespace Sledgemapper.UI
|
|||
|
||||
private void CenterOnTile(int x, int y)
|
||||
{
|
||||
var center = new Point((Window.ClientBounds.Width + 200) / 2 - _state.TileSize / 2, Window.ClientBounds.Height / 2 - _state.TileSize / 2);
|
||||
|
||||
var center = new Point((_window.ClientBounds.Width + 200) / 2 - _state.TileSize / 2, _window.ClientBounds.Height / 2 - _state.TileSize / 2);
|
||||
var dx = center.X - x * _state.TileSize - _state.ViewportCenter.X;
|
||||
var dy = center.Y - y * _state.TileSize - _state.ViewportCenter.Y;
|
||||
_state.ViewportCenter = new Vector3(_state.ViewportCenter.X + dx, _state.ViewportCenter.Y + dy, _state.ViewportCenter.Z);
|
||||
|
||||
_state.ViewportCenter.X += dx;
|
||||
_state.ViewportCenter.Y += dy;
|
||||
}
|
||||
|
||||
private void OnMenuCampaignNew(object sender, EventArgs e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue