-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v0.9.0' into 'main'
chore: Merge release v0.9.0 into main See merge request elympics/unity-sdk-package!220
- Loading branch information
Showing
194 changed files
with
5,645 additions
and
599 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,43 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
function usage() { | ||
console.log("Usage: node bump_package.js ./path/to/package.json ./path/to/Runtime/AssemblyInfo.cs [version]") | ||
console.log("[version] must be in format X.Y.Z") | ||
console.log("Usage: node bump_package.js ./path/to/package.json ./path/to/Runtime/AssemblyInfo.cs [version]"); | ||
console.log("[version] must be in format X.Y.Z"); | ||
} | ||
|
||
function isCorrectVersion(string) { | ||
return /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(string) | ||
return /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(string); | ||
} | ||
|
||
async function main() { | ||
args = process.argv.slice(2); | ||
if (args.length != 3 || !isCorrectVersion(args[2])) { | ||
version = args[0]; | ||
packagePath = args[1]; | ||
assemblyPaths = args.slice(2); | ||
|
||
if (args.length < 3 || !isCorrectVersion(version)) { | ||
usage(); | ||
process.exit(1); | ||
} | ||
|
||
packagePath = args[0] | ||
assemblyPath = args[1] | ||
version = args[2] | ||
|
||
let packageFileName = path.resolve(__dirname, packagePath) | ||
let packageJson = JSON.parse(fs.readFileSync(packageFileName)) | ||
packageJson.version = version | ||
fs.writeFileSync(packageFileName, JSON.stringify(packageJson, null, 2)) | ||
console.log(`Updated package version to ${version}`) | ||
const packageFileName = path.resolve(__dirname, packagePath); | ||
const packageJson = JSON.parse(fs.readFileSync(packageFileName)); | ||
packageJson.version = version; | ||
fs.writeFileSync(packageFileName, JSON.stringify(packageJson, null, 2)); | ||
console.log(`Updated package version to ${version}`); | ||
|
||
let assemblyFileName = path.resolve(__dirname, assemblyPath) | ||
let assemblyFile = fs.readFileSync(assemblyFileName).toString(); | ||
assemblyFile = assemblyFile.replace(/(AssemblyVersion\(\").*(\.[0-9]+\"\))/, `$1${version}$2`) | ||
fs.writeFileSync(assemblyFileName, assemblyFile) | ||
console.log(`Updated Assembly version to ${version}`) | ||
assemblyPaths.forEach(assemblyPath => { | ||
const assemblyFileName = path.resolve(__dirname, assemblyPath); | ||
const assemblyFile = fs.readFileSync(assemblyFileName) | ||
.toString() | ||
.replace(/(AssemblyVersion\(\").*(\.[0-9]+\"\))/, `$1${version}$2`); | ||
fs.writeFileSync(assemblyFileName, assemblyFile); | ||
console.log(`Updated ${assemblyFileName} Assembly version to ${version}`); | ||
}); | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error) | ||
process.exitCode = 1 | ||
}) | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
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
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 |
---|---|---|
@@ -1,22 +1,58 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.SceneManagement; | ||
|
||
namespace Elympics | ||
{ | ||
public static class ElympicsMouseActions | ||
{ | ||
private const string PathToElympicsSystem = "Elympics"; | ||
private const string PathToElympicsLobby = "ElympicsLobby"; | ||
|
||
[MenuItem(ElympicsEditorMenuPaths.MOUSE_ACTION_CREATE_ELYMPICS_SYSTEM, priority = 11)] | ||
[MenuItem(ElympicsEditorMenuPaths.MOUSE_ACTION_CREATE_ELYMPICS_SYSTEM)] | ||
private static void AddElympicsSystemToScene() | ||
{ | ||
var elympicsSystemPrefabReference = Resources.Load<GameObject>(PathToElympicsSystem); | ||
const string name = "Elympics System"; | ||
if (HasActiveSceneAnyObjectOfType<ElympicsLobbyClient>()) | ||
{ | ||
Debug.LogError($"{name} cannot be placed in the menu scene. Use a separate game scene."); | ||
return; | ||
} | ||
AddUniquePrefabToScene<GameSceneManager>(PathToElympicsSystem, name); | ||
} | ||
|
||
[MenuItem(ElympicsEditorMenuPaths.MOUSE_ACTION_CREATE_ELYMPICS_LOBBY)] | ||
private static void AddElympicsLobbyToScene() | ||
{ | ||
const string name = "Elympics Lobby"; | ||
if (HasActiveSceneAnyObjectOfType<GameSceneManager>()) | ||
{ | ||
Debug.LogError($"{name} cannot be placed in the game scene. Use a separate menu scene."); | ||
return; | ||
} | ||
AddUniquePrefabToScene<ElympicsLobbyClient>(PathToElympicsLobby, name); | ||
} | ||
|
||
if (elympicsSystemPrefabReference != null) | ||
_ = PrefabUtility.InstantiatePrefab(elympicsSystemPrefabReference); | ||
else | ||
Debug.LogError("Cannot instantiate elympics system - prefab reference is null!"); | ||
private static void AddUniquePrefabToScene<T>(string path, string name) | ||
where T : Component | ||
{ | ||
if (HasActiveSceneAnyObjectOfType<T>()) | ||
{ | ||
Debug.LogError($"{name} is already present in the current scene."); | ||
return; | ||
} | ||
var prefabReference = Resources.Load<T>(path); | ||
if (prefabReference == null) | ||
{ | ||
Debug.LogError($"Cannot instantiate {name} - prefab reference is null!"); | ||
return; | ||
} | ||
var instance = PrefabUtility.InstantiatePrefab(prefabReference.gameObject); | ||
Undo.RegisterCreatedObjectUndo(instance, $"Instantiate {name}"); | ||
} | ||
|
||
private static bool HasActiveSceneAnyObjectOfType<T>() where T : Object => | ||
SceneObjectsFinder.FindObjectsOfType<T>(SceneManager.GetActiveScene(), true).Count > 0; | ||
} | ||
} | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[*] | ||
generated_code = true | ||
dotnet_analyzer_diagnostic.severity = none | ||
indent_style = unset | ||
end_of_line = unset | ||
charset = unset | ||
insert_final_newline = unset | ||
trim_trailing_whitespace = unset |
File renamed without changes.
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
33 changes: 33 additions & 0 deletions
33
Editor/Plugins/Mono.Cecil/Elympics.Mono.Cecil.Pdb.dll.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
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
Oops, something went wrong.