mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
联机功能预备 + 修复工作问题
This commit is contained in:
parent
8a797fd4e4
commit
78b84adf32
@ -156,6 +156,7 @@ namespace VPet_Simulator.Core
|
|||||||
labeldisplaytimer.Start();
|
labeldisplaytimer.Start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public Work NowWork;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据消耗计算相关数据
|
/// 根据消耗计算相关数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -171,6 +172,8 @@ namespace VPet_Simulator.Core
|
|||||||
freedrop = Math.Min(Math.Sqrt(freedrop) * TimePass / 2, Core.Save.FeelingMax / 400);
|
freedrop = Math.Min(Math.Sqrt(freedrop) * TimePass / 2, Core.Save.FeelingMax / 400);
|
||||||
switch (State)
|
switch (State)
|
||||||
{
|
{
|
||||||
|
case WorkingState.Empty:
|
||||||
|
break;
|
||||||
case WorkingState.Sleep:
|
case WorkingState.Sleep:
|
||||||
//睡觉不消耗
|
//睡觉不消耗
|
||||||
Core.Save.StrengthChange(TimePass * 2);
|
Core.Save.StrengthChange(TimePass * 2);
|
||||||
@ -189,9 +192,10 @@ namespace VPet_Simulator.Core
|
|||||||
LastInteractionTime = DateTime.Now;
|
LastInteractionTime = DateTime.Now;
|
||||||
break;
|
break;
|
||||||
case WorkingState.Work:
|
case WorkingState.Work:
|
||||||
var nowwork = nowWork;
|
if (NowWork == null)
|
||||||
var needfood = TimePass * nowwork.StrengthFood;
|
break;
|
||||||
var needdrink = TimePass * nowwork.StrengthDrink;
|
var needfood = TimePass * NowWork.StrengthFood;
|
||||||
|
var needdrink = TimePass * NowWork.StrengthDrink;
|
||||||
double efficiency = 0;
|
double efficiency = 0;
|
||||||
int addhealth = -2;
|
int addhealth = -2;
|
||||||
if (Core.Save.StrengthFood <= 25)
|
if (Core.Save.StrengthFood <= 25)
|
||||||
@ -232,19 +236,19 @@ namespace VPet_Simulator.Core
|
|||||||
}
|
}
|
||||||
if (addhealth > 0)
|
if (addhealth > 0)
|
||||||
Core.Save.Health += addhealth * TimePass;
|
Core.Save.Health += addhealth * TimePass;
|
||||||
var addmoney = Math.Max(0, nowwork.MoneyBase * (1.500000000 * efficiency - 0.5));
|
var addmoney = Math.Max(0, NowWork.MoneyBase * (1.500000000 * efficiency - 0.5));
|
||||||
if (nowwork.Type == Work.WorkType.Work)
|
if (NowWork.Type == Work.WorkType.Work)
|
||||||
Core.Save.Money += addmoney;
|
Core.Save.Money += addmoney;
|
||||||
else
|
else
|
||||||
Core.Save.Exp += addmoney;
|
Core.Save.Exp += addmoney;
|
||||||
WorkTimer.GetCount += addmoney;
|
WorkTimer.GetCount += addmoney;
|
||||||
if (nowwork.Type == Work.WorkType.Play)
|
if (NowWork.Type == Work.WorkType.Play)
|
||||||
{
|
{
|
||||||
LastInteractionTime = DateTime.Now;
|
LastInteractionTime = DateTime.Now;
|
||||||
Core.Save.FeelingChange(-nowwork.Feeling * TimePass);
|
Core.Save.FeelingChange(-NowWork.Feeling * TimePass);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Core.Save.FeelingChange(-freedrop * nowwork.Feeling);
|
Core.Save.FeelingChange(-freedrop * NowWork.Feeling);
|
||||||
if (Core.Save.Mode == IGameSave.ModeType.Ill)//生病时候停止工作
|
if (Core.Save.Mode == IGameSave.ModeType.Ill)//生病时候停止工作
|
||||||
WorkTimer.Stop();
|
WorkTimer.Stop();
|
||||||
break;
|
break;
|
||||||
@ -479,14 +483,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// 当前状态
|
/// 当前状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WorkingState State = WorkingState.Nomal;
|
public WorkingState State = WorkingState.Nomal;
|
||||||
/// <summary>
|
|
||||||
/// 当前状态辅助ID
|
|
||||||
/// </summary>
|
|
||||||
public int StateID = 0;
|
|
||||||
/// <summary>
|
|
||||||
/// 当前工作
|
|
||||||
/// </summary>
|
|
||||||
public GraphHelper.Work nowWork => Core.Graph.GraphConfig.Works[StateID];
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前正在的状态
|
/// 当前正在的状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -552,7 +549,7 @@ namespace VPet_Simulator.Core
|
|||||||
{
|
{
|
||||||
if (!Core.Controller.EnableFunction || Core.Save.Mode != IGameSave.ModeType.Ill)
|
if (!Core.Controller.EnableFunction || Core.Save.Mode != IGameSave.ModeType.Ill)
|
||||||
if (!Core.Controller.EnableFunction || Core.Save.Level >= work.LevelLimit)
|
if (!Core.Controller.EnableFunction || Core.Save.Level >= work.LevelLimit)
|
||||||
if (State == Main.WorkingState.Work && StateID == Core.Graph.GraphConfig.Works.IndexOf(work))
|
if (State == Main.WorkingState.Work && NowWork.Name == work.Name)
|
||||||
WorkTimer.Stop();
|
WorkTimer.Stop();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -82,23 +82,23 @@ namespace VPet_Simulator.Core
|
|||||||
if (Visibility == Visibility.Collapsed) return;
|
if (Visibility == Visibility.Collapsed) return;
|
||||||
TimeSpan ts = DateTime.Now - StartTime;
|
TimeSpan ts = DateTime.Now - StartTime;
|
||||||
TimeSpan tleft;
|
TimeSpan tleft;
|
||||||
if (ts.TotalMinutes > nowWork.Time)
|
if (ts.TotalMinutes > m.NowWork.Time)
|
||||||
{
|
{
|
||||||
//学完了,停止
|
//学完了,停止
|
||||||
//ts = TimeSpan.FromMinutes(MaxTime);
|
//ts = TimeSpan.FromMinutes(MaxTime);
|
||||||
//tleft = TimeSpan.Zero;
|
//tleft = TimeSpan.Zero;
|
||||||
//PBLeft.Value = MaxTime;
|
//PBLeft.Value = MaxTime;
|
||||||
FinishWorkInfo fwi = new FinishWorkInfo(nowWork, GetCount);
|
FinishWorkInfo fwi = new FinishWorkInfo(m.NowWork, GetCount);
|
||||||
E_FinishWork?.Invoke(fwi);
|
E_FinishWork?.Invoke(fwi);
|
||||||
if (nowWork.Type == Work.WorkType.Work)
|
if (m.NowWork.Type == Work.WorkType.Work)
|
||||||
{
|
{
|
||||||
m.Core.Save.Money += GetCount * nowWork.FinishBonus;
|
m.Core.Save.Money += GetCount * m.NowWork.FinishBonus;
|
||||||
Stop(() => m.SayRnd(LocalizeCore.Translate("{2}完成啦, 累计赚了 {0:f2} 金钱\n共计花费了{1}分钟", fwi.count,
|
Stop(() => m.SayRnd(LocalizeCore.Translate("{2}完成啦, 累计赚了 {0:f2} 金钱\n共计花费了{1}分钟", fwi.count,
|
||||||
fwi.spendtime, fwi.work.NameTrans), true));
|
fwi.spendtime, fwi.work.NameTrans), true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m.Core.Save.Exp += GetCount * nowWork.FinishBonus;
|
m.Core.Save.Exp += GetCount * m.NowWork.FinishBonus;
|
||||||
Stop(() => m.SayRnd(LocalizeCore.Translate("{2}完成啦, 累计获得 {0:f2} 经验\n共计花费了{1}分钟", fwi.count,
|
Stop(() => m.SayRnd(LocalizeCore.Translate("{2}完成啦, 累计获得 {0:f2} 经验\n共计花费了{1}分钟", fwi.count,
|
||||||
fwi.spendtime, fwi.work.NameTrans), true));
|
fwi.spendtime, fwi.work.NameTrans), true));
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ namespace VPet_Simulator.Core
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tleft = TimeSpan.FromMinutes(nowWork.Time) - ts;
|
tleft = TimeSpan.FromMinutes(m.NowWork.Time) - ts;
|
||||||
PBLeft.Value = ts.TotalMinutes;
|
PBLeft.Value = ts.TotalMinutes;
|
||||||
}
|
}
|
||||||
switch (DisplayType)
|
switch (DisplayType)
|
||||||
@ -118,7 +118,7 @@ namespace VPet_Simulator.Core
|
|||||||
ShowTimeSpan(tleft); break;
|
ShowTimeSpan(tleft); break;
|
||||||
case 2:
|
case 2:
|
||||||
tNumber.Text = GetCount.ToString("f0");
|
tNumber.Text = GetCount.ToString("f0");
|
||||||
if (nowWork.Type == Work.WorkType.Work)
|
if (m.NowWork.Type == Work.WorkType.Work)
|
||||||
tNumberUnit.Text = LocalizeCore.Translate("钱");
|
tNumberUnit.Text = LocalizeCore.Translate("钱");
|
||||||
else
|
else
|
||||||
tNumberUnit.Text = "EXP";
|
tNumberUnit.Text = "EXP";
|
||||||
@ -154,18 +154,18 @@ namespace VPet_Simulator.Core
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DisplayBorder.Visibility = Visibility.Visible;
|
DisplayBorder.Visibility = Visibility.Visible;
|
||||||
btnStop.Content = LocalizeCore.Translate("停止") + nowWork.NameTrans;
|
btnStop.Content = LocalizeCore.Translate("停止") + m.NowWork.NameTrans;
|
||||||
switch (DisplayType)
|
switch (DisplayType)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
tNow.Text = LocalizeCore.Translate("当前已{0}", nowWork.NameTrans);
|
tNow.Text = LocalizeCore.Translate("当前已{0}", m.NowWork.NameTrans);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
tNow.Text = LocalizeCore.Translate("剩余{0}时间", nowWork.NameTrans);
|
tNow.Text = LocalizeCore.Translate("剩余{0}时间", m.NowWork.NameTrans);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (nowWork.Type == Work.WorkType.Work)
|
if (m.NowWork.Type == Work.WorkType.Work)
|
||||||
tNow.Text = LocalizeCore.Translate("累计金钱收益");
|
tNow.Text = LocalizeCore.Translate("累计金钱收益");
|
||||||
else
|
else
|
||||||
tNow.Text = LocalizeCore.Translate("获得经验值");
|
tNow.Text = LocalizeCore.Translate("获得经验值");
|
||||||
@ -187,7 +187,7 @@ namespace VPet_Simulator.Core
|
|||||||
// return;
|
// return;
|
||||||
Visibility = Visibility.Visible;
|
Visibility = Visibility.Visible;
|
||||||
m.State = Main.WorkingState.Work;
|
m.State = Main.WorkingState.Work;
|
||||||
m.StateID = m.Core.Graph.GraphConfig.Works.IndexOf(work);
|
m.NowWork = work;
|
||||||
StartTime = DateTime.Now;
|
StartTime = DateTime.Now;
|
||||||
GetCount = 0;
|
GetCount = 0;
|
||||||
|
|
||||||
@ -195,24 +195,22 @@ namespace VPet_Simulator.Core
|
|||||||
work.Display(m);
|
work.Display(m);
|
||||||
|
|
||||||
PBLeft.Maximum = work.Time;
|
PBLeft.Maximum = work.Time;
|
||||||
nowWork = work;
|
|
||||||
DisplayUI();
|
DisplayUI();
|
||||||
}
|
}
|
||||||
private Work nowWork;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 停止工作
|
/// 停止工作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="then"></param>
|
/// <param name="then"></param>
|
||||||
public void Stop(Action @then = null)
|
public void Stop(Action @then = null)
|
||||||
{
|
{
|
||||||
if (m.State == Main.WorkingState.Work && nowWork != null)
|
if (m.State == Main.WorkingState.Work && m.NowWork != null)
|
||||||
{
|
{
|
||||||
FinishWorkInfo fwi = new FinishWorkInfo(nowWork, GetCount);
|
FinishWorkInfo fwi = new FinishWorkInfo(m.NowWork, GetCount);
|
||||||
E_FinishWork?.Invoke(fwi);
|
E_FinishWork?.Invoke(fwi);
|
||||||
}
|
}
|
||||||
Visibility = Visibility.Collapsed;
|
Visibility = Visibility.Collapsed;
|
||||||
m.State = Main.WorkingState.Nomal;
|
m.State = Main.WorkingState.Nomal;
|
||||||
m.Display(nowWork.Graph, AnimatType.C_End, then ?? m.DisplayNomal);
|
m.Display(m.NowWork.Graph, AnimatType.C_End, then ?? m.DisplayNomal);
|
||||||
}
|
}
|
||||||
private void btnStop_Click(object sender, RoutedEventArgs e)
|
private void btnStop_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -763,7 +763,7 @@ namespace VPet_Simulator.Windows
|
|||||||
switch (Main.State)
|
switch (Main.State)
|
||||||
{
|
{
|
||||||
case Main.WorkingState.Work:
|
case Main.WorkingState.Work:
|
||||||
if (Main.nowWork.Type == Work.WorkType.Work)
|
if (Main.NowWork.Type == Work.WorkType.Work)
|
||||||
stat[(gi64)"stat_work_time"] += (int)Set.LogicInterval;
|
stat[(gi64)"stat_work_time"] += (int)Set.LogicInterval;
|
||||||
else
|
else
|
||||||
stat[(gi64)"stat_study_time"] += (int)Set.LogicInterval;
|
stat[(gi64)"stat_study_time"] += (int)Set.LogicInterval;
|
||||||
@ -940,7 +940,7 @@ namespace VPet_Simulator.Windows
|
|||||||
switch (obj.State)
|
switch (obj.State)
|
||||||
{
|
{
|
||||||
case Main.WorkingState.Work:
|
case Main.WorkingState.Work:
|
||||||
SteamFriends.SetRichPresence("work", obj.nowWork.Name.Translate());
|
SteamFriends.SetRichPresence("work", obj.NowWork.Name.Translate());
|
||||||
SteamFriends.SetRichPresence("steam_display", "#Status_Work");
|
SteamFriends.SetRichPresence("steam_display", "#Status_Work");
|
||||||
break;
|
break;
|
||||||
case Main.WorkingState.Sleep:
|
case Main.WorkingState.Sleep:
|
||||||
@ -1345,9 +1345,8 @@ namespace VPet_Simulator.Windows
|
|||||||
/// 加载游戏
|
/// 加载游戏
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Path">MOD地址</param>
|
/// <param name="Path">MOD地址</param>
|
||||||
public async void GameLoad(List<DirectoryInfo> Path)
|
public async Task GameLoad(List<DirectoryInfo> Path)
|
||||||
{
|
{
|
||||||
|
|
||||||
Path = Path.Distinct().ToList();
|
Path = Path.Distinct().ToList();
|
||||||
await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "Loading MOD"));
|
await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "Loading MOD"));
|
||||||
//加载mod
|
//加载mod
|
||||||
@ -1997,6 +1996,10 @@ namespace VPet_Simulator.Windows
|
|||||||
tlvplus.Text = $" / {1000 + GameSavesData.GameSave.LevelMax * 100} x{GameSavesData.GameSave.LevelMax}";
|
tlvplus.Text = $" / {1000 + GameSavesData.GameSave.LevelMax * 100} x{GameSavesData.GameSave.LevelMax}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if NewYear
|
#if NewYear
|
||||||
int newyearsay = 0;
|
int newyearsay = 0;
|
||||||
private void NewYearHandle(Main main)
|
private void NewYearHandle(Main main)
|
||||||
|
@ -21,6 +21,7 @@ using static VPet_Simulator.Core.GraphInfo;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using LinePutScript.Dictionary;
|
using LinePutScript.Dictionary;
|
||||||
using Steamworks.Data;
|
using Steamworks.Data;
|
||||||
|
using VPet_Simulator.Windows.WinDesign;
|
||||||
|
|
||||||
namespace VPet_Simulator.Windows
|
namespace VPet_Simulator.Windows
|
||||||
{
|
{
|
||||||
@ -100,7 +101,7 @@ namespace VPet_Simulator.Windows
|
|||||||
|
|
||||||
GameInitialization();
|
GameInitialization();
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
//加载所有MOD
|
//加载所有MOD
|
||||||
List<DirectoryInfo> Path = new List<DirectoryInfo>();
|
List<DirectoryInfo> Path = new List<DirectoryInfo>();
|
||||||
@ -216,10 +217,27 @@ namespace VPet_Simulator.Windows
|
|||||||
else//新玩家,默认设置为
|
else//新玩家,默认设置为
|
||||||
Set["CGPT"][(gstr)"type"] = "LB";
|
Set["CGPT"][(gstr)"type"] = "LB";
|
||||||
|
|
||||||
GameLoad(Path);
|
await GameLoad(Path);
|
||||||
|
if (IsSteamUser)
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Setting, "访客表".Translate(), () =>
|
||||||
|
{
|
||||||
|
if (winMutiPlayer == null)
|
||||||
|
{
|
||||||
|
winMutiPlayer = new winMutiPlayer(this);
|
||||||
|
winMutiPlayer.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
winMutiPlayer.Focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
internal winMutiPlayer winMutiPlayer;
|
||||||
|
|
||||||
public new void Close()
|
public new void Close()
|
||||||
{
|
{
|
||||||
@ -372,9 +390,9 @@ namespace VPet_Simulator.Windows
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
if (SavesLoad(new LPS(File.ReadAllText(latestsave))))
|
if (SavesLoad(new LPS(File.ReadAllText(latestsave))))
|
||||||
return;
|
return;
|
||||||
//MessageBoxX.Show("存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档", "存档损毁".Translate());
|
//MessageBoxX.Show("存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档", "存档损毁".Translate());
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -396,10 +396,7 @@
|
|||||||
ToolTip="{ll:Str '重新开始新游戏,重置统计等信息\ 对于想要获得脱离超模从而获得成就非常有帮助'}" Click="restart_click" />
|
ToolTip="{ll:Str '重新开始新游戏,重置统计等信息\ 对于想要获得脱离超模从而获得成就非常有帮助'}" Click="restart_click" />
|
||||||
<Button x:Name="btn_cleancache" Grid.Row="1" Grid.Column="2" Margin="4" Padding="1"
|
<Button x:Name="btn_cleancache" Grid.Row="1" Grid.Column="2" Margin="4" Padding="1"
|
||||||
pu:ButtonHelper.CornerRadius="4" Background="{DynamicResource SecondaryLight}"
|
pu:ButtonHelper.CornerRadius="4" Background="{DynamicResource SecondaryLight}"
|
||||||
Click="cleancache_click" Content="{ll:Str 清理缓存}" ToolTip="{ll:Str '清理缓存的动画,声音文件'}" />
|
Click="cleancache_click" Content="{ll:Str 清理缓存}" ToolTip="{ll:Str '清理缓存的动画,声音文件'}" />
|
||||||
<Button Grid.Row="1" Grid.Column="2" Margin="4" Padding="1" pu:ButtonHelper.CornerRadius="4"
|
|
||||||
Background="{DynamicResource SecondaryLight}" Click="cleancache_click"
|
|
||||||
Content="{ll:Str 清理缓存}" ToolTip="{ll:Str '清理缓存的动画,声音文件'}" />
|
|
||||||
<TextBlock Margin="0,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"
|
<TextBlock Margin="0,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
Background="{x:Null}" TextWrapping="Wrap">
|
Background="{x:Null}" TextWrapping="Wrap">
|
||||||
<Run FontSize="18" FontWeight="Bold" Text="{ll:Str 桌宠多开}" /> <LineBreak />
|
<Run FontSize="18" FontWeight="Bold" Text="{ll:Str 桌宠多开}" /> <LineBreak />
|
||||||
|
21
VPet-Simulator.Windows/WinDesign/winMutiPlayer.xaml
Normal file
21
VPet-Simulator.Windows/WinDesign/winMutiPlayer.xaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<Window x:Class="VPet_Simulator.Windows.WinDesign.winMutiPlayer"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:VPet_Simulator.Windows.WinDesign" mc:Ignorable="d"
|
||||||
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
|
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF" Title="xxx的访客表"
|
||||||
|
Height="600" Width="400" Closed="Window_Closed" FontSize="16">
|
||||||
|
<Grid>
|
||||||
|
<Image Margin="20" Width="80" Height="80" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
|
Source="/Res/TopLogo2019.PNG" />
|
||||||
|
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="120,20,0,0"
|
||||||
|
Foreground="{DynamicResource DARKPrimaryDarker}">
|
||||||
|
<Run Text="萝莉斯" FontSize="24" FontWeight="Bold" /> <Run Text="{ll:Str 的访客表}" />
|
||||||
|
<LineBreak />
|
||||||
|
<Run Text="{ll:Str 主持人}" />: <Run x:Name="hostName" Text="XXX" />
|
||||||
|
</TextBlock>
|
||||||
|
<StackPanel />
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
54
VPet-Simulator.Windows/WinDesign/winMutiPlayer.xaml.cs
Normal file
54
VPet-Simulator.Windows/WinDesign/winMutiPlayer.xaml.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using Steamworks;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
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;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace VPet_Simulator.Windows.WinDesign;
|
||||||
|
/// <summary>
|
||||||
|
/// winMutiPlayer.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class winMutiPlayer : Window
|
||||||
|
{
|
||||||
|
Steamworks.Data.Lobby lb;
|
||||||
|
MainWindow mw;
|
||||||
|
public winMutiPlayer(MainWindow mw, ulong? lobbyid = null)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.mw = mw;
|
||||||
|
if (lobbyid == null)
|
||||||
|
CreateLobby();
|
||||||
|
else
|
||||||
|
JoinLobby(lobbyid);
|
||||||
|
}
|
||||||
|
public async void JoinLobby(ulong? lobbyid)
|
||||||
|
{
|
||||||
|
lb = (await SteamMatchmaking.JoinLobbyAsync((SteamId)lobbyid)).Value;
|
||||||
|
}
|
||||||
|
public async void CreateLobby()
|
||||||
|
{
|
||||||
|
lb = (await SteamMatchmaking.CreateLobbyAsync()).Value;
|
||||||
|
lb.SetJoinable(true);
|
||||||
|
lb.SetPublic();
|
||||||
|
|
||||||
|
}
|
||||||
|
public void ShowLobbyInfo()
|
||||||
|
{
|
||||||
|
hostName.Text = lb.Owner.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Closed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
lb.Leave();
|
||||||
|
mw.winMutiPlayer = null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user