代码插件支持风格管理

This commit is contained in:
ZouJin 2023-04-05 02:21:46 +10:00
parent 43685d6e8e
commit b5fc501226
15 changed files with 49 additions and 46 deletions

View File

@ -6,11 +6,10 @@
<Viewbox>
<Grid x:Name="MainGrid" Width="500" Height="500" MouseLeftButtonDown="MainGrid_MouseLeftButtonDown" x:FieldModifier="public"
MouseLeftButtonUp="MainGrid_MouseLeftButtonUp" MouseRightButtonDown="MainGrid_MouseRightButtonDown" MouseMove="MainGrid_MouseWave">
<Grid x:Name="UIGrid_Back" x:FieldModifier="public"/>
<Border x:Name="PetGrid" VerticalAlignment="Bottom" />
<Border x:Name="PetGrid2" VerticalAlignment="Bottom" />
<Grid x:Name="UIGrid">
</Grid>
<Grid x:Name="UIGrid" x:FieldModifier="public"/>
</Grid>
</Viewbox>
</pu:ContentControlX>

View File

@ -24,7 +24,9 @@ namespace VPet_Simulator.Core
/// </summary>
public event Action<string> OnSay;
/// <summary>
/// 事件Timer
/// </summary>
public Timer EventTimer = new Timer(15000)
{
AutoReset = true,
@ -207,7 +209,7 @@ namespace VPet_Simulator.Core
/// 设置移动模式
/// </summary>
/// <param name="AllowMove">允许移动</param>
/// <param name="SmartMove">启用智能移动</param>
/// <param name="smartMove">启用智能移动</param>
/// <param name="SmartMoveInterval">智能移动周期</param>
public void SetMoveMode(bool AllowMove, bool smartMove, int SmartMoveInterval)
{

View File

@ -13,11 +13,10 @@
MouseLeave="Border_MouseLeave">
<StackPanel>
<Label x:Name="LName" Content="虚拟桌宠名字:" Foreground="{DynamicResource PrimaryText}" HorizontalAlignment="Left" Padding="0"
FontWeight="Bold" Margin="0,0,0,6" FontSize="32"
Background="{x:Null}" />
FontWeight="Bold" Margin="0,0,0,6" FontSize="32" Background="{x:Null}" />
<ScrollViewer MaxHeight="400">
<TextBlock x:Name="TText" Text="我说话长这样,这是我说的话巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉" TextWrapping="WrapWithOverflow"
FontSize="24" />
FontSize="24" x:FieldModifier="public"/>
</ScrollViewer>
</StackPanel>
</Border>

View File

@ -16,7 +16,7 @@
<Border x:Name="BdrPanel" VerticalAlignment="Bottom" Margin="0,0,0,55" TextBlock.FontSize="24"
TextElement.FontSize="24" BorderBrush="{DynamicResource DARKPrimaryDarker}"
BorderThickness="1" Background="{DynamicResource DARKPrimaryText}" CornerRadius="5"
MouseLeave="MenuPanel_MouseLeave" Visibility="Collapsed">
MouseLeave="MenuPanel_MouseLeave" Visibility="Collapsed" x:FieldModifier="public">
<Grid Margin="15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@ -115,7 +115,7 @@
</MenuItem>
<MenuItem x:Name="MenuDIY" Header="自定" HorizontalContentAlignment="Center" Click="MenuDIY_Click"
x:FieldModifier="public" />
<MenuItem x:Name="MenuSetting" Header="系统" HorizontalContentAlignment="Center" />
<MenuItem x:Name="MenuSetting" Header="系统" HorizontalContentAlignment="Center" x:FieldModifier="public"/>
</Menu>
</Grid>
</UserControl>

View File

@ -18,7 +18,7 @@ namespace VPet_Simulator.Core
/// <returns></returns>
public static Brush ResourcesBrush(BrushType name)
{
return (Brush)Application.Current.Resources.MergedDictionaries.First()[name.ToString()];
return (Brush)Application.Current.Resources.MergedDictionaries[0][name.ToString()];
}
public enum BrushType
{

View File

@ -24,12 +24,17 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\Release\VPet-Simulator.Core.xml</DocumentationFile>
<RegisterForComInterop>false</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<DebugSymbols>true</DebugSymbols>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>

View File

@ -24,7 +24,7 @@ namespace VPet_Simulator.Windows.Interface
/// </summary>
/// <param name="mainwin">主窗体</param>
/// 请不要加载游戏和玩家数据,仅用作初始化
/// 加载数据(CORE)/游戏(SAVE),请使用 StartGame
/// 加载数据(CORE)/游戏(SAVE),请使用 LoadPlugin
public MainPlugin(IMainWindow mainwin)
{
//此处主窗体玩家,Core等信息均为空,请不要加载游戏和玩家数据
@ -36,9 +36,11 @@ namespace VPet_Simulator.Windows.Interface
///// <param name="theme">主题</param>
//public virtual void LoadTheme(Theme theme) { }
/// <summary>
/// 游戏开始 (可以读取Save存档) (如果玩家登出后重新开始游戏,将会被再次调用)
/// 初始化程序+读取存档
/// </summary>
public virtual void StartGame() { }
/// 例:添加自己的Tick到 mw.Main.EventTimer
/// 例:创建使用UI的桌面控件
public virtual void LoadPlugin() { }
/// <summary>
/// 游戏结束 (可以保存或清空等,不过保存有专门的Save())

View File

@ -3,7 +3,8 @@
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
<ResourceDictionary.MergedDictionaries>
<pucore:SharedResourceDictionary Source="/Panuon.WPF.UI;component/Control.xaml" />
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/Theme.xaml"/>
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/basestyle.xaml"/>
</ResourceDictionary.MergedDictionaries>

View File

@ -24,12 +24,14 @@
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\VPet-Simulator.Windows.Interface.xml</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
@ -89,9 +91,17 @@
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.6.1\lib\net462\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.8.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.8.5\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -115,5 +125,11 @@
<Name>VPet-Simulator.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="ResourceStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LinePutScript" version="1.6.1" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.8.5" targetFramework="net462" />
</packages>

View File

@ -4,11 +4,6 @@
xmlns:local="clr-namespace:VPet_Simulator.Windows"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/Theme.xaml" />
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/basestyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<ResourceDictionary Source="/VPet-Simulator.Windows.Interface;component/ResourceStyle.xaml" />
</Application.Resources>
</Application>

View File

@ -73,7 +73,7 @@ namespace VPet_Simulator.Windows
{
//加载游戏创意工坊插件
foreach (MainPlugin mp in Plugins)
mp.StartGame();
mp.LoadDIY();
}
catch (Exception e)
{

View File

@ -223,7 +223,7 @@ namespace VPet_Simulator.Windows
{
//加载游戏创意工坊插件
foreach (MainPlugin mp in Plugins)
mp.StartGame();
mp.LoadPlugin();
}
catch (Exception e)
{

View File

@ -142,10 +142,6 @@
<Compile Include="WinDesign\winReport.xaml.cs">
<DependentUpon>winReport.xaml</DependentUpon>
</Compile>
<Page Include="Design\Theme\basestyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WinDesign\TalkBoxAPI.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet-Simulator.Windows", "V
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet-Simulator.Windows.Interface", "VPet-Simulator.Windows.Interface\VPet-Simulator.Windows.Interface.csproj", "{DCAD838A-1A02-4BDF-962C-FD47C6006D28}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet-Simulator.Windows.Interface.Demo", "VPet-Simulator.Windows.Interface.Demo\VPet-Simulator.Windows.Interface.Demo.csproj", "{4DB2457C-143A-4100-9A93-A8AD2D973BDA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -31,8 +29,8 @@ Global
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Debug|x86.Build.0 = Debug|Any CPU
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|Any CPU.Build.0 = Release|Any CPU
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x64.ActiveCfg = Release|x64
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x64.Build.0 = Release|x64
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x64.ActiveCfg = Release|Any CPU
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x64.Build.0 = Release|Any CPU
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x86.ActiveCfg = Release|x86
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x86.Build.0 = Release|x86
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@ -71,18 +69,6 @@ Global
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x64.Build.0 = Release|Any CPU
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x86.ActiveCfg = Release|Any CPU
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x86.Build.0 = Release|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|x64.ActiveCfg = Debug|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|x64.Build.0 = Debug|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|x86.ActiveCfg = Debug|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|x86.Build.0 = Debug|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|Any CPU.Build.0 = Release|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|x64.ActiveCfg = Release|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|x64.Build.0 = Release|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|x86.ActiveCfg = Release|Any CPU
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE