-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to load custom scripts generated by the script tool
- Loading branch information
Showing
177 changed files
with
21,451 additions
and
3,596 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,6 +271,18 @@ | |
<Reference Include="SyntaxTree.VisualStudio.Unity.Bridge"> | ||
<HintPath>C:/Program Files (x86)/Microsoft Visual Studio Tools for Unity/15.0/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll</HintPath> | ||
</Reference> | ||
<Reference Include="DotNetZip"> | ||
<HintPath>C:/Projects/Grimoire/Assets/NuGet/Editor/DotNetZip.dll</HintPath> | ||
</Reference> | ||
<Reference Include="NugetForUnity"> | ||
<HintPath>C:/Projects/Grimoire/Assets/NuGet/Editor/NugetForUnity.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Ookii.Dialogs"> | ||
<HintPath>C:/Projects/Grimoire/Assets/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Windows.Forms"> | ||
<HintPath>C:/Projects/Grimoire/Assets/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor.Advertisements"> | ||
<HintPath>C:/Projects/Grimoire/Library/PackageCache/[email protected]/Editor/UnityEditor.Advertisements.dll</HintPath> | ||
</Reference> | ||
|
@@ -286,6 +298,9 @@ | |
<Reference Include="UnityEditor.Purchasing"> | ||
<HintPath>C:/Projects/Grimoire/Library/PackageCache/[email protected]/Editor/UnityEditor.Purchasing.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json"> | ||
<HintPath>C:/Projects/Grimoire/Assets/Packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll</HintPath> | ||
</Reference> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>C:/Projects/Grimoire/Library/PackageCache/[email protected]/net35/unity-custom/nunit.framework.dll</HintPath> | ||
</Reference> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>Temp\bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;UNITY_2019_3_15;UNITY_2019_3;UNITY_2019;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;UNITY_ANALYTICS;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;INCLUDE_DYNAMIC_GI;ENABLE_MONO_BDWGC;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;PLATFORM_STANDALONE;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_STANDARD_2_0;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_VSTU;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants> | ||
<DefineConstants>DEBUG;TRACE;UNITY_2019_3_15;UNITY_2019_3;UNITY_2019;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;UNITY_ANALYTICS;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;INCLUDE_DYNAMIC_GI;ENABLE_MONO_BDWGC;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;PLATFORM_STANDALONE;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_VSTU;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<NoWarn>0169</NoWarn> | ||
|
@@ -63,6 +63,7 @@ | |
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Assets\AlignmentToken.cs" /> | ||
<Compile Include="Assets\CustomScriptReader.cs" /> | ||
<Compile Include="Assets\GrimoireManager.cs" /> | ||
<Compile Include="Assets\GrimoireShuffle.cs" /> | ||
<Compile Include="Assets\GrimoireToken.cs" /> | ||
|
@@ -92,6 +93,12 @@ | |
<Compile Include="Assets\RoleData.cs" /> | ||
<Compile Include="Assets\RoleEntry.cs" /> | ||
<Compile Include="Assets\RoleSelectionManager.cs" /> | ||
<Compile Include="Assets\StandaloneFileBrowser\IStandaloneFileBrowser.cs" /> | ||
<Compile Include="Assets\StandaloneFileBrowser\StandaloneFileBrowser.cs" /> | ||
<Compile Include="Assets\StandaloneFileBrowser\StandaloneFileBrowserEditor.cs" /> | ||
<Compile Include="Assets\StandaloneFileBrowser\StandaloneFileBrowserLinux.cs" /> | ||
<Compile Include="Assets\StandaloneFileBrowser\StandaloneFileBrowserMac.cs" /> | ||
<Compile Include="Assets\StandaloneFileBrowser\StandaloneFileBrowserWindows.cs" /> | ||
<Compile Include="Assets\StepManager.cs" /> | ||
<Compile Include="Assets\SwapEntry.cs" /> | ||
<Compile Include="Assets\SwapRolePanel.cs" /> | ||
|
@@ -108,6 +115,7 @@ | |
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMPro_Properties.cginc" /> | ||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMPro_Surface.cginc" /> | ||
<None Include="Assets\TextMesh Pro\Resources\LineBreaking Following Characters.txt" /> | ||
<None Include="Assets\Packages\Newtonsoft.Json.12.0.3\lib\netstandard2.0\Newtonsoft.Json.xml" /> | ||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_SDF-Mobile Masking.shader" /> | ||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_SDF Overlay.shader" /> | ||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_Bitmap-Mobile.shader" /> | ||
|
@@ -297,6 +305,12 @@ | |
<Reference Include="UnityEditor"> | ||
<HintPath>C:/Program Files/Unity/Hub/Editor/2019.3.15f1/Editor/Data/Managed/UnityEditor.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Ookii.Dialogs"> | ||
<HintPath>C:/Projects/Grimoire/Assets/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Windows.Forms"> | ||
<HintPath>C:/Projects/Grimoire/Assets/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Unity.Analytics.Editor"> | ||
<HintPath>C:/Projects/Grimoire/Library/PackageCache/[email protected]/Unity.Analytics.Editor.dll</HintPath> | ||
</Reference> | ||
|
@@ -306,6 +320,9 @@ | |
<Reference Include="Unity.Analytics.StandardEvents"> | ||
<HintPath>C:/Projects/Grimoire/Library/PackageCache/[email protected]/AnalyticsStandardEvents/Unity.Analytics.StandardEvents.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json"> | ||
<HintPath>C:/Projects/Grimoire/Assets/Packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll</HintPath> | ||
</Reference> | ||
<Reference Include="mscorlib"> | ||
<HintPath>C:/Program Files/Unity/Hub/Editor/2019.3.15f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath> | ||
</Reference> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using Newtonsoft.Json; | ||
using SFB; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.Networking; | ||
|
||
public class CustomScriptReader : MonoBehaviour | ||
{ | ||
public RoleSelectionManager RoleSelectionManager; | ||
|
||
public void OpenCustomScript() | ||
{ | ||
var paths = StandaloneFileBrowser.OpenFilePanel("Title", "", "json", false); | ||
if (paths.Length > 0) | ||
{ | ||
StartCoroutine(OutputRoutine(new System.Uri(paths[0]).AbsoluteUri)); | ||
} | ||
} | ||
|
||
private IEnumerator OutputRoutine(string url) | ||
{ | ||
var loader = new UnityWebRequest(url); | ||
loader.downloadHandler = new DownloadHandlerBuffer(); | ||
yield return loader.SendWebRequest(); | ||
|
||
ParseCustomScript(loader.downloadHandler.text); | ||
} | ||
|
||
[System.Serializable] | ||
class IdWrapper | ||
{ | ||
public string id { get; set; } | ||
} | ||
|
||
void ParseCustomScript(string json) | ||
{ | ||
RoleSelectionManager.CustomScriptData.Clear(); | ||
|
||
List<string> missingIds = new List<string>(); | ||
var idList = JsonConvert.DeserializeObject<List<IdWrapper>>(json); | ||
foreach (var id in idList) | ||
{ | ||
RoleData roleData = Array.Find(RoleSelectionManager.RoleDataList, x => x.ScriptToolId == id.id); | ||
if(roleData == null) | ||
{ | ||
missingIds.Add(id.id); | ||
continue; | ||
} | ||
|
||
RoleSelectionManager.CustomScriptData.Add(roleData); | ||
} | ||
|
||
RoleSelectionManager.OnCustomScriptLoaded(); | ||
|
||
if (missingIds.Count > 0) | ||
{ | ||
string errorMessage = "Failed to parse the following roles from the .json file:\n"; | ||
errorMessage += string.Join(", ", missingIds); | ||
ModalManager.Instance().MessageBox(errorMessage, null, null, null, null, "Ok"); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.