diff --git a/Assets/ABI.CCK/Components/AnimatorDriver.cs b/Assets/ABI.CCK/Components/AnimatorDriver.cs deleted file mode 100755 index 6e8435a..0000000 --- a/Assets/ABI.CCK/Components/AnimatorDriver.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace ABI.CCK.Components -{ - public class AnimatorDriver : StateMachineBehaviour - { - public List EnterTasks = new List(); - public List ExitTasks = new List(); - - public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) - { - foreach (var task in EnterTasks) - { - task.Execute(animator); - } - } - - public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) - { - foreach (var task in ExitTasks) - { - task.Execute(animator); - } - } - } - - [System.Serializable] - public class AnimatorDriverTask - { - public enum Operator - { - Set, - Addition, - Subtraction, - Multiplication, - Division, - Modulo, - Power, - Log, - Equal, - NotEqual, - LessThen, - LessEqual, - MoreThen, - MoreEqual - } - - public enum SourceType - { - Static, - Parameter, - Random - } - - public enum ParameterType - { - None, - Float, - Int, - Bool, - Trigger - } - - public ParameterType targetType = ParameterType.None; - public string targetName = ""; - - public Operator op = Operator.Set; - - public SourceType aType = SourceType.Static; - public float aValue = 0f; - public float aMax = 1f; - public ParameterType aParamType; - public string aName = ""; - - public SourceType bType = SourceType.Static; - public float bValue = 0f; - public float bMax = 1f; - public ParameterType bParamType; - public string bName = ""; - - public void Execute(Animator animator) - { - float valA = 0f; - float valB = 0f; - float res = 0f; - - switch (aType) - { - case SourceType.Static: - valA = aValue; - break; - case SourceType.Random: - valA = Random.Range(aValue, aMax); - break; - case SourceType.Parameter: - switch (aParamType) - { - default: - valA = 0f; - break; - case ParameterType.Bool: - valA = animator.GetBool(aName) ? 1f : 0f; - break; - case ParameterType.Float: - valA = animator.GetFloat(aName); - break; - case ParameterType.Int: - valA = animator.GetInteger(aName); - break; - } - break; - } - - if (op == Operator.Set) - { - res = valA; - } - else - { - switch (bType) - { - case SourceType.Static: - valB = bValue; - break; - case SourceType.Random: - valB = Random.Range(bValue, aMax); - break; - case SourceType.Parameter: - switch (aParamType) - { - default: - valB = 0f; - break; - case ParameterType.Bool: - valB = animator.GetBool(bName) ? 1f : 0f; - break; - case ParameterType.Float: - valB = animator.GetFloat(bName); - break; - case ParameterType.Int: - valB = animator.GetInteger(bName); - break; - } - break; - } - - switch (op) - { - case Operator.Addition: - res = valA + valB; - break; - case Operator.Subtraction: - res = valA - valB; - break; - case Operator.Multiplication: - res = valA * valB; - break; - case Operator.Division: - res = valA / valB; - break; - case Operator.Modulo: - res = valA % valB; - break; - case Operator.Power: - res = Mathf.Pow(valA, valB); - break; - case Operator.Log: - res = Mathf.Log(valA, valB); - break; - case Operator.Equal: - res = valA == valB ? 1f : 0f; - break; - case Operator.NotEqual: - res = valA != valB ? 1f : 0f; - break; - case Operator.LessThen: - res = valA < valB ? 1f : 0f; - break; - case Operator.LessEqual: - res = valA <= valB ? 1f : 0f; - break; - case Operator.MoreThen: - res = valA > valB ? 1f : 0f; - break; - case Operator.MoreEqual: - res = valA >= valB ? 1f : 0f; - break; - } - } - - switch (targetType) - { - case ParameterType.Bool: - animator.SetBool(targetName, res >= 0.5f); - break; - case ParameterType.Trigger: - if (res >= 0.5f) animator.SetTrigger(targetName); - break; - case ParameterType.Float: - animator.SetFloat(targetName, res); - break; - case ParameterType.Int: - animator.SetInteger(targetName, (int) res); - break; - } - } - } -} \ No newline at end of file diff --git a/Assets/ABI.CCK/Components/AnimatorDriver.cs.meta b/Assets/ABI.CCK/Components/AnimatorDriver.cs.meta deleted file mode 100755 index dd3c423..0000000 --- a/Assets/ABI.CCK/Components/AnimatorDriver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6007a7c7844c4bcc994fd9111bf4d5a5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ABI.CCK/Components/CVRAssetInfo.cs b/Assets/ABI.CCK/Components/CVRAssetInfo.cs index 2ca2be4..60b4282 100755 --- a/Assets/ABI.CCK/Components/CVRAssetInfo.cs +++ b/Assets/ABI.CCK/Components/CVRAssetInfo.cs @@ -17,8 +17,5 @@ namespace ABI.CCK.Components public AssetType type; public string objectId; - - [HideInInspector] - public string randomNum; } } diff --git a/Assets/ABI.CCK/Components/CVRAttachment.cs b/Assets/ABI.CCK/Components/CVRAttachment.cs index f987128..b1d3b2d 100755 --- a/Assets/ABI.CCK/Components/CVRAttachment.cs +++ b/Assets/ABI.CCK/Components/CVRAttachment.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; using UnityEngine.Events; namespace ABI.CCK.Components @@ -11,7 +10,6 @@ namespace ABI.CCK.Components { Bone = 1, Tracker = 2, - SnappingPoint = 4, } public AttachmentType attachmentType; @@ -54,8 +52,6 @@ namespace ABI.CCK.Components } public TrackerType trackerType = 0; - - public List snappingPointTypes = new List(); public bool useFixedPositionOffset = false; public bool useFixedRotationOffset = false; diff --git a/Assets/ABI.CCK/Components/CVRAvatar.cs b/Assets/ABI.CCK/Components/CVRAvatar.cs index 2d52469..8fed611 100755 --- a/Assets/ABI.CCK/Components/CVRAvatar.cs +++ b/Assets/ABI.CCK/Components/CVRAvatar.cs @@ -37,8 +37,6 @@ namespace ABI.CCK.Components public CVRAvatarVisemeMode visemeMode = CVRAvatarVisemeMode.Visemes; - public int visemeSmoothing = 50; - public string[] visemeBlendshapes = new string[15]; [Space] [Header("Avatar customization")] [Space] @@ -84,8 +82,8 @@ namespace ABI.CCK.Components FlashingLights = 16, Violence = 32, Gore = 64, - Suggestive = 128, - Nudity = 256, + //Suggestive = 128, + //Nudity = 256, Horror = 512 } diff --git a/Assets/ABI.CCK/Components/CVRInteractableAction.cs b/Assets/ABI.CCK/Components/CVRInteractableAction.cs index 04a9cfc..97a4801 100755 --- a/Assets/ABI.CCK/Components/CVRInteractableAction.cs +++ b/Assets/ABI.CCK/Components/CVRInteractableAction.cs @@ -123,11 +123,6 @@ namespace ABI.CCK.Components Alpha7 = KeyCode.Alpha7, Alpha8 = KeyCode.Alpha8, Alpha9 = KeyCode.Alpha9, - LeftShift = KeyCode.LeftShift, - RightShift = KeyCode.RightShift, - LeftControl = KeyCode.LeftControl, - RightControl = KeyCode.RightControl, - Space = KeyCode.Space, InputHorizontalNegative = 10000, InputHorizontalPositive = 10001, InputVerticalNegative = 10002, diff --git a/Assets/ABI.CCK/Components/CVRInteractableActionOperation.cs b/Assets/ABI.CCK/Components/CVRInteractableActionOperation.cs index 9034f52..450f3d8 100755 --- a/Assets/ABI.CCK/Components/CVRInteractableActionOperation.cs +++ b/Assets/ABI.CCK/Components/CVRInteractableActionOperation.cs @@ -29,7 +29,6 @@ namespace ABI.CCK.Components DisplayWorldDetailPage = 13, DisplayInstanceDetailPage = 14, DisplayAvatarDetailPage = 15, - DisplaySpawnableDetailPage = 37, SitAtPosition = 16, MethodCall = 21, SetSpawnableValue = 22, diff --git a/Assets/ABI.CCK/Components/CombatSystem.cs b/Assets/ABI.CCK/Components/CombatSystem.cs index 3bea52e..57d4cdd 100755 --- a/Assets/ABI.CCK/Components/CombatSystem.cs +++ b/Assets/ABI.CCK/Components/CombatSystem.cs @@ -24,15 +24,12 @@ namespace ABI.CCK.Components [Header("Events")] public UnityEvent playerDownEvent = new UnityEvent(); - public UnityEvent playerHitEvent = new UnityEvent(); public UnityEvent playerRespawnEvent = new UnityEvent(); public UnityEvent playerRevitalizeEvent = new UnityEvent(); [Header("PVP Events")] public UnityEvent playerDownedEvent = new UnityEvent(); public UnityEvent downedAnotherPlayerEvent = new UnityEvent(); - public UnityEvent playerGotHitEvent = new UnityEvent(); - public UnityEvent hitAnotherPlayerEvent = new UnityEvent(); private void Reset() { diff --git a/Assets/ABI.CCK/Components/GameInstanceController.cs b/Assets/ABI.CCK/Components/GameInstanceController.cs index 5a93e45..5525239 100755 --- a/Assets/ABI.CCK/Components/GameInstanceController.cs +++ b/Assets/ABI.CCK/Components/GameInstanceController.cs @@ -103,7 +103,5 @@ namespace ABI.CCK.Components public UnityEvent teamLeaveEvent = new UnityEvent(); public UnityEvent teamWinRoundEvent = new UnityEvent(); public UnityEvent teamWinGameEvent = new UnityEvent(); - public UnityEvent teamMemberReadyEvent = new UnityEvent(); - public UnityEvent teamMemberUnReadyEvent = new UnityEvent(); } } \ No newline at end of file diff --git a/Assets/ABI.CCK/Components/GunController.cs b/Assets/ABI.CCK/Components/GunController.cs index 3ce764e..72f7e54 100755 --- a/Assets/ABI.CCK/Components/GunController.cs +++ b/Assets/ABI.CCK/Components/GunController.cs @@ -25,15 +25,6 @@ namespace ABI.CCK.Components public FiringMode firingMode = FiringMode.HalfAuto; public float firingRate = 1f; public float reloadTime = 1f; - - public enum HitDetection - { - Particle = 0, - Raycast = 1, - } - - public HitDetection hitDetection = HitDetection.Particle; - public LayerMask hitMask = (1 << 0) | (1 << 8); public void Shoot() { diff --git a/Assets/ABI.CCK/Components/ObjectHealth.cs b/Assets/ABI.CCK/Components/ObjectHealth.cs index 5887a24..8e24fd6 100755 --- a/Assets/ABI.CCK/Components/ObjectHealth.cs +++ b/Assets/ABI.CCK/Components/ObjectHealth.cs @@ -11,16 +11,11 @@ namespace ABI.CCK.Components { Destroy = 0, RespawnAfterTime = 1, - RespawnOnRoundStart = 2, - RespawnOnRoundEnd = 3, - RespawnOnGameStart = 4, - RespawnOnGameEnd = 5, } [Header("Down Behavior")] public DownBehavior downBehavior = DownBehavior.Destroy; public float respawnTime = 10f; public Transform respawnPoint; - public GameInstanceController connectedGameInstance; [Header("Events")] public UnityEvent downEvent = new UnityEvent(); diff --git a/Assets/ABI.CCK/Components/PlayerMaterialParser.cs b/Assets/ABI.CCK/Components/PlayerMaterialParser.cs deleted file mode 100755 index 33642d9..0000000 --- a/Assets/ABI.CCK/Components/PlayerMaterialParser.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace ABI.CCK.Components -{ - public class PlayerMaterialParser : MonoBehaviour - { - public Material targetMaterial; - - public string playerRootPositions = "_PlayerRootPositions"; - public string playerHipPositions = "_PlayerHipPositions"; - public string playerHeadPositions = "_PlayerHeadPositions"; - public string playerLeftHandPositions = "_PlayerLeftHandPositions"; - public string playerRightHandPositions = "_PlayerRightHandPositions"; - public string playerChestPositions = "_PlayerChestPositions"; - public string playerLeftFootPositions = "_PlayerLeftFootPositions"; - public string playerRightFootPositions = "_PlayerRightFootPositions"; - } -} diff --git a/Assets/ABI.CCK/Components/PlayerMaterialParser.cs.meta b/Assets/ABI.CCK/Components/PlayerMaterialParser.cs.meta deleted file mode 100755 index b538903..0000000 --- a/Assets/ABI.CCK/Components/PlayerMaterialParser.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5256473d683a24743ab8a6b352997437 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ABI.CCK/Components/SpawnablePickupMarker.cs b/Assets/ABI.CCK/Components/SpawnablePickupMarker.cs deleted file mode 100755 index a5e556d..0000000 --- a/Assets/ABI.CCK/Components/SpawnablePickupMarker.cs +++ /dev/null @@ -1,27 +0,0 @@ -using UnityEngine; - -namespace ABI.CCK.Components -{ - public class SpawnablePickupMarker : MonoBehaviour - { - public string spawnableGuid; - - private void OnDrawGizmos() - { - Gizmos.color = Color.magenta; - Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale); - Gizmos.matrix = rotationMatrix; - Gizmos.DrawWireCube(new Vector3(0, 0.75f, 0), new Vector3(1f, 1.5f, 0f)); - - Gizmos.DrawWireCube(new Vector3(0, 0.7f, 0), new Vector3(0.8f, 0.1f, 0f)); - Gizmos.DrawWireCube(new Vector3(0, 0.615f, 0), new Vector3(0.6f, 0.07f, 0f)); - Gizmos.DrawWireCube(new Vector3(0.24f, 0.28f, 0), new Vector3(0.32f, 0.42f, 0f)); - Gizmos.DrawWireCube(new Vector3(-0.24f, 0.28f, 0), new Vector3(0.32f, 0.42f, 0f)); - var scale = transform.lossyScale; - scale.Scale(new Vector3(1f, 1f, 0f)); - rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, scale); - Gizmos.matrix = rotationMatrix; - Gizmos.DrawWireSphere(new Vector3(0, 1.11f, 0), 0.31f); - } - } -} \ No newline at end of file diff --git a/Assets/ABI.CCK/Components/SpawnablePickupMarker.cs.meta b/Assets/ABI.CCK/Components/SpawnablePickupMarker.cs.meta deleted file mode 100755 index fb72485..0000000 --- a/Assets/ABI.CCK/Components/SpawnablePickupMarker.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eff309c86b8103c45a87cf57553d787f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ABI.CCK/GUIAssets/CCK_UploaderHead.prefab b/Assets/ABI.CCK/GUIAssets/CCK_UploaderHead.prefab index 5e4a1f2..96c9168 100755 --- a/Assets/ABI.CCK/GUIAssets/CCK_UploaderHead.prefab +++ b/Assets/ABI.CCK/GUIAssets/CCK_UploaderHead.prefab @@ -17079,7 +17079,7 @@ MonoBehaviour: m_HorizontalOverflow: 1 m_VerticalOverflow: 1 m_LineSpacing: 1 - m_Text: ABI Platform Content Creation Kit v3.5 RELEASE (Build 98, Public) + m_Text: ABI Platform Content Creation Kit v3.4 RELEASE (Build 92, Public) --- !u!1 &8389522060313083026 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/ABI.CCK/Materials/UI Additive.mat b/Assets/ABI.CCK/Materials/UI Additive.mat index 4109985..cf97815 100755 Binary files a/Assets/ABI.CCK/Materials/UI Additive.mat and b/Assets/ABI.CCK/Materials/UI Additive.mat differ diff --git a/Assets/ABI.CCK/Materials/VideoPlayerSpeaker.mat b/Assets/ABI.CCK/Materials/VideoPlayerSpeaker.mat index cd659d9..3acccb7 100755 Binary files a/Assets/ABI.CCK/Materials/VideoPlayerSpeaker.mat and b/Assets/ABI.CCK/Materials/VideoPlayerSpeaker.mat differ diff --git a/Assets/ABI.CCK/Materials/VideoScreen.mat b/Assets/ABI.CCK/Materials/VideoScreen.mat index 4624e0b..c577ec8 100755 Binary files a/Assets/ABI.CCK/Materials/VideoScreen.mat and b/Assets/ABI.CCK/Materials/VideoScreen.mat differ diff --git a/Assets/ABI.CCK/Prefabs/CVRVideoPlayerCinemaScreen.prefab b/Assets/ABI.CCK/Prefabs/CVRVideoPlayerCinemaScreen.prefab index f45c35a..91b31f8 100755 Binary files a/Assets/ABI.CCK/Prefabs/CVRVideoPlayerCinemaScreen.prefab and b/Assets/ABI.CCK/Prefabs/CVRVideoPlayerCinemaScreen.prefab differ diff --git a/Assets/ABI.CCK/Prefabs/Chair.prefab b/Assets/ABI.CCK/Prefabs/Chair.prefab index 338d9bd..ab8f7ab 100755 Binary files a/Assets/ABI.CCK/Prefabs/Chair.prefab and b/Assets/ABI.CCK/Prefabs/Chair.prefab differ diff --git a/Assets/ABI.CCK/Prefabs/Mirror.prefab b/Assets/ABI.CCK/Prefabs/Mirror.prefab index 3c50b10..6a8600f 100755 Binary files a/Assets/ABI.CCK/Prefabs/Mirror.prefab and b/Assets/ABI.CCK/Prefabs/Mirror.prefab differ diff --git a/Assets/ABI.CCK/Prefabs/VideoPlayer/Speakers.prefab b/Assets/ABI.CCK/Prefabs/VideoPlayer/Speakers.prefab index f7257f7..d1d726f 100755 Binary files a/Assets/ABI.CCK/Prefabs/VideoPlayer/Speakers.prefab and b/Assets/ABI.CCK/Prefabs/VideoPlayer/Speakers.prefab differ diff --git a/Assets/ABI.CCK/Prefabs/VideoPlayer/VideoPlayerRoomScaleAudioPrefab.prefab b/Assets/ABI.CCK/Prefabs/VideoPlayer/VideoPlayerRoomScaleAudioPrefab.prefab index 24370a2..3f9d833 100755 Binary files a/Assets/ABI.CCK/Prefabs/VideoPlayer/VideoPlayerRoomScaleAudioPrefab.prefab and b/Assets/ABI.CCK/Prefabs/VideoPlayer/VideoPlayerRoomScaleAudioPrefab.prefab differ diff --git a/Assets/ABI.CCK/Prefabs/VideoPlayer/VideoPlayerUiPrefab.prefab b/Assets/ABI.CCK/Prefabs/VideoPlayer/VideoPlayerUiPrefab.prefab index bdc0a3b..1758b9c 100755 Binary files a/Assets/ABI.CCK/Prefabs/VideoPlayer/VideoPlayerUiPrefab.prefab and b/Assets/ABI.CCK/Prefabs/VideoPlayer/VideoPlayerUiPrefab.prefab differ diff --git a/Assets/ABI.CCK/Prefabs/VideoPlayer/_AudioSourceRoom.prefab b/Assets/ABI.CCK/Prefabs/VideoPlayer/_AudioSourceRoom.prefab index 2cdfbad..38f7546 100755 Binary files a/Assets/ABI.CCK/Prefabs/VideoPlayer/_AudioSourceRoom.prefab and b/Assets/ABI.CCK/Prefabs/VideoPlayer/_AudioSourceRoom.prefab differ diff --git a/Assets/ABI.CCK/Scripts/APIConnection.cs b/Assets/ABI.CCK/Scripts/APIConnection.cs deleted file mode 100755 index 5a5708b..0000000 --- a/Assets/ABI.CCK/Scripts/APIConnection.cs +++ /dev/null @@ -1,176 +0,0 @@ -using System; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using Abi.Newtonsoft.Json; -using Abi.Newtonsoft.Json.Linq; -using UnityEngine; -using Object = System.Object; - -public static class APIConnection -{ - public static string APIAddress = "https://api.abinteractive.net"; - public static string APIVersion = "2"; - private static string _apiUserAgent = "ChilloutVR API-Requests"; - - private static HttpClient _client = new HttpClient(); - - private static string _username; - private static string _accessKey; - - private static bool _initialized = false; - public static bool Initialized - { - get => _initialized; - } - - public static void Initialize(string username, string accessKey) - { - if (username == "" || accessKey == "") return; - - _username = username; - _accessKey = accessKey; - - _client.DefaultRequestHeaders.Clear(); - - _client.DefaultRequestHeaders.Add("Username", _username); - _client.DefaultRequestHeaders.Add("AccessKey", _accessKey); - _client.DefaultRequestHeaders.Add("User-Agent", _apiUserAgent); - - _client.Timeout = TimeSpan.FromSeconds(30); - _initialized = true; - } - - public static async Task> MakeRequest(string url, Object data = null, string apiVersion = null, bool put = false) - { - if (!_initialized) return default(BaseResponse); - - JObject currentRequestData; - string currentRequestUrl = String.Empty; - int currentRequestType = 0; - - if (apiVersion == null) apiVersion = APIVersion; - - currentRequestUrl = $"{APIAddress}/{apiVersion}/{url}"; - - HttpResponseMessage response; - if (data != null) currentRequestType = 1; - if (put) currentRequestType = 2; - - if (currentRequestType == 0) - { - response = await _client.GetAsync(currentRequestUrl); - } - else if (currentRequestType == 2) - { - response = await _client.PutAsync(currentRequestUrl, null); - } - else - { - response = await _client.PostAsync(currentRequestUrl, new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json")); - } - - - if (response.IsSuccessStatusCode) - { - return JsonConvert.DeserializeObject>(await response.Content.ReadAsStringAsync()); - } - else - { - Debug.LogError($"Result from API Request {currentRequestUrl} returned {response.StatusCode}"); - } - - try - { - BaseResponse res = JsonConvert.DeserializeObject>(await response.Content.ReadAsStringAsync()); - if (res != null) - return res; - } - catch (Exception e) - { - Debug.LogError($"Result from API Request {currentRequestUrl} could not be parsed"); - } - - return default(BaseResponse); - } - - //Responses - public class BaseResponse - { - public string Message { get; set; } - public T Data { get; set; } - - public BaseResponse(string message = null, T data = default) - { - Message = message; - Data = data; - } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - public class UserinfoResponse - { - public bool IsAccountUnlocked { get; set; } - public string UserId { get; set; } - public string Name { get; set; } - public string UserRank { get; set; } - } - - public enum ContentTypes - { - Avatar, - World, - Spawnable - } - - public class GenerateResponse - { - public Guid Id { get; set; } - public ContentTypes Type { get; set; } - } - - public class ContentInfoResponse - { - public string UploadLocation { get; set; } - public ContentDataIni ContentData { get; set; } - - public class ContentDataIni : GenericINI - { - public ContentTypes Type { get; set; } - public UgcTagsData Tags { get; set; } - } - } - - public class GenericINI - { - public string Id { get; set; } - public string Name { get; set; } - public string Description { get; set; } - public Uri Image { get; set; } - } - - public struct UgcTagsData - { - public bool Gore; - public bool Horror; - public bool Jumpscare; - public bool Nudity; - public bool Suggestive; - public bool Violence; - public bool ContainsMusic; - public bool ExtremelyBright; - public bool ExtremelyHuge; - public bool ExtremelySmall; - public bool FlashingColors; - public bool FlashingLights; - public bool LoudAudio; - public bool ParticleSystems; - public bool ScreenEffects; - public bool SpawnAudio; - public bool LongRangeAudio; - } -} \ No newline at end of file diff --git a/Assets/ABI.CCK/Scripts/APIConnection.cs.meta b/Assets/ABI.CCK/Scripts/APIConnection.cs.meta deleted file mode 100755 index c5a3c7e..0000000 --- a/Assets/ABI.CCK/Scripts/APIConnection.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: b6e98b6775f64bbdb3309a8b58773d81 -timeCreated: 1678553770 \ No newline at end of file diff --git a/Assets/ABI.CCK/Scripts/CVRAdvancedAvatarSettings.cs b/Assets/ABI.CCK/Scripts/CVRAdvancedAvatarSettings.cs index 8ec1ad9..3a46c92 100755 --- a/Assets/ABI.CCK/Scripts/CVRAdvancedAvatarSettings.cs +++ b/Assets/ABI.CCK/Scripts/CVRAdvancedAvatarSettings.cs @@ -179,7 +179,6 @@ namespace ABI.CCK.Scripts public bool useAnimationClip; public AnimationClip animationClip; - public AnimationClip offAnimationClip; public List gameObjectTargets = new List(); @@ -257,14 +256,7 @@ namespace ABI.CCK.Scripts if (useAnimationClip) { onClip = animationClip; - if (offAnimationClip != null) - { - offClip = offAnimationClip; - } - else - { - AssetDatabase.CreateAsset(offClip, folderPath + "/Anim_" + machineName + "_Toggle_Off.anim"); - } + AssetDatabase.CreateAsset(offClip, folderPath + "/Anim_" + machineName + "_Toggle_Off.anim"); } else { AssetDatabase.CreateAsset(offClip, folderPath + "/Anim_" + machineName + "_Toggle_Off.anim"); diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_AnimatorDriverEditor.cs b/Assets/ABI.CCK/Scripts/Editor/CCK_AnimatorDriverEditor.cs deleted file mode 100755 index c20b84b..0000000 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_AnimatorDriverEditor.cs +++ /dev/null @@ -1,353 +0,0 @@ -using System; -using System.Collections.Generic; -using ABI.CCK.Components; -using UnityEditor; -using UnityEditorInternal; -using UnityEngine; -using AnimatorController = UnityEditor.Animations.AnimatorController; -using AnimatorControllerParameterType = UnityEngine.AnimatorControllerParameterType; - -[CustomEditor(typeof(ABI.CCK.Components.AnimatorDriver))] -public class CCK_AnimatorDriverEditor : UnityEditor.Editor -{ - private AnimatorDriver _animatorDriver; - - private ReorderableList _onEnterList; - private ReorderableList _onExitList; - - private List animatorParamNames = new List(); - private List animatorParamNamesDisplay = new List(); - private List animatorParamTypes = new List(); - - public override void OnInspectorGUI() - { - if (_animatorDriver == null) _animatorDriver = (AnimatorDriver) target; - - animatorParamNames.Clear(); - animatorParamNamesDisplay.Clear(); - animatorParamTypes.Clear(); - - animatorParamNames.Add("- None -"); - animatorParamNamesDisplay.Add("- None -"); - animatorParamTypes.Add(AnimatorDriverTask.ParameterType.None); - - var behaviorContext = AnimatorController.FindStateMachineBehaviourContext(_animatorDriver); - if (behaviorContext.Length > 0) - { - var controller = behaviorContext[0].animatorController; - - foreach (var parameter in controller.parameters) - { - switch (parameter.type) - { - case AnimatorControllerParameterType.Bool: - animatorParamNames.Add($"{parameter.name}"); - animatorParamNamesDisplay.Add($"{parameter.name} (Bool)"); - animatorParamTypes.Add(AnimatorDriverTask.ParameterType.Bool); - break; - case AnimatorControllerParameterType.Float: - animatorParamNames.Add($"{parameter.name}"); - animatorParamNamesDisplay.Add($"{parameter.name} (Float)"); - animatorParamTypes.Add(AnimatorDriverTask.ParameterType.Float); - break; - case AnimatorControllerParameterType.Int: - animatorParamNames.Add($"{parameter.name}"); - animatorParamNamesDisplay.Add($"{parameter.name} (Int)"); - animatorParamTypes.Add(AnimatorDriverTask.ParameterType.Int); - break; - case AnimatorControllerParameterType.Trigger: - animatorParamNames.Add($"{parameter.name}"); - animatorParamNamesDisplay.Add($"{parameter.name} (Trigger)"); - animatorParamTypes.Add(AnimatorDriverTask.ParameterType.Trigger); - break; - } - } - } - - if (_onEnterList == null) - { - _onEnterList = new ReorderableList(_animatorDriver.EnterTasks, typeof(AnimatorDriverTask), - true, true, true, true); - _onEnterList.drawHeaderCallback = OnDrawHeaderTaskEnter; - _onEnterList.drawElementCallback = OnDrawElementTaskEnter; - _onEnterList.elementHeightCallback = OnHeightElementTaskEnter; - } - - _onEnterList.DoLayoutList(); - - if (_onExitList == null) - { - _onExitList = new ReorderableList(_animatorDriver.ExitTasks, typeof(AnimatorDriverTask), - true, true, true, true); - _onExitList.drawHeaderCallback = OnDrawHeaderTaskExit; - _onExitList.drawElementCallback = OnDrawElementTaskExit; - _onExitList.elementHeightCallback = OnHeightElementTaskExit; - } - - _onExitList.DoLayoutList(); - } - - private void OnDrawHeaderTaskEnter(Rect rect) - { - Rect _rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight); - - GUI.Label(_rect, "On Enter State"); - } - - private void OnDrawElementTaskEnter(Rect rect, int index, bool isactive, bool isfocused) - { - if (index > _animatorDriver.EnterTasks.Count) return; - AnimatorDriverTask element = _animatorDriver.EnterTasks[index]; - - RenderTask(rect, element); - } - - private float OnHeightElementTaskEnter(int index) - { - int length = 3; - - if (index > _animatorDriver.EnterTasks.Count) return 1.25f * length * EditorGUIUtility.singleLineHeight; - AnimatorDriverTask task = _animatorDriver.EnterTasks[index]; - - return (length + TaskHeight(task)) * 1.25f * EditorGUIUtility.singleLineHeight; - } - - private void OnDrawHeaderTaskExit(Rect rect) - { - Rect _rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight); - - GUI.Label(_rect, "On Exit State"); - } - - private void OnDrawElementTaskExit(Rect rect, int index, bool isactive, bool isfocused) - { - if (index > _animatorDriver.ExitTasks.Count) return; - AnimatorDriverTask element = _animatorDriver.ExitTasks[index]; - - RenderTask(rect, element); - } - - private float OnHeightElementTaskExit(int index) - { - int length = 3; - - if (index > _animatorDriver.ExitTasks.Count) return 1.25f * length * EditorGUIUtility.singleLineHeight; - AnimatorDriverTask task = _animatorDriver.ExitTasks[index]; - - return (length + TaskHeight(task)) * 1.25f * EditorGUIUtility.singleLineHeight; - } - - private int TaskHeight(AnimatorDriverTask task) - { - int length = 0; - - switch (task.aType) - { - case AnimatorDriverTask.SourceType.Static: - case AnimatorDriverTask.SourceType.Parameter: - length += 1; - break; - case AnimatorDriverTask.SourceType.Random: - length += 2; - break; - } - - if (task.op != AnimatorDriverTask.Operator.Set) - { - length += 1; - - switch (task.bType) - { - case AnimatorDriverTask.SourceType.Static: - case AnimatorDriverTask.SourceType.Parameter: - length += 1; - break; - case AnimatorDriverTask.SourceType.Random: - length += 2; - break; - } - } - - length += 1; - - return length; - } - - private void RenderTask(Rect rect, AnimatorDriverTask task) - { - string formulaDisplay = ""; - - Rect _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - int parameterIndex = Math.Max(animatorParamNames.FindIndex(m => m == task.targetName), 0); - EditorGUI.LabelField(_rect, "Parameter"); - _rect.x += 100; - _rect.width = rect.width - 100; - int selectedIndex = EditorGUI.Popup(_rect, parameterIndex, animatorParamNamesDisplay.ToArray()); - task.targetType = animatorParamTypes[selectedIndex]; - task.targetName = animatorParamNames[selectedIndex]; - - formulaDisplay = $"{task.targetName} = "; - - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - EditorGUI.LabelField(_rect, "Operation"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.op = (AnimatorDriverTask.Operator) EditorGUI.EnumPopup(_rect, task.op); - - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - EditorGUI.LabelField(_rect, "A Type"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.aType = (AnimatorDriverTask.SourceType) EditorGUI.EnumPopup(_rect, task.aType); - - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - switch (task.aType) - { - case AnimatorDriverTask.SourceType.Static: - EditorGUI.LabelField(_rect, "A Value"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.aValue = EditorGUI.FloatField(_rect, task.aValue); - - formulaDisplay += $"{task.aValue} "; - break; - case AnimatorDriverTask.SourceType.Parameter: - parameterIndex = Math.Max(animatorParamNames.FindIndex(m => m == task.aName), 0); - EditorGUI.LabelField(_rect, "Parameter A"); - _rect.x += 100; - _rect.width = rect.width - 100; - selectedIndex = EditorGUI.Popup(_rect, parameterIndex, animatorParamNamesDisplay.ToArray()); - task.aParamType = animatorParamTypes[selectedIndex]; - task.aName = animatorParamNames[selectedIndex]; - - formulaDisplay += $"{task.aName} "; - break; - case AnimatorDriverTask.SourceType.Random: - EditorGUI.LabelField(_rect, "A Min"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.aValue = EditorGUI.FloatField(_rect, task.aValue); - - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - EditorGUI.LabelField(_rect, "A Max"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.aMax = Convert.ToSingle(EditorGUI.TextField(_rect, task.aMax.ToString())); - - formulaDisplay += $"Rand({task.aValue}, {task.aMax}) "; - break; - } - - if (task.op != AnimatorDriverTask.Operator.Set) - { - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - switch (task.op) - { - case AnimatorDriverTask.Operator.Addition: - formulaDisplay += "+ "; - break; - case AnimatorDriverTask.Operator.Subtraction: - formulaDisplay += "- "; - break; - case AnimatorDriverTask.Operator.Multiplication: - formulaDisplay += "* "; - break; - case AnimatorDriverTask.Operator.Division: - formulaDisplay += "/ "; - break; - case AnimatorDriverTask.Operator.Modulo: - formulaDisplay += "% "; - break; - case AnimatorDriverTask.Operator.Power: - formulaDisplay += "pow "; - break; - case AnimatorDriverTask.Operator.Log: - formulaDisplay += "log "; - break; - case AnimatorDriverTask.Operator.Equal: - formulaDisplay += "== "; - break; - case AnimatorDriverTask.Operator.LessThen: - formulaDisplay += "< "; - break; - case AnimatorDriverTask.Operator.LessEqual: - formulaDisplay += "<= "; - break; - case AnimatorDriverTask.Operator.MoreThen: - formulaDisplay += "> "; - break; - case AnimatorDriverTask.Operator.MoreEqual: - formulaDisplay += ">= "; - break; - case AnimatorDriverTask.Operator.NotEqual: - formulaDisplay += "!= "; - break; - } - - EditorGUI.LabelField(_rect, "B Type"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.bType = (AnimatorDriverTask.SourceType) EditorGUI.EnumPopup(_rect, task.bType); - - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - switch (task.bType) - { - case AnimatorDriverTask.SourceType.Static: - EditorGUI.LabelField(_rect, "B Value"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.bValue = EditorGUI.FloatField(_rect, task.bValue); - - formulaDisplay += $"{task.bValue} "; - break; - case AnimatorDriverTask.SourceType.Parameter: - parameterIndex = Math.Max(animatorParamNames.FindIndex(m => m == task.bName), 0); - EditorGUI.LabelField(_rect, "Parameter B"); - _rect.x += 100; - _rect.width = rect.width - 100; - selectedIndex = EditorGUI.Popup(_rect, parameterIndex, animatorParamNamesDisplay.ToArray()); - task.bParamType = animatorParamTypes[selectedIndex]; - task.bName = animatorParamNames[selectedIndex]; - - formulaDisplay += $"{task.bName} "; - break; - case AnimatorDriverTask.SourceType.Random: - EditorGUI.LabelField(_rect, "B Min"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.bValue = EditorGUI.FloatField(_rect, task.bValue); - - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - EditorGUI.LabelField(_rect, "B Max"); - _rect.x += 100; - _rect.width = rect.width - 100; - task.bMax = Convert.ToSingle(EditorGUI.TextField(_rect, task.bMax.ToString())); - - formulaDisplay += $"Rand({task.bValue}, {task.bMax}) "; - break; - } - } - - var boldtext = new GUIStyle (GUI.skin.label); - boldtext.fontStyle = FontStyle.Bold; - - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight); - EditorGUI.LabelField(_rect, task.targetName == "- None -"?"Parameter = A":formulaDisplay, boldtext); - } -} \ No newline at end of file diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_AnimatorDriverEditor.cs.meta b/Assets/ABI.CCK/Scripts/Editor/CCK_AnimatorDriverEditor.cs.meta deleted file mode 100755 index 7cbc779..0000000 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_AnimatorDriverEditor.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: cf1a3cb4c93d41c9b01fcf9f128fbca2 -timeCreated: 1685439016 \ No newline at end of file diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_BuildManagerWindow.cs b/Assets/ABI.CCK/Scripts/Editor/CCK_BuildManagerWindow.cs index 1bd4ecf..f66ab87 100755 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_BuildManagerWindow.cs +++ b/Assets/ABI.CCK/Scripts/Editor/CCK_BuildManagerWindow.cs @@ -23,9 +23,9 @@ namespace ABI.CCK.Scripts.Editor [InitializeOnLoad] public class CCK_BuildManagerWindow : EditorWindow { - public static string Version = "3.5 RELEASE"; - public static int BuildID = 98; - private const string CCKVersion = "3.5 RELEASE (Build 98)"; + public static string Version = "3.4 RELEASE"; + public static int BuildID = 90; + private const string CCKVersion = "3.4 RELEASE (Build 92)"; private string[] SupportedUnityVersions = new[] { @@ -34,11 +34,7 @@ namespace ABI.CCK.Scripts.Editor "2019.4.13f1", "2019.4.14f1", "2019.4.15f1", "2019.4.16f1", "2019.4.17f1", "2019.4.18f1", "2019.4.19f1", "2019.4.20f1", "2019.4.21f1", "2019.4.22f1", "2019.4.23f1", "2019.4.24f1", "2019.4.25f1", "2019.4.26f1", "2019.4.27f1", "2019.4.28f1", "2019.4.29f1", "2019.4.30f1", - "2019.4.31f1", - "2021.3.1f1", "2021.3.2f1", "2021.3.3f1", "2021.3.4f1", "2021.3.5f1", "2021.3.6f1", "2021.3.7f1", - "2021.3.8f1", "2021.3.9f1", "2021.3.10f1", "2021.3.11f1", "2021.3.12f1", "2021.3.13f1", "2021.3.14f1", - "2021.3.15f1", "2021.3.16f1", "2021.3.17f1", "2021.3.18f1", "2021.3.19f1", "2021.3.20f1", "2021.3.21f1", - "2021.3.22f1", "2021.3.23f1", "2021.3.24f1" + "2019.4.31f1" }; string _username; @@ -112,41 +108,13 @@ namespace ABI.CCK.Scripts.Editor { EditorPrefs.SetBool("m_ABI_isBuilding", false); EditorPrefs.SetString("m_ABI_TempVersion", Version); - - string[] filePaths = Directory.GetFiles(Application.dataPath + "/ABI.CCK/Resources/Cache/", "*.prefab"); - foreach (string filePath in filePaths) - { - File.Delete(filePath); - } - - filePaths = Directory.GetFiles(Application.persistentDataPath + "/", "*.cvravatar"); - foreach (string filePath in filePaths) - { - File.Delete(filePath); - } - - filePaths = Directory.GetFiles(Application.persistentDataPath + "/", "*.cvravatar.manifest"); - foreach (string filePath in filePaths) - { - File.Delete(filePath); - } - - filePaths = Directory.GetFiles(Application.persistentDataPath + "/", "*.cvrprop"); - foreach (string filePath in filePaths) - { - File.Delete(filePath); - } - - filePaths = Directory.GetFiles(Application.persistentDataPath + "/", "*.cvrprop.manifest"); - foreach (string filePath in filePaths) - { - File.Delete(filePath); - } - - /*if (File.Exists(Application.persistentDataPath + "/bundle.cvravatar")) File.Delete(Application.persistentDataPath + "/bundle.cvravatar"); + if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRAvatar.prefab")) File.Delete(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRAvatar.prefab"); + if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab")) File.Delete(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab"); + if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRWorld.prefab")) File.Delete(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRWorld.prefab"); + if (File.Exists(Application.persistentDataPath + "/bundle.cvravatar")) File.Delete(Application.persistentDataPath + "/bundle.cvravatar"); if (File.Exists(Application.persistentDataPath + "/bundle.cvravatar.manifest")) File.Delete(Application.persistentDataPath + "/bundle.cvravatar.manifest"); if (File.Exists(Application.persistentDataPath + "/bundle.cvrprop")) File.Delete(Application.persistentDataPath + "/bundle.cvrprop"); - if (File.Exists(Application.persistentDataPath + "/bundle.cvrprop.manifest")) File.Delete(Application.persistentDataPath + "/bundle.cvrprop.manifest");*/ + if (File.Exists(Application.persistentDataPath + "/bundle.cvrprop.manifest")) File.Delete(Application.persistentDataPath + "/bundle.cvrprop.manifest"); if (File.Exists(Application.persistentDataPath + "/bundle.cvrworld")) File.Delete(Application.persistentDataPath + "/bundle.cvrworld"); if (File.Exists(Application.persistentDataPath + "/bundle.cvrworld.manifest")) File.Delete(Application.persistentDataPath + "/bundle.cvrworld.manifest"); if (File.Exists(Application.persistentDataPath + "/bundle.png")) File.Delete(Application.persistentDataPath + "/bundle.png"); @@ -160,15 +128,10 @@ namespace ABI.CCK.Scripts.Editor if (state == PlayModeStateChange.EnteredPlayMode && EditorPrefs.GetBool("m_ABI_isBuilding")) { - CCK_BuildUtility.upload_id = EditorPrefs.GetString("m_ABI_uploadId"); - string randomNum = EditorPrefs.GetString("m_ABI_uploadRand"); - var ui = Instantiate(AssetDatabase.LoadAssetAtPath("Assets/ABI.CCK/GUIAssets/CCK_UploaderHead.prefab")); OnGuiUpdater up = ui.GetComponentInChildren(); if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRAvatar.prefab"))up.asset = Resources.Load("Cache/_CVRAvatar").GetComponent(); - if (File.Exists(Application.dataPath + $"/ABI.CCK/Resources/Cache/CVRAvatar_{CCK_BuildUtility.upload_id}_{randomNum}.prefab"))up.asset = Resources.Load($"Cache/CVRAvatar_{CCK_BuildUtility.upload_id}_{randomNum}").GetComponent(); if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab"))up.asset = Resources.Load("Cache/_CVRSpawnable").GetComponent(); - if (File.Exists(Application.dataPath + $"/ABI.CCK/Resources/Cache/CVRSpawnable_{CCK_BuildUtility.upload_id}_{randomNum}.prefab"))up.asset = Resources.Load($"Cache/CVRSpawnable_{CCK_BuildUtility.upload_id}_{randomNum}").GetComponent(); if (File.Exists(Application.dataPath + "/ABI.CCK/Resources/Cache/_CVRWorld.prefab"))up.asset = Resources.Load("Cache/_CVRWorld").GetComponent(); } } @@ -727,30 +690,71 @@ namespace ABI.CCK.Scripts.Editor { _attemptingToLogin = true; - APIConnection.Initialize(_username, _key); - APIConnection.BaseResponse response = await APIConnection.MakeRequest("cck/userinfo"); - - if (response != null) + using (HttpClient httpclient = new HttpClient()) { - if (response.Data != null) + HttpResponseMessage response; + response = await httpclient.PostAsync( + "https://api.abinteractive.net/1/cck/validateKey", + new StringContent(JsonConvert.SerializeObject(new {Username = _username, AccessKey = _key}), + Encoding.UTF8, "application/json") + ); + + if (response.IsSuccessStatusCode) { - _apiUserRank = response.Data.UserRank; - Debug.Log("[ABI:CCK] Successfully authenticated as " + _username + " using AlphaLink Public API."); - EditorPrefs.SetString("m_ABI_Username", _username); - EditorPrefs.SetString("m_ABI_Key", _key); - _loggedIn = true; - _hasAttemptedToLogin = false; + string result = await response.Content.ReadAsStringAsync(); + BaseResponse usr = Abi.Newtonsoft.Json.JsonConvert.DeserializeObject>(result); + + if (usr == null || usr.Data == null) return; + + if (usr.Data.isValidCredentials) + { + _apiUserRank = usr.Data.userRank; + Debug.Log("[ABI:CCK] Successfully authenticated as " + _username + " using AlphaLink Public API."); + EditorPrefs.SetString("m_ABI_Username", _username); + EditorPrefs.SetString("m_ABI_Key", _key); + _loggedIn = true; + _hasAttemptedToLogin = false; + } + else + { + Debug.Log("[ABI:CCK] Unable to authenticate using provided credentials. API responded with: " + usr.Message + "."); + _loggedIn = false; + _hasAttemptedToLogin = true; + _username = _key = string.Empty; + } } else { - Debug.Log("[ABI:CCK] Unable to authenticate using provided credentials. API responded with: " + response.Message + "."); - _loggedIn = false; - _hasAttemptedToLogin = true; - _username = _key = string.Empty; + Debug.LogError("[ABI:CCK] Web Request Error while trying to authenticate."); } } _attemptingToLogin = false; } } } + + public class LoginResponse + { + public bool isValidCredentials { get; set; } + public bool isAccountUnlocked { get; set; } + public string userId { get; set; } + public string userRank { get; set; } + } + + public class BaseResponse + { + public string Message { get; set; } + public T Data { get; set; } + + public BaseResponse(string message = null, T data = default) + { + Message = message; + Data = data; + } + + public override string ToString() + { + return JsonConvert.SerializeObject(this); + } + } } \ No newline at end of file diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_BuildUtility.cs b/Assets/ABI.CCK/Scripts/Editor/CCK_BuildUtility.cs index 1aa6f27..30ea1a2 100755 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_BuildUtility.cs +++ b/Assets/ABI.CCK/Scripts/Editor/CCK_BuildUtility.cs @@ -1,14 +1,11 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.Threading.Tasks; using ABI.CCK.Components; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; -using Random = System.Random; namespace ABI.CCK.Scripts.Editor { @@ -16,10 +13,8 @@ namespace ABI.CCK.Scripts.Editor { public static PreAvatarBundleEvent PreAvatarBundleEvent = new PreAvatarBundleEvent(); public static PrePropBundleEvent PrePropBundleEvent = new PrePropBundleEvent(); - - public static string upload_id = ""; - public static async Task BuildAndUploadAvatar(GameObject avatarObject) + public static void BuildAndUploadAvatar(GameObject avatarObject) { //GameObject avatarCopy = null; var origInfo = avatarObject.GetComponent(); @@ -38,35 +33,17 @@ namespace ABI.CCK.Scripts.Editor //CVRAssetInfo info = avatarCopy.GetComponent(); if (string.IsNullOrEmpty(origInfo.objectId)) { -#if UNITY_EDITOR - APIConnection.Initialize(EditorPrefs.GetString("m_ABI_Username"), EditorPrefs.GetString("m_ABI_Key")); -#endif - - APIConnection.BaseResponse response = await APIConnection.MakeRequest("cck/generate/avatar", put: true); - - if (response != null && response.Data != null) + origInfo.objectId = Guid.NewGuid().ToString(); + //origInfo.guid = info.guid; + try { - origInfo.objectId = response.Data.Id.ToString(); + PrefabUtility.ApplyPrefabInstance(avatarObject, InteractionMode.UserAction); } - else + catch { - Debug.LogError($"[CCK:BuildUtility] New Guid could not be generated"); + Debug.Log("[CCK:BuildUtility] Object is not a prefab. No need to Apply To Instance."); } } - - Random rnd = new Random(); - origInfo.randomNum = rnd.Next(11111111, 99999999).ToString(); - - EditorUtility.SetDirty(origInfo); - - try - { - PrefabUtility.ApplyPrefabInstance(avatarObject, InteractionMode.UserAction); - } - catch - { - Debug.Log("[CCK:BuildUtility] Object is not a prefab. No need to Apply To Instance."); - } PreAvatarBundleEvent.Invoke(avatarObject); @@ -74,10 +51,7 @@ namespace ABI.CCK.Scripts.Editor EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene()); - if (!Application.unityVersion.Contains("2021")) - PrefabUtility.SaveAsPrefabAsset(avatarObject, "Assets/ABI.CCK/Resources/Cache/_CVRAvatar.prefab"); - else - PrefabUtility.SaveAsPrefabAsset(avatarObject, $"Assets/ABI.CCK/Resources/Cache/CVRAvatar_{origInfo.objectId}_{origInfo.randomNum}.prefab"); + PrefabUtility.SaveAsPrefabAsset(avatarObject, "Assets/ABI.CCK/Resources/Cache/_CVRAvatar.prefab"); //GameObject.DestroyImmediate(avatarCopy); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); @@ -85,19 +59,11 @@ namespace ABI.CCK.Scripts.Editor EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene()); AssetBundleBuild assetBundleBuild = new AssetBundleBuild(); - if (!Application.unityVersion.Contains("2021")) - assetBundleBuild.assetNames = new[] {"Assets/ABI.CCK/Resources/Cache/_CVRAvatar.prefab"}; - else - assetBundleBuild.assetNames = new[] {$"Assets/ABI.CCK/Resources/Cache/CVRAvatar_{origInfo.objectId}_{origInfo.randomNum}.prefab"}; - - upload_id = origInfo.objectId; - EditorPrefs.SetString("m_ABI_uploadId", upload_id); - EditorPrefs.SetString("m_ABI_uploadRand", origInfo.randomNum); - - assetBundleBuild.assetBundleName = $"cvravatar_{origInfo.objectId}_{origInfo.randomNum}.cvravatar"; + assetBundleBuild.assetNames = new[] {"Assets/ABI.CCK/Resources/Cache/_CVRAvatar.prefab"}; + assetBundleBuild.assetBundleName = "bundle.cvravatar"; BuildPipeline.BuildAssetBundles(Application.persistentDataPath, new[] {assetBundleBuild}, - BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget); + BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget); AssetDatabase.Refresh(); @@ -105,35 +71,13 @@ namespace ABI.CCK.Scripts.Editor EditorApplication.isPlaying = true; } - public static async Task BuildAndUploadSpawnable(GameObject s) + public static void BuildAndUploadSpawnable(GameObject s) { GameObject sCopy = null; var origInfo = s.GetComponent(); var spawnable = s.GetComponent(); spawnable.spawnableType = CVRSpawnable.SpawnableType.StandaloneSpawnable; - if (string.IsNullOrEmpty(origInfo.objectId)) - { -#if UNITY_EDITOR - APIConnection.Initialize(EditorPrefs.GetString("m_ABI_Username"), EditorPrefs.GetString("m_ABI_Key")); -#endif - - APIConnection.BaseResponse response = await APIConnection.MakeRequest("cck/generate/spawnable", put: true); - - if (response != null && response.Data != null) - { - origInfo.objectId = response.Data.Id.ToString(); - } - else - { - Debug.LogError($"[CCK:BuildUtility] New Guid could not be generated"); - } - } - - Random rnd = new Random(); - origInfo.randomNum = rnd.Next(11111111, 99999999).ToString(); - EditorUtility.SetDirty(origInfo); - PrePropBundleEvent.Invoke(s); try @@ -148,25 +92,25 @@ namespace ABI.CCK.Scripts.Editor } CVRAssetInfo info = sCopy.GetComponent(); - - try + if (string.IsNullOrEmpty(info.objectId)) { - PrefabUtility.ApplyPrefabInstance(s, InteractionMode.UserAction); - } - catch - { - Debug.Log("[CCK:BuildUtility] Object is not a prefab. No need to Apply To Instance."); + info.objectId = Guid.NewGuid().ToString(); + origInfo.objectId = info.objectId; + try + { + PrefabUtility.ApplyPrefabInstance(s, InteractionMode.UserAction); + } + catch + { + Debug.Log("[CCK:BuildUtility] Object is not a prefab. No need to Apply To Instance."); + } } EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene()); - if (!Application.unityVersion.Contains("2021")) - PrefabUtility.SaveAsPrefabAsset(sCopy, "Assets/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab"); - else - PrefabUtility.SaveAsPrefabAsset(sCopy, $"Assets/ABI.CCK/Resources/Cache/CVRSpawnable_{origInfo.objectId}_{origInfo.randomNum}.prefab"); - + PrefabUtility.SaveAsPrefabAsset(sCopy, "Assets/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab"); GameObject.DestroyImmediate(sCopy); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); @@ -174,20 +118,11 @@ namespace ABI.CCK.Scripts.Editor EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene()); AssetBundleBuild assetBundleBuild = new AssetBundleBuild(); - - if (!Application.unityVersion.Contains("2021")) - assetBundleBuild.assetNames = new[] {"Assets/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab"}; - else - assetBundleBuild.assetNames = new[] {$"Assets/ABI.CCK/Resources/Cache/CVRSpawnable_{origInfo.objectId}_{origInfo.randomNum}.prefab"}; - - upload_id = origInfo.objectId; - EditorPrefs.SetString("m_ABI_uploadId", upload_id); - EditorPrefs.SetString("m_ABI_uploadRand", origInfo.randomNum); - - assetBundleBuild.assetBundleName = $"cvrspawnable_{origInfo.objectId}_{origInfo.randomNum}.cvrprop"; + assetBundleBuild.assetNames = new[] {"Assets/ABI.CCK/Resources/Cache/_CVRSpawnable.prefab"}; + assetBundleBuild.assetBundleName = "bundle.cvrprop"; BuildPipeline.BuildAssetBundles(Application.persistentDataPath, new[] {assetBundleBuild}, - BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget); + BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget); AssetDatabase.Refresh(); @@ -195,35 +130,17 @@ namespace ABI.CCK.Scripts.Editor EditorApplication.isPlaying = true; } - public static async Task BuildAndUploadMapAsset(Scene scene, GameObject descriptor) + public static void BuildAndUploadMapAsset(Scene scene, GameObject descriptor) { SetupNetworkUUIDs(); - - CVRAssetInfo info = descriptor.GetComponent(); - - if (string.IsNullOrEmpty(info.objectId)) - { -#if UNITY_EDITOR - APIConnection.Initialize(EditorPrefs.GetString("m_ABI_Username"), EditorPrefs.GetString("m_ABI_Key")); -#endif - - APIConnection.BaseResponse response = await APIConnection.MakeRequest("cck/generate/world", put: true); - if (response != null && response.Data != null) - { - info.objectId = response.Data.Id.ToString(); - EditorUtility.SetDirty(info); - } - else - { - Debug.LogError($"[CCK:BuildUtility] New Guid could not be generated"); - } - } - EditorSceneManager.MarkSceneDirty(scene); EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene()); - + + CVRAssetInfo info = descriptor.GetComponent(); + if (string.IsNullOrEmpty(info.objectId)) info.objectId = Guid.NewGuid().ToString(); + PrefabUtility.SaveAsPrefabAsset(descriptor, "Assets/ABI.CCK/Resources/Cache/_CVRWorld.prefab"); AssetBundleBuild assetBundleBuild = new AssetBundleBuild(); @@ -231,7 +148,7 @@ namespace ABI.CCK.Scripts.Editor assetBundleBuild.assetBundleName = "bundle.cvrworld"; BuildPipeline.BuildAssetBundles(Application.persistentDataPath, new[] {assetBundleBuild}, - BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget); + BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget); AssetDatabase.Refresh(); diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_CVRAnimatorDriverEditor.cs b/Assets/ABI.CCK/Scripts/Editor/CCK_CVRAnimatorDriverEditor.cs index 64ac452..c5f8391 100755 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_CVRAnimatorDriverEditor.cs +++ b/Assets/ABI.CCK/Scripts/Editor/CCK_CVRAnimatorDriverEditor.cs @@ -109,33 +109,18 @@ namespace ABI.CCK.Scripts.Editor if (_driver.animators[index] != null && _driver.animators[index].runtimeAnimatorController != null) { - var runtimeController = _driver.animators[index].runtimeAnimatorController; - UnityEngine.AnimatorControllerParameter[] parameters = null; + var controller = (AnimatorController) _driver.animators[index].runtimeAnimatorController; + foreach (var parameter in controller.parameters) + { + animatorParamNameList.Add(parameter.name); + animatorParamTypeList.Add(parameter.type); - if (runtimeController is AnimatorController animatorController) - { - parameters = animatorController.parameters; - } - else if (runtimeController is AnimatorOverrideController overrideController && - overrideController.runtimeAnimatorController is AnimatorController baseController) - { - parameters = baseController.parameters; - } - - if (parameters != null) - { - foreach (var parameter in parameters) + if (_driver.animatorParameters[index] == parameter.name) { - animatorParamNameList.Add(parameter.name); - animatorParamTypeList.Add(parameter.type); - - if (_driver.animatorParameters[index] == parameter.name) - { - oldIndex = i; - } - - i++; + oldIndex = i; } + + i++; } } diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_CVRAvatarEditor.cs b/Assets/ABI.CCK/Scripts/Editor/CCK_CVRAvatarEditor.cs index 9f47d49..7370a11 100755 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_CVRAvatarEditor.cs +++ b/Assets/ABI.CCK/Scripts/Editor/CCK_CVRAvatarEditor.cs @@ -105,9 +105,6 @@ namespace ABI.CCK.Scripts.Editor _avatar.visemeMode = (CVRAvatar.CVRAvatarVisemeMode) EditorGUILayout.EnumPopup("Lip Sync Mode", _avatar.visemeMode); - if (_avatar.visemeMode == CVRAvatar.CVRAvatarVisemeMode.Visemes) - _avatar.visemeSmoothing = EditorGUILayout.IntSlider("Viseme Smoothing", _avatar.visemeSmoothing, 0, 100); - if (_avatar.visemeBlendshapes == null || _avatar.visemeBlendshapes.Length != _visemeNames.Length) _avatar.visemeBlendshapes = new string[_visemeNames.Length]; @@ -156,7 +153,7 @@ namespace ABI.CCK.Scripts.Editor if (_avatar.enableAdvancedTagging) { - EditorGUILayout.HelpBox("If you are using the Advanced Tagging System, you do not need to Tag your Avatar appropriately if you mark all affected GameObjects here.", MessageType.Info); + EditorGUILayout.HelpBox("Attention! If you are using the Advanced Tagging System, you still need to Tag your Avatar appropriately and Set all affected GameObjects here.", MessageType.Warning); if (taggingList == null) InitializeTaggingList(); taggingList.DoLayoutList(); @@ -432,7 +429,7 @@ namespace ABI.CCK.Scripts.Editor float height = 10.50f; if (gameObjectToggle.useAnimationClip) { - //height -= 1.25f; + height -= 1.25f; } else { @@ -784,15 +781,6 @@ namespace ABI.CCK.Scripts.Editor _rect.x += 100; _rect.width = rect.width - 100; gameObjectToggle.animationClip = (AnimationClip)EditorGUI.ObjectField(_rect, gameObjectToggle.animationClip, typeof(AnimationClip), true); - - rect.y += EditorGUIUtility.singleLineHeight * 1.25f; - _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight); - - // Animation Clip Slot - EditorGUI.LabelField(_rect, "Off Clip"); - _rect.x += 100; - _rect.width = rect.width - 100; - gameObjectToggle.offAnimationClip = (AnimationClip)EditorGUI.ObjectField(_rect, gameObjectToggle.offAnimationClip, typeof(AnimationClip), true); } else { diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_CVRInteractableEditor.cs b/Assets/ABI.CCK/Scripts/Editor/CCK_CVRInteractableEditor.cs index 11e9d61..67a9f60 100755 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_CVRInteractableEditor.cs +++ b/Assets/ABI.CCK/Scripts/Editor/CCK_CVRInteractableEditor.cs @@ -455,12 +455,6 @@ namespace ABI.CCK.Scripts.Editor break; - case CVRInteractableActionOperation.ActionType.DisplaySpawnableDetailPage: - - trigger.operations[j].stringVal = EditorGUILayout.TextField("Spawnable GUID:", trigger.operations[j].stringVal); - - break; - case CVRInteractableActionOperation.ActionType.SitAtPosition: trigger.operations[j].gameObjectVal = (GameObject)EditorGUILayout.ObjectField( diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_CVR_VideoPlayerEditor.cs b/Assets/ABI.CCK/Scripts/Editor/CCK_CVR_VideoPlayerEditor.cs index f730de4..e580f75 100755 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_CVR_VideoPlayerEditor.cs +++ b/Assets/ABI.CCK/Scripts/Editor/CCK_CVR_VideoPlayerEditor.cs @@ -133,7 +133,7 @@ public class CCK_CVR_VideoPlayerEditor : Editor { #region General settings - _showGeneral = EditorGUILayout.Foldout(_showGeneral, "General"); + _showGeneral = EditorGUILayout.BeginFoldoutHeaderGroup(_showGeneral, "General"); if (_showGeneral) { _player.syncEnabled = EditorGUILayout.Toggle("Network Sync", _player.syncEnabled); @@ -170,11 +170,14 @@ public class CCK_CVR_VideoPlayerEditor : Editor EditorGUILayout.Space(); } + EditorGUILayout.EndFoldoutHeaderGroup(); + #endregion #region Audio settings - _showAudio = EditorGUILayout.Foldout(_showAudio, "Audio"); + _showAudio = EditorGUILayout.BeginFoldoutHeaderGroup(_showAudio, "Audio"); + if (_showAudio) { _player.playbackVolume = EditorGUILayout.Slider("Playback Volume", _player.playbackVolume, 0.0f, 1.0f); @@ -187,12 +190,15 @@ public class CCK_CVR_VideoPlayerEditor : Editor EditorGUILayout.Space(); } - + + EditorGUILayout.EndFoldoutHeaderGroup(); + #endregion #region Playlists - _showPlaylists = EditorGUILayout.Foldout(_showPlaylists, "Playlists"); + _showPlaylists = EditorGUILayout.BeginFoldoutHeaderGroup(_showPlaylists, "Playlists"); + if (_showPlaylists) { EditorGUILayout.LabelField(new GUIContent("Play On Awake Object", "Default video to play on start/awake"), new GUIContent(_player.playOnAwakeObject?.videoTitle)); @@ -205,11 +211,14 @@ public class CCK_CVR_VideoPlayerEditor : Editor EditorGUILayout.Space(); } + EditorGUILayout.EndFoldoutHeaderGroup(); + #endregion #region Events _showEvents = EditorGUILayout.BeginFoldoutHeaderGroup(_showEvents, "Events"); + if (_showEvents) { serializedObject.Update(); @@ -229,6 +238,8 @@ public class CCK_CVR_VideoPlayerEditor : Editor serializedObject.ApplyModifiedProperties(); EditorGUILayout.Space(); } + + EditorGUILayout.EndFoldoutHeaderGroup(); #endregion } diff --git a/Assets/ABI.CCK/Scripts/Editor/CCK_Init.cs b/Assets/ABI.CCK/Scripts/Editor/CCK_Init.cs index 670ac10..e5aa217 100755 --- a/Assets/ABI.CCK/Scripts/Editor/CCK_Init.cs +++ b/Assets/ABI.CCK/Scripts/Editor/CCK_Init.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; -using UnityEngine.XR; #pragma warning disable @@ -15,25 +13,13 @@ public class CCK_Init void SetTag(SerializedProperty tags, string name, int index) { - SerializedProperty sp = null; - try - { - sp = tags.GetArrayElementAtIndex(index); - } - catch{} - + SerializedProperty sp = tags.GetArrayElementAtIndex(index); if (sp != null) sp.stringValue = name; } void SetLayer(SerializedProperty layers, string name, int index) { - SerializedProperty sp = null; - try - { - sp = layers.GetArrayElementAtIndex(index); - } - catch{} - + SerializedProperty sp = layers.GetArrayElementAtIndex(index); if (sp != null) sp.stringValue = name; } @@ -87,33 +73,17 @@ public class CCK_Init tagManager.ApplyModifiedProperties(); } -#if UNITY_2021_1_OR_NEWER - if (true) -#else if (!PlayerSettings.virtualRealitySupported) -#endif { Debug.Log("[CCK:Init] XR and render settings have to be changed. Now changing."); -#if PLATFORM_ANDROID - if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android) - EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.Android); -#else - if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.StandaloneWindows64) - EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); -#endif + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); PlayerSettings.colorSpace = UnityEngine.ColorSpace.Linear; PlayerSettings.apiCompatibilityLevel = ApiCompatibilityLevel.NET_4_6; -#if UNITY_2021_1_OR_NEWER - PlayerSettings.virtualRealitySupported = true; - PlayerSettings.stereoRenderingPath = StereoRenderingPath.Instancing; - XRSettings.enabled = false; -#else PlayerSettings.virtualRealitySupported = true; PlayerSettings.SetVirtualRealitySDKs(BuildTargetGroup.Standalone, new string[] { "None", "Oculus", "OpenVR", "MockHMD" }); PlayerSettings.stereoRenderingPath = StereoRenderingPath.SinglePass; -#endif } if (LayerMask.LayerToName(10) == "PlayerNetwork" && LayerMask.LayerToName(17) == "CVRPickup" && LayerMask.LayerToName(15) == "CVRReserved4" && PlayerSettings.virtualRealitySupported ) diff --git a/Assets/ABI.CCK/Scripts/Runtime/CCK_RuntimeUploaderMaster.cs b/Assets/ABI.CCK/Scripts/Runtime/CCK_RuntimeUploaderMaster.cs index 59ee6af..e843c8a 100755 --- a/Assets/ABI.CCK/Scripts/Runtime/CCK_RuntimeUploaderMaster.cs +++ b/Assets/ABI.CCK/Scripts/Runtime/CCK_RuntimeUploaderMaster.cs @@ -33,17 +33,17 @@ namespace ABI.CCK.Scripts.Runtime var overwritePic = string.Empty; if (!File.Exists($"{Application.persistentDataPath}/bundle.png")) gameObject.GetComponent().SaveTexture(updater.camObj.GetComponent(), updater.tex); - StartCoroutine(UploadAssetAndSendInformation(updater.asset.objectId, type.ToString(), sfwLevel, updater.assetName.text, updater.assetDesc.text, updater.dontOverridePicture.isOn, updater.asset.randomNum)); + StartCoroutine(UploadAssetAndSendInformation(updater.asset.GetComponent().objectId, type.ToString(), sfwLevel, updater.assetName.text, updater.assetDesc.text, updater.dontOverridePicture.isOn)); } - private IEnumerator UploadAssetAndSendInformation(string contentId, string type, string sfwLevel, string assetName, string assetDesc, bool overwritePic, string randomNum) + private IEnumerator UploadAssetAndSendInformation(string contentId, string type, string sfwLevel, string assetName, string assetDesc, bool overwritePic) { string[] path = null; if (type == "Avatar") { path = new string[3]; - path[0] = $"file://{Application.persistentDataPath}/cvravatar_{contentId}_{randomNum}.cvravatar"; - path[1] = $"file://{Application.persistentDataPath}/cvravatar_{contentId}_{randomNum}.cvravatar.manifest"; + path[0] = $"file://{Application.persistentDataPath}/bundle.cvravatar"; + path[1] = $"file://{Application.persistentDataPath}/bundle.cvravatar.manifest"; path[2] = $"file://{Application.persistentDataPath}/bundle.png"; } if (type == "World") @@ -58,8 +58,8 @@ namespace ABI.CCK.Scripts.Runtime if (type == "Spawnable") { path = new string[3]; - path[0] = $"file://{Application.persistentDataPath}/cvrspawnable_{contentId}_{randomNum}.cvrprop"; - path[1] = $"file://{Application.persistentDataPath}/cvrspawnable_{contentId}_{randomNum}.cvrprop.manifest"; + path[0] = $"file://{Application.persistentDataPath}/bundle.cvrprop"; + path[1] = $"file://{Application.persistentDataPath}/bundle.cvrprop.manifest"; path[2] = $"file://{Application.persistentDataPath}/bundle.png"; } @@ -77,13 +77,6 @@ namespace ABI.CCK.Scripts.Runtime form.AddField("ContentDescription", assetDesc); form.AddField("ContentChangelog", updater.assetChangelog.text); -#if PLATFORM_ANDROID - form.AddField("Platform", "android_standalone"); -#else - form.AddField("Platform", "pc_standalone"); -#endif - form.AddField("CompatibilityVersion", Application.unityVersion.Contains("2021") ? 2 : 1); - if (updater.LoudAudio.isOn) form.AddField("Tag_LoudAudio", 1); if (updater.LongRangeAudio.isOn) form.AddField("Tag_LongRangeAudio", 1); if (updater.ContainsMusic.isOn) form.AddField("Tag_ContainsMusic", 1); diff --git a/Assets/ABI.CCK/Scripts/Runtime/CCK_RuntimeVariableStream.cs b/Assets/ABI.CCK/Scripts/Runtime/CCK_RuntimeVariableStream.cs index 091fd2c..0d938e2 100755 --- a/Assets/ABI.CCK/Scripts/Runtime/CCK_RuntimeVariableStream.cs +++ b/Assets/ABI.CCK/Scripts/Runtime/CCK_RuntimeVariableStream.cs @@ -2,7 +2,6 @@ using System; using System.Collections; using System.Net.Http; using System.Text; -using System.Threading.Tasks; using Abi.Newtonsoft.Json; using UnityEditor; using UnityEngine; @@ -20,77 +19,164 @@ namespace ABI.CCK.Scripts.Runtime { OnGuiUpdater updater = gameObject.GetComponent(); string type = updater.asset.type.ToString(); - string uploadRegion = "0"; -#if UNITY_EDITOR - APIConnection.Initialize(EditorPrefs.GetString("m_ABI_Username"), EditorPrefs.GetString("m_ABI_Key")); - EditorPrefs.GetInt("ABI_PREF_UPLOAD_REGION").ToString(); -#endif - - Task> task = Task.Run(() => APIConnection.MakeRequest( - $"cck/contentInfo/{type}/{updater.asset.objectId}?platform=pc_standalone®ion={uploadRegion}")); - - while (!task.IsCompleted) yield return null; - APIConnection.BaseResponse response = task.Result; - - if (response != null) + using (HttpClient httpclient = new HttpClient()) { - if (response.Data != null) - { - updater.UploadLocation = response.Data.UploadLocation; - - Debug.Log($"Upload Location: {updater.UploadLocation}"); - - updater.assetName.text = response.Data.ContentData.Name; - updater.assetDesc.text = response.Data.ContentData.Description; - - updater.LoudAudio.isOn = response.Data.ContentData.Tags.LoudAudio; - updater.LongRangeAudio.isOn = response.Data.ContentData.Tags.LongRangeAudio; - updater.SpawnAudio.isOn = response.Data.ContentData.Tags.SpawnAudio; - updater.ContainsMusic.isOn = response.Data.ContentData.Tags.ContainsMusic; - - updater.ScreenEffects.isOn = response.Data.ContentData.Tags.ScreenEffects; - updater.FlashingColors.isOn = response.Data.ContentData.Tags.FlashingColors; - updater.FlashingLights.isOn = response.Data.ContentData.Tags.FlashingLights; - updater.ExtremelyBright.isOn = response.Data.ContentData.Tags.ExtremelyBright; - updater.ParticleSystems.isOn = response.Data.ContentData.Tags.ParticleSystems; - - updater.Violence.isOn = response.Data.ContentData.Tags.Violence; - updater.Gore.isOn = response.Data.ContentData.Tags.Gore; - updater.Horror.isOn = response.Data.ContentData.Tags.Horror; - updater.Jumpscare.isOn = response.Data.ContentData.Tags.Jumpscare; - - updater.ExcessivelySmall.isOn = response.Data.ContentData.Tags.ExtremelySmall; - updater.ExcessivelyHuge.isOn = response.Data.ContentData.Tags.ExtremelyHuge; - - updater.Suggestive.isOn = response.Data.ContentData.Tags.Suggestive; - updater.Nudity.isOn = response.Data.ContentData.Tags.Nudity; - } - else - { + HttpResponseMessage response; + response = httpclient.PostAsync( + "https://api.abinteractive.net/1/cck/parameterStream", + new StringContent(JsonConvert.SerializeObject(new + { + ContentType = type, ContentId = updater.asset.objectId, #if UNITY_EDITOR - EditorUtility.ClearProgressBar(); - if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK", - response.Message, "Okay")) + Username = EditorPrefs.GetString("m_ABI_Username"), + AccessKey = EditorPrefs.GetString("m_ABI_Key"), + UploadRegion = EditorPrefs.GetInt("ABI_PREF_UPLOAD_REGION").ToString() +#endif + }), + Encoding.UTF8, "application/json") + ).GetAwaiter().GetResult(); + + if (response.IsSuccessStatusCode) + { + string result = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); + BaseResponse streamResponse = Abi.Newtonsoft.Json.JsonConvert .DeserializeObject>(result); + + + + if (streamResponse == null || streamResponse.Data == null) { - EditorApplication.isPlaying = false; - } -#endif - yield break; - } - } - else - { #if UNITY_EDITOR - EditorUtility.ClearProgressBar(); - if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK", - "An Error occured while uploading. Please try again later.", "Okay")) - { - EditorApplication.isPlaying = false; - } + EditorUtility.ClearProgressBar(); + if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK", + "Request failed. Unable to connect to the Gateway. The Gateway might be unavailable. Check https://status.abinteractive.net for more info.", + "Okay")) + { + EditorApplication.isPlaying = false; + } #endif - yield break; + yield break; + } + + if (!streamResponse.Data.HasPermission) + { +#if UNITY_EDITOR + EditorUtility.ClearProgressBar(); + if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK", + "Request failed. The provided content ID does not belong to your account.", "Okay")) + { + EditorApplication.isPlaying = false; + } +#endif + yield break; + } + + if (streamResponse.Data.IsAtUploadLimit) + { +#if UNITY_EDITOR + EditorUtility.ClearProgressBar(); + if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK", + "Request failed. Your account has reached the upload limit. Please consider buying the Unlocked account.", + "Okay")) + { + EditorApplication.isPlaying = false; + } +#endif + } + + if (streamResponse.Data.IsBannedFromUploading) + { +#if UNITY_EDITOR + EditorUtility.ClearProgressBar(); + if (UnityEditor.EditorUtility.DisplayDialog("Alpha Blend Interactive CCK", + "Request failed. Your upload permissions are suspended. For more information, consult your moderation profile in the ABI community hub.", + "Okay")) + { + EditorApplication.isPlaying = false; + } +#endif + } + + updater.UploadLocation = streamResponse.Data.UploadLocation; + + updater.assetName.text = streamResponse.Data.ObjectName; + updater.assetDesc.text = streamResponse.Data.ObjectDescription; + + updater.LoudAudio.isOn = streamResponse.Data.LoudAudio; + updater.LongRangeAudio.isOn = streamResponse.Data.LongRangeAudio; + updater.SpawnAudio.isOn = streamResponse.Data.SpawnAudio; + updater.ContainsMusic.isOn = streamResponse.Data.ContainsMusic; + + updater.ScreenEffects.isOn = streamResponse.Data.ScreenFx; + updater.FlashingColors.isOn = streamResponse.Data.FlashingColors; + updater.FlashingLights.isOn = streamResponse.Data.FlashingLights; + updater.ExtremelyBright.isOn = streamResponse.Data.ExtremelyBright; + updater.ParticleSystems.isOn = streamResponse.Data.ParticleSystems; + + updater.Violence.isOn = streamResponse.Data.Violence; + updater.Gore.isOn = streamResponse.Data.Gore; + updater.Horror.isOn = streamResponse.Data.Horror; + updater.Jumpscare.isOn = streamResponse.Data.Jumpscare; + + updater.ExcessivelySmall.isOn = streamResponse.Data.ExtremelySmall; + updater.ExcessivelyHuge.isOn = streamResponse.Data.ExtremelyHuge; + + updater.Suggestive.isOn = streamResponse.Data.Suggestive; + updater.Nudity.isOn = streamResponse.Data.Nudity; + } } } } + + [Serializable] + public class VariableStreamResponse + { + public bool HasPermission { get; set; } + public bool IsAtUploadLimit { get; set; } + public bool IsBannedFromUploading { get; set; } + + public string UploadLocation { get; set; } + + public string ObjectName { get; set; } + public string ObjectDescription { get; set; } + + public bool LoudAudio { get; set; } + public bool LongRangeAudio { get; set; } + public bool SpawnAudio { get; set; } + public bool ContainsMusic { get; set; } + + public bool ScreenFx { get; set; } + public bool FlashingColors { get; set; } + public bool FlashingLights { get; set; } + public bool ExtremelyBright { get; set; } + public bool ParticleSystems { get; set; } + + public bool Violence { get; set; } + public bool Gore { get; set; } + public bool Horror { get; set; } + public bool Jumpscare { get; set; } + + public bool ExtremelySmall { get; set; } + public bool ExtremelyHuge { get; set; } + + public bool Suggestive { get; set; } + public bool Nudity { get; set; } + } + + public class BaseResponse + { + public string Message { get; set; } + public T Data { get; set; } + + public BaseResponse(string message = null, T data = default) + { + Message = message; + Data = data; + } + + public override string ToString() + { + return JsonConvert.SerializeObject(this); + } + } } \ No newline at end of file diff --git a/Assets/ABI.CCK/Scripts/Runtime/OnGuiUpdater.cs b/Assets/ABI.CCK/Scripts/Runtime/OnGuiUpdater.cs index 53acc58..61e2662 100755 --- a/Assets/ABI.CCK/Scripts/Runtime/OnGuiUpdater.cs +++ b/Assets/ABI.CCK/Scripts/Runtime/OnGuiUpdater.cs @@ -114,7 +114,7 @@ namespace ABI.CCK.Scripts.Runtime camObj.name = "ShotCam for CVR CCK"; camObj.transform.rotation = new Quaternion(0,180,0,0); CVRAvatar avatar = asset.GetComponent(); - if (avatar != null && asset.type == CVRAssetInfo.AssetType.Avatar) camObj.transform.position = new Vector3(avatar.viewPosition.x, avatar.viewPosition.y, avatar.viewPosition.z *= 5f); + if (asset.type == CVRAssetInfo.AssetType.Avatar) camObj.transform.position = new Vector3(avatar.viewPosition.x, avatar.viewPosition.y, avatar.viewPosition.z *= 5f); var cam = camObj.AddComponent(); cam.aspect = 1f; cam.nearClipPlane = 0.01f; @@ -125,23 +125,21 @@ namespace ABI.CCK.Scripts.Runtime #if UNITY_EDITOR #endif - - string content_id = asset.objectId; if (type == CVRAssetInfo.AssetType.Avatar) { - assetFileSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + $"/cvravatar_{content_id}_{asset.randomNum}.cvravatar").Length); + assetFileSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + "/bundle.cvravatar").Length); assetImageFileSizeText.text = "N/A"; - assetFileManifestSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + $"/cvravatar_{content_id}_{asset.randomNum}.cvravatar.manifest").Length); + assetFileManifestSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + "/bundle.cvravatar.manifest").Length); assetFilePano1SizeText.text = "N/A"; assetFilePano4SizeText.text = "N/A"; } if (type == CVRAssetInfo.AssetType.Spawnable) { - assetFileSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + $"/cvrspawnable_{content_id}_{asset.randomNum}.cvrprop").Length); + assetFileSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + "/bundle.cvrprop").Length); assetImageFileSizeText.text = ""; - assetFileManifestSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + $"/cvrspawnable_{content_id}_{asset.randomNum}.cvrprop.manifest").Length); + assetFileManifestSizeText.text = ToFileSizeString(new FileInfo(Application.persistentDataPath + "/bundle.cvrprop.manifest").Length); assetFilePano1SizeText.text = "N/A"; assetFilePano4SizeText.text = "N/A"; } diff --git a/Assets/ABI.CCK/Scripts/ShaderCompatibilityPreprocessor.cs b/Assets/ABI.CCK/Scripts/ShaderCompatibilityPreprocessor.cs index 6a5d006..ad15c79 100755 --- a/Assets/ABI.CCK/Scripts/ShaderCompatibilityPreprocessor.cs +++ b/Assets/ABI.CCK/Scripts/ShaderCompatibilityPreprocessor.cs @@ -16,9 +16,6 @@ public class ShaderCompatibilityPreprocessor : IPreprocessShaders public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList data) { -#if UNITY_2021_1_OR_NEWER - //Do nothing here -#else if(EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64) { List reworkedData = new List(); @@ -50,7 +47,6 @@ public class ShaderCompatibilityPreprocessor : IPreprocessShaders data.Add(entry); } } -#endif } } #endif \ No newline at end of file diff --git a/Assets/ABI.CCK/Textures/24718.renderTexture b/Assets/ABI.CCK/Textures/24718.renderTexture index 34f71a4..c44b4bd 100755 Binary files a/Assets/ABI.CCK/Textures/24718.renderTexture and b/Assets/ABI.CCK/Textures/24718.renderTexture differ diff --git a/Assets/test/FleshCube.shader b/Assets/test/FleshCube.shader index b000374..65c2f1c 100644 --- a/Assets/test/FleshCube.shader +++ b/Assets/test/FleshCube.shader @@ -26,7 +26,7 @@ // #define USE_WORLD_SPACE #define DYNAMIC_QUALITY #define USE_REFLECTIONS - // #define CONSTRAIN_TO_MESH + #define CONSTRAIN_TO_MESH #define MAX_REFLECTIONS 1 #include "RayMarchLib.cginc" @@ -58,12 +58,11 @@ o = sdfAdd(p, o, sdfSphere(p, 6 + bias*3, mRed), 5); // o = sdfInter(p, o, sdfSphere(p, 50, mat(0.04, 0.005, 0.035)), 1.1); - o = sdfInter(p, o, sdfBox(p, 20, mRed)); - // sdfData gyroid = o; - // o = sdfAdd(p, - // sdfInter(p, gyroid, sdfBox(p, 30, mRed)), - // sdfSub(p, gyroid, sdfBox(p, 30, mRed)) - // ); + sdfData gyroid = o; + o = sdfAdd(p, + sdfInter(p, gyroid, sdfBox(p, 30, mRed)), + sdfSub(p, gyroid, sdfBox(p, 30, mRed)) + ); // o = p, o, sdfBox(p, 20, mRed)); //sdfData bobby = sdfSphere(p, 51, col(0.5, 0.25, 0.001)); //bobby = sdfAdd(p, bobby, sdfSphere(p, 50.5, col(.5,.01,.01))); @@ -82,18 +81,17 @@ if (ray.bMissed) { // discard; - // return fogCol; - return 0; + return fogCol; } fixed4 col = 0; col += ray.mat.col * lightSun(ray.vNorm, vSunDir, col(5, 2, 0.1)); col += ray.mat.col * lightSky(ray.vNorm, 1); - // col *= lightAO(ray.vHit, ray.vNorm, 0.05); + col *= lightAO(ray.vHit, ray.vNorm, 0.05); - // col = pow(col, 0.7); - // col = lightFog(col, fogCol, ray.dist, 0.5, 16); + col = pow(col, 0.7); + col = lightFog(col, fogCol, ray.dist, 0.5, 16); return col; } ENDCG