VPet/VPet-Simulator.Windows/MutiPlayer/MPUserControl.xaml.cs

53 lines
1.4 KiB
C#
Raw Normal View History

2024-03-16 16:41:20 +00:00
using Steamworks;
using Steamworks.Data;
using System;
2024-03-11 07:22:23 +00:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
2024-03-16 16:41:20 +00:00
using System.Threading;
2024-03-11 07:22:23 +00:00
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
2024-03-15 17:33:56 +00:00
using System.Windows.Navigation;
2024-03-16 16:41:20 +00:00
using VPet_Simulator.Windows.Interface;
2024-03-11 07:22:23 +00:00
namespace VPet_Simulator.Windows;
/// <summary>
2024-03-15 17:33:56 +00:00
/// MPUserControl.xaml 的交互逻辑
2024-03-11 07:22:23 +00:00
/// </summary>
2024-03-16 16:41:20 +00:00
public partial class MPUserControl : Border
2024-03-11 07:22:23 +00:00
{
public Friend friend => mpf.friend;
2024-03-16 16:41:20 +00:00
winMutiPlayer wmp;
public MPFriends mpf;
2024-03-16 16:41:20 +00:00
Lobby lb => mpf.lb;
public MPUserControl(winMutiPlayer wmp, MPFriends mpf)
2024-03-11 07:22:23 +00:00
{
InitializeComponent();
2024-03-16 16:41:20 +00:00
this.wmp = wmp;
this.mpf = mpf;
Task.Run(LoadInfo);
}
public void LoadInfo()
{
//加载lobby传过来的数据
while (!mpf.Loaded)
{
Thread.Sleep(500);
}
Dispatcher.Invoke(async () =>
{
rPetName.Text = mpf.Core.Save.Name;
hostName.Text = friend.Name;
var img = await friend.GetMediumAvatarAsync();
uimg.Source = winMutiPlayer.ConvertToImageSource(img);
info.Text = "Lv " + mpf.Core.Save.Level;
});
2024-03-11 07:22:23 +00:00
}
}