1
This commit is contained in:
@@ -16,7 +16,9 @@
|
||||
"GUID:d70a36705df567d40ac20b6aef5182ba",
|
||||
"GUID:82823b57d8750f84398492a9a1764509",
|
||||
"GUID:a3cd7886d0941284aa4f5e020270c73a",
|
||||
"GUID:ba8323a5a01afc24188ded7f4b05db8a"
|
||||
"GUID:ba8323a5a01afc24188ded7f4b05db8a",
|
||||
"GUID:44495f3f3cb105748baf59ecacd464c6",
|
||||
"GUID:6efaa16b661faf94188fd63eda46f87c"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
@@ -3,8 +3,11 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using BITKit.UX;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Net.Project.B.Cosmetics;
|
||||
using Net.Project.B.UX;
|
||||
using Project.B.Entities;
|
||||
using Project.B.Map;
|
||||
@@ -16,18 +19,45 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
{
|
||||
public class UXMenu : UIToolKitPanel,IUXLobby
|
||||
{
|
||||
private readonly IEntitiesService _entitiesService;
|
||||
private readonly IGameMapService _gameMapService;
|
||||
private readonly IWrapper<CosmeticsCustomizeComponent> _cosmeticsCustomize;
|
||||
protected override string DocumentPath => "ux_menu";
|
||||
public override bool AllowInput => false;
|
||||
public override bool AllowCursor => true;
|
||||
[UXBindPath("play-button")]
|
||||
private Button _playButton;
|
||||
public UXMenu(IUXService uxService, IGameMapService gameMapService) : base(uxService)
|
||||
[UXBindPath("avatar-image")]
|
||||
private VisualElement _avatarImage;
|
||||
[UXBindPath("player-name")]
|
||||
private Label _playerName;
|
||||
public UXMenu(IUXService uxService, IGameMapService gameMapService, IWrapper<CosmeticsCustomizeComponent> cosmeticsCustomize, IEntitiesService entitiesService) : base(uxService)
|
||||
{
|
||||
_gameMapService = gameMapService;
|
||||
_cosmeticsCustomize = cosmeticsCustomize;
|
||||
_entitiesService = entitiesService;
|
||||
OnInitiated += Initiated;
|
||||
|
||||
_gameMapService.OnMapChanged += OnMapChanged;
|
||||
|
||||
_cosmeticsCustomize.OnValueChanged += OnValueChanged;
|
||||
}
|
||||
|
||||
private void OnValueChanged(CosmeticsCustomizeComponent arg1, CosmeticsCustomizeComponent arg2)
|
||||
{
|
||||
var cosmetics = _entitiesService.QueryComponents<ScriptableCosmetics>().ToArray()
|
||||
.ToDictionary(x => x.ScriptableId, x => x);
|
||||
foreach (var id in arg2.ComponentIds)
|
||||
{
|
||||
if (cosmetics.TryGetValue(id,out var cosmetic))
|
||||
{
|
||||
if (cosmetic.CosmeticsClass is CosmeticsModel)
|
||||
{
|
||||
_avatarImage.style.backgroundImage = new(cosmetic.Icon);
|
||||
_playerName.text = cosmetic.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMapChanged(Guid arg1, string arg2)
|
||||
|
Reference in New Issue
Block a user