mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using Steamworks;
|
|
using Steamworks.Data;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace VPet_Simulator.Windows;
|
|
/// <summary>
|
|
/// MPUserControl.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class MPUserControl : Border
|
|
{
|
|
public Friend friend => mpf.friend;
|
|
winMutiPlayer wmp;
|
|
public MPFriends mpf;
|
|
Lobby lb => mpf.lb;
|
|
public MPUserControl(winMutiPlayer wmp, MPFriends mpf)
|
|
{
|
|
InitializeComponent();
|
|
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;
|
|
if (lb.Owner.IsMe)
|
|
Kick.Visibility = Visibility.Visible;
|
|
});
|
|
}
|
|
|
|
private void btn_ReSetLocal(object sender, RoutedEventArgs e)
|
|
{
|
|
mpf.ReSetLocal();
|
|
}
|
|
|
|
|
|
private void Kick_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
lb.SetData("kick", friend.Id.Value.ToString());
|
|
}
|
|
}
|