diff --git a/2048uwp.sln b/2048uwp.sln new file mode 100644 index 0000000..dc29864 --- /dev/null +++ b/2048uwp.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2048uwp", "2048uwp\2048uwp.vcxproj", "{AC1D64A4-9CB3-4F69-947C-802840993C67}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM.ActiveCfg = Debug|ARM + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM.Build.0 = Debug|ARM + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM.Deploy.0 = Debug|ARM + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM64.Build.0 = Debug|ARM64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x64.ActiveCfg = Debug|x64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x64.Build.0 = Debug|x64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x64.Deploy.0 = Debug|x64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x86.ActiveCfg = Debug|Win32 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x86.Build.0 = Debug|Win32 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x86.Deploy.0 = Debug|Win32 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM.ActiveCfg = Release|ARM + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM.Build.0 = Release|ARM + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM.Deploy.0 = Release|ARM + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM64.ActiveCfg = Release|ARM64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM64.Build.0 = Release|ARM64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM64.Deploy.0 = Release|ARM64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x64.ActiveCfg = Release|x64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x64.Build.0 = Release|x64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x64.Deploy.0 = Release|x64 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x86.ActiveCfg = Release|Win32 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x86.Build.0 = Release|Win32 + {AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0E8B49DC-49E9-4128-8FCD-4DA49640F2FE} + EndGlobalSection +EndGlobal diff --git a/2048uwp/2048uwp.vcxproj b/2048uwp/2048uwp.vcxproj new file mode 100644 index 0000000..69c59de --- /dev/null +++ b/2048uwp/2048uwp.vcxproj @@ -0,0 +1,239 @@ + + + + {ac1d64a4-9cb3-4f69-947c-802840993c67} + _2048uwp + en-US + 14.0 + true + Windows Store + 10.0.19041.0 + 10.0.17763.0 + 10.0 + True + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + Application + true + v142 + + + Application + true + v142 + + + Application + true + v142 + + + Application + true + v142 + true + + + Application + false + true + v142 + true + + + Application + false + true + v142 + true + + + Application + false + true + v142 + true + + + Application + false + true + v142 + true + + + + + + + + + + + + + + + + + + + + + + + + False + SHA256 + True + False + Always + x86|x64|arm|arm64 + 0 + 2048uwp_TemporaryKey.pfx + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + + App.xaml + + + MainPage.xaml + + + + + + + Designer + + + Designer + + + + + Designer + + + + + + + + + + + + + + + App.xaml + + + MainPage.xaml + + + Create + Create + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + \ No newline at end of file diff --git a/2048uwp/2048uwp.vcxproj.filters b/2048uwp/2048uwp.vcxproj.filters new file mode 100644 index 0000000..8d11faa --- /dev/null +++ b/2048uwp/2048uwp.vcxproj.filters @@ -0,0 +1,59 @@ + + + + + ac1d64a4-9cb3-4f69-947c-802840993c67 + + + c6240b1d-a8e5-48bd-82b3-86ad23d3c936 + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + + + + + \ No newline at end of file diff --git a/2048uwp/App.xaml b/2048uwp/App.xaml new file mode 100644 index 0000000..2452beb --- /dev/null +++ b/2048uwp/App.xaml @@ -0,0 +1,7 @@ + + + diff --git a/2048uwp/App.xaml.cpp b/2048uwp/App.xaml.cpp new file mode 100644 index 0000000..cc0e72e --- /dev/null +++ b/2048uwp/App.xaml.cpp @@ -0,0 +1,116 @@ +// +// App.xaml.cpp +// App 类的实现。 +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace _2048uwp; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +/// +/// 初始化单一实例应用程序对象。这是执行的创作代码的第一行, +/// 已执行,逻辑上等同于 main() 或 WinMain()。 +/// +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// +/// 在应用程序由最终用户正常启动时进行调用。 +/// 将在启动应用程序以打开特定文件等情况下使用。 +/// +/// 有关启动请求和过程的详细信息。 +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +{ + auto rootFrame = dynamic_cast(Window::Current->Content); + + // 不要在窗口已包含内容时重复应用程序初始化, + // 只需确保窗口处于活动状态 + if (rootFrame == nullptr) + { + // 创建一个 Frame 以用作导航上下文并将其与 + // SuspensionManager 键关联 + rootFrame = ref new Frame(); + + rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: 仅当适用时还原保存的会话状态,并安排 + // 还原完成后的最终启动步骤 + + } + + if (e->PrelaunchActivated == false) + { + if (rootFrame->Content == nullptr) + { + // 当导航堆栈尚未还原时,导航到第一页, + // 并通过将所需信息作为导航参数传入来配置 + // 新页面 + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // 将框架放在当前窗口中 + Window::Current->Content = rootFrame; + // 确保当前窗口处于活动状态 + Window::Current->Activate(); + } + } + else + { + if (e->PrelaunchActivated == false) + { + if (rootFrame->Content == nullptr) + { + // 当导航堆栈尚未还原时,导航到第一页, + // 并通过将所需信息作为导航参数传入来配置 + // 参数 + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // 确保当前窗口处于活动状态 + Window::Current->Activate(); + } + } +} + +/// +/// 在将要挂起应用程序执行时调用。 在不知道应用程序 +/// 无需知道应用程序会被终止还是会恢复, +/// 并让内存内容保持不变。 +/// +/// 挂起的请求的源。 +/// 有关挂起请求的详细信息。 +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // 未使用的参数 + (void) e; // 未使用的参数 + + //TODO: 保存应用程序状态并停止任何后台活动 +} + +/// +/// 导航到特定页失败时调用 +/// +///导航失败的框架 +///有关导航失败的详细信息 +void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) +{ + throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); +} diff --git a/2048uwp/App.xaml.h b/2048uwp/App.xaml.h new file mode 100644 index 0000000..8aa3a8c --- /dev/null +++ b/2048uwp/App.xaml.h @@ -0,0 +1,27 @@ +// +// App.xaml.h +// App 类的声明。 +// + +#pragma once + +#include "App.g.h" + +namespace _2048uwp +{ + /// + /// 提供特定于应用程序的行为,以补充默认的应用程序类。 + /// + ref class App sealed + { + protected: + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; + + internal: + App(); + + private: + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); + }; +} diff --git a/2048uwp/Assets/LockScreenLogo.scale-200.png b/2048uwp/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000..41384f8 Binary files /dev/null and b/2048uwp/Assets/LockScreenLogo.scale-200.png differ diff --git a/2048uwp/Assets/SplashScreen.scale-200.png b/2048uwp/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000..5036781 Binary files /dev/null and b/2048uwp/Assets/SplashScreen.scale-200.png differ diff --git a/2048uwp/Assets/Square150x150Logo.scale-200.png b/2048uwp/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000..d028663 Binary files /dev/null and b/2048uwp/Assets/Square150x150Logo.scale-200.png differ diff --git a/2048uwp/Assets/Square44x44Logo.scale-200.png b/2048uwp/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000..82f8aa5 Binary files /dev/null and b/2048uwp/Assets/Square44x44Logo.scale-200.png differ diff --git a/2048uwp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/2048uwp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000..cdf9f6a Binary files /dev/null and b/2048uwp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/2048uwp/Assets/StoreLogo.png b/2048uwp/Assets/StoreLogo.png new file mode 100644 index 0000000..066b736 Binary files /dev/null and b/2048uwp/Assets/StoreLogo.png differ diff --git a/2048uwp/Assets/Wide310x150Logo.scale-200.png b/2048uwp/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000..f212f24 Binary files /dev/null and b/2048uwp/Assets/Wide310x150Logo.scale-200.png differ diff --git a/2048uwp/Assets/miku.jpg b/2048uwp/Assets/miku.jpg new file mode 100644 index 0000000..3ed3a66 Binary files /dev/null and b/2048uwp/Assets/miku.jpg differ diff --git a/2048uwp/MainPage.xaml b/2048uwp/MainPage.xaml new file mode 100644 index 0000000..adf94d4 --- /dev/null +++ b/2048uwp/MainPage.xaml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +