Skip to content

Commit

Permalink
Unity project
Browse files Browse the repository at this point in the history
  • Loading branch information
howardhuanghtc committed Jan 29, 2024
1 parent 90e3429 commit a8f1735
Show file tree
Hide file tree
Showing 110 changed files with 13,750 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Assets/Installer.meta

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

173 changes: 173 additions & 0 deletions Assets/Installer/VIVEOpenXRInstaller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#if UNITY_EDITOR
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using UnityEditor;
using UnityEditor.PackageManager;
using UnityEngine;
using UnityEngine.UI;

[InitializeOnLoad]
public class VIVEOpenXRInstaller : MonoBehaviour
{
[MenuItem("VIVE/OpenXR Android Installer/Install or Update latest version")]
private static void AddGITPackages()
{
AddPackage("https://github.com/ViveSoftware/VIVE-OpenXR-AIO.git?path=com.htc.upm.wave.openxr");
AddPackage("https://github.com/ViveSoftware/VIVE-OpenXR-AIO.git?path=com.htc.upm.wave.openxr.toolkit");
AddPackage("https://github.com/ViveSoftware/VIVE-OpenXR-AIO.git?path=com.htc.upm.wave.openxr.toolkit.samples");
}

public InputField betInput;
public static string inputString = "";

[MenuItem("VIVE/OpenXR Android Installer/Install specific version")]
private static void AddGITPackagesByVersion()
{
var version = EditorInputDialog.Show("Question", "Please enter the version", "");
if (!string.IsNullOrEmpty(version))
{
Debug.Log("Hello " + version);

AddPackage("https://github.com/ViveSoftware/VIVE-OpenXR-AIO.git?path=com.htc.upm.wave.openxr#versions/" + version);
AddPackage("https://github.com/ViveSoftware/VIVE-OpenXR-AIO.git?path=com.htc.upm.wave.openxr.toolkit#versions/" + version);
AddPackage("https://github.com/ViveSoftware/VIVE-OpenXR-AIO.git?path=com.htc.upm.wave.openxr.toolkit.samples#versions/" + version);
}
}

public class EditorInputDialog : EditorWindow
{
string description, inputText;
string okButton, cancelButton;
bool initializedPosition = false;
Action onOKButton;

bool shouldClose = false;

#region OnGUI()
void OnGUI()
{
// Check if Esc/Return have been pressed
var e = Event.current;
if (e.type == EventType.KeyDown)
{
switch (e.keyCode)
{
// Escape pressed
case KeyCode.Escape:
shouldClose = true;
break;

// Enter pressed
case KeyCode.Return:
case KeyCode.KeypadEnter:
onOKButton?.Invoke();
shouldClose = true;
break;
}
}

if (shouldClose)
{ // Close this dialog
Close();
//return;
}

// Draw our control
var rect = EditorGUILayout.BeginVertical();

EditorGUILayout.Space(12);
EditorGUILayout.LabelField(description);

EditorGUILayout.Space(8);
GUI.SetNextControlName("inText");
inputText = EditorGUILayout.TextField("", inputText);
GUI.FocusControl("inText"); // Focus text field
EditorGUILayout.Space(12);

// Draw OK / Cancel buttons
var r = EditorGUILayout.GetControlRect();
r.width /= 2;
if (GUI.Button(r, okButton))
{
onOKButton?.Invoke();
shouldClose = true;
}

r.x += r.width;
if (GUI.Button(r, cancelButton))
{
inputText = null; // Cancel - delete inputText
shouldClose = true;
}

EditorGUILayout.Space(8);
EditorGUILayout.EndVertical();

// Force change size of the window
if (rect.width != 0 && minSize != rect.size)
{
minSize = maxSize = rect.size;
}

// Set dialog position next to mouse position
if (!initializedPosition)
{
var mousePos = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
position = new Rect(mousePos.x + 32, mousePos.y, position.width, position.height);
initializedPosition = true;
}
}
#endregion OnGUI()

#region Show()
/// <summary>
/// Returns text player entered, or null if player cancelled the dialog.
/// </summary>
/// <param name="title"></param>
/// <param name="description"></param>
/// <param name="inputText"></param>
/// <param name="okButton"></param>
/// <param name="cancelButton"></param>
/// <returns></returns>
public static string Show(string title, string description, string inputText, string okButton = "OK", string cancelButton = "Cancel")
{
string ret = null;
//var window = EditorWindow.GetWindow<InputDialog>();
var window = CreateInstance<EditorInputDialog>();
window.titleContent = new GUIContent(title);
window.description = description;
window.inputText = inputText;
window.okButton = okButton;
window.cancelButton = cancelButton;
window.onOKButton += () => ret = window.inputText;
window.ShowModal();

return ret;
}
#endregion Show()
}

static bool AddPackage(string packageFolder)
{
Debug.Log("Processing package folder: " + packageFolder);

var addRequest = Client.Add(packageFolder);
while (!addRequest.IsCompleted)
{
Thread.Sleep(100);
}
try
{
Debug.Log("Has Error?" + addRequest.Error == null ? "No" : addRequest.Error.message);
Debug.Log("Has Status?" + addRequest.Status);
Debug.Log("Has Result?" + addRequest.Result);
return addRequest.Error == null;
}
catch (Exception) { }
return true;
}
}
#endif
11 changes: 11 additions & 0 deletions Assets/Installer/VIVEOpenXRInstaller.cs.meta

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

34 changes: 34 additions & 0 deletions Assets/Readme.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fcf7219bab7fe46a1ad266029b2fee19, type: 3}
m_Name: Readme
m_EditorClassIdentifier:
icon: {fileID: 2800000, guid: 727a75301c3d24613a3ebcec4a24c2c8, type: 3}
title: URP Empty Template
sections:
- heading: Welcome to the Universal Render Pipeline
text: This template includes the settings and assets you need to start creating with the Universal Render Pipeline.
linkText:
url:
- heading: URP Documentation
text:
linkText: Read more about URP
url: https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest
- heading: Forums
text:
linkText: Get answers and support
url: https://forum.unity.com/forums/universal-render-pipeline.383/
- heading: Report bugs
text:
linkText: Submit a report
url: https://unity3d.com/unity/qa/bug-reporting
loadedLayout: 1
8 changes: 8 additions & 0 deletions Assets/Readme.asset.meta

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

8 changes: 8 additions & 0 deletions Assets/Samples.meta

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

8 changes: 8 additions & 0 deletions Assets/Samples/NVIDIA CloudXR Client for Unity.meta

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

8 changes: 8 additions & 0 deletions Assets/Samples/NVIDIA CloudXR Client for Unity/0.0.4.meta

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

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

Loading

0 comments on commit a8f1735

Please sign in to comment.