feat: add outgoing messages to client
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
using Client.Domain.Common;
|
||||
using Client.Application.Commands;
|
||||
using Client.Domain.Common;
|
||||
using Client.Domain.Entities;
|
||||
using Client.Domain.Service;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Client.Application.ViewModels
|
||||
{
|
||||
@@ -46,14 +49,14 @@ namespace Client.Application.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return drop.Transform.Position.HorizontalDistance(hero.Transform.Position) / 100;
|
||||
return drop.Transform.Position.HorizontalDistance(hero.Transform.Position);
|
||||
}
|
||||
}
|
||||
public float DeltaZ
|
||||
{
|
||||
get
|
||||
{
|
||||
return (drop.Transform.Position.Z - hero.Transform.Position.Z) / 100;
|
||||
return (drop.Transform.Position.Z - hero.Transform.Position.Z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,14 +68,27 @@ namespace Client.Application.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public DropListViewModel(Drop drop, Hero hero)
|
||||
public ICommand MouseLeftClickCommand { get; }
|
||||
public ICommand MouseRightClickCommand { get; }
|
||||
private void OnMouseLeftClick(object? obj)
|
||||
{
|
||||
worldHandler.RequestPickUp(Id);
|
||||
}
|
||||
private void OnMouseRightClick(object? obj)
|
||||
{
|
||||
worldHandler.RequestMoveToEntity(Id);
|
||||
}
|
||||
|
||||
public DropListViewModel(Drop drop, Hero hero, WorldHandler worldHandler)
|
||||
{
|
||||
this.drop = drop;
|
||||
this.hero = hero;
|
||||
|
||||
this.worldHandler = worldHandler;
|
||||
drop.PropertyChanged += Drop_PropertyChanged;
|
||||
drop.Transform.Position.PropertyChanged += DropPosition_PropertyChanged;
|
||||
hero.Transform.Position.PropertyChanged += HeroPosition_PropertyChanged;
|
||||
MouseLeftClickCommand = new RelayCommand(OnMouseLeftClick);
|
||||
MouseRightClickCommand = new RelayCommand(OnMouseRightClick);
|
||||
}
|
||||
|
||||
private void HeroPosition_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
@@ -109,5 +125,6 @@ namespace Client.Application.ViewModels
|
||||
|
||||
private readonly Drop drop;
|
||||
private readonly Hero hero;
|
||||
private readonly WorldHandler worldHandler;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user