deltavr multiplayer 2.0
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
using UnityEngine.Analytics;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
#if DEBUG_XRC_EDITOR_ANALYTICS
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace UnityEngine.XR.Content.Interaction.Analytics
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for <c>XRContent</c> editor events.
|
||||
/// </summary>
|
||||
abstract class EditorEvent
|
||||
{
|
||||
protected const int k_DefaultMaxEventsPerHour = 1000;
|
||||
protected const int k_DefaultMaxElementCount = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// The event name determines which database table it goes into in the CDP backend.
|
||||
/// All events which we want grouped into a table must share the same event name.
|
||||
/// </summary>
|
||||
readonly string m_EventName;
|
||||
|
||||
readonly int m_MaxEventsPerHour;
|
||||
readonly int m_MaxElementCount;
|
||||
|
||||
internal EditorEvent(string eventName, int maxPerHour = k_DefaultMaxEventsPerHour, int maxElementCount = k_DefaultMaxElementCount)
|
||||
{
|
||||
m_EventName = eventName;
|
||||
m_MaxEventsPerHour = maxPerHour;
|
||||
m_MaxElementCount = maxElementCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this method in the child classes to send an event.
|
||||
/// </summary>
|
||||
/// <param name="parameter">The parameter object within the event.</param>
|
||||
/// <returns>Returns whenever the event was successfully sent.</returns>
|
||||
protected bool Send(object parameter)
|
||||
{
|
||||
#if ENABLE_CLOUD_SERVICES_ANALYTICS
|
||||
// Analytics events will always refuse to send if analytics are disabled or the editor is for sure quitting
|
||||
if (XrcAnalytics.disabled || XrcAnalytics.quitting)
|
||||
return false;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
var result = EditorAnalytics.SendEventWithLimit(m_EventName, parameter);
|
||||
#else
|
||||
var result = AnalyticsResult.AnalyticsDisabled;
|
||||
#endif
|
||||
|
||||
#if DEBUG_XRC_EDITOR_ANALYTICS
|
||||
Debug.Log($"Event {m_EventName} : {parameter} sent with status {result}");
|
||||
#endif
|
||||
|
||||
return result == AnalyticsResult.Ok;
|
||||
#else // ENABLE_CLOUD_SERVICES_ANALYTICS
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal bool Register()
|
||||
{
|
||||
#if UNITY_EDITOR && ENABLE_CLOUD_SERVICES_ANALYTICS
|
||||
return EditorAnalytics.RegisterEventWithLimit(m_EventName, m_MaxEventsPerHour, m_MaxElementCount, XrcAnalytics.k_VendorKey) == AnalyticsResult.Ok;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 361f96375872bab42b1254af3fbc27e5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,453 @@
|
||||
using System;
|
||||
|
||||
namespace UnityEngine.XR.Content.Interaction.Analytics
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for interaction parameters.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
abstract class InteractionEventParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// The parameter unique name.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
protected string Name;
|
||||
|
||||
internal InteractionEventParameter()
|
||||
{
|
||||
Name = GetType().Name;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonUtility.ToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Scene Started Parameter
|
||||
[Serializable]
|
||||
sealed class SceneStarted : InteractionEventParameter
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Base class for station parameters. A station parameter has a <c>Station</c> and <c>Substaion</c> name.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
abstract class StationParameter : InteractionEventParameter
|
||||
{
|
||||
protected static class GrabInteractableStation
|
||||
{
|
||||
internal const string k_StationName = "GrabInteractable";
|
||||
|
||||
internal const string k_SimpleObjectSubstationName = "SimpleObject";
|
||||
internal const string k_WateringCanSubstationName = "WateringCan";
|
||||
internal const string k_PiggyBankSubstationName = "PiggyBank";
|
||||
internal const string k_RibbonStickSubstationName = "RibbonSitck";
|
||||
}
|
||||
|
||||
protected static class ActiveInteractableStation
|
||||
{
|
||||
internal const string k_StationName = "ActiveInteractable";
|
||||
|
||||
internal const string k_ActiveSimpleObjectSubstationName = "ActiveSimpleObject";
|
||||
internal const string k_CandleSubstationName = "Candle";
|
||||
internal const string k_LauncherSubstationName = "Launcher";
|
||||
internal const string k_MegaphoneSubstationName = "Megaphone";
|
||||
}
|
||||
|
||||
protected static class SocketInteractorStation
|
||||
{
|
||||
internal const string k_StationName = "SocketInteractors";
|
||||
|
||||
internal const string k_SimpleSocketSubstationName = "SocketSimpleObject";
|
||||
internal const string k_PerlerMachineSubstationName = "PerlerMachine";
|
||||
}
|
||||
|
||||
protected static class Interaction3DUIStation
|
||||
{
|
||||
internal const string k_StationName = "3DUIInteraction";
|
||||
|
||||
internal const string k_3DUISimpleControlsSubstationName = "3DUISimpleControls";
|
||||
internal const string k_ClawMachineSubstationName = "ClawMachine";
|
||||
}
|
||||
|
||||
protected static class PhysicsInteractableStation
|
||||
{
|
||||
internal const string k_StationName = "PhysicsInteraction";
|
||||
|
||||
internal const string k_PhysicsSimpleControlsSubstationName = "PhysicsSimpleControls";
|
||||
internal const string k_CabinetExampleSubstationName = "CabinetExample";
|
||||
internal const string k_DoorsExampleSubstationName = "DoorsExample";
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
protected string Station;
|
||||
|
||||
[SerializeField]
|
||||
protected string Substation;
|
||||
}
|
||||
|
||||
// Grab Simple Object Parameters
|
||||
[Serializable]
|
||||
abstract class SimpleObjectSubstation : StationParameter
|
||||
{
|
||||
internal SimpleObjectSubstation()
|
||||
{
|
||||
Station = GrabInteractableStation.k_StationName;
|
||||
Substation = GrabInteractableStation.k_SimpleObjectSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabSimpleObjectInstant : SimpleObjectSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabSimpleObjectKinematic : SimpleObjectSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabSimpleObjectVelocity : SimpleObjectSubstation
|
||||
{ }
|
||||
|
||||
// Watering Can Parameters
|
||||
[Serializable]
|
||||
abstract class WateringCanSubstation : StationParameter
|
||||
{
|
||||
internal WateringCanSubstation()
|
||||
{
|
||||
Station = GrabInteractableStation.k_StationName;
|
||||
Substation = GrabInteractableStation.k_WateringCanSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabWateringCan : WateringCanSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class WateringPlant : WateringCanSubstation
|
||||
{ }
|
||||
|
||||
// Piggy Bank Parameters
|
||||
[Serializable]
|
||||
abstract class PiggyBankSubstation : StationParameter
|
||||
{
|
||||
internal PiggyBankSubstation()
|
||||
{
|
||||
Station = GrabInteractableStation.k_StationName;
|
||||
Substation = GrabInteractableStation.k_PiggyBankSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabMallet : PiggyBankSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class BreakPiggyBank : PiggyBankSubstation
|
||||
{ }
|
||||
|
||||
// Grab Ribbon Stick Parameters
|
||||
[Serializable]
|
||||
sealed class GrabRibbonStick : StationParameter
|
||||
{
|
||||
internal GrabRibbonStick()
|
||||
{
|
||||
Station = GrabInteractableStation.k_StationName;
|
||||
Substation = GrabInteractableStation.k_RibbonStickSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
// Active Simple Object Parameters
|
||||
[Serializable]
|
||||
abstract class ActiveSimpleObjectSubstation : StationParameter
|
||||
{
|
||||
internal ActiveSimpleObjectSubstation()
|
||||
{
|
||||
Station = ActiveInteractableStation.k_StationName;
|
||||
Substation = ActiveInteractableStation.k_ActiveSimpleObjectSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabActiveSimpleObject : ActiveSimpleObjectSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class SimpleObjectActivated : ActiveSimpleObjectSubstation
|
||||
{ }
|
||||
|
||||
// Candle Parameters
|
||||
[Serializable]
|
||||
abstract class CandleSubstation : StationParameter
|
||||
{
|
||||
internal CandleSubstation()
|
||||
{
|
||||
Station = ActiveInteractableStation.k_StationName;
|
||||
Substation = ActiveInteractableStation.k_CandleSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabLighter : CandleSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class LighterActivated : CandleSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabCandle : CandleSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class LightCandle : CandleSubstation
|
||||
{ }
|
||||
|
||||
// Launcher Parameters
|
||||
[Serializable]
|
||||
abstract class LauncherSubstation : StationParameter
|
||||
{
|
||||
internal LauncherSubstation()
|
||||
{
|
||||
Station = ActiveInteractableStation.k_StationName;
|
||||
Substation = ActiveInteractableStation.k_LauncherSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabLauncher : LauncherSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class LauncherActivated : LauncherSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class LauncherEasyTargetHit : LauncherSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class LauncherMediumTargetHit : LauncherSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class LauncherHardTargetHit : LauncherSubstation
|
||||
{ }
|
||||
|
||||
// Megaphone Parameters
|
||||
[Serializable]
|
||||
abstract class MegaphoneSubstation : StationParameter
|
||||
{
|
||||
internal MegaphoneSubstation()
|
||||
{
|
||||
Station = ActiveInteractableStation.k_StationName;
|
||||
Substation = ActiveInteractableStation.k_MegaphoneSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabMegaphone : MegaphoneSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class MegaphoneActivated : MegaphoneSubstation
|
||||
{ }
|
||||
|
||||
// Socket Simple Object
|
||||
[Serializable]
|
||||
abstract class SimpleSocketSubstation : StationParameter
|
||||
{
|
||||
internal SimpleSocketSubstation()
|
||||
{
|
||||
Station = SocketInteractorStation.k_StationName;
|
||||
Substation = SocketInteractorStation.k_SimpleSocketSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class ConnectSocketSimpleObject : SimpleSocketSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class DisconnectSocketSimpleObject : SimpleSocketSubstation
|
||||
{ }
|
||||
|
||||
// Perler Machine
|
||||
[Serializable]
|
||||
abstract class PerlerMachineSubstation : StationParameter
|
||||
{
|
||||
internal PerlerMachineSubstation()
|
||||
{
|
||||
Station = SocketInteractorStation.k_StationName;
|
||||
Substation = SocketInteractorStation.k_PerlerMachineSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class ConnectPerlerMachineBattery : PerlerMachineSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabPerlerBead : PerlerMachineSubstation
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class ConnectPerlerBead : PerlerMachineSubstation
|
||||
{ }
|
||||
|
||||
// 3DUI Simple Controls
|
||||
[Serializable]
|
||||
abstract class SimpleControlsParameter : StationParameter
|
||||
{
|
||||
internal SimpleControlsParameter()
|
||||
{
|
||||
Station = Interaction3DUIStation.k_StationName;
|
||||
Substation = Interaction3DUIStation.k_3DUISimpleControlsSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class LeverInteraction : SimpleControlsParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class JoystickInteraction : SimpleControlsParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class DialInteraction : SimpleControlsParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class WheelInteraction : SimpleControlsParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class SliderInteraction : SimpleControlsParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GripButtonPressed : SimpleControlsParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class PushButtonPressed : SimpleControlsParameter
|
||||
{ }
|
||||
|
||||
// Claw Machine Parameters
|
||||
[Serializable]
|
||||
abstract class ClawMachineParameter : StationParameter
|
||||
{
|
||||
internal ClawMachineParameter()
|
||||
{
|
||||
Station = Interaction3DUIStation.k_StationName;
|
||||
Substation = Interaction3DUIStation.k_ClawMachineSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class ClawMachineJoystickInteraction : ClawMachineParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class ClawMachinePushButtonPressed : ClawMachineParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class ConnectClawMachineToPrize : ClawMachineParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabClawMachinePrize : ClawMachineParameter
|
||||
{ }
|
||||
|
||||
// Physics Simple Controls
|
||||
[Serializable]
|
||||
abstract class PhysicsSimpleControlsParameter : StationParameter
|
||||
{
|
||||
internal PhysicsSimpleControlsParameter()
|
||||
{
|
||||
Station = PhysicsInteractableStation.k_StationName;
|
||||
Substation = PhysicsInteractableStation.k_PhysicsSimpleControlsSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabSpringJoint : PhysicsSimpleControlsParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabHingeJoint : PhysicsSimpleControlsParameter
|
||||
{ }
|
||||
|
||||
// Cabinet Example
|
||||
[Serializable]
|
||||
abstract class CabinetExampleParameter : StationParameter
|
||||
{
|
||||
internal CabinetExampleParameter()
|
||||
{
|
||||
Station = PhysicsInteractableStation.k_StationName;
|
||||
Substation = PhysicsInteractableStation.k_CabinetExampleSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabCabinet1 : CabinetExampleParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabCabinet2 : CabinetExampleParameter
|
||||
{ }
|
||||
|
||||
// Doors Example
|
||||
[Serializable]
|
||||
abstract class DoorsExampleParameter : StationParameter
|
||||
{
|
||||
internal DoorsExampleParameter()
|
||||
{
|
||||
Station = PhysicsInteractableStation.k_StationName;
|
||||
Substation = PhysicsInteractableStation.k_DoorsExampleSubstationName;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class PushFlipDoor : DoorsExampleParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabDoorKey : DoorsExampleParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class DoorUnlocked : DoorsExampleParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class DoorLocked : DoorsExampleParameter
|
||||
{ }
|
||||
|
||||
[Serializable]
|
||||
sealed class GrabDoorHandle : DoorsExampleParameter
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Editor event used to send <c>XRContent</c> interaction analytics data.
|
||||
/// Only accepts <c>InteractionEventParameter</c> objects as parameter.
|
||||
/// </summary>
|
||||
class InteractionEvent : EditorEvent
|
||||
{
|
||||
const string k_EventName = "xrcInteraction";
|
||||
|
||||
internal InteractionEvent(int maxPerHour = k_DefaultMaxEventsPerHour, int maxElementCount = k_DefaultMaxElementCount)
|
||||
: base(k_EventName, maxPerHour, maxElementCount)
|
||||
{ }
|
||||
|
||||
internal bool Send(InteractionEventParameter parameter)
|
||||
{
|
||||
return parameter != null && base.Send(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14586b01c3c01004ba72418f6b2ed6c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user