fix: fix toggle soulshot method
This commit is contained in:
@ -44,7 +44,7 @@ namespace Client.Application.ViewModels
|
||||
worldHandler.RequestMoveToEntity(Id);
|
||||
}
|
||||
|
||||
public CreatureListViewModel(CreatureInterface creature, Hero hero, WorldHandler worldHandler)
|
||||
public CreatureListViewModel(WorldHandler worldHandler, CreatureInterface creature, Hero hero)
|
||||
{
|
||||
creature.PropertyChanged += Creature_PropertyChanged;
|
||||
creature.Transform.Position.PropertyChanged += Position_PropertyChanged;
|
||||
|
@ -82,7 +82,7 @@ namespace Client.Application.ViewModels
|
||||
worldHandler.RequestMoveToEntity(Id);
|
||||
}
|
||||
|
||||
public CreatureMapViewModel(CreatureInterface creature, Hero hero, WorldHandler worldHandler)
|
||||
public CreatureMapViewModel(WorldHandler worldHandler, CreatureInterface creature, Hero hero)
|
||||
{
|
||||
this.creature = creature;
|
||||
this.hero = hero;
|
||||
|
@ -79,7 +79,7 @@ namespace Client.Application.ViewModels
|
||||
worldHandler.RequestMoveToEntity(Id);
|
||||
}
|
||||
|
||||
public DropListViewModel(Drop drop, Hero hero, WorldHandler worldHandler)
|
||||
public DropListViewModel(WorldHandler worldHandler, Drop drop, Hero hero)
|
||||
{
|
||||
this.drop = drop;
|
||||
this.hero = hero;
|
||||
|
@ -61,7 +61,7 @@ namespace Client.Application.ViewModels
|
||||
worldHandler.RequestMoveToEntity(Id);
|
||||
}
|
||||
|
||||
public DropMapViewModel(Drop drop, Hero hero, WorldHandler worldHandler)
|
||||
public DropMapViewModel(WorldHandler worldHandler, Drop drop, Hero hero)
|
||||
{
|
||||
this.drop = drop;
|
||||
this.hero = hero;
|
||||
|
46
Client/Application/ViewModels/ItemListViewModel.cs
Normal file
46
Client/Application/ViewModels/ItemListViewModel.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using Client.Application.Commands;
|
||||
using Client.Application.Components;
|
||||
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
|
||||
{
|
||||
public class ItemListViewModel : ObservableObject
|
||||
{
|
||||
public uint Id => item.Id;
|
||||
public string Name => item.Name;
|
||||
public string Description => item.FullDescription;
|
||||
public string IconName => "/Assets/icons/" + item.IconName + ".png";
|
||||
|
||||
public ICommand MouseLeftClickCommand { get; }
|
||||
public ICommand MouseRightClickCommand { get; }
|
||||
private void OnLeftMouseClick(object? obj)
|
||||
{
|
||||
worldHandler.RequestUseItem(Id);
|
||||
}
|
||||
private void OnRightMouseClick(object? obj)
|
||||
{
|
||||
worldHandler.RequestToggleAutouseSoulshot(Id);
|
||||
}
|
||||
|
||||
public ItemListViewModel(WorldHandler worldHandler, ItemInterface item)
|
||||
{
|
||||
this.worldHandler = worldHandler;
|
||||
this.item = item;
|
||||
|
||||
//skill.PropertyChanged += Skill_PropertyChanged;
|
||||
MouseLeftClickCommand = new RelayCommand(OnLeftMouseClick);
|
||||
MouseRightClickCommand = new RelayCommand(OnRightMouseClick);
|
||||
}
|
||||
|
||||
private readonly WorldHandler worldHandler;
|
||||
private readonly ItemInterface item;
|
||||
}
|
||||
}
|
@ -59,7 +59,7 @@ namespace Client.Application.ViewModels
|
||||
{
|
||||
if (hero != null)
|
||||
{
|
||||
Creatures.Add(new CreatureListViewModel(@event.Creature, hero, worldHandler));
|
||||
Creatures.Add(new CreatureListViewModel(worldHandler, @event.Creature, hero));
|
||||
AddCreature(@event.Creature);
|
||||
}
|
||||
}
|
||||
@ -74,8 +74,8 @@ namespace Client.Application.ViewModels
|
||||
{
|
||||
if (hero != null)
|
||||
{
|
||||
Drops.Add(new DropListViewModel(@event.Drop, hero, worldHandler));
|
||||
Map.Drops.Add(new DropMapViewModel(@event.Drop, hero, worldHandler));
|
||||
Drops.Add(new DropListViewModel(worldHandler, @event.Drop, hero));
|
||||
Map.Drops.Add(new DropMapViewModel(worldHandler, @event.Drop, hero));
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,20 +115,28 @@ namespace Client.Application.ViewModels
|
||||
{
|
||||
if (hero != null)
|
||||
{
|
||||
Items.Add(@event.Item);
|
||||
if (!@event.Item.IsQuest)
|
||||
{
|
||||
Items.Add(new ItemListViewModel(worldHandler, @event.Item));
|
||||
}
|
||||
else
|
||||
{
|
||||
QuestItems.Add(new ItemListViewModel(worldHandler, @event.Item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(ItemDeletedEvent @event)
|
||||
{
|
||||
Items.RemoveAll(x => x.Id == @event.Id);
|
||||
QuestItems.RemoveAll(x => x.Id == @event.Id);
|
||||
}
|
||||
|
||||
private void AddCreature(CreatureInterface creature)
|
||||
{
|
||||
if (hero != null)
|
||||
{
|
||||
Map.Creatures.Add(new CreatureMapViewModel(creature, hero, worldHandler));
|
||||
Map.Creatures.Add(new CreatureMapViewModel(worldHandler, creature, hero));
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +156,8 @@ namespace Client.Application.ViewModels
|
||||
public ObservableCollection<DropListViewModel> Drops { get; } = new ObservableCollection<DropListViewModel>();
|
||||
public ObservableCollection<SkillListViewModel> ActiveSkills { get; } = new ObservableCollection<SkillListViewModel>();
|
||||
public ObservableCollection<SkillListViewModel> PassiveSkills { get; } = new ObservableCollection<SkillListViewModel>();
|
||||
public ObservableCollection<BaseItem> Items { get; } = new ObservableCollection<BaseItem>();
|
||||
public ObservableCollection<ItemListViewModel> Items { get; } = new ObservableCollection<ItemListViewModel>();
|
||||
public ObservableCollection<ItemListViewModel> QuestItems { get; } = new ObservableCollection<ItemListViewModel>();
|
||||
public HeroSummaryInfoViewModel? Hero { get; private set; }
|
||||
public MapViewModel Map { get; private set; }
|
||||
public Hero? hero;
|
||||
|
Reference in New Issue
Block a user