# 在 Microsoft Store 上發佈你的 RPG Maker MV/MZ 的遊戲 :::danger ![](https://i.imgur.com/xQoThD6.png) ::: 這次我會寫這篇文章,主要也是 Microsoft Store 的個人開發者費用降到比較便宜的金額,然後想說嘗試上架到 Microsoft Store 看看這樣,總之先看以下教學吧! 1.首先,註冊你的 Windows 開發者帳號,到以下網址並登入好你的 Microsoft 帳戶,按下「註冊」後,接著輸入你聯繫用的 Email 和設定慣用的郵件內容語言。 https://developer.microsoft.com/zh-tw/microsoft-store/register/ ![](https://i.imgur.com/nfRFlap.png) ![](https://i.imgur.com/SGbuBBs.png) 2.接著輸入你的帳戶資訊,分別輸入你所在的地區、註冊的開發者身分、以及開發者的名稱等相關資訊。 ![](https://i.imgur.com/VctECuZ.png) 3.然後,選擇「新增付款方式」並設定好你的「信用卡」或「簽帳信用卡」來支付一次性的開發者費用。 ![](https://i.imgur.com/cE6h067.png) ![](https://i.imgur.com/TBRZSjh.png) ![](https://i.imgur.com/LrWUtrI.png) 4.等待付款完成並收到成功註冊開發者的 Email 信件之後,開始到以下網址登入並選擇「應用程式與遊戲」。 https://partner.microsoft.com/zh-tw/dashboard/home ![](https://i.imgur.com/6lbn7JC.png) 5.接著開始建立你的應用程式,並新增提交內容。 ![](https://i.imgur.com/keH2K2T.png) ![](https://i.imgur.com/WUv3R1g.png) ![](https://i.imgur.com/s06xooH.png) 6.分別先設定好「定價和可用性」、「屬性」、「年齡分級」和「Microsoft Store 清單」這幾項。 ![](https://i.imgur.com/XuvfRU8.png) 7.然後開始準備部署時的一些必備的 SDK 套件,到以下網址下載舊版的 Windows 10 SDK,並下載好之後安裝等待完成。 https://developer.microsoft.com/zh-tw/windows/downloads/sdk-archive/ ![](https://i.imgur.com/2sTgfMN.png) ![](https://i.imgur.com/OiX2Gbo.png) ![](https://i.imgur.com/85g4ac8.png) ![](https://i.imgur.com/F4yvGSl.png) 8.回到剛才的開發者後台頁面,在左邊選擇「產品身分識別」,並將紅條、黃條、綠條, 以及橘條的文字複製下來,等等會需要用到它們。 ![](https://i.imgur.com/Yij0oTE.png) 9.之後參照以下我寫的這篇教學文章,接著在進行部署輸出之前,分別修改目前的 package.json 和 rpg_managers.js / rmmz_managers.js 的某段程式碼。 https://hackmd.io/@Mirai/rpg_maker_electron_win_cht 修改以下檔案的一些參數,並將剛剛複製的紅條、黃條、綠條, 以及橘條的字串內容依序貼在以下指定的位置。 **package.json** ```json= { "name": "RPGMaker (←這邊設定你部署輸出的專案名稱)", //但要注意是一旦決定好部署名稱就不能再改了,否則以後要部屬輸出更新版本時會很容易被拒絕審查。 "version": "1.0.0 (←這邊設定你的版本號)", "description": "RPG Maker Game", "main": "index.js", //【RPG Maker MZ】 "chromium-args": "--force-color-profile=srgb", //【RPG Maker MV】 "js-flags": "--expose-gc", "build": { "appId": "com.rpgmaker.game", "productName": "Game", "asar": true, "afterPack": "./myAfterPackHook.js", "win": { "icon": "icon/icon.ico", "target": { "target": "appx", "arch": [ "x64", "ia32" ] } }, "appx": { "applicationId": "RPGMakerGame", "displayName": "(橘色字串)", "identityName": "(紅色字串)", "publisher": "(黃色字串)", "publisherDisplayName": "(綠色字串)", "languages": "zh-Hant-TW", "backgroundColor": "#ffffff (←這邊設定你的應用程式動態磚的背景色塊)" } }, "scripts": { "start": "electron .", "pack": "electron-builder --dir", "dist": "electron-builder" }, "author": "Mirai (←這邊設定你的作者/團隊署名)", "copyright": "Copyright 2022 ${author} All rights reserved.", "devDependencies": { "electron": "^11.5.0", "electron-builder": "^22.5.1", "asarmor": "^2.0.0" } } ``` 修改以下檔案的一些程式碼,並將遊戲存檔的資料夾路徑改為「文件」資料夾,這是為了避免會有無法正常寫入遊戲存檔的問題。 ## RPG Maker MV 場合 **rpg_managers.js** ```js= StorageManager.localFileDirectoryPath = function () { var path = require('path'); if (Utils.isElectronjs()) { var base = path.dirname(__filename); var os = require('os'); //← 需要加入這段 return Utils.isOptionValid('test') ? path.join(base, 'save/') : path.join(os.homedir() + "/Documents/", "(你的遊戲存檔資料夾名稱)/"); } else { var base = path.dirname(process.mainModule.filename); return path.join(base, 'save/'); } }; ``` ## RPG Maker MZ 場合 **rmmz_managers.js** ```js= StorageManager.fileDirectoryPath = function () { const path = require("path"); if (Utils.isElectronjs()) { const base = path.dirname(__filename); const os = require('os'); //← 需要加入這段 return Utils.isOptionValid('test') ? path.join(base, "save/") : path.join(os.homedir() + "/Documents/", "(你的遊戲存檔資料夾名稱)/"); } else { const base = path.dirname(process.mainModule.filename); return path.join(base, "save/"); } }; ``` 10.之後在部署用的資料夾內建立「build」→「appx」等資料夾, 接著在「build」→「appx」資料夾內,建立如下圖 7 張尺寸規格的 png 格式圖檔,這邊需要注意的是這 7 張 png 格式圖檔的尺寸規格以及檔案名稱要跟下圖的資訊完全一致。 ![](https://i.imgur.com/AAzwijv.png) 11.使用「命令提示字元」輸入「`npm run dist`」開始執行部署輸出的動作之後,到部署用的資料夾的「dist」資料夾內,建立一個「appx」資料夾,並將以下兩個 Game xxxx.appx 檔案移動到「appx」資料夾。 ![](https://i.imgur.com/kJa7usf.png) 12.然後使用「命令提示字元」輸入「`cd C:\Program Files (x86)\Windows Kits\10\bin\10.0.xxxxx.0\x64`」,10.0.xxxxx.0為資料夾的版本號,選擇最新版本的資料夾就好,接著輸入「`./makeappx.exe bundle /d '(你的輸出用資料夾)\dist\appx' /p '(你的輸出用資料夾)\dist\RPGMaker.appxbundle'`」。 13.之後當你執行在「dist」資料夾內的「RPGMaker.appxbundle」時,系統會因為你所執行的 appxbundle 檔案格式為未簽署的應用程式而阻止你執行安裝。 ![](https://i.imgur.com/mA5ShJ7.png) 14.到開始功能表的「設定」→「更新與安全性」,在「開發人員專用」那邊,將「開發人員模式」功能開啟。 ![](https://i.imgur.com/QbXEYtd.png) 15.然後我們要開始製作「測試用」的簽署金鑰檔案,使用「命令提示字元」輸入「`cd C:\Program Files (x86)\Windows Kits\10\bin\10.0.xxxxx.0\x64`」,10.0.xxxxx.0為資料夾的版本號,選擇最新版本的資料夾就好,接著輸入「`./MakeCert.exe -r -n "(黃色字串)" -b 01/01/2022 -e 01/01/2023 -sv "(你的輸出用資料夾)\dist\myselfName.pvk" "(你的輸出用資料夾)\dist\myselfName.cer"`」,輸入並執行時會跳出視窗,並請你設定幾次簽署金鑰的密碼。 ![](https://i.imgur.com/ekzs9js.png) 16.接著我們需要將剛才產生的 pvk 檔案格式轉換成 pfx 檔案格式,使用「命令提示字元」輸入「`cd C:\Program Files (x86)\Windows Kits\10\bin\10.0.xxxxx.0\x64`」,10.0.xxxxx.0為資料夾的版本號,選擇最新版本的資料夾就好,接著輸入「`./pvk2pfx.exe -pvk '(你的輸出用資料夾)\dist\myselfName.pvk' -pi '(你設定的金鑰密碼)' -spc '(你的輸出用資料夾)\dist\myselfName.cer' -pfx '(你的輸出用資料夾)\dist\mypfxfile.pfx' -f`」。 17.然後我們要使用轉換好的 pfx 檔案對「RPGMaker.appxbundle」進行簽署,使用「命令提示字元」輸入「`cd C:\Program Files (x86)\Windows Kits\10\App Certification Kit」,接著輸入「./signtool.exe sign /fd SHA256 /a /f '(你的輸出用資料夾)\dist\mypfxfile.pfx' /p '(你設定的金鑰密碼)' '(你的輸出用資料夾)\dist\RPGMaker.appxbundle'`」。 18.之後在「RPGMaker.appxbundle」按滑鼠右鍵選擇「內容」,接著按照下圖的步驟操作。 ![](https://i.imgur.com/K9gTfYV.png) 19.之後再次執行「RPGMaker.appxbundle」時,已經可以執行安裝並進行測試了。 ![](https://i.imgur.com/bzf8Hwi.png) 20.接下來我們要用 Windows SDK 內所附的驗證工具去測試這個應用程式是否能正常用於上架,到以下路徑「C:\Program Files (x86)\Windows Kits\10\App Certification Kit\」去執行「appcertui.exe」,並瀏覽選擇「RPGMaker.appxbundle」來執行測試之後,等待「測試結果」的報告資料。 ![](https://i.imgur.com/NxED1J8.png) 21.接下來要進行上架動作,我們要刪除掉剛剛用測試金鑰簽署的「RPGMaker.appxbundle」,然後回到第 12 步重新製作未簽署的「RPGMaker.appxbundle」。 22.接著在「RPGMaker.appxbundle」滑鼠右鍵選擇「壓縮檔案」,並將壓縮後的副檔名「zip」改成「appxupload」。 ![](https://i.imgur.com/bUExuOl.png) 23.回到第 6 步的開發者後台頁面,在「套件」項目那邊勾選「Windows 10/11 電腦」,瀏覽並選擇「RPGMaker.appxupload」等待上傳完成之後,按下「儲存」。 ![](https://i.imgur.com/MyNZwl4.png) 如果你要刪除已上傳的套件,在下方展開「詳細資料」並在下方按下「移除」之後選擇「儲存」即可刪除。 ![](https://i.imgur.com/knwqAOu.png) 24.在「提交選項」項目那邊明確寫好測試內容資訊,以及需要此項功能的理由,填寫完之後按下「儲存」。 ![](https://i.imgur.com/3P915FJ.png) 25.最後,按下「提交至 Microsoft Store」,並且等待 3 天左右的時間後,會收到審核結果的通知信件。 :::warning <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> 順帶一提,「Xbox 創作者計畫」那項不填留空白就好,那是給有要移植 Xbox 系列主機的開發者使用,但是該計畫只接受有一定知名度的遊戲作品。 ::: ![](https://i.imgur.com/2GHK7ME.png) ![](https://i.imgur.com/Pkg1Z9g.png) ## ■ 最終通過審查並上架到 Microsoft Store 的遊戲頁面。 ![](https://i.imgur.com/zyOA4vp.png) 《Mirai》Patreon創作: https://www.patreon.com/MiraiDiary 《Mirai》個人推特(X): https://twitter.com/Mirai_so_Sad 《Mirai》itch.io頁面: https://miraisosad.itch.io 《Mirai》個人Instagram https://www.instagram.com/miraisosad/ ###### tags: `貓咪學園` `NekoGakuen` `RPG Maker` `RPG Maker MV` `RPG Maker MZ` `Microsoft Store`