├── .gitignore ├── .gitmodules ├── .vscode ├── launch.json └── settings.json ├── Assets ├── Demos.meta ├── Demos │ ├── AssetBundle.meta │ ├── AssetBundle │ │ ├── AssetBundleDemo.cs │ │ ├── AssetBundleDemo.cs.meta │ │ ├── AssetBundleScene.unity │ │ ├── AssetBundleScene.unity.meta │ │ ├── DataModels.meta │ │ ├── DataModels │ │ │ ├── JSON.meta │ │ │ ├── JSON │ │ │ │ ├── Level.cs │ │ │ │ ├── Level.cs.meta │ │ │ │ ├── Prefab.cs │ │ │ │ ├── Prefab.cs.meta │ │ │ │ ├── Scene.cs │ │ │ │ └── Scene.cs.meta │ │ │ ├── XML.meta │ │ │ └── XML │ │ │ │ ├── SceneDoc.cs │ │ │ │ └── SceneDoc.cs.meta │ │ ├── ReferencedScripts.meta │ │ ├── ReferencedScripts │ │ │ ├── Spin.cs │ │ │ └── Spin.cs.meta │ │ ├── cloud.meta │ │ └── cloud │ │ │ ├── Materials.meta │ │ │ ├── Materials │ │ │ ├── azure.mat │ │ │ └── azure.mat.meta │ │ │ ├── Prefabs.meta │ │ │ ├── Prefabs │ │ │ ├── CloudCube.prefab │ │ │ └── CloudCube.prefab.meta │ │ │ ├── Sounds.meta │ │ │ ├── Sounds │ │ │ ├── Power_Up3.wav │ │ │ └── Power_Up3.wav.meta │ │ │ ├── Textures.meta │ │ │ └── Textures │ │ │ ├── cloud.jpg │ │ │ └── cloud.jpg.meta │ ├── Audio.meta │ ├── Audio │ │ ├── AudioDemo.cs │ │ ├── AudioDemo.cs.meta │ │ ├── AudioScene.unity │ │ └── AudioScene.unity.meta │ ├── Image.meta │ ├── Image │ │ ├── ImageDemo.cs │ │ ├── ImageDemo.cs.meta │ │ ├── ImageScene.unity │ │ └── ImageScene.unity.meta │ ├── List.meta │ ├── List │ │ ├── ListDemo.cs │ │ ├── ListDemo.cs.meta │ │ ├── ListScene.unity │ │ ├── ListScene.unity.meta │ │ ├── ListViewCell.cs │ │ ├── ListViewCell.cs.meta │ │ ├── ListViewPrefab.prefab │ │ └── ListViewPrefab.prefab.meta │ ├── Text.meta │ └── Text │ │ ├── TextDemo.cs │ │ ├── TextDemo.cs.meta │ │ ├── TextScene.unity │ │ └── TextScene.unity.meta ├── Dependencies.meta ├── Dependencies │ ├── RESTClient.meta │ ├── StorageServices.meta │ ├── TSTableView.meta │ └── TSTableView │ │ ├── ITableViewDataSource.cs │ │ ├── ITableViewDataSource.cs.meta │ │ ├── LICENSE │ │ ├── LICENSE.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── TableView.cs │ │ ├── TableView.cs.meta │ │ ├── TableViewCell.cs │ │ └── TableViewCell.cs.meta ├── Editor.meta ├── Editor │ ├── CreateAssetBundles.cs │ ├── CreateAssetBundles.cs.meta │ ├── PreserveCode.cs │ └── PreserveCode.cs.meta ├── Resources.meta ├── Resources │ ├── scene.json │ ├── scene.json.meta │ ├── sceneDoc.xml │ └── sceneDoc.xml.meta ├── Utilities.meta └── Utilities │ ├── Log.cs │ ├── Log.cs.meta │ ├── Screenshot.cs │ ├── Screenshot.cs.meta │ ├── WavUtility.cs │ └── WavUtility.cs.meta ├── LICENSE ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset ├── README.md └── UnityPackageManager └── manifest.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Unity 2 | [Ll]ibrary/ 3 | [Tt]emp/ 4 | [Oo]bj/ 5 | [Bb]uild/ 6 | 7 | # Windows 8 | UWP/ 9 | Assets/*.pfx 10 | 11 | # AssetBundles 12 | AssetBundles/ 13 | 14 | # Builds 15 | *.unitypackage 16 | 17 | # Android 18 | *.apk 19 | 20 | # Autogenerated VS/MD solution and project files 21 | *.csproj 22 | *.unityproj 23 | *.sln 24 | *.suo 25 | *.tmp 26 | *.user 27 | *.userprefs 28 | *.pidb 29 | *.booproj 30 | *.svd 31 | 32 | # Source control temp files 33 | *.orig 34 | 35 | # Unity3D generated meta files in directories 36 | *.pidb.meta 37 | 38 | # Unity3D Generated File On Crash Reports 39 | sysinfo.txt 40 | 41 | # OS generated 42 | .DS_Store 43 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | 2 | [submodule "Assets/Dependencies/RESTClient"] 3 | path = Assets/Dependencies/RESTClient 4 | url = https://github.com/Unity3dAzure/RESTClient.git 5 | [submodule "Assets/Dependencies/StorageServices"] 6 | path = Assets/Dependencies/StorageServices 7 | url = https://github.com/Unity3dAzure/StorageServices.git 8 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Unity Editor", 9 | "type": "unity", 10 | "request": "launch" 11 | }, 12 | { 13 | "name": "Windows Player", 14 | "type": "unity", 15 | "request": "launch" 16 | }, 17 | { 18 | "name": "OSX Player", 19 | "type": "unity", 20 | "request": "launch" 21 | }, 22 | { 23 | "name": "Linux Player", 24 | "type": "unity", 25 | "request": "launch" 26 | }, 27 | { 28 | "name": "iOS Player", 29 | "type": "unity", 30 | "request": "launch" 31 | }, 32 | { 33 | "name": "Android Player", 34 | "type": "unity", 35 | "request": "launch" 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.DS_Store": true, 4 | "**/.git": true, 5 | "**/.gitignore": true, 6 | "**/.gitmodules": true, 7 | "**/*.booproj": true, 8 | "**/*.pidb": true, 9 | "**/*.suo": true, 10 | "**/*.user": true, 11 | "**/*.userprefs": true, 12 | "**/*.unityproj": true, 13 | "**/*.dll": true, 14 | "**/*.exe": true, 15 | "**/*.pdf": true, 16 | "**/*.mid": true, 17 | "**/*.midi": true, 18 | "**/*.wav": true, 19 | "**/*.gif": true, 20 | "**/*.ico": true, 21 | "**/*.jpg": true, 22 | "**/*.jpeg": true, 23 | "**/*.png": true, 24 | "**/*.psd": true, 25 | "**/*.tga": true, 26 | "**/*.tif": true, 27 | "**/*.tiff": true, 28 | "**/*.3ds": true, 29 | "**/*.3DS": true, 30 | "**/*.fbx": true, 31 | "**/*.FBX": true, 32 | "**/*.lxo": true, 33 | "**/*.LXO": true, 34 | "**/*.ma": true, 35 | "**/*.MA": true, 36 | "**/*.obj": true, 37 | "**/*.OBJ": true, 38 | "**/*.asset": true, 39 | "**/*.cubemap": true, 40 | "**/*.flare": true, 41 | "**/*.mat": true, 42 | "**/*.meta": true, 43 | "**/*.prefab": true, 44 | "**/*.unity": true, 45 | "build/": true, 46 | "Build/": true, 47 | "Library/": true, 48 | "library/": true, 49 | "obj/": true, 50 | "Obj/": true, 51 | "ProjectSettings/": true, 52 | "temp/": true, 53 | "Temp/": true 54 | }, 55 | "editor.tabSize": 2, 56 | "editor.insertSpaces": true, 57 | "editor.detectIndentation": false, 58 | "editor.rulers": [140], 59 | "search.exclude": { 60 | "**/.git": true, 61 | "**/obj": true, 62 | "**/build": true, 63 | "**/*.csproj": true, 64 | "**/*.sln": true 65 | }, 66 | "editor.formatOnSave": true, 67 | "omnisharp.useMono": true 68 | } 69 | -------------------------------------------------------------------------------- /Assets/Demos.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e195755ff4af49fc86eed229d86bac1 3 | folderAsset: yes 4 | timeCreated: 1487944373 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d85839386d4fd4290b643842f6c9a709 3 | folderAsset: yes 4 | timeCreated: 1487947050 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/AssetBundleDemo.cs: -------------------------------------------------------------------------------- 1 | using RESTClient; 2 | using Azure.StorageServices; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using UnityEngine; 6 | using UnityEngine.UI; 7 | using UnityEngine.SceneManagement; 8 | using System; 9 | using System.IO; 10 | using UnityEngine.Networking; 11 | using System.Xml; 12 | 13 | public class AssetBundleDemo : MonoBehaviour 14 | { 15 | 16 | [Header("Azure Storage Service")] 17 | [SerializeField] 18 | private string storageAccount; 19 | [SerializeField] 20 | private string accessKey; 21 | [SerializeField] 22 | private string container; 23 | 24 | private StorageServiceClient client; 25 | private BlobService blobService; 26 | 27 | [Header("Asset Bundle Demo")] 28 | public Text label; 29 | public string assetBundleName = "cloud"; 30 | private AssetBundle assetBundle; 31 | private GameObject loadedObject; 32 | 33 | [Header("Audio")] 34 | public AudioSource audioSource; 35 | 36 | private string localPath; 37 | private string saveFileXML = "scene.xml"; 38 | private string saveFileJSON = "scene.json"; 39 | 40 | // Use this for initialization 41 | void Start() 42 | { 43 | if (string.IsNullOrEmpty(storageAccount) || string.IsNullOrEmpty(accessKey)) 44 | { 45 | Log.Text(label, "Storage account and access key are required", "Enter storage account and access key in Unity Editor", Log.Level.Error); 46 | } 47 | 48 | client = StorageServiceClient.Create(storageAccount, accessKey); 49 | blobService = client.GetBlobService(); 50 | } 51 | 52 | // Update is called once per frame 53 | void Update() 54 | { 55 | 56 | } 57 | 58 | void OnDestroy() 59 | { 60 | UnloadAssetBundle(); 61 | } 62 | 63 | private void UnloadAssetBundle() 64 | { 65 | if (assetBundle != null) 66 | { 67 | RemovePrefabs(); 68 | loadedObject = null; 69 | assetBundle.Unload(true); 70 | Debug.Log("Unloaded Asset Bundle"); 71 | } 72 | } 73 | 74 | public void TappedLoadAssetBundle() 75 | { 76 | UnloadAssetBundle(); 77 | string filename = assetBundleName + "-" + GetAssetBundlePlatformName() + ".unity3d"; 78 | string resourcePath = container + "/" + filename; 79 | Log.Text(label, "Load asset bundle: " + resourcePath); 80 | StartCoroutine(blobService.GetAssetBundle(GetAssetBundleComplete, resourcePath)); 81 | } 82 | 83 | private void GetAssetBundleComplete(IRestResponse response) 84 | { 85 | if (response.IsError) 86 | { 87 | Log.Text(label, "Failed to load asset bunlde: " + response.StatusCode, response.ErrorMessage, Log.Level.Error); 88 | } 89 | else 90 | { 91 | Log.Text(label, "Loaded Asset Bundle:" + response.Url); 92 | assetBundle = response.Data; 93 | StartCoroutine(LoadAssets(assetBundle, "CloudCube")); ; 94 | } 95 | } 96 | 97 | private IEnumerator LoadAssets(AssetBundle bundle, string name) 98 | { 99 | // Load the object asynchronously 100 | AssetBundleRequest request = bundle.LoadAssetAsync(name, typeof(GameObject)); 101 | 102 | // Wait for completion 103 | yield return request; 104 | 105 | // Get the reference to the loaded object 106 | loadedObject = request.asset as GameObject; 107 | loadedObject.tag = "Player"; 108 | 109 | AddPrefab(new Vector3(0, 4, 0)); 110 | Log.Text(label, "+ Prefab" + loadedObject.name, "Added prefab name: " + loadedObject.name); 111 | } 112 | 113 | private void AddPrefab(Vector3 position = default(Vector3)) 114 | { 115 | AddPrefab(position, Quaternion.identity, Vector3.one, Color.clear); 116 | } 117 | 118 | private void AddPrefab(Vector3 position, Quaternion rotation, Vector3 scale, Color color) 119 | { 120 | if (assetBundle == null || loadedObject == null) 121 | { 122 | Log.Text(label, "Load asset bundle first", "Error, Asset Bundle was null", Log.Level.Warning); 123 | return; 124 | } 125 | GameObject gameObject = Instantiate(loadedObject, position, rotation); 126 | gameObject.transform.localScale = scale; 127 | gameObject.transform.GetComponent().material.SetColor("_EmissionColor", color); 128 | } 129 | 130 | public void TappedRemovePrefabs() 131 | { 132 | if (assetBundle == null) 133 | { 134 | Log.Text(label, "Tap 'Load Asset Bundle' first", "No asset bundles loaded", Log.Level.Warning); 135 | return; 136 | } 137 | RemovePrefabs(); 138 | Log.Text(label, "- Remove Prefabs", "Remove Prefabs"); 139 | } 140 | 141 | private void RemovePrefabs() 142 | { 143 | GameObject[] objs = GameObject.FindGameObjectsWithTag("Player"); 144 | foreach (GameObject obj in objs) 145 | { 146 | Destroy(obj); 147 | } 148 | } 149 | 150 | private string GetAssetBundlePlatformName() 151 | { 152 | switch (Application.platform) 153 | { 154 | case RuntimePlatform.WindowsEditor: 155 | case RuntimePlatform.WindowsPlayer: 156 | return SystemInfo.operatingSystem.Contains("64 bit") ? "x64" : "x86"; 157 | case RuntimePlatform.WSAPlayerX86: 158 | case RuntimePlatform.WSAPlayerX64: 159 | case RuntimePlatform.WSAPlayerARM: 160 | return "WSA"; 161 | case RuntimePlatform.Android: 162 | return "Android"; 163 | case RuntimePlatform.IPhonePlayer: 164 | return "iOS"; 165 | case RuntimePlatform.OSXEditor: 166 | case RuntimePlatform.OSXPlayer: 167 | return "OSX"; 168 | default: 169 | throw new Exception("Platform not listed"); 170 | } 171 | } 172 | 173 | #region XML blob example 174 | 175 | public void TappedSaveXML() 176 | { 177 | XmlDocument xml = XmlHelper.LoadResourceDocument("sceneDoc"); 178 | Debug.Log(xml.OuterXml); 179 | StartCoroutine(blobService.PutTextBlob(PutXmlCompleted, xml.OuterXml, container, saveFileXML, "application/xml")); 180 | } 181 | 182 | private void PutXmlCompleted(RestResponse response) 183 | { 184 | if (response.IsError) 185 | { 186 | Log.Text(label, "Put XML error: " + response.ErrorMessage, "Put XML error: " + response.ErrorMessage, Log.Level.Warning); 187 | return; 188 | } 189 | Log.Text(label, "Put XML: " + response.Url, "Put XML: " + response.Url); 190 | } 191 | 192 | public void TappedLoadXML() 193 | { 194 | string resourcePath = container + "/" + saveFileXML; 195 | Log.Text(label, "Load XML: " + resourcePath); 196 | StartCoroutine(blobService.GetXmlBlob(LoadXMLComplete, resourcePath)); 197 | } 198 | 199 | private void LoadXMLComplete(IRestResponse response) 200 | { 201 | if (response.IsError) 202 | { 203 | Log.Text(label, "Tap 'Save XML' first", response.StatusCode + " Failed to load XML: " + response.Url, Log.Level.Warning); 204 | } 205 | else 206 | { 207 | Debug.Log("xml:" + response.Content); 208 | ProcessSceneXML(response.Data); 209 | } 210 | } 211 | 212 | private void ProcessSceneXML(SceneDoc sceneData) 213 | { 214 | Debug.LogFormat("Levels: {0}", sceneData.Levels.Length); 215 | 216 | if (sceneData.Levels.Length <= 0) 217 | { 218 | return; 219 | } 220 | 221 | if (loadedObject == null) 222 | { 223 | Log.Text(label, "Tap 'Load Asset Bundle' first to load prefabs"); 224 | return; 225 | } 226 | 227 | LevelDoc level = sceneData.Levels[0]; 228 | foreach (PrefabDoc prefab in level.Prefabs) 229 | { 230 | prefab.Init(); 231 | Debug.LogFormat("Name: {0} Color: {1} Location: {2} Scale: {3}", prefab.name, prefab.GetColour(), prefab.GetPosition(), prefab.GetScale()); 232 | AddPrefab(prefab.GetPosition(), Quaternion.identity, prefab.GetScale(), prefab.GetColour()); 233 | } 234 | } 235 | 236 | #endregion 237 | 238 | #region JSON blob example 239 | 240 | public void TappedSaveJSON() 241 | { 242 | string filename = "scene"; 243 | TextAsset asset = (TextAsset)Resources.Load(filename); 244 | string json = asset.text; 245 | 246 | Scene scene = JsonUtility.FromJson(json); 247 | string jsonString = JsonUtility.ToJson(scene); 248 | 249 | StartCoroutine(blobService.PutTextBlob(PutJSONCompleted, jsonString, container, saveFileJSON, "application/json")); 250 | } 251 | 252 | private void PutJSONCompleted(RestResponse response) 253 | { 254 | if (response.IsError) 255 | { 256 | Log.Text(label, "Put JSON error: " + response.ErrorMessage, "Put JSON error: " + response.ErrorMessage, Log.Level.Warning); 257 | return; 258 | } 259 | Log.Text(label, "Put JSON: " + response.Url, "Put JSON: " + response.Url); 260 | } 261 | 262 | public void TappedLoadJSON() 263 | { 264 | string resourcePath = container + "/" + saveFileJSON; 265 | Log.Text(label, "Load JSON: " + resourcePath); 266 | StartCoroutine(blobService.GetJsonBlob(LoadJSONComplete, resourcePath)); 267 | } 268 | 269 | private void LoadJSONComplete(IRestResponse response) 270 | { 271 | if (response.IsError) 272 | { 273 | Log.Text(label, "Tap 'Save XML' first", response.StatusCode + " Failed to load XML: " + response.Url, Log.Level.Warning); 274 | } 275 | else 276 | { 277 | Debug.Log("json: " + response.Content); 278 | ProcessJSONSceneData(response.Data); 279 | } 280 | } 281 | 282 | private void ProcessJSONSceneData(Scene sceneData) 283 | { 284 | Debug.LogFormat("Levels: {0}", sceneData.levels.Length); 285 | 286 | if (sceneData.levels.Length <= 0) 287 | { 288 | return; 289 | } 290 | 291 | if (loadedObject == null) 292 | { 293 | Log.Text(label, "Tap 'Load Asset Bundle' first to load prefabs"); 294 | return; 295 | } 296 | 297 | Level level = sceneData.levels[0]; 298 | foreach (Prefab prefab in level.prefabs) 299 | { 300 | prefab.Init(); 301 | Debug.LogFormat("Name: {0} Color: {1} Location: {2} Scale: {3}", prefab.name, prefab.Colour, prefab.Position, prefab.Scale); 302 | AddPrefab(prefab.Position, Quaternion.identity, prefab.Scale, prefab.Colour); 303 | } 304 | } 305 | 306 | #endregion 307 | 308 | public void TappedNext() 309 | { 310 | SceneManager.LoadScene("AudioScene"); 311 | } 312 | } 313 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/AssetBundleDemo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd195adcee4d347859275e91b853aa97 3 | timeCreated: 1487947028 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/AssetBundleScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity3dAzure/StorageServicesDemo/486486bdea907acf2ca175a1842beb7cd6e344a9/Assets/Demos/AssetBundle/AssetBundleScene.unity -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/AssetBundleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71860a2abc4674a20902e33c9311a1af 3 | timeCreated: 1487947362 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1e50e5dc07514764af0c8feeff8c572 3 | folderAsset: yes 4 | timeCreated: 1488232124 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/JSON.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40ad065a4bdf649bd9879bbd12de3f0c 3 | folderAsset: yes 4 | timeCreated: 1487944373 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/JSON/Level.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | [Serializable] 4 | public class Level 5 | { 6 | public int number; 7 | public Prefab[] prefabs; 8 | } -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/JSON/Level.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de167f69f7f0446e6a003aad695a65f6 3 | timeCreated: 1487944374 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/JSON/Prefab.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | [Serializable] 5 | public class Prefab 6 | { 7 | public string name; 8 | public string color; 9 | public string location; 10 | public string scale; 11 | 12 | [NonSerialized] 13 | public Vector3 Position; 14 | 15 | [NonSerialized] 16 | public Vector3 Scale; 17 | 18 | [NonSerialized] 19 | public Color Colour; 20 | 21 | public void Init () 22 | { 23 | string[] loc = location.Split (','); 24 | if (loc.Length != 3) { 25 | Position = Vector3.zero; 26 | } else { 27 | Position = new Vector3 (float.Parse (loc [0]), float.Parse (loc [1]), float.Parse (loc [2])); 28 | } 29 | 30 | string[] s = scale.Split (','); 31 | if (s.Length != 3) { 32 | Scale = new Vector3 (1, 1, 1); 33 | } else { 34 | Scale = new Vector3 (float.Parse (s [0]), float.Parse (s [1]), float.Parse (s [2])); 35 | } 36 | 37 | Colour = Color.clear; 38 | if (!string.IsNullOrEmpty (color)) { 39 | ColorUtility.TryParseHtmlString (color, out Colour); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/JSON/Prefab.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4c6514e14cf942c9bd8ff76688bb249 3 | timeCreated: 1487944374 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/JSON/Scene.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | [Serializable] 4 | public class Scene 5 | { 6 | public Level[] levels; 7 | } -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/JSON/Scene.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01fef127bbdff493db4a69cb27e4a884 3 | timeCreated: 1487944374 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/XML.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d260f20efcdc44de3af545fbde508846 3 | folderAsset: yes 4 | timeCreated: 1487944373 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/XML/SceneDoc.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | using System.Xml.Serialization; 4 | using UnityEngine; 5 | 6 | [Serializable] 7 | [XmlRoot ("scene")] 8 | public class SceneDoc 9 | { 10 | [XmlArray ("levels")] 11 | [XmlArrayItem ("level")] // NB: watch out for lowercase fields in xml doc 12 | public LevelDoc[] Levels; 13 | } 14 | 15 | [Serializable] 16 | public class LevelDoc 17 | { 18 | [XmlAttribute ("number")] 19 | public string Number; 20 | 21 | [XmlArray ("prefabs")] 22 | [XmlArrayItem ("prefab")] 23 | public PrefabDoc[] Prefabs; 24 | } 25 | 26 | [Serializable] 27 | public class PrefabDoc 28 | { 29 | [XmlAttribute ("name")] 30 | public string name; 31 | 32 | [XmlElement ("color")] 33 | public string color; 34 | 35 | [XmlElement ("location")] 36 | public string location; 37 | 38 | [XmlElement ("scale")] 39 | public string scale; 40 | 41 | private Vector3 _position; 42 | 43 | public Vector3 GetPosition () 44 | { 45 | return _position; 46 | } 47 | 48 | private Vector3 _scale; 49 | 50 | public Vector3 GetScale () 51 | { 52 | return _scale; 53 | } 54 | 55 | private Color _color; 56 | 57 | public Color GetColour () 58 | { 59 | return _color; 60 | } 61 | 62 | public void Init () 63 | { 64 | string[] loc = location.Split (','); 65 | if (loc.Length != 3) { 66 | _position = Vector3.zero; 67 | } else { 68 | _position = new Vector3 (float.Parse (loc [0]), float.Parse (loc [1]), float.Parse (loc [2])); 69 | } 70 | 71 | string[] s = scale.Split (','); 72 | if (s.Length != 3) { 73 | _scale = new Vector3 (1, 1, 1); 74 | } else { 75 | _scale = new Vector3 (float.Parse (s [0]), float.Parse (s [1]), float.Parse (s [2])); 76 | } 77 | 78 | _color = Color.clear; 79 | if (!string.IsNullOrEmpty (color)) { 80 | ColorUtility.TryParseHtmlString (color, out _color); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/DataModels/XML/SceneDoc.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4241df8d4d607462d9a6cd3982fecfdc 3 | timeCreated: 1487944374 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/ReferencedScripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 200755eefebc843de83c9a75701e59a8 3 | folderAsset: yes 4 | timeCreated: 1487944373 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/ReferencedScripts/Spin.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Spin : MonoBehaviour 6 | { 7 | 8 | // Use this for initialization 9 | void Start () 10 | { 11 | 12 | } 13 | 14 | // Update is called once per frame 15 | void Update () 16 | { 17 | transform.Rotate (new Vector3 (1.0f, 1.0f, 1.0f)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/ReferencedScripts/Spin.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97121f570fedf47df9fff6da3bf0d692 3 | timeCreated: 1484253792 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb21ae263c5e4c742b833505e0591c62 3 | folderAsset: yes 4 | timeCreated: 1488289921 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f4fc32c8bc854a7ebbbdedb3feac11e 3 | folderAsset: yes 4 | timeCreated: 1484242243 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Materials/azure.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity3dAzure/StorageServicesDemo/486486bdea907acf2ca175a1842beb7cd6e344a9/Assets/Demos/AssetBundle/cloud/Materials/azure.mat -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Materials/azure.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1acdc6caf35c4aa08cad11b99ab973e 3 | timeCreated: 1484240327 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: cloud 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dfe01ddb7f48c496b89ab4f671007693 3 | folderAsset: yes 4 | timeCreated: 1484242451 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Prefabs/CloudCube.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity3dAzure/StorageServicesDemo/486486bdea907acf2ca175a1842beb7cd6e344a9/Assets/Demos/AssetBundle/cloud/Prefabs/CloudCube.prefab -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Prefabs/CloudCube.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9cd0921bb03a648efa117d7a8289942d 3 | timeCreated: 1484242611 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: cloud 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Sounds.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9ebdf49de8c3493bb446336b197f826 3 | folderAsset: yes 4 | timeCreated: 1484245809 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Sounds/Power_Up3.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity3dAzure/StorageServicesDemo/486486bdea907acf2ca175a1842beb7cd6e344a9/Assets/Demos/AssetBundle/cloud/Sounds/Power_Up3.wav -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Sounds/Power_Up3.wav.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc21313d2494d42169894c84052587ad 3 | timeCreated: 1484245814 4 | licenseType: Pro 5 | AudioImporter: 6 | serializedVersion: 6 7 | defaultSettings: 8 | loadType: 0 9 | sampleRateSetting: 0 10 | sampleRateOverride: 44100 11 | compressionFormat: 1 12 | quality: 1 13 | conversionMode: 0 14 | platformSettingOverrides: {} 15 | forceToMono: 0 16 | normalize: 1 17 | preloadAudioData: 1 18 | loadInBackground: 0 19 | 3D: 1 20 | userData: 21 | assetBundleName: cloud 22 | assetBundleVariant: 23 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0488cbf7e9d8d40aa945d7416562341d 3 | folderAsset: yes 4 | timeCreated: 1484242243 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Textures/cloud.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity3dAzure/StorageServicesDemo/486486bdea907acf2ca175a1842beb7cd6e344a9/Assets/Demos/AssetBundle/cloud/Textures/cloud.jpg -------------------------------------------------------------------------------- /Assets/Demos/AssetBundle/cloud/Textures/cloud.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1dc6797976a1b4769b92d182f7f80a5a 3 | timeCreated: 1484242903 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 2048 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: iPhone 70 | maxTextureSize: 2048 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | - buildTarget: tvOS 78 | maxTextureSize: 2048 79 | textureFormat: -1 80 | textureCompression: 1 81 | compressionQuality: 50 82 | crunchedCompression: 0 83 | allowsAlphaSplitting: 0 84 | overridden: 0 85 | - buildTarget: Android 86 | maxTextureSize: 2048 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | spriteSheet: 94 | serializedVersion: 2 95 | sprites: [] 96 | outline: [] 97 | spritePackingTag: 98 | userData: 99 | assetBundleName: cloud 100 | assetBundleVariant: 101 | -------------------------------------------------------------------------------- /Assets/Demos/Audio.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51d5c143f40d44b55ad1dc1bd734989b 3 | folderAsset: yes 4 | timeCreated: 1487944373 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demos/Audio/AudioDemo.cs: -------------------------------------------------------------------------------- 1 | using RESTClient; 2 | using Azure.StorageServices; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using UnityEngine; 6 | using UnityEngine.UI; 7 | using UnityEngine.SceneManagement; 8 | using System.IO; 9 | using UnityEngine.Networking; 10 | 11 | public class AudioDemo : MonoBehaviour 12 | { 13 | 14 | [Header("Azure Storage Service")] 15 | [SerializeField] 16 | private string storageAccount; 17 | [SerializeField] 18 | private string accessKey; 19 | [SerializeField] 20 | private string container; 21 | 22 | private StorageServiceClient client; 23 | private BlobService blobService; 24 | 25 | [Header("Audio Demo")] 26 | public Text label; 27 | public Button buttonRecord; 28 | 29 | [Header("Audio")] 30 | public AudioSource audioSource; 31 | public int recordTime = 2; 32 | 33 | private string mic; 34 | private const int sampleRate = 16000; 35 | private AudioClip audioClip; 36 | private bool isRecording = false; 37 | private float recordingTime; 38 | 39 | private string localPath; 40 | 41 | // Use this for initialization 42 | void Start() 43 | { 44 | if (string.IsNullOrEmpty(storageAccount) || string.IsNullOrEmpty(accessKey)) 45 | { 46 | Log.Text(label, "Storage account and access key are required", "Enter storage account and access key in Unity Editor", Log.Level.Error); 47 | } 48 | 49 | client = StorageServiceClient.Create(storageAccount, accessKey); 50 | blobService = client.GetBlobService(); 51 | } 52 | 53 | // Update is called once per frame 54 | void Update() 55 | { 56 | if (!isRecording) 57 | { 58 | return; 59 | } 60 | recordingTime += Time.deltaTime; 61 | if (recordingTime > recordTime) 62 | { 63 | StopRecording(); 64 | } 65 | } 66 | 67 | public void TappedRecordAudio() 68 | { 69 | if (Microphone.devices.Length == 0) 70 | { 71 | Log.Text(label, "No microphone found to record audio clip sample with.", "Check microphone is connected and Microphone permissions are enabled in Player Settings.", Log.Level.Error); 72 | return; 73 | } 74 | buttonRecord.GetComponent