Skip to content

Commit

Permalink
feat: rename webgl example
Browse files Browse the repository at this point in the history
  • Loading branch information
rYuuk committed Oct 25, 2023
1 parent b701db4 commit a0dbfd7
Show file tree
Hide file tree
Showing 78 changed files with 35 additions and 26 deletions.
8 changes: 8 additions & 0 deletions Samples~/QuickStart.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
using System.Collections.Generic;
using System.IO;
using JetBrains.Annotations;
using ReadyPlayerMe.Core;
using ReadyPlayerMe.Samples;
using UnityEditor;
using UnityEngine;

namespace ReadyPlayerMe.Samples
{
public static class ExampleSetup
public static class SampleSetup
{
private const string TAG = nameof(ExampleSetup);
private static string WINDOW_TITLE = "RPM WebGL Example";
private static string DESCRIPTION =
"This example includes a WebGL template that can be used for WebGL builds. To use the template it needs to be moved inside WebGLTemplates folder and set in the player settings. Would you like to move it automatically?";
private const string TAG = nameof(SampleSetup);
private const string WINDOW_TITLE = "RPM WebGL Sample";
private const string DESCRIPTION =
"This sample includes a WebGL template that can be used for WebGL builds. To use the template it needs to be moved inside WebGLTemplates folder and set in the player settings. Would you like to move it automatically?";
private const string CONFIRM_BUTTON_TEXT = "Ok";
private const string CANCEL_BUTTON_TEXT = "Cancel";

private static readonly string RPM_WEBGL_SCREEN_SHOWN_KEY = "rpm-webgl-screen-shown";

private static readonly string TEMPLATE_PATH = "/WebGLTemplates/RPMTemplate";
private static readonly string FILE_NAME = "ExampleSetup.cs";
private static readonly string ROOT_PATH = "/Assets";
private const string RPM_WEBGL_SCREEN_SHOWN_KEY = "rpm-webgl-screen-shown";
private const string TEMPLATE_PATH = "/WebGLTemplates/RPMTemplate";
private const string FILE_NAME = "SampleSetup.cs";
private const string ROOT_PATH = "/Assets";

[InitializeOnLoadMethod]
private static void InitializeOnLoad()
Expand Down Expand Up @@ -68,12 +65,12 @@ private static void OnConfirm()

private static List<string> GetTemplatePaths()
{
string[] res = Directory.GetFiles(Application.dataPath, FILE_NAME, SearchOption.AllDirectories);
var res = Directory.GetFiles(Application.dataPath, FILE_NAME, SearchOption.AllDirectories);
if (res.Length == 0)
{
return null;
}
string path = res[0].Replace(FILE_NAME, "").Replace("\\", "/");
var path = res[0].Replace(FILE_NAME, "").Replace("\\", "/");
var sourcePath = path.Substring(0, path.IndexOf("/Editor/")) + TEMPLATE_PATH;
var destinationPath = path.Substring(0, path.IndexOf(ROOT_PATH)) + ROOT_PATH;
return new List<string>() { sourcePath, destinationPath };
Expand All @@ -92,7 +89,7 @@ private static void Copy(string sourcePath, string destinationPath)

if (File.Exists(sourceFilePath))
{
string destination = destinationPath + sourceFilePath.Substring(sourceFilePath.IndexOf(TEMPLATE_PATH)).Replace("\\", "/");
var destination = destinationPath + sourceFilePath.Substring(sourceFilePath.IndexOf(TEMPLATE_PATH)).Replace("\\", "/");

if (!Directory.Exists(destination.Substring(0, destination.LastIndexOf("/"))))
{
Expand All @@ -106,15 +103,16 @@ private static void Copy(string sourcePath, string destinationPath)
Debug.LogError("Source file does not exist: " + sourceFilePath);
}
}
Debug.Log("Copied RPMTemplate to the WebGLTemplate folder in the root path of Assets");

SDKLogger.Log(TAG, "Copied RPMTemplate to the WebGLTemplate folder in the root path of Assets");
AssetDatabase.Refresh();
}


private static void SetWebGLTemplate()
{
PlayerSettings.WebGL.template = "PROJECT:RPMTemplate";
Debug.Log("Updated player settings to use RPMTemplate");
SDKLogger.Log(TAG, "Updated player settings to use RPMTemplate");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "ReadyPlayerMe.Core.WebGLExample.Editor",
"name": "ReadyPlayerMe.Core.WebGLSample.Editor",
"rootNamespace": "",
"references": ["GUID:36f486ff968bbf4439cd840e8fca87ea"],
"references": [
"ReadyPlayerMe.Core",
"ReadyPlayerMe.Core.Editor"
],
"includePlatforms": [
"Editor"
],
Expand All @@ -13,4 +16,4 @@
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "ReadyPlayerMe.Core.WebGLExample",
"name": "ReadyPlayerMe.Core.WebGLSample",
"rootNamespace": "",
"references": [
"GUID:96af4ea235d92d245a095007c6ca3701",
"GUID:292600d1b44837d4b8ce752a20ebe446"
"ReadyPlayerMe.Core",
"ReadyPlayerMe.WebView"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -14,4 +14,4 @@
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
"path": "Samples~/MultipleAvatarRender"
},
{
"displayName": "WebGLExample",
"displayName": "WebGLSample",
"description": "This sample includes a WebGL template and demonstrates how run the Ready Player Me Web avatar creator inside an iFrame for WebGL applications.",
"path": "Samples~/WebGLExample"
"path": "Samples~/WebGLSample"
},
{
"displayName": "AvatarCreatorSamples",
Expand Down

0 comments on commit a0dbfd7

Please sign in to comment.