diff --git a/.github/workflows/activation.yml b/.github/workflows/activation.yml index e2e32d7..bd7fdb2 100644 --- a/.github/workflows/activation.yml +++ b/.github/workflows/activation.yml @@ -11,7 +11,7 @@ jobs: id: getManualLicenseFile uses: game-ci/unity-request-activation-file@v2 with: - unityVersion: 2022.2.5f1 + unityVersion: 2022.2.15f1 # Upload artifact (Unity_v20XX.X.XXXX.alf) - name: Expose as artifact uses: actions/upload-artifact@v3.1.1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 42d417d..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Build - -env: - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - -# Controls when the action will run. -on: - workflow_dispatch: {} - push: - branches: - - main - paths-ignore: - - '.github/**' - # Triggers the workflow on push or pull request events but only for the main branch - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - projectPath: - - . - unityVersion: - - 2022.2.5f1 - targetPlatform: - - WebGL - steps: - - name: Checkout - uses: actions/checkout@v3.2.0 - with: - lfs: true - clean: false - -# Cache - - uses: actions/cache@v3 - with: - path: Library - key: Library - - # Build - - name: Build project - uses: game-ci/unity-builder@v2.1.2 - with: - unityVersion: ${{ matrix.unityVersion }} - targetPlatform: ${{ matrix.targetPlatform }} - - # Output - - uses: actions/upload-artifact@v3.1.1 - with: - name: Build-${{ matrix.targetPlatform }} - path: build/${{ matrix.targetPlatform }} diff --git a/.github/workflows/check-meta-files.yml b/.github/workflows/check-meta-files.yml index 26b1af3..080549d 100644 --- a/.github/workflows/check-meta-files.yml +++ b/.github/workflows/check-meta-files.yml @@ -9,6 +9,7 @@ on: pull_request: branches: - main + - develop jobs: meta-check: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db8a3da..a6710f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,7 @@ on: pull_request: branches: - main + - develop # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: diff --git a/Assets/EasyADV/BackgroundImage.meta b/Assets/EasyADV/BackgroundImage.meta new file mode 100644 index 0000000..237bd3c --- /dev/null +++ b/Assets/EasyADV/BackgroundImage.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 576c8f3745a2481e8d4ab1867c620326 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EasyADV/BackgroundImage/.gitkeep b/Assets/EasyADV/BackgroundImage/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Assets/EasyADV/CharacterImage.meta b/Assets/EasyADV/CharacterImage.meta new file mode 100644 index 0000000..4d78160 --- /dev/null +++ b/Assets/EasyADV/CharacterImage.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a9d7841a61dc469ca6b8a9a9ac69019c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EasyADV/CharacterImage/.gitkeep b/Assets/EasyADV/CharacterImage/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Assets/EasyADV/Prefabs.meta b/Assets/EasyADV/Prefabs.meta new file mode 100644 index 0000000..7e7692e --- /dev/null +++ b/Assets/EasyADV/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 13d5864d1384f28448f6c7bd1f55623b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EasyADV/Prefabs/Background.prefab b/Assets/EasyADV/Prefabs/Background.prefab new file mode 100644 index 0000000..f3ce1c5 --- /dev/null +++ b/Assets/EasyADV/Prefabs/Background.prefab @@ -0,0 +1,92 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7114562640169053628 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 997822693772618305} + - component: {fileID: 2866147896293219298} + - component: {fileID: 45360905756024039} + - component: {fileID: 1689601321579300571} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &997822693772618305 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7114562640169053628} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2866147896293219298 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7114562640169053628} + m_CullTransparentMesh: 1 +--- !u!114 &45360905756024039 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7114562640169053628} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1689601321579300571 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7114562640169053628} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a1f4d01e48c9499f80ebc24e695fa593, type: 3} + m_Name: + m_EditorClassIdentifier: + backgroundSprites: [] diff --git a/Assets/EasyADV/Prefabs/Background.prefab.meta b/Assets/EasyADV/Prefabs/Background.prefab.meta new file mode 100644 index 0000000..5968501 --- /dev/null +++ b/Assets/EasyADV/Prefabs/Background.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 753e25e07c0e24d4f95d3448c7d12f56 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EasyADV/Scripts/DataModel/CharacterVoiceSetting.cs b/Assets/EasyADV/Scripts/DataModel/CharacterVoiceSetting.cs deleted file mode 100644 index e7b5b64..0000000 --- a/Assets/EasyADV/Scripts/DataModel/CharacterVoiceSetting.cs +++ /dev/null @@ -1,24 +0,0 @@ -using KoeiromapUnity.Core; - -namespace EasyADV.DataModel -{ - public static class CharacterVoiceSetting - { - /// - /// sample - /// - /// - /// - public static VoiceParam Character1(string text) - { - return new VoiceParam - { - text = text, - speaker_x = 0.50f, - speaker_y = 0.20f, - style = "talk", - seed = "15" - }; - } - } -} \ No newline at end of file diff --git a/Assets/EasyADV/Scripts/DataModel/CharacterVoiceSetting.cs.meta b/Assets/EasyADV/Scripts/DataModel/CharacterVoiceSetting.cs.meta deleted file mode 100644 index 8af2b6f..0000000 --- a/Assets/EasyADV/Scripts/DataModel/CharacterVoiceSetting.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 26045c5a567e477aae934c4981eeb8a8 -timeCreated: 1679417240 \ No newline at end of file diff --git a/Assets/EasyADV/Scripts/DataModel/ScenarioData.cs b/Assets/EasyADV/Scripts/DataModel/ScenarioData.cs index e5332d3..68f1652 100644 --- a/Assets/EasyADV/Scripts/DataModel/ScenarioData.cs +++ b/Assets/EasyADV/Scripts/DataModel/ScenarioData.cs @@ -3,6 +3,9 @@ namespace EasyADV.DataModel { + /// + /// シナリオデータ + /// [Serializable] public class ScenarioData { @@ -11,10 +14,12 @@ public class ScenarioData public string characterName; public string command; public string content; - public string description; public string sound; } + /// + /// シナリオデータリスト + /// [Serializable] public class ScenarioDataList { diff --git a/Assets/EasyADV/Scripts/EasyADV.asmdef b/Assets/EasyADV/Scripts/EasyADV.asmdef index 1ac7ce6..b336390 100644 --- a/Assets/EasyADV/Scripts/EasyADV.asmdef +++ b/Assets/EasyADV/Scripts/EasyADV.asmdef @@ -4,7 +4,6 @@ "references": [ "GUID:007db7f7a4c8f944990d71603a110f82", "GUID:f51ebe6a0ceec4240a699833d6309b23", - "GUID:cc04cd67926c76747844771fb8e474a5", "GUID:34cf00d3f10a8f34783a2f8b914a0219" ], "includePlatforms": [], diff --git a/Assets/EasyADV/Scripts/Editor/EasyADVMenu.cs b/Assets/EasyADV/Scripts/Editor/EasyADVMenu.cs new file mode 100644 index 0000000..8df1fbd --- /dev/null +++ b/Assets/EasyADV/Scripts/Editor/EasyADVMenu.cs @@ -0,0 +1,125 @@ +using System.IO; +using EasyADV.FungusExtension; +using EasyADV.Scripts; +using Fungus; +using UnityEditor; +using UnityEngine; + +namespace EasyADV.Editor +{ + /// + /// EasyADVのメニューを追加するクラス + /// + public class EasyADVMenu + { + /// + /// 背景画像のフォルダ名 + /// + private const string BackgroundImageFolderName = "BackgroundImage"; + + /// + /// キャラクター画像のフォルダ名 + /// + private const string CharacterImageFolderName = "CharacterImage"; + + /// + /// サウンドのフォルダ名 + /// + private const string SoundFolderName = "Sound"; + + [MenuItem("Tools/EasyADV/Setup")] + private static void Setup() + { + SetupHierarchyObject(); + SetupMaterialFolder(); + } + + /// + /// 素材フォルダを作成する + /// + private static void SetupMaterialFolder() + { + var folderRoot = Application.dataPath + "/EasyADV/"; + + // 背景画像フォルダがなければ作成 + if (!Directory.Exists(folderRoot + BackgroundImageFolderName)) + { + Directory.CreateDirectory(folderRoot + BackgroundImageFolderName); + CreateGitKeep(Path.Combine(folderRoot, BackgroundImageFolderName)); + } + + // キャラクター画像フォルダがなければ作成 + if (!Directory.Exists(folderRoot + CharacterImageFolderName)) + { + Directory.CreateDirectory(folderRoot + CharacterImageFolderName); + CreateGitKeep(Path.Combine(folderRoot, CharacterImageFolderName)); + } + + // サウンドフォルダがなければ作成 + if (!Directory.Exists(folderRoot + SoundFolderName)) + { + Directory.CreateDirectory(folderRoot + SoundFolderName); + CreateGitKeep(Path.Combine(folderRoot, SoundFolderName)); + } + + AssetDatabase.Refresh(); + } + + /// + /// Fungus・EasyADVを使用するためのオブジェクトを作成する + /// + private static void SetupHierarchyObject() + { + if (Object.FindObjectOfType() == null) + { + Fungus.EditorUtils.FlowchartMenuItems.CreateFlowchart(); + } + + if(Object.FindObjectOfType() == null) + { + Fungus.EditorUtils.NarrativeMenuItems.CreateStage(); + } + + if (Object.FindObjectOfType() == null) + { + Fungus.EditorUtils.NarrativeMenuItems.CreateSayDialog(); + } + + // FlowchartにUpdateScenarioFromGoogleSheetコンポーネントが追加されていなければ追加 + var flowchart = Object.FindObjectOfType(); + if (flowchart == null || flowchart.GetComponent() != null) + { + return; + } + + flowchart.gameObject.AddComponent(); + + // ステージ内に背景画 切り替え用のオブジェクトとコンポーネントの追加 + var stageCanvas = Object.FindObjectOfType().GetComponentInChildren(); + if (stageCanvas.GetComponentInChildren() != null) + { + return; + } + + var backgroundPrefab = + AssetDatabase.LoadAssetAtPath("Assets/EasyADV/Prefabs/Background.prefab"); + var backgroundObject = Object.Instantiate(backgroundPrefab, stageCanvas.transform); + backgroundObject.name = "Background"; + } + + /// + /// Gitの管理下に置くためのファイルを作成する + /// + /// + private static void CreateGitKeep(string path) + { + var gitKeepPath = path + "/.gitkeep"; + if (File.Exists(gitKeepPath)) + { + return; + } + + File.Create(gitKeepPath); + } + } +} \ No newline at end of file diff --git a/Assets/EasyADV/Scripts/Editor/EasyADVMenu.cs.meta b/Assets/EasyADV/Scripts/Editor/EasyADVMenu.cs.meta new file mode 100644 index 0000000..c564f6c --- /dev/null +++ b/Assets/EasyADV/Scripts/Editor/EasyADVMenu.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 76db53e435b64772977b29f5f09e5eb0 +timeCreated: 1691291362 \ No newline at end of file diff --git a/Assets/EasyADV/Scripts/Editor/EditScenario.cs b/Assets/EasyADV/Scripts/Editor/EditScenario.cs index 725f79c..742a5b9 100644 --- a/Assets/EasyADV/Scripts/Editor/EditScenario.cs +++ b/Assets/EasyADV/Scripts/Editor/EditScenario.cs @@ -18,7 +18,7 @@ namespace EasyADV.Editor { [CustomEditor(typeof(UpdateScenarioFromGoogleSheet))] - public partial class EditScenario : UnityEditor.Editor + public class EditScenario : UnityEditor.Editor { private const string SheetName = ScenarioSheetData.MainSheet; @@ -49,12 +49,9 @@ public override async void OnInspectorGUI() serializedObject.Update(); // serializedObjectからSampleComponentのプロパティを取得 - _characterImageFolderPath = serializedObject.FindProperty("characterImageFolderPath").stringValue; - _backgroundImageFolderPath = serializedObject.FindProperty("backgroundImageFolderPath").stringValue; - _bgmFolderPath = serializedObject.FindProperty("bgmFolderPath").stringValue; - _isUpdateVoiceProperty = serializedObject.FindProperty("isUpdateVoice").boolValue; - _voiceStartIndex = serializedObject.FindProperty("voiceStartIndex").intValue; - _voiceFolderPath = serializedObject.FindProperty("voiceFolderPath").stringValue; + _characterImageFolderPath = Application.dataPath + "/EasyADV/CharacterImage"; + _backgroundImageFolderPath = Application.dataPath + "/EasyADV/BackgroundImage"; + _bgmFolderPath = Application.dataPath + "/EasyADV/Sound"; if (GUILayout.Button(new GUIContent("Update Scenario"))) { @@ -62,19 +59,25 @@ public override async void OnInspectorGUI() var scenarioData = await DownloadScenarioData(SheetName); CacheComponents(); DeleteAllCommand(); - DeleteVoice(_isUpdateVoiceProperty); UpdateCharacterInfo(scenarioData); await UpdateConversationBlock(scenarioData, BlockName); Debug.Log("Update Scenario"); } } + /// + /// コンポーネントをキャッシュする + /// private static void CacheComponents() { _flowchart = FindObjectOfType(); _blocks = _flowchart.GetComponents().ToList(); } + /// + /// キャラクターの情報を更新する + /// + /// private void UpdateCharacterInfo(ScenarioDataList scenarioDataList) { var characters = FindObjectsOfType().ToList(); @@ -95,6 +98,11 @@ private void UpdateCharacterInfo(ScenarioDataList scenarioDataList) } } + /// + /// シナリオデータをダウンロードする + /// + /// + /// private static async UniTask DownloadScenarioData(string sheetName) { return await GetScenarioFromSheet.GetGameInfo(ScenarioSheetData.SheetURL, sheetName); @@ -121,6 +129,13 @@ private async UniTask UpdateConversationBlock(ScenarioDataList scenarioDataList, } } + /// + /// Flowchartにブロック(コマンド)を追加する + /// + /// + /// + /// + /// private async UniTask AddBlock(ScenarioData scenarioData, Block block, int blockIndex) { if (string.IsNullOrEmpty(scenarioData.command)) return; @@ -134,28 +149,6 @@ private async UniTask AddBlock(ScenarioData scenarioData, Block block, int block .FirstOrDefault(x => x.Key == scenarioData.characterName).Value; commandSay.ItemId = blockIndex + 1; - if (!string.IsNullOrEmpty(scenarioData.characterName)) - { - var inputText = scenarioData.content.Replace("「", "").Replace("」", ""); - if (!IsSilentText(inputText)) - { - if (_isUpdateVoiceProperty && _voiceStartIndex <= blockIndex) - { - commandSay.VoiceOverClip = - await GetVoiceClip(scenarioData.characterName, inputText, blockIndex, - _cancellationTokenSource.Token); - await UniTask.Delay(TimeSpan.FromSeconds(1f), - cancellationToken: _cancellationTokenSource.Token); - } - else - { - var savePath = Path.Combine("Assets", _voiceFolderPath, - $"{blockIndex}.wav"); - commandSay.VoiceOverClip = AssetDatabase.LoadAssetAtPath(savePath); - } - } - } - block.CommandList.Add(commandSay); break; //このコマンドは要修正 @@ -209,6 +202,9 @@ await UniTask.Delay(TimeSpan.FromSeconds(1f), } } + /// + /// Flowchartのブロックを削除する + /// private static void DeleteAllCommand() { foreach (var (deleteBlock, _) in _blocks.Select((info, index) => (info, index))) diff --git a/Assets/EasyADV/Scripts/Editor/UpdateVoice.cs b/Assets/EasyADV/Scripts/Editor/UpdateVoice.cs deleted file mode 100644 index 7b79ad7..0000000 --- a/Assets/EasyADV/Scripts/Editor/UpdateVoice.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.IO; -using System.Text.RegularExpressions; -using System.Threading; -using Cysharp.Threading.Tasks; -using EasyADV.DataModel; -using KoeiromapUnity.Core; -using KoeiromapUnity.Util; -using UnityEditor; -using UnityEngine; - -namespace EasyADV.Editor -{ - public partial class EditScenario - { - private static void DeleteVoice(bool isUpdateVoice) - { - if (isUpdateVoice) DeleteAllVoice(); - } - - private static void DeleteAllVoice() - { - var voiceFiles = Directory.GetFiles(Path.Combine("Assets", _voiceFolderPath)); - foreach (var voiceFile in voiceFiles) AssetDatabase.DeleteAsset(voiceFile); - AssetDatabase.Refresh(); - } - - private static bool IsSilentText(string text) - { - if (string.IsNullOrEmpty(text)) return true; - - text = text.Trim(); - if (string.IsNullOrEmpty(text)) return true; - - // 音を発しないセリフを表す正規表現パターン - const string pattern = @"^[\.\!.!??]+$"; - return Regex.IsMatch(text, pattern); - } - - - private static async UniTask GetVoiceClip(string characterName, string text, int index, - CancellationToken token) - { - var audioResponse = await CharacterVoice(characterName, text, token); - var audioClip = audioResponse.voiceResult.audioClip; - if (audioClip == null) return null; - if (audioClip != null && !audioClip.LoadAudioData()) - { - Debug.Log("Failed to load audio data."); - return null; - } - - var savePath = Path.Combine(Application.dataPath, _voiceFolderPath, $"{index}.wav"); - await AudioFileUtility.Save(audioResponse.voiceResult.audioBase64, savePath, token); - AssetDatabase.ImportAsset(Path.Combine("Assets", _voiceFolderPath, $"{index}.wav")); - AssetDatabase.Refresh(); - return AssetDatabase.LoadAssetAtPath(Path.Combine("Assets", _voiceFolderPath, $"{index}.wav")); - } - - private static VoiceParam GetCharacterVoiceParam(string characterName, string text) - { - switch (characterName) - { - case "主人公": - return CharacterVoiceSetting.Character1(text); - default: - throw new ArgumentOutOfRangeException(nameof(characterName), characterName, null); - } - } - - private static async UniTask CharacterVoice(string characterName, string text, - CancellationToken token) - { - var response = new CreateVoiceResponse - { - voiceParam = GetCharacterVoiceParam(characterName, text) - }; - response.voiceResult = await Koeiromap.GetVoice(response.voiceParam, token); - return response; - } - } - - [Serializable] - public class CreateVoiceResponse - { - public VoiceResult voiceResult; - public VoiceParam voiceParam; - } - - [Serializable] - public class CreatedVoiceData - { - public int voiceIndex; - public string text; - public string characterName; - public VoiceParam voiceParam; - } -} \ No newline at end of file diff --git a/Assets/EasyADV/Scripts/Editor/UpdateVoice.cs.meta b/Assets/EasyADV/Scripts/Editor/UpdateVoice.cs.meta deleted file mode 100644 index 540f8b0..0000000 --- a/Assets/EasyADV/Scripts/Editor/UpdateVoice.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: b46295463c5a4ed08b7dde35646730be -timeCreated: 1679412368 \ No newline at end of file diff --git a/Assets/EasyADV/Scripts/UpdateScenarioFromGoogleSheet.cs b/Assets/EasyADV/Scripts/UpdateScenarioFromGoogleSheet.cs index 3b855bb..17a5439 100644 --- a/Assets/EasyADV/Scripts/UpdateScenarioFromGoogleSheet.cs +++ b/Assets/EasyADV/Scripts/UpdateScenarioFromGoogleSheet.cs @@ -2,13 +2,10 @@ namespace EasyADV.Scripts { + /// + /// Googleスプレッドシートからシナリオを更新するためのクラス + /// public class UpdateScenarioFromGoogleSheet : MonoBehaviour { - [SerializeField] private string characterImageFolderPath; - [SerializeField] private string backgroundImageFolderPath; - [SerializeField] private string bgmFolderPath; - [SerializeField] private bool isUpdateVoice; - [SerializeField] private int voiceStartIndex; - [SerializeField] private string voiceFolderPath; } } \ No newline at end of file diff --git a/Assets/EasyADV/Sound.meta b/Assets/EasyADV/Sound.meta new file mode 100644 index 0000000..3f4b166 --- /dev/null +++ b/Assets/EasyADV/Sound.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3fbd1d9504a54775bebfb54d0ca20379 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EasyADV/Sound/.gitkeep b/Assets/EasyADV/Sound/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Assets/EasyADV/Scripts/package.json b/Assets/EasyADV/package.json similarity index 85% rename from Assets/EasyADV/Scripts/package.json rename to Assets/EasyADV/package.json index a50ce8c..8da0a73 100644 --- a/Assets/EasyADV/Scripts/package.json +++ b/Assets/EasyADV/package.json @@ -1,8 +1,8 @@ { "name": "com.midralab.easy-adv", "displayName": "Easy ADV", - "version": "0.0.1", - "unity": "2022.2", + "version": "0.0.3", + "unity": "2022.3", "description": "Library for easier ADV production using Fungus and Google Sheet", "keywords": [ diff --git a/Assets/EasyADV/Scripts/package.json.meta b/Assets/EasyADV/package.json.meta similarity index 100% rename from Assets/EasyADV/Scripts/package.json.meta rename to Assets/EasyADV/package.json.meta diff --git a/Assets/Editor/PackageExporter.cs b/Assets/Editor/PackageExporter.cs index e56f97c..92ec546 100644 --- a/Assets/Editor/PackageExporter.cs +++ b/Assets/Editor/PackageExporter.cs @@ -3,6 +3,9 @@ using UnityEditor; using UnityEngine; +/// +/// パッケージの書き出しを行うクラス +/// public static class PackageExporter { private const string RootDirectory = "Assets/EasyADV"; @@ -12,7 +15,7 @@ public static class PackageExporter /// パッケージの書き出し(エディタ上でのテスト用) /// メニュー 「Tools > Export Unitypackage Test」をクリックで実行 /// - [MenuItem("Tools/Export Unitypackage Test")] + [MenuItem("Tools/EasyADV/Export Unitypackage")] public static void ExportTestOnEditor() { var exportPath = EditorUtility.SaveFilePanel @@ -35,6 +38,11 @@ public static void Export() CreatePackage(RootDirectory, $"build/{FileName}.unitypackage"); } + /// + /// パッケージの書き出し + /// + /// + /// private static void CreatePackage(string rootDirectory, string exportPath) { SafeCreateDirectory(exportPath); @@ -51,6 +59,11 @@ private static DirectoryInfo SafeCreateDirectory(string path) return Directory.CreateDirectory(diParent.FullName); } + /// + /// 指定したディレクトリ以下の全てのファイルのパスを取得する + /// + /// + /// private static string[] GetAllAssetsAtPath(string root) { return Directory.GetFiles(root, "*", SearchOption.AllDirectories) diff --git a/Docs/apps_script.png b/Docs/apps_script.png new file mode 100644 index 0000000..5c2b73b Binary files /dev/null and b/Docs/apps_script.png differ diff --git a/Docs/copy_files.png b/Docs/copy_files.png new file mode 100644 index 0000000..6a0f3b9 Binary files /dev/null and b/Docs/copy_files.png differ diff --git a/Docs/inspector.png b/Docs/inspector.png new file mode 100644 index 0000000..2b1f498 Binary files /dev/null and b/Docs/inspector.png differ diff --git a/Packages/manifest.json b/Packages/manifest.json index 12e6848..5d12aa2 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -4,20 +4,19 @@ "com.dbrizov.naughtyattributes": "2.1.4", "com.needle.compilation-visualizer": "1.8.3", "com.neuecc.unirx": "7.1.0", - "com.unity.collab-proxy": "2.0.0", - "com.unity.feature.2d": "1.0.0", - "com.unity.ide.rider": "3.0.18", - "com.unity.ide.visualstudio": "2.0.17", - "com.unity.inputsystem": "1.4.4", - "com.unity.recorder": "4.0.0", + "com.unity.collab-proxy": "2.0.5", + "com.unity.feature.2d": "2.0.0", + "com.unity.ide.rider": "3.0.24", + "com.unity.ide.visualstudio": "2.0.18", + "com.unity.inputsystem": "1.6.1", + "com.unity.recorder": "4.0.1", "com.unity.test-framework": "1.1.33", "com.unity.textmeshpro": "3.0.6", - "com.unity.timeline": "1.7.2", + "com.unity.timeline": "1.7.4", "com.unity.ugui": "1.0.0", "com.unity.visualscripting": "1.8.0", "jp.amagamina.overwriter": "https://github.com/ina-amagami/unity-overwriter.git", "jp.ayutaz.simplefoldericon": "1.3.3", - "jp.ayutaz.koeiromap-unity": "https://github.com/ayutaz/koeiromap-unity.git?path=Assets/KoeiromapUnity/Scripts", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 2f6203b..7c68804 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -29,7 +29,7 @@ "url": "https://package.openupm.com" }, "com.unity.2d.animation": { - "version": "9.0.1", + "version": "9.0.3", "depth": 1, "source": "registry", "dependencies": { @@ -41,6 +41,18 @@ }, "url": "https://packages.unity.com" }, + "com.unity.2d.aseprite": { + "version": "1.0.0", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.2d.sprite": "1.0.0", + "com.unity.2d.common": "6.0.6", + "com.unity.mathematics": "1.2.6", + "com.unity.modules.animation": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.2d.common": { "version": "8.0.1", "depth": 2, @@ -79,7 +91,7 @@ "dependencies": {} }, "com.unity.2d.spriteshape": { - "version": "9.0.1", + "version": "9.0.2", "depth": 1, "source": "registry", "dependencies": { @@ -99,7 +111,7 @@ } }, "com.unity.2d.tilemap.extras": { - "version": "3.0.3", + "version": "3.1.0", "depth": 1, "source": "registry", "dependencies": { @@ -111,7 +123,7 @@ "url": "https://packages.unity.com" }, "com.unity.burst": { - "version": "1.8.2", + "version": "1.8.7", "depth": 3, "source": "registry", "dependencies": { @@ -120,7 +132,7 @@ "url": "https://packages.unity.com" }, "com.unity.collab-proxy": { - "version": "2.0.0", + "version": "2.0.5", "depth": 0, "source": "registry", "dependencies": {}, @@ -144,21 +156,22 @@ "url": "https://packages.unity.com" }, "com.unity.feature.2d": { - "version": "1.0.0", + "version": "2.0.0", "depth": 0, "source": "builtin", "dependencies": { - "com.unity.2d.animation": "9.0.1", + "com.unity.2d.animation": "9.0.3", "com.unity.2d.pixel-perfect": "5.0.3", "com.unity.2d.psdimporter": "8.0.2", "com.unity.2d.sprite": "1.0.0", - "com.unity.2d.spriteshape": "9.0.1", + "com.unity.2d.spriteshape": "9.0.2", "com.unity.2d.tilemap": "1.0.0", - "com.unity.2d.tilemap.extras": "3.0.3" + "com.unity.2d.tilemap.extras": "3.1.0", + "com.unity.2d.aseprite": "1.0.0" } }, "com.unity.ide.rider": { - "version": "3.0.18", + "version": "3.0.24", "depth": 0, "source": "registry", "dependencies": { @@ -167,7 +180,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.17", + "version": "2.0.18", "depth": 0, "source": "registry", "dependencies": { @@ -176,7 +189,7 @@ "url": "https://packages.unity.com" }, "com.unity.inputsystem": { - "version": "1.4.4", + "version": "1.6.1", "depth": 0, "source": "registry", "dependencies": { @@ -199,7 +212,7 @@ "url": "https://packages.unity.com" }, "com.unity.recorder": { - "version": "4.0.0", + "version": "4.0.1", "depth": 0, "source": "registry", "dependencies": { @@ -228,7 +241,7 @@ "url": "https://packages.unity.com" }, "com.unity.timeline": { - "version": "1.7.2", + "version": "1.7.4", "depth": 0, "source": "registry", "dependencies": { @@ -265,15 +278,6 @@ "dependencies": {}, "hash": "24c16816637242c4aad552ffed8d4fafd283fbec" }, - "jp.ayutaz.koeiromap-unity": { - "version": "https://github.com/ayutaz/koeiromap-unity.git?path=Assets/KoeiromapUnity/Scripts", - "depth": 0, - "source": "git", - "dependencies": { - "com.cysharp.unitask": "2.3.3" - }, - "hash": "ba10114a43a5d5450f801c7a35f01c13cb26ef19" - }, "jp.ayutaz.simplefoldericon": { "version": "1.3.3", "depth": 0, diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index b2f0d29..e7e2f19 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2022.2.5f1 -m_EditorVersionWithRevision: 2022.2.5f1 (551d45108343) +m_EditorVersion: 2022.3.4f1 +m_EditorVersionWithRevision: 2022.3.4f1 (35713cd46cd7) diff --git a/README.md b/README.md index d7cdf21..62404ad 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,53 @@ Unityで ADVを作成する際に Fungusを使ってより簡単に作成できるようにするためのライブラリです。 -# requirements -* Unity 2022.2.5f1 +# 使い方 +## シナリオ環境 +1. [GoogleSheet](https://docs.google.com/spreadsheets/d/1k2AGDMgL6sLlIwmGZ5oQH2knIRoIAUhfyIYyVp93Nh0/edit?usp=share_link) + をコピーする +2. 以下のように3つのフォルダを作成する + +- `sounds` +- `characterImage` +- `backgroundImage` + +![img.png](Docs/copy_files.png) + +3. フォルダのIDを取得して、GoogleSheetのApps Scriptの`AutoUpdatePulldown.gs` の変数を作成したフォルダIDに変更する + +```js +const characterImageFolder = "1JbdOEpA5ES2Rq9OqeNr2X98HyHu8ZTTg" +const backgroundImageFolder = "1TeW1IFjPKufBB9b-a9-BTDtJU9PSXIMe" +const soundFolder = "1pXyls5L5T_uWcw4lJyOtoCtXtm-8GynC" +``` + +![](Docs/apps_script.png) + +4. Apps Scriptをデプロイして、ウェブアプリURLを取得する + +## Unity環境 + +1. [EasyADV.unitypackage](https://github.com/MidraLab/easy-adv/releases)をダウンロードする +2. [Fungus.unitypackage](https://github.com/MidraLab/fungus/releases)をダウンロードする +3. Unityプロジェクトに1,2,[UniTask](https://github.com/Cysharp/UniTask)を追加する +4. `Tools/EasyADV/Setup`を実行して、開発環境をセットアップする。 +5. 以下のフォルダに画像、音声を配置する + - `Asset/EasyADV/CharacterImage` + - `Asset/EasyADV/BackgroundImage` + - `Asset/EasyADV/Sound` + +6`ScenarioSheetData.cs`の以下の変数を設定する + +```cs +public static class ScenarioSheetData +{ + public const string SheetURL = + "SheetURL"; + + public const string MainSheet = "シート名"; +} +``` + +7Google Sheetにシナリオを記載後、`UpdateScenarioFromGoogleSheet`の`Update`ボタンを押す \ No newline at end of file