Added the test LoginLogoutTest, which interacts with UI to login and logout.

This commit is contained in:
alexiscatnip
2022-01-15 23:03:42 +08:00
parent 4ca961b09b
commit a2e1acf74a
102 changed files with 12344 additions and 1103 deletions
+3 -1
View File
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise">
<file url="file://$PROJECT_DIR$/Assets/Tests/BinarySDTests.cs" charset="windows-1252" />
</component>
</project>
+2 -2
View File
@@ -9,7 +9,7 @@ using UnityEngine;
public class AddTouchGesturesHandler : MonoBehaviour
{
[SerializeField]
private MapUI mapUI;
private MapUIView mapUIView;
public GameObject mapUIGO;
[SerializeField]
@@ -94,7 +94,7 @@ public class AddTouchGesturesHandler : MonoBehaviour
{
Vector3 worldPoint = camera.ScreenToWorldPoint((Vector2)recognizer.touchLocation());
ulong regionCoords = Coverters.getRegionFromWorldPoint(worldPoint);
mapUI.getPresenter().OnMapClick(regionCoords);
mapUIView.getPresenter().OnMapClick(regionCoords);
//Debug.Log("tap recognizer fired: " + r);
};
TouchKit.addGestureRecognizer(recognizer);
+73
View File
@@ -0,0 +1,73 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Gameframe.GUI.Utility;
using JetBrains.Annotations;
using UnityEngine;
public class CamerasManager : MonoBehaviour
{
#region Monobehavior Singleton stuff
private static CamerasManager _instance;
public static CamerasManager Instance
{
get
{
if (_instance == null)
{
Debug.LogError("you forget to attach the singleton CamerasManager script.");
}
return _instance;
}
}
void Awake()
{
_instance = this;
DontDestroyOnLoad(this.gameObject);
}
#endregion
private Dictionary<string, Camera> cameras = new Dictionary<string, Camera>();
public Camera currentCam;
private void Start()
{
//get all cameras.
foreach(Transform child in transform)
{
RegisterCamera(child.gameObject);
}
}
private void RegisterCamera(GameObject childGameObject)
{
Camera cam = childGameObject.GetComponent<Camera>();
if (cam)
{
cameras.Add(childGameObject.name, cam);
}
}
//warn: silent failure
// return null if camera not found.
[CanBeNull]
public Camera ActivateCamera(string name)
{
Camera cam = cameras[name];
if (cam)
{
//1 deactive current
currentCam.gameObject.SetActive(false);
//2 active current
currentCam = cam;
cam.gameObject.SetActive(true);
}
return cam;
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f764335f78f0a604b9c150c1cfd2daae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+40
View File
@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using OpenMetaverse;
using Raindrop.Map.Model;
using Raindrop.ServiceLocator;
using UnityEngine;
public class FetchMapTile : MonoBehaviour
{
public int Grid_X = 1000;
public int Grid_Y = 1000;
private bool modified = true;
public TexturePlane image;
// Update is called once per frame
void Start()
{
SyncMapTile_blocking(image, Grid_X, Grid_Y);
modified = false;
}
//blocks until tex is successfully printed.
private void SyncMapTile_blocking(TexturePlane texturePlane, int gridX, int gridY)
{
MapFetcher mf = new MapFetcher();
MapTile mt = mf.GetRegionTileExternal(Utils.UIntsToLong(1000,1000), 1);
while (mt.isReady == false)
{
continue;
}
lock (mt.getTex())
{
texturePlane.ApplyTexture(mt.getTex());
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ab480bcc4ebf194d86a3c02fa6c0c81
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,452 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.3731193, g: 0.38073996, b: 0.35872698, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!114 &81118334
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d44e6804bc58be84ea71a619b468f150, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &293021976
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 293021979}
- component: {fileID: 293021978}
- component: {fileID: 293021977}
m_Layer: 0
m_Name: Code-based tests runner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &293021977
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 293021976}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3cf5cb9e1ef590c48b1f919f2a7bd895, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &293021978
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 293021976}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 102e512f651ee834f951a2516c1ea3b8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AssembliesWithTests:
- Tests
- UnityEngine.TestRunner
testStartedEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 293021977}
m_TargetAssemblyTypeName: UnityEngine.TestTools.TestRunner.Callbacks.PlayModeRunnerCallback,
UnityEngine.TestRunner
m_MethodName: TestStarted
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 81118334}
m_TargetAssemblyTypeName: UnityEditor.TestTools.TestRunner.TestRunnerCallback,
UnityEditor.TestRunner
m_MethodName: TestStarted
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1753937287}
m_TargetAssemblyTypeName: UnityEditor.TestTools.TestRunner.Api.CallbacksDelegatorListener,
UnityEditor.TestRunner
m_MethodName: TestStarted
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1889354441}
m_TargetAssemblyTypeName: UnityEngine.TestRunner.Utils.TestRunCallbackListener,
UnityEngine.TestRunner
m_MethodName: TestStarted
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
testFinishedEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 293021977}
m_TargetAssemblyTypeName: UnityEngine.TestTools.TestRunner.Callbacks.PlayModeRunnerCallback,
UnityEngine.TestRunner
m_MethodName: TestFinished
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 81118334}
m_TargetAssemblyTypeName: UnityEditor.TestTools.TestRunner.TestRunnerCallback,
UnityEditor.TestRunner
m_MethodName: TestFinished
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1753937287}
m_TargetAssemblyTypeName: UnityEditor.TestTools.TestRunner.Api.CallbacksDelegatorListener,
UnityEditor.TestRunner
m_MethodName: TestFinished
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1889354441}
m_TargetAssemblyTypeName: UnityEngine.TestRunner.Utils.TestRunCallbackListener,
UnityEngine.TestRunner
m_MethodName: TestFinished
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
runStartedEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 293021977}
m_TargetAssemblyTypeName: UnityEngine.TestTools.TestRunner.Callbacks.PlayModeRunnerCallback,
UnityEngine.TestRunner
m_MethodName: RunStarted
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 81118334}
m_TargetAssemblyTypeName: UnityEditor.TestTools.TestRunner.TestRunnerCallback,
UnityEditor.TestRunner
m_MethodName: RunStarted
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1753937287}
m_TargetAssemblyTypeName: UnityEditor.TestTools.TestRunner.Api.CallbacksDelegatorListener,
UnityEditor.TestRunner
m_MethodName: RunStarted
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1889354441}
m_TargetAssemblyTypeName: UnityEngine.TestRunner.Utils.TestRunCallbackListener,
UnityEngine.TestRunner
m_MethodName: RunStarted
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
runFinishedEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 293021977}
m_TargetAssemblyTypeName: UnityEngine.TestTools.TestRunner.Callbacks.PlayModeRunnerCallback,
UnityEngine.TestRunner
m_MethodName: RunFinished
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 81118334}
m_TargetAssemblyTypeName: UnityEditor.TestTools.TestRunner.TestRunnerCallback,
UnityEditor.TestRunner
m_MethodName: RunFinished
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1753937287}
m_TargetAssemblyTypeName: UnityEditor.TestTools.TestRunner.Api.CallbacksDelegatorListener,
UnityEditor.TestRunner
m_MethodName: RunFinished
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1889354441}
m_TargetAssemblyTypeName: UnityEngine.TestRunner.Utils.TestRunCallbackListener,
UnityEngine.TestRunner
m_MethodName: RunFinished
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
settings:
filters:
- assemblyNames:
- Tests
groupNames:
- ^OpenMetaverse\.Tests\.MessageTests$
categoryNames: []
testNames: []
synchronousOnly: 0
sceneBased: 0
originalScene: Assets/Scenes/MainScene.unity
bootstrapScene: Assets/InitTestScene637778662700475246.unity
--- !u!4 &293021979
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 293021976}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1753937287
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f3e1b3cbf3fac6a459b1a602167ad311, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1889354441
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68f09f0f82599b5448579854e622a4c1, type: 3}
m_Name:
m_EditorClassIdentifier:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3ee6d324e286f454298f162e2ef7ba5a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+18
View File
@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MapTileView : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d4302bd36a44f14da27baa1448fa494
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a4484e5e876662b4796bc3a8fdb65cb8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 868616ad6dc9f374da8065c9e492feeb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 34192c5e0d14aee43a0e86cc4823268a
TextScriptImporter:
userData:
Binary file not shown.
@@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: a811bde74b26b53498b4f6d872b09b6d
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 1
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
WindowsStoreApps:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: b27f58ae5d5c33a4bb2d1f4f34bd036d
folderAsset: yes
DefaultImporter:
userData:
@@ -0,0 +1,110 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>DOTweenEditor</name>
</assembly>
<members>
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.Start(System.Action)">
<summary>
Starts the update loop of tween in the editor. Has no effect during playMode.
</summary>
<param name="onPreviewUpdated">Eventual callback to call after every update</param>
</member>
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.Stop(System.Boolean,System.Boolean)">
<summary>
Stops the update loop and clears the onPreviewUpdated callback.
</summary>
<param name="resetTweenTargets">If TRUE also resets the tweened objects to their original state.
Note that this works by calling Rewind on all tweens, so it will work correctly
only if you have a single tween type per object and it wasn't killed</param>
<param name="clearTweens">If TRUE also kills any cached tween</param>
</member>
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.PrepareTweenForPreview(DG.Tweening.Tween,System.Boolean,System.Boolean,System.Boolean)">
<summary>
Readies the tween for editor preview by setting its UpdateType to Manual plus eventual extra settings.
</summary>
<param name="t">The tween to ready</param>
<param name="clearCallbacks">If TRUE (recommended) removes all callbacks (OnComplete/Rewind/etc)</param>
<param name="preventAutoKill">If TRUE prevents the tween from being auto-killed at completion</param>
<param name="andPlay">If TRUE starts playing the tween immediately</param>
</member>
<member name="F:DG.DOTweenEditor.EditorVersion.Version">
<summary>Full major version + first minor version (ex: 2018.1f)</summary>
</member>
<member name="F:DG.DOTweenEditor.EditorVersion.MajorVersion">
<summary>Major version</summary>
</member>
<member name="F:DG.DOTweenEditor.EditorVersion.MinorVersion">
<summary>First minor version (ex: in 2018.1 it would be 1)</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.SetEditorTexture(UnityEngine.Texture2D,UnityEngine.FilterMode,System.Int32)">
<summary>
Checks that the given editor texture use the correct import settings,
and applies them if they're incorrect.
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.DOTweenSetupRequired">
<summary>
Returns TRUE if setup is required
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.AssetExists(System.String)">
<summary>
Returns TRUE if the file/directory at the given path exists.
</summary>
<param name="adbPath">Path, relative to Unity's project folder</param>
<returns></returns>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.ADBPathToFullPath(System.String)">
<summary>
Converts the given project-relative path to a full path,
with backward (\) slashes).
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.FullPathToADBPath(System.String)">
<summary>
Converts the given full path to a path usable with AssetDatabase methods
(relative to Unity's project folder, and with the correct Unity forward (/) slashes).
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.ConnectToSourceAsset``1(System.String,System.Boolean)">
<summary>
Connects to a <see cref="T:UnityEngine.ScriptableObject"/> asset.
If the asset already exists at the given path, loads it and returns it.
Otherwise, either returns NULL or automatically creates it before loading and returning it
(depending on the given parameters).
</summary>
<typeparam name="T">Asset type</typeparam>
<param name="adbFilePath">File path (relative to Unity's project folder)</param>
<param name="createIfMissing">If TRUE and the requested asset doesn't exist, forces its creation</param>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.GetAssemblyFilePath(System.Reflection.Assembly)">
<summary>
Full path for the given loaded assembly, assembly file included
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.AddGlobalDefine(System.String)">
<summary>
Adds the given global define if it's not already present
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.RemoveGlobalDefine(System.String)">
<summary>
Removes the given global define if it's present
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.HasGlobalDefine(System.String,System.Nullable{UnityEditor.BuildTargetGroup})">
<summary>
Returns TRUE if the given global define is present in all the <see cref="T:UnityEditor.BuildTargetGroup"/>
or only in the given <see cref="T:UnityEditor.BuildTargetGroup"/>, depending on passed parameters.<para/>
</summary>
<param name="id"></param>
<param name="buildTargetGroup"><see cref="T:UnityEditor.BuildTargetGroup"/>to use. Leave NULL to check in all of them.</param>
</member>
<member name="T:DG.DOTweenEditor.DOTweenDefines">
<summary>
Not used as menu item anymore, but as a utiity function
</summary>
</member>
</members>
</doc>
@@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 2e2c6224d345d9249acfa6e8ef40bb2d
TextScriptImporter:
userData:
@@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 45d5034162d6cf04dbe46da84fc7d074
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 1
settings:
DefaultValueInitialized: true
WindowsStoreApps:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 0034ebae0c2a9344e897db1160d71b6d
folderAsset: yes
DefaultImporter:
userData:
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 8da095e39e9b4df488dfd436f81116d6
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 128
textureSettings:
filterMode: 1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 2
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

@@ -0,0 +1,68 @@
fileFormatVersion: 2
guid: 61521df2e071645488ba3d05e49289ae
timeCreated: 1602317874
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

@@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 7051dba417b3d53409f2918f1ea4938d
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 256
textureSettings:
filterMode: 1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 2
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

@@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 519694efe2bb2914788b151fbd8c01f4
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 1024
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

@@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 78a59ca99f8987941adb61f9e14a06a7
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 512
textureSettings:
filterMode: 1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 2
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 143604b8bad857d47a6f7cc7a533e2dc
folderAsset: yes
DefaultImporter:
userData:
@@ -0,0 +1,3 @@
{
"name": "DOTween.Modules"
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 45a9dcb0bf9ee7b4c95a6ce2f6441047
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,202 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
#if true // MODULE_MARKER
using System;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
#if UNITY_5 || UNITY_2017_1_OR_NEWER
using UnityEngine.Audio; // Required for AudioMixer
#endif
#pragma warning disable 1591
namespace DG.Tweening
{
public static class DOTweenModuleAudio
{
#region Shortcuts
#region Audio
/// <summary>Tweens an AudioSource's volume to the given value.
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DOFade(this AudioSource target, float endValue, float duration)
{
if (endValue < 0) endValue = 0;
else if (endValue > 1) endValue = 1;
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.volume, x => target.volume = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens an AudioSource's pitch to the given value.
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DOPitch(this AudioSource target, float endValue, float duration)
{
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration);
t.SetTarget(target);
return t;
}
#endregion
#if UNITY_5 || UNITY_2017_1_OR_NEWER
#region AudioMixer (Unity 5 or Newer)
/// <summary>Tweens an AudioMixer's exposed float to the given value.
/// Also stores the AudioMixer as the tween's target so it can be used for filtered operations.
/// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.</summary>
/// <param name="floatName">Name given to the exposed float to set</param>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
{
TweenerCore<float, float, FloatOptions> t = DOTween.To(()=> {
float currVal;
target.GetFloat(floatName, out currVal);
return currVal;
}, x=> target.SetFloat(floatName, x), endValue, duration);
t.SetTarget(target);
return t;
}
#region Operation Shortcuts
/// <summary>
/// Completes all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens completed
/// (meaning the tweens that don't have infinite loops and were not already complete)
/// </summary>
/// <param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired,
/// otherwise they will be ignored</param>
public static int DOComplete(this AudioMixer target, bool withCallbacks = false)
{
return DOTween.Complete(target, withCallbacks);
}
/// <summary>
/// Kills all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens killed.
/// </summary>
/// <param name="complete">If TRUE completes the tween before killing it</param>
public static int DOKill(this AudioMixer target, bool complete = false)
{
return DOTween.Kill(target, complete);
}
/// <summary>
/// Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens flipped.
/// </summary>
public static int DOFlip(this AudioMixer target)
{
return DOTween.Flip(target);
}
/// <summary>
/// Sends to the given position all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens involved.
/// </summary>
/// <param name="to">Time position to reach
/// (if higher than the whole tween duration the tween will simply reach its end)</param>
/// <param name="andPlay">If TRUE will play the tween after reaching the given position, otherwise it will pause it</param>
public static int DOGoto(this AudioMixer target, float to, bool andPlay = false)
{
return DOTween.Goto(target, to, andPlay);
}
/// <summary>
/// Pauses all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens paused.
/// </summary>
public static int DOPause(this AudioMixer target)
{
return DOTween.Pause(target);
}
/// <summary>
/// Plays all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlay(this AudioMixer target)
{
return DOTween.Play(target);
}
/// <summary>
/// Plays backwards all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlayBackwards(this AudioMixer target)
{
return DOTween.PlayBackwards(target);
}
/// <summary>
/// Plays forward all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlayForward(this AudioMixer target)
{
return DOTween.PlayForward(target);
}
/// <summary>
/// Restarts all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens restarted.
/// </summary>
public static int DORestart(this AudioMixer target)
{
return DOTween.Restart(target);
}
/// <summary>
/// Rewinds all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens rewinded.
/// </summary>
public static int DORewind(this AudioMixer target)
{
return DOTween.Rewind(target);
}
/// <summary>
/// Smoothly rewinds all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens rewinded.
/// </summary>
public static int DOSmoothRewind(this AudioMixer target)
{
return DOTween.SmoothRewind(target);
}
/// <summary>
/// Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens involved.
/// </summary>
public static int DOTogglePause(this AudioMixer target)
{
return DOTween.TogglePause(target);
}
#endregion
#endregion
#endif
#endregion
}
}
#endif
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b766d08851589514b97afb23c6f30a70
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,142 @@
using UnityEngine;
#if false || EPO_DOTWEEN // MODULE_MARKER
using EPOOutline;
using DG.Tweening.Plugins.Options;
using DG.Tweening;
using DG.Tweening.Core;
namespace DG.Tweening
{
public static class DOTweenModuleEPOOutline
{
public static int DOKill(this SerializedPass target, bool complete)
{
return DOTween.Kill(target, complete);
}
public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, string propertyName, float endValue, float duration)
{
var tweener = DOTween.To(() => target.GetFloat(propertyName), x => target.SetFloat(propertyName, x), endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, string propertyName, float endValue, float duration)
{
var tweener = DOTween.ToAlpha(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, string propertyName, Color endValue, float duration)
{
var tweener = DOTween.To(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, string propertyName, Vector4 endValue, float duration)
{
var tweener = DOTween.To(() => target.GetVector(propertyName), x => target.SetVector(propertyName, x), endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, int propertyId, float endValue, float duration)
{
var tweener = DOTween.To(() => target.GetFloat(propertyId), x => target.SetFloat(propertyId, x), endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, int propertyId, float endValue, float duration)
{
var tweener = DOTween.ToAlpha(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, int propertyId, Color endValue, float duration)
{
var tweener = DOTween.To(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, int propertyId, Vector4 endValue, float duration)
{
var tweener = DOTween.To(() => target.GetVector(propertyId), x => target.SetVector(propertyId, x), endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static int DOKill(this Outlinable.OutlineProperties target, bool complete = false)
{
return DOTween.Kill(target, complete);
}
public static int DOKill(this Outliner target, bool complete = false)
{
return DOTween.Kill(target, complete);
}
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Outlinable.OutlineProperties target, float endValue, float duration)
{
var tweener = DOTween.ToAlpha(() => target.Color, x => target.Color = x, endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Outlinable.OutlineProperties target, Color endValue, float duration)
{
var tweener = DOTween.To(() => target.Color, x => target.Color = x, endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outliner target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outliner target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
public static TweenerCore<float, float, FloatOptions> DOInfoRendererScale(this Outliner target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.InfoRendererScale, x => target.InfoRendererScale = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
public static TweenerCore<float, float, FloatOptions> DOPrimaryRendererScale(this Outliner target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.PrimaryRendererScale, x => target.PrimaryRendererScale = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e944529dcaee98f4e9498d80e541d93e
timeCreated: 1602593330
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,216 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
#if true // MODULE_MARKER
using System;
using DG.Tweening.Core;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins;
using DG.Tweening.Plugins.Core.PathCore;
using DG.Tweening.Plugins.Options;
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening
{
public static class DOTweenModulePhysics
{
#region Shortcuts
#region Rigidbody
/// <summary>Tweens a Rigidbody's position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody's X position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration);
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody's Y position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration);
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody's Z position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration);
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody's rotation to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="mode">Rotation mode</param>
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
{
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
t.SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
}
/// <summary>Tweens a Rigidbody's rotation so that it will look towards the given position.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
/// <param name="axisConstraint">Eventual axis constraint for the rotation</param>
/// <param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
{
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
t.plugOptions.axisConstraint = axisConstraint;
t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up;
return t;
}
#region Special
/// <summary>Tweens a Rigidbody's position to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
float startPosY = 0;
float offsetY = -1;
bool offsetYSet = false;
Sequence s = DOTween.Sequence();
Tween yTween = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
.OnStart(() => startPosY = target.position.y);
s.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration)
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
).Join(yTween)
.SetTarget(target).SetEase(DOTween.defaultEaseType);
yTween.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
target.MovePosition(pos);
});
return s;
}
/// <summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
/// If you plan to publish there you should use a regular transform.DOPath.</para></summary>
/// <param name="path">The waypoints to go through</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
/// <param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
)
{
if (resolution < 1) resolution = 1;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, new Path(pathType, path, resolution, gizmoColor), duration)
.SetTarget(target).SetUpdate(UpdateType.Fixed);
t.plugOptions.isRigidbody = true;
t.plugOptions.mode = pathMode;
return t;
}
/// <summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
/// If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
/// <param name="path">The waypoint to go through</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
/// <param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
)
{
if (resolution < 1) resolution = 1;
Transform trans = target.transform;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path, resolution, gizmoColor), duration)
.SetTarget(target).SetUpdate(UpdateType.Fixed);
t.plugOptions.isRigidbody = true;
t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t;
}
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
)
{
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, path, duration)
.SetTarget(target);
t.plugOptions.isRigidbody = true;
t.plugOptions.mode = pathMode;
return t;
}
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
)
{
Transform trans = target.transform;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration)
.SetTarget(target);
t.plugOptions.isRigidbody = true;
t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t;
}
#endregion
#endregion
#endregion
}
}
#endif
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dae9aa560b4242648a3affa2bfabc365
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,193 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER
using System;
using DG.Tweening.Core;
using DG.Tweening.Plugins;
using DG.Tweening.Plugins.Core.PathCore;
using DG.Tweening.Plugins.Options;
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening
{
public static class DOTweenModulePhysics2D
{
#region Shortcuts
#region Rigidbody2D Shortcuts
/// <summary>Tweens a Rigidbody2D's position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody2D's X position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration);
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody2D's Y position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration);
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody2D's rotation to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DORotate(this Rigidbody2D target, float endValue, float duration)
{
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
t.SetTarget(target);
return t;
}
#region Special
/// <summary>Tweens a Rigidbody2D's position to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
/// <para>IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set the position</para></summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
float startPosY = 0;
float offsetY = -1;
bool offsetYSet = false;
Sequence s = DOTween.Sequence();
Tween yTween = DOTween.To(() => target.position, x => target.position = x, new Vector2(0, jumpPower), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
.OnStart(() => startPosY = target.position.y);
s.Append(DOTween.To(() => target.position, x => target.position = x, new Vector2(endValue.x, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
).Join(yTween)
.SetTarget(target).SetEase(DOTween.defaultEaseType);
yTween.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
target.MovePosition(pos);
});
return s;
}
/// <summary>Tweens a Rigidbody2D's position through the given path waypoints, using the chosen path algorithm.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
/// <para>NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened.</para>
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
/// If you plan to publish there you should use a regular transform.DOPath.</para></summary>
/// <param name="path">The waypoints to go through</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
/// <param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = PathType.Linear,
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
)
{
if (resolution < 1) resolution = 1;
int len = path.Length;
Vector3[] path3D = new Vector3[len];
for (int i = 0; i < len; ++i) path3D[i] = path[i];
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.MovePosition(x), new Path(pathType, path3D, resolution, gizmoColor), duration)
.SetTarget(target).SetUpdate(UpdateType.Fixed);
t.plugOptions.isRigidbody2D = true;
t.plugOptions.mode = pathMode;
return t;
}
/// <summary>Tweens a Rigidbody2D's localPosition through the given path waypoints, using the chosen path algorithm.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
/// <para>NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened.</para>
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
/// If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
/// <param name="path">The waypoint to go through</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
/// <param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = PathType.Linear,
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
)
{
if (resolution < 1) resolution = 1;
int len = path.Length;
Vector3[] path3D = new Vector3[len];
for (int i = 0; i < len; ++i) path3D[i] = path[i];
Transform trans = target.transform;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path3D, resolution, gizmoColor), duration)
.SetTarget(target).SetUpdate(UpdateType.Fixed);
t.plugOptions.isRigidbody2D = true;
t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t;
}
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
this Rigidbody2D target, Path path, float duration, PathMode pathMode = PathMode.Full3D
)
{
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.MovePosition(x), path, duration)
.SetTarget(target);
t.plugOptions.isRigidbody2D = true;
t.plugOptions.mode = pathMode;
return t;
}
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
this Rigidbody2D target, Path path, float duration, PathMode pathMode = PathMode.Full3D
)
{
Transform trans = target.transform;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration)
.SetTarget(target);
t.plugOptions.isRigidbody2D = true;
t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t;
}
#endregion
#endregion
#endregion
}
}
#endif
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 230fe34542e175245ba74b4659dae700
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,93 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER
using System;
using UnityEngine;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
#pragma warning disable 1591
namespace DG.Tweening
{
public static class DOTweenModuleSprite
{
#region Shortcuts
#region SpriteRenderer
/// <summary>Tweens a SpriteRenderer's color to the given value.
/// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SpriteRenderer target, Color endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a Material's alpha color to the given value.
/// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SpriteRenderer target, float endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a SpriteRenderer's color using the given gradient
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
public static Sequence DOGradientColor(this SpriteRenderer target, Gradient gradient, float duration)
{
Sequence s = DOTween.Sequence();
GradientColorKey[] colors = gradient.colorKeys;
int len = colors.Length;
for (int i = 0; i < len; ++i) {
GradientColorKey c = colors[i];
if (i == 0 && c.time <= 0) {
target.color = c.color;
continue;
}
float colorDuration = i == len - 1
? duration - s.Duration(false) // Verifies that total duration is correct
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear));
}
s.SetTarget(target);
return s;
}
#endregion
#region Blendables
#region SpriteRenderer
/// <summary>Tweens a SpriteRenderer's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this SpriteRenderer target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
#endregion
#endregion
#endregion
}
}
#endif
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 188918ab119d93148aa0de59ccf5286b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,660 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
#if true && (UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER
using System;
using System.Globalization;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening.Core;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins;
using DG.Tweening.Plugins.Options;
using Outline = UnityEngine.UI.Outline;
using Text = UnityEngine.UI.Text;
#pragma warning disable 1591
namespace DG.Tweening
{
public static class DOTweenModuleUI
{
#region Shortcuts
#region CanvasGroup
/// <summary>Tweens a CanvasGroup's alpha color to the given value.
/// Also stores the canvasGroup as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DOFade(this CanvasGroup target, float endValue, float duration)
{
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.alpha, x => target.alpha = x, endValue, duration);
t.SetTarget(target);
return t;
}
#endregion
#region Graphic
/// <summary>Tweens an Graphic's color to the given value.
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Graphic target, Color endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens an Graphic's alpha color to the given value.
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Graphic target, float endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
t.SetTarget(target);
return t;
}
#endregion
#region Image
/// <summary>Tweens an Image's color to the given value.
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Image target, Color endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens an Image's alpha color to the given value.
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Image target, float endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens an Image's fillAmount to the given value.
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DOFillAmount(this Image target, float endValue, float duration)
{
if (endValue > 1) endValue = 1;
else if (endValue < 0) endValue = 0;
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.fillAmount, x => target.fillAmount = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens an Image's colors using the given gradient
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
public static Sequence DOGradientColor(this Image target, Gradient gradient, float duration)
{
Sequence s = DOTween.Sequence();
GradientColorKey[] colors = gradient.colorKeys;
int len = colors.Length;
for (int i = 0; i < len; ++i) {
GradientColorKey c = colors[i];
if (i == 0 && c.time <= 0) {
target.color = c.color;
continue;
}
float colorDuration = i == len - 1
? duration - s.Duration(false) // Verifies that total duration is correct
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear));
}
s.SetTarget(target);
return s;
}
#endregion
#region LayoutElement
/// <summary>Tweens an LayoutElement's flexibleWidth/Height to the given value.
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOFlexibleSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x => {
target.flexibleWidth = x.x;
target.flexibleHeight = x.y;
}, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens an LayoutElement's minWidth/Height to the given value.
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMinSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x => {
target.minWidth = x.x;
target.minHeight = x.y;
}, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens an LayoutElement's preferredWidth/Height to the given value.
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPreferredSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => {
target.preferredWidth = x.x;
target.preferredHeight = x.y;
}, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
#endregion
#region Outline
/// <summary>Tweens a Outline's effectColor to the given value.
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Outline target, Color endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.effectColor, x => target.effectColor = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a Outline's effectColor alpha to the given value.
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Outline target, float endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.effectColor, x => target.effectColor = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a Outline's effectDistance to the given value.
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOScale(this Outline target, Vector2 endValue, float duration)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.effectDistance, x => target.effectDistance = x, endValue, duration);
t.SetTarget(target);
return t;
}
#endregion
#region RectTransform
/// <summary>Tweens a RectTransform's anchoredPosition to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPos(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's anchoredPosition X to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPosX(this RectTransform target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue, 0), duration);
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's anchoredPosition Y to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPosY(this RectTransform target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, endValue), duration);
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's anchoredPosition3D to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3D(this RectTransform target, Vector3 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's anchoredPosition3D X to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DX(this RectTransform target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(endValue, 0, 0), duration);
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's anchoredPosition3D Y to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DY(this RectTransform target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, endValue, 0), duration);
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's anchoredPosition3D Z to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DZ(this RectTransform target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, 0, endValue), duration);
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's anchorMax to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorMax(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchorMax, x => target.anchorMax = x, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's anchorMin to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorMin(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchorMin, x => target.anchorMin = x, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's pivot to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivot(this RectTransform target, Vector2 endValue, float duration)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's pivot X to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivotX(this RectTransform target, float endValue, float duration)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(endValue, 0), duration);
t.SetOptions(AxisConstraint.X).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's pivot Y to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivotY(this RectTransform target, float endValue, float duration)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(0, endValue), duration);
t.SetOptions(AxisConstraint.Y).SetTarget(target);
return t;
}
/// <summary>Tweens a RectTransform's sizeDelta to the given value.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOSizeDelta(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.sizeDelta, x => target.sizeDelta = x, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Punches a RectTransform's anchoredPosition towards the given direction and then back to the starting one
/// as if it was connected to the starting position via an elastic.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="punch">The direction and strength of the punch (added to the RectTransform's current position)</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="vibrato">Indicates how much will the punch vibrate</param>
/// <param name="elasticity">Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards.
/// 1 creates a full oscillation between the punch direction and the opposite direction,
/// while 0 oscillates only between the punch and the start position</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOPunchAnchorPos(this RectTransform target, Vector2 punch, float duration, int vibrato = 10, float elasticity = 1, bool snapping = false)
{
return DOTween.Punch(() => target.anchoredPosition, x => target.anchoredPosition = x, punch, duration, vibrato, elasticity)
.SetTarget(target).SetOptions(snapping);
}
/// <summary>Shakes a RectTransform's anchoredPosition with the given values.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
/// <param name="fadeOut">If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not</param>
public static Tweener DOShakeAnchorPos(this RectTransform target, float duration, float strength = 100, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true)
{
return DOTween.Shake(() => target.anchoredPosition, x => target.anchoredPosition = x, duration, strength, vibrato, randomness, true, fadeOut)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping);
}
/// <summary>Shakes a RectTransform's anchoredPosition with the given values.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength on each axis</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
/// <param name="fadeOut">If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not</param>
public static Tweener DOShakeAnchorPos(this RectTransform target, float duration, Vector2 strength, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true)
{
return DOTween.Shake(() => target.anchoredPosition, x => target.anchoredPosition = x, duration, strength, vibrato, randomness, fadeOut)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping);
}
#region Special
/// <summary>Tweens a RectTransform's anchoredPosition to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOJumpAnchorPos(this RectTransform target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
float startPosY = 0;
float offsetY = -1;
bool offsetYSet = false;
// Separate Y Tween so we can elaborate elapsedPercentage on that insted of on the Sequence
// (in case users add a delay or other elements to the Sequence)
Sequence s = DOTween.Sequence();
Tween yTween = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, jumpPower), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
.OnStart(()=> startPosY = target.anchoredPosition.y);
s.Append(DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue.x, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
).Join(yTween)
.SetTarget(target).SetEase(DOTween.defaultEaseType);
s.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector2 pos = target.anchoredPosition;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.anchoredPosition = pos;
});
return s;
}
#endregion
#endregion
#region ScrollRect
/// <summary>Tweens a ScrollRect's horizontal/verticalNormalizedPosition to the given value.
/// Also stores the ScrollRect as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DONormalizedPos(this ScrollRect target, Vector2 endValue, float duration, bool snapping = false)
{
return DOTween.To(() => new Vector2(target.horizontalNormalizedPosition, target.verticalNormalizedPosition),
x => {
target.horizontalNormalizedPosition = x.x;
target.verticalNormalizedPosition = x.y;
}, endValue, duration)
.SetOptions(snapping).SetTarget(target);
}
/// <summary>Tweens a ScrollRect's horizontalNormalizedPosition to the given value.
/// Also stores the ScrollRect as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOHorizontalNormalizedPos(this ScrollRect target, float endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.horizontalNormalizedPosition, x => target.horizontalNormalizedPosition = x, endValue, duration)
.SetOptions(snapping).SetTarget(target);
}
/// <summary>Tweens a ScrollRect's verticalNormalizedPosition to the given value.
/// Also stores the ScrollRect as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOVerticalNormalizedPos(this ScrollRect target, float endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.verticalNormalizedPosition, x => target.verticalNormalizedPosition = x, endValue, duration)
.SetOptions(snapping).SetTarget(target);
}
#endregion
#region Slider
/// <summary>Tweens a Slider's value to the given value.
/// Also stores the Slider as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<float, float, FloatOptions> DOValue(this Slider target, float endValue, float duration, bool snapping = false)
{
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.value, x => target.value = x, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
#endregion
#region Text
/// <summary>Tweens a Text's color to the given value.
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Text target, Color endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>
/// Tweens a Text's text from one integer to another, with options for thousands separators
/// </summary>
/// <param name="fromValue">The value to start from</param>
/// <param name="endValue">The end value to reach</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="addThousandsSeparator">If TRUE (default) also adds thousands separators</param>
/// <param name="culture">The <see cref="CultureInfo"/> to use (InvariantCulture if NULL)</param>
public static TweenerCore<int, int, NoOptions> DOCounter(
this Text target, int fromValue, int endValue, float duration, bool addThousandsSeparator = true, CultureInfo culture = null
){
int v = fromValue;
CultureInfo cInfo = !addThousandsSeparator ? null : culture ?? CultureInfo.InvariantCulture;
TweenerCore<int, int, NoOptions> t = DOTween.To(() => v, x => {
v = x;
target.text = addThousandsSeparator
? v.ToString("N0", cInfo)
: v.ToString();
}, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a Text's alpha color to the given value.
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Text target, float endValue, float duration)
{
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a Text's text to the given value.
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end string to tween to</param><param name="duration">The duration of the tween</param>
/// <param name="richTextEnabled">If TRUE (default), rich text will be interpreted correctly while animated,
/// otherwise all tags will be considered as normal text</param>
/// <param name="scrambleMode">The type of scramble mode to use, if any</param>
/// <param name="scrambleChars">A string containing the characters to use for scrambling.
/// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
/// Leave it to NULL (default) to use default ones</param>
public static TweenerCore<string, string, StringOptions> DOText(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
{
if (endValue == null) {
if (Debugger.logPriority > 0) Debugger.LogWarning("You can't pass a NULL string to DOText: an empty string will be used instead to avoid errors");
endValue = "";
}
TweenerCore<string, string, StringOptions> t = DOTween.To(() => target.text, x => target.text = x, endValue, duration);
t.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
.SetTarget(target);
return t;
}
#endregion
#region Blendables
#region Graphic
/// <summary>Tweens a Graphic's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Graphic target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
#endregion
#region Image
/// <summary>Tweens a Image's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Image as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Image target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
#endregion
#region Text
/// <summary>Tweens a Text's color BY the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Text target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
#endregion
#endregion
#region Shapes
/// <summary>Tweens a RectTransform's anchoredPosition so that it draws a circle around the given center.
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations.<para/>
/// IMPORTANT: SetFrom(value) requires a <see cref="Vector2"/> instead of a float, where the X property represents the "from degrees value"</summary>
/// <param name="center">Circle-center/pivot around which to rotate (in UI anchoredPosition coordinates)</param>
/// <param name="endValueDegrees">The end value degrees to reach (to rotate counter-clockwise pass a negative value)</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="relativeCenter">If TRUE the <see cref="center"/> coordinates will be considered as relative to the target's current anchoredPosition</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, CircleOptions> DOShapeCircle(
this RectTransform target, Vector2 center, float endValueDegrees, float duration, bool relativeCenter = false, bool snapping = false
)
{
TweenerCore<Vector2, Vector2, CircleOptions> t = DOTween.To(
CirclePlugin.Get(), () => target.anchoredPosition, x => target.anchoredPosition = x, center, duration
);
t.SetOptions(endValueDegrees, relativeCenter, snapping).SetTarget(target);
return t;
}
#endregion
#endregion
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
public static class Utils
{
/// <summary>
/// Converts the anchoredPosition of the first RectTransform to the second RectTransform,
/// taking into consideration offset, anchors and pivot, and returns the new anchoredPosition
/// </summary>
public static Vector2 SwitchToRectTransform(RectTransform from, RectTransform to)
{
Vector2 localPoint;
Vector2 fromPivotDerivedOffset = new Vector2(from.rect.width * 0.5f + from.rect.xMin, from.rect.height * 0.5f + from.rect.yMin);
Vector2 screenP = RectTransformUtility.WorldToScreenPoint(null, from.position);
screenP += fromPivotDerivedOffset;
RectTransformUtility.ScreenPointToLocalPointInRectangle(to, screenP, null, out localPoint);
Vector2 pivotDerivedOffset = new Vector2(to.rect.width * 0.5f + to.rect.xMin, to.rect.height * 0.5f + to.rect.yMin);
return to.anchoredPosition + localPoint - pivotDerivedOffset;
}
}
}
}
#endif
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a060394c03331a64392db53a10e7f2d1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,403 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
using System;
using UnityEngine;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
//#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0)
//using Task = System.Threading.Tasks.Task;
//#endif
#pragma warning disable 1591
namespace DG.Tweening
{
/// <summary>
/// Shortcuts/functions that are not strictly related to specific Modules
/// but are available only on some Unity versions
/// </summary>
public static class DOTweenModuleUnityVersion
{
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER
#region Unity 4.3 or Newer
#region Material
/// <summary>Tweens a Material's color using the given gradient
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
public static Sequence DOGradientColor(this Material target, Gradient gradient, float duration)
{
Sequence s = DOTween.Sequence();
GradientColorKey[] colors = gradient.colorKeys;
int len = colors.Length;
for (int i = 0; i < len; ++i) {
GradientColorKey c = colors[i];
if (i == 0 && c.time <= 0) {
target.color = c.color;
continue;
}
float colorDuration = i == len - 1
? duration - s.Duration(false) // Verifies that total duration is correct
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear));
}
s.SetTarget(target);
return s;
}
/// <summary>Tweens a Material's named color property using the given gradient
/// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
/// <param name="gradient">The gradient to use</param>
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
/// <param name="duration">The duration of the tween</param>
public static Sequence DOGradientColor(this Material target, Gradient gradient, string property, float duration)
{
Sequence s = DOTween.Sequence();
GradientColorKey[] colors = gradient.colorKeys;
int len = colors.Length;
for (int i = 0; i < len; ++i) {
GradientColorKey c = colors[i];
if (i == 0 && c.time <= 0) {
target.SetColor(property, c.color);
continue;
}
float colorDuration = i == len - 1
? duration - s.Duration(false) // Verifies that total duration is correct
: duration * (i == 0 ? c.time : c.time - colors[i - 1].time);
s.Append(target.DOColor(c.color, property, colorDuration).SetEase(Ease.Linear));
}
s.SetTarget(target);
return s;
}
#endregion
#endregion
#endif
#if UNITY_5_3_OR_NEWER || UNITY_2017_1_OR_NEWER
#region Unity 5.3 or Newer
#region CustomYieldInstructions
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or complete.
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForCompletion(true);</code>
/// </summary>
public static CustomYieldInstruction WaitForCompletion(this Tween t, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForCompletion(t);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or rewinded.
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForRewind();</code>
/// </summary>
public static CustomYieldInstruction WaitForRewind(this Tween t, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForRewind(t);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed.
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForKill();</code>
/// </summary>
public static CustomYieldInstruction WaitForKill(this Tween t, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForKill(t);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or has gone through the given amount of loops.
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForElapsedLoops(2);</code>
/// </summary>
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
public static CustomYieldInstruction WaitForElapsedLoops(this Tween t, int elapsedLoops, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForElapsedLoops(t, elapsedLoops);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed
/// or has reached the given time position (loops included, delays excluded).
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForPosition(2.5f);</code>
/// </summary>
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
public static CustomYieldInstruction WaitForPosition(this Tween t, float position, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForPosition(t, position);
}
/// <summary>
/// Returns a <see cref="CustomYieldInstruction"/> that waits until the tween is killed or started
/// (meaning when the tween is set in a playing state the first time, after any eventual delay).
/// It can be used inside a coroutine as a yield.
/// <para>Example usage:</para><code>yield return myTween.WaitForStart();</code>
/// </summary>
public static CustomYieldInstruction WaitForStart(this Tween t, bool returnCustomYieldInstruction)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return null;
}
return new DOTweenCYInstruction.WaitForStart(t);
}
#endregion
#endregion
#endif
#if UNITY_2018_1_OR_NEWER
#region Unity 2018.1 or Newer
#region Material
/// <summary>Tweens a Material's named texture offset property with the given ID to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
/// <param name="duration">The duration of the tween</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOOffset(this Material target, Vector2 endValue, int propertyID, float duration)
{
if (!target.HasProperty(propertyID)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
return null;
}
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureOffset(propertyID), x => target.SetTextureOffset(propertyID, x), endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a Material's named texture scale property with the given ID to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
/// <param name="duration">The duration of the tween</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOTiling(this Material target, Vector2 endValue, int propertyID, float duration)
{
if (!target.HasProperty(propertyID)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
return null;
}
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureScale(propertyID), x => target.SetTextureScale(propertyID, x), endValue, duration);
t.SetTarget(target);
return t;
}
#endregion
#region .NET 4.6 or Newer
#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0)
#region Async Instructions
/// <summary>
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or complete.
/// It can be used inside an async operation.
/// <para>Example usage:</para><code>await myTween.WaitForCompletion();</code>
/// </summary>
public static async System.Threading.Tasks.Task AsyncWaitForCompletion(this Tween t)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return;
}
while (t.active && !t.IsComplete()) await System.Threading.Tasks.Task.Yield();
}
/// <summary>
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or rewinded.
/// It can be used inside an async operation.
/// <para>Example usage:</para><code>await myTween.AsyncWaitForRewind();</code>
/// </summary>
public static async System.Threading.Tasks.Task AsyncWaitForRewind(this Tween t)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return;
}
while (t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0)) await System.Threading.Tasks.Task.Yield();
}
/// <summary>
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed.
/// It can be used inside an async operation.
/// <para>Example usage:</para><code>await myTween.AsyncWaitForKill();</code>
/// </summary>
public static async System.Threading.Tasks.Task AsyncWaitForKill(this Tween t)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return;
}
while (t.active) await System.Threading.Tasks.Task.Yield();
}
/// <summary>
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or has gone through the given amount of loops.
/// It can be used inside an async operation.
/// <para>Example usage:</para><code>await myTween.AsyncWaitForElapsedLoops();</code>
/// </summary>
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
public static async System.Threading.Tasks.Task AsyncWaitForElapsedLoops(this Tween t, int elapsedLoops)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return;
}
while (t.active && t.CompletedLoops() < elapsedLoops) await System.Threading.Tasks.Task.Yield();
}
/// <summary>
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed or started
/// (meaning when the tween is set in a playing state the first time, after any eventual delay).
/// It can be used inside an async operation.
/// <para>Example usage:</para><code>await myTween.AsyncWaitForPosition();</code>
/// </summary>
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
public static async System.Threading.Tasks.Task AsyncWaitForPosition(this Tween t, float position)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return;
}
while (t.active && t.position * (t.CompletedLoops() + 1) < position) await System.Threading.Tasks.Task.Yield();
}
/// <summary>
/// Returns an async <see cref="System.Threading.Tasks.Task"/> that waits until the tween is killed.
/// It can be used inside an async operation.
/// <para>Example usage:</para><code>await myTween.AsyncWaitForKill();</code>
/// </summary>
public static async System.Threading.Tasks.Task AsyncWaitForStart(this Tween t)
{
if (!t.active) {
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
return;
}
while (t.active && !t.playedOnce) await System.Threading.Tasks.Task.Yield();
}
#endregion
#endif
#endregion
#endregion
#endif
}
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// ███ CLASSES █████████████████████████████████████████████████████████████████████████████████████████████████████████
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
#if UNITY_5_3_OR_NEWER || UNITY_2017_1_OR_NEWER
public static class DOTweenCYInstruction
{
public class WaitForCompletion : CustomYieldInstruction
{
public override bool keepWaiting { get {
return t.active && !t.IsComplete();
}}
readonly Tween t;
public WaitForCompletion(Tween tween)
{
t = tween;
}
}
public class WaitForRewind : CustomYieldInstruction
{
public override bool keepWaiting { get {
return t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0);
}}
readonly Tween t;
public WaitForRewind(Tween tween)
{
t = tween;
}
}
public class WaitForKill : CustomYieldInstruction
{
public override bool keepWaiting { get {
return t.active;
}}
readonly Tween t;
public WaitForKill(Tween tween)
{
t = tween;
}
}
public class WaitForElapsedLoops : CustomYieldInstruction
{
public override bool keepWaiting { get {
return t.active && t.CompletedLoops() < elapsedLoops;
}}
readonly Tween t;
readonly int elapsedLoops;
public WaitForElapsedLoops(Tween tween, int elapsedLoops)
{
t = tween;
this.elapsedLoops = elapsedLoops;
}
}
public class WaitForPosition : CustomYieldInstruction
{
public override bool keepWaiting { get {
return t.active && t.position * (t.CompletedLoops() + 1) < position;
}}
readonly Tween t;
readonly float position;
public WaitForPosition(Tween tween, float position)
{
t = tween;
this.position = position;
}
}
public class WaitForStart : CustomYieldInstruction
{
public override bool keepWaiting { get {
return t.active && !t.playedOnce;
}}
readonly Tween t;
public WaitForStart(Tween tween)
{
t = tween;
}
}
}
#endif
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 63c02322328255542995bd02b47b0457
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,167 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
using System;
using System.Reflection;
using UnityEngine;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Core.PathCore;
using DG.Tweening.Plugins.Options;
#pragma warning disable 1591
namespace DG.Tweening
{
/// <summary>
/// Utility functions that deal with available Modules.
/// Modules defines:
/// - DOTAUDIO
/// - DOTPHYSICS
/// - DOTPHYSICS2D
/// - DOTSPRITE
/// - DOTUI
/// Extra defines set and used for implementation of external assets:
/// - DOTWEEN_TMP ► TextMesh Pro
/// - DOTWEEN_TK2D ► 2D Toolkit
/// </summary>
public static class DOTweenModuleUtils
{
static bool _initialized;
#region Reflection
/// <summary>
/// Called via Reflection by DOTweenComponent on Awake
/// </summary>
#if UNITY_2018_1_OR_NEWER
[UnityEngine.Scripting.Preserve]
#endif
public static void Init()
{
if (_initialized) return;
_initialized = true;
DOTweenExternalCommand.SetOrientationOnPath += Physics.SetOrientationOnPath;
#if UNITY_EDITOR
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1
UnityEditor.EditorApplication.playmodeStateChanged += PlaymodeStateChanged;
#else
UnityEditor.EditorApplication.playModeStateChanged += PlaymodeStateChanged;
#endif
#endif
}
#if UNITY_2018_1_OR_NEWER
#pragma warning disable
[UnityEngine.Scripting.Preserve]
// Just used to preserve methods when building, never called
static void Preserver()
{
Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
MethodInfo mi = typeof(MonoBehaviour).GetMethod("Stub");
}
#pragma warning restore
#endif
#endregion
#if UNITY_EDITOR
// Fires OnApplicationPause in DOTweenComponent even when Editor is paused (otherwise it's only fired at runtime)
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1
static void PlaymodeStateChanged()
#else
static void PlaymodeStateChanged(UnityEditor.PlayModeStateChange state)
#endif
{
if (DOTween.instance == null) return;
DOTween.instance.OnApplicationPause(UnityEditor.EditorApplication.isPaused);
}
#endif
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
public static class Physics
{
// Called via DOTweenExternalCommand callback
public static void SetOrientationOnPath(PathOptions options, Tween t, Quaternion newRot, Transform trans)
{
#if true // PHYSICS_MARKER
if (options.isRigidbody) ((Rigidbody)t.target).rotation = newRot;
else trans.rotation = newRot;
#else
trans.rotation = newRot;
#endif
}
// Returns FALSE if the DOTween's Physics2D Module is disabled, or if there's no Rigidbody2D attached
public static bool HasRigidbody2D(Component target)
{
#if true // PHYSICS2D_MARKER
return target.GetComponent<Rigidbody2D>() != null;
#else
return false;
#endif
}
#region Called via Reflection
// Called via Reflection by DOTweenPathInspector
// Returns FALSE if the DOTween's Physics Module is disabled, or if there's no rigidbody attached
#if UNITY_2018_1_OR_NEWER
[UnityEngine.Scripting.Preserve]
#endif
public static bool HasRigidbody(Component target)
{
#if true // PHYSICS_MARKER
return target.GetComponent<Rigidbody>() != null;
#else
return false;
#endif
}
// Called via Reflection by DOTweenPath
#if UNITY_2018_1_OR_NEWER
[UnityEngine.Scripting.Preserve]
#endif
public static TweenerCore<Vector3, Path, PathOptions> CreateDOTweenPathTween(
MonoBehaviour target, bool tweenRigidbody, bool isLocal, Path path, float duration, PathMode pathMode
){
TweenerCore<Vector3, Path, PathOptions> t = null;
bool rBodyFoundAndTweened = false;
#if true // PHYSICS_MARKER
if (tweenRigidbody) {
Rigidbody rBody = target.GetComponent<Rigidbody>();
if (rBody != null) {
rBodyFoundAndTweened = true;
t = isLocal
? rBody.DOLocalPath(path, duration, pathMode)
: rBody.DOPath(path, duration, pathMode);
}
}
#endif
#if true // PHYSICS2D_MARKER
if (!rBodyFoundAndTweened && tweenRigidbody) {
Rigidbody2D rBody2D = target.GetComponent<Rigidbody2D>();
if (rBody2D != null) {
rBodyFoundAndTweened = true;
t = isLocal
? rBody2D.DOLocalPath(path, duration, pathMode)
: rBody2D.DOPath(path, duration, pathMode);
}
}
#endif
if (!rBodyFoundAndTweened) {
t = isLocal
? target.transform.DOLocalPath(path, duration, pathMode)
: target.transform.DOPath(path, duration, pathMode);
}
return t;
}
#endregion
}
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7bcaf917d9cf5b84090421a5a2abe42e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,29 @@
DOTween and DOTween Pro are copyright (c) 2014-2018 Daniele Giardini - Demigiant
// IMPORTANT!!! /////////////////////////////////////////////
// Upgrading DOTween from versions older than 1.2.000 ///////
// (or DOTween Pro older than 1.0.000) //////////////////////
-------------------------------------------------------------
If you're upgrading your project from a version of DOTween older than 1.2.000 (or DOTween Pro older than 1.0.000) please follow these instructions carefully.
1) Import the new version in the same folder as the previous one, overwriting old files. A lot of errors will appear but don't worry
2) Close and reopen Unity (and your project). This is fundamental: skipping this step will cause a bloodbath
3) Open DOTween's Utility Panel (Tools > Demigiant > DOTween Utility Panel) if it doesn't open automatically, then press "Setup DOTween...": this will run the upgrade setup
4) From the Add/Remove Modules panel that opens, activate/deactivate Modules for Unity systems and for external assets (Pro version only)
// GET STARTED //////////////////////////////////////////////
- After importing a new DOTween update, select DOTween's Utility Panel from the "Tools/Demigiant" menu (if it doesn't open automatically) and press the "Setup DOTween..." button to activate/deactivate Modules. You can also access a Preferences Tab from there to choose default settings for DOTween.
- In your code, add "using DG.Tweening" to each class where you want to use DOTween.
- You're ready to tween. Check out the links below for full documentation and license info.
// LINKS ///////////////////////////////////////////////////////
DOTween website (documentation, examples, etc): http://dotween.demigiant.com
DOTween license: http://dotween.demigiant.com/license.php
DOTween repository (Google Code): https://code.google.com/p/dotween/
Demigiant website (documentation, examples, etc): http://www.demigiant.com
// NOTES //////////////////////////////////////////////////////
- DOTween's Utility Panel can be found under "Tools > Demigiant > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences
@@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: fccfc62abf2eb0a4db614853430894fd
TextScriptImporter:
userData:
+17 -17
View File
@@ -13,8 +13,8 @@ namespace Raindrop
// equivalent to a chat window with all the tabs and chats the user is chatting in.
public class ChatPresenterManager
{
public LocalChatTextManager LocalLocalChat { get; private set; }
public List<IMTextManager> IMChats { get; private set; }
public LocalChatTextManager LocalChatManager { get; private set; }
public List<IMTextManager> IMChatManagers { get; private set; }
RaindropInstance instance;
@@ -29,26 +29,26 @@ namespace Raindrop
this.instance = instance;
TextPrinter = textPrinter;
RegisterClientEvents(instance);
//make managers that we depend on.
LocalChatManager = new LocalChatTextManager(instance, TextPrinter);
IMChatManagers = new List<IMTextManager>();
//make the chat manager. (seems like we destroy it on disconnection.)
LocalLocalChat = new LocalChatTextManager(instance, TextPrinter);
IMChats = new List<IMTextManager>();
RegisterClientEvents(instance);
}
private void RegisterClientEvents(RaindropInstance instance)
{
instance.Client.Network.SimConnected += Network_SimConnected;
instance.Client.Network.Disconnected += Network_Disconnected;
LocalLocalChat.ChatLineAdded += LocalChatManager_ChatLineAdded;
LocalChatManager.ChatLineAdded += LocalChatManager_ChatLineAdded;
}
public ITextPrinter TextPrinter { get; set; }
public void Dispose()
{
LocalLocalChat = null;
IMChats = new List<IMTextManager>();
LocalChatManager = null;
IMChatManagers = new List<IMTextManager>();
}
private void Network_Disconnected(object sender, OpenMetaverse.DisconnectedEventArgs e)
@@ -56,16 +56,16 @@ namespace Raindrop
Logger.Log("Network_Disconnected", Helpers.LogLevel.Info);
//wind down chatmanager
LocalLocalChat.Dispose();
LocalLocalChat = null;
LocalChatManager.Dispose();
LocalChatManager = null;
}
private void LocalChatManager_ChatLineAdded(object sender, ChatLineAddedArgs chatLineAddedArgs)
{
Logger.Log("new message in local chat!", Helpers.LogLevel.Info);
if (LocalLocalChat == null)
LocalLocalChat = new LocalChatTextManager(instance, TextPrinter);
if (LocalChatManager == null)
LocalChatManager = new LocalChatTextManager(instance, TextPrinter);
Logger.Log("creating local chat in memory.", Helpers.LogLevel.Info);
printToMainChat("todo");
@@ -76,8 +76,8 @@ namespace Raindrop
//create local chat.
Logger.Log("Simulator Connected", Helpers.LogLevel.Info);
if (LocalLocalChat == null)
LocalLocalChat = new LocalChatTextManager(instance, TextPrinter);
if (LocalChatManager == null)
LocalChatManager = new LocalChatTextManager(instance, TextPrinter);
Logger.Log("creating local chat in memory.", Helpers.LogLevel.Info);
printToMainChat("Simulator Connected");
@@ -86,7 +86,7 @@ namespace Raindrop
UUID agentID; //todo.
// ah ok, so it seems use (A xor B) = C , where A is us and B is target, because this represents a link between us.
// we send C to let the lindens know its between A and B. abit strange TBH.
IMChats.Add(new IMTextManager(instance, null,IMTextManagerType.Agent, instance.Client.Self.AgentID ^ agentID, "cutie nuki"));
IMChatManagers.Add(new IMTextManager(instance, null,IMTextManagerType.Agent, instance.Client.Self.AgentID ^ agentID, "cutie nuki"));
}
public void printToMainChat(string message)
@@ -102,7 +102,7 @@ namespace Raindrop
UnityMainThreadDispatcher.Instance().Enqueue(() =>
{
//process printing in main thread.
LocalLocalChat.ProcessBufferItem(line, true);
LocalChatManager.ProcessBufferItem(line, true);
});
}
}
+11 -1
View File
@@ -31,8 +31,11 @@
using System;
using System.Timers;
using OpenMetaverse;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Quaternion = OpenMetaverse.Quaternion;
using Vector2 = UnityEngine.Vector2;
using Vector3 = OpenMetaverse.Vector3;
namespace Raindrop
{
@@ -48,7 +51,6 @@ namespace Raindrop
private Timer timer;
private Vector3 forward = new Vector3(1, 0, 0);
private bool isTurning = false;
// private bool turningRight = false;
private uint _prev;
public void SetTurningRight()
@@ -210,5 +212,13 @@ namespace Raindrop
client.Self.Movement.SendUpdate(true);
}
}
// user's direct input processed here.
public void setCameraInputs(object zero)
{
}
}
}
+1
View File
@@ -314,6 +314,7 @@ namespace Raindrop
_names = new NameManager(this);
Cof = new CurrentOutfitFolder(this);
//ui_manager = new UIManager(this);
//mainCanvas.InitializeControls();
@@ -1,10 +1,12 @@
using OpenMetaverse;
using System.Threading;
using OpenMetaverse;
using Raindrop.Netcom;
using UnityEngine;
using Logger = OpenMetaverse.Logger;
namespace Raindrop.Services.Bootstrap
{
//This sets up and tears down the raindrop instance and other servies.
//This sets up and tears down the raindrop instance service.
//This is attached to a scene as the SOLE gameobject.
// inspired by https://medium.com/medialesson/simple-service-locator-for-your-unity-project-40e317aad307
@@ -13,65 +15,48 @@ namespace Raindrop.Services.Bootstrap
{
public GameObject UIBootstrapper;
public static RaindropInstance rd_instance;
private RaindropInstance instance => ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
private RaindropNetcom netcom => instance.Netcom;
private void Start()
{
LinkUnityObjects();
Start_RaindropInstance();
}
private static void StartLogger()
{
Logger.Log("OpenMetaverse.Helpers.LogLevel.Info : Application Started.", Helpers.LogLevel.Info);
}
// //find the unity objects that this script depends on.
// turns out we don't want the base layer to depend on the ui layer, or any unity objects for that matter.
// private void LinkUnityObjects()
// {
// var ui = this.gameObject.GetComponent<UIBootstrapper>();
// if (ui == null)
// {
// Debug.LogError("the UI script is not found.");
// Application.Quit();
// return;
// }
// }
public static void Start_RaindropInstance()
{
// LinkUnityObjects();
StartLogger();
Main();
StartUI();
Logger.Log("Instance initialisation finished. ", Helpers.LogLevel.Info);
}
private void StartUI()
{
}
private void StartLogger()
{
Logger.Log("OpenMetaverse.Helpers.LogLevel.Info : Application Started.", Helpers.LogLevel.Info);
}
//find the unity objects that this script depends on.
private void LinkUnityObjects()
{
var ui = this.gameObject.GetComponent<UIBootstrapper>();
if (ui == null)
{
Debug.LogError("the UI script is not found.");
Application.Quit();
return;
}
}
private void Main()
{
//0. servicelocator pattern.
//0. start servicelocator pattern.
StartServiceLocator();
//1. main instance.
CreateAndRegister_RaindropInstance();
//set client settings here
//2. construct raindrop instance and register it
var client = ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>().Client;
// client.Settings.USE_ASSET_CACHE = false;
//Debug.Log("main Bootstrap finished");
//Debug.Log("UI should be appeared in front of you");
Logger.Log("Start_RaindropInstance Bootstrap Success", Helpers.LogLevel.Info);
}
public static void CreateAndRegister_RaindropInstance()
@@ -80,9 +65,8 @@ namespace Raindrop.Services.Bootstrap
return;
Debug.Log("creating and registering raindropinstance!");
ServiceLocator.ServiceLocator.Instance.Register<RaindropInstance>(
new RaindropInstance(new GridClient()));
rd_instance = ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
var rdi = new RaindropInstance(new GridClient());
ServiceLocator.ServiceLocator.Instance.Register<RaindropInstance>(rdi);
}
public static void StartServiceLocator()
@@ -92,5 +76,57 @@ namespace Raindrop.Services.Bootstrap
ServiceLocator.ServiceLocator.Initiailze();
}
}
void OnApplicationQuit()
{
Debug.Log("Application ending after " + Time.time + " seconds");
//if (statusTimer != null)
//{
// statusTimer.Stop();
// statusTimer.Dispose();
// statusTimer = null;
//}
if (!netcom.IsLoggedIn) return;
Thread saveInvToDisk = new Thread(delegate ()
{
instance.Client.Inventory.Store.SaveToDisk(instance.InventoryCacheFileName);
})
{
Name = "Save inventory to disk"
};
saveInvToDisk.Start();
netcom.Logout();
Debug.Log("Logged out! :)");
frmMain_Disposed();
Debug.Log("disposed mainform! :)");
}
//wraps up the netcom and client.
void frmMain_Disposed( )
{
if (netcom != null)
{
netcom.Dispose();
}
//
// if (instance.Client != null)
// {
// instance.UnregisterClientEvents(client);
// }
//if (instance?.Names != null)
//{
// instance.Names.NameUpdated -= new EventHandler<UUIDNameReplyEventArgs>(Names_NameUpdated);
//}
instance.CleanUp();
}
}
}
@@ -6,35 +6,30 @@ using UnityEngine;
namespace Raindrop.Services.Bootstrap
{
//show the first UI panel to the user.
// link all the UI together
// show the first UI panel to the user.
class UIBootstrapper : MonoBehaviour
{
private RaindropInstance instance => ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
private RaindropNetcom netcom => instance.Netcom;
// bootstraps in order to obtain the canvasmanager instance.
// bootstraps to find all instances of panels in the children tree.
// bootstraps the UI.
// 1. it first bootstraps the base layer of RaindropInstance
// 2. then it find all the canvasmanager and modal managers.
// has a funny role; in that it will register itself to the UIservice on start/awake.
// this should really be the other way round - that the UIservice
// creates/has dependency on the UIrootGO!!!
private void Awake()
{
Main();
RaindropBootstrapper.Start_RaindropInstance();
OpenMetaverse.Logger.Log("UI variant of application Started. Logging Started.", OpenMetaverse.Helpers.LogLevel.Info);
}
public void Main()
{
//OpenMetaverse.Logger.Log("Application Started. Logging Started.", OpenMetaverse.Helpers.LogLevel.Info);
RaindropBootstrapper.StartServiceLocator();
//skipped if the main bootstrapper is already run.
RaindropBootstrapper.CreateAndRegister_RaindropInstance();
}
// initialise the UI items
private void Start()
{
//1. mapfetcher - logic, not ui. please refactor
if (!ServiceLocator.ServiceLocator.Instance.IsRegistered<MapFetcher>())
{
Debug.Log("UIBootstrapper creating and registering MapBackend.MapFetcher!");
@@ -42,65 +37,16 @@ namespace Raindrop.Services.Bootstrap
//return;
}
//2. ui services
var cm = GetComponentInChildren<CanvasManager>();
if (cm == null) Debug.LogError("canvasmanager not present");
if (cm == null)
Debug.LogError("canvasmanager not present");
var mm = GetComponentInChildren<ModalManager>();
if (mm == null) Debug.LogError("modalmanager not present");
if (mm == null)
Debug.LogError("modalmanager not present");
ServiceLocator.ServiceLocator.Instance.Register<UIService>(new UIService(cm, mm));
}
void OnApplicationQuit()
{
Debug.Log("Application ending after " + Time.time + " seconds");
//if (statusTimer != null)
//{
// statusTimer.Stop();
// statusTimer.Dispose();
// statusTimer = null;
//}
if (!netcom.IsLoggedIn) return;
Thread saveInvToDisk = new Thread(delegate ()
{
instance.Client.Inventory.Store.SaveToDisk(instance.InventoryCacheFileName);
})
{
Name = "Save inventory to disk"
};
saveInvToDisk.Start();
netcom.Logout();
Debug.Log("Logged out! :)");
frmMain_Disposed();
Debug.Log("disposed mainform! :)");
}
//wraps up the netcom and client.
void frmMain_Disposed( )
{
if (netcom != null)
{
netcom.Dispose();
}
//
// if (instance.Client != null)
// {
// instance.UnregisterClientEvents(client);
// }
//if (instance?.Names != null)
//{
// instance.Names.NameUpdated -= new EventHandler<UUIDNameReplyEventArgs>(Names_NameUpdated);
//}
instance.CleanUp();
}
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a4804f9a0f80e3341ac117f8fc36fab6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using Raindrop.ServiceLocator;
using UnityEngine;
using UnityEngine.Serialization;
//helper class that helps to pop, push, stack canvases.
//singleton.
@@ -15,7 +16,22 @@ public class CanvasManager : MonoBehaviour
[Tooltip("The canvases that are created and in memory stack.")]
public Stack<CanvasIdentifier> activeCanvasStack = new Stack<CanvasIdentifier>();
public CanvasType main;
public CanvasIdentifier topCanvas
{
get
{
try
{
return activeCanvasStack.Peek();
}
catch (InvalidOperationException e)
{
return null;
}
}
}
public CanvasType initialPage;
private void Awake()
{
@@ -51,7 +67,7 @@ public class CanvasManager : MonoBehaviour
else
{
canvasControllerList.ForEach(x => x.gameObject.SetActive(false));
Push(main);
Push(initialPage);
}
}
@@ -95,17 +111,18 @@ public class CanvasManager : MonoBehaviour
//pop current, then push the desired canvas.
public void PopAndPush(CanvasType type)
{
PopCanvas();
Push(type);
// CanvasType theCanvasType = getCanvasTypeFromString(_type);
// if (theCanvasType ==CanvasType.UNKNOWN)
// {
// Debug.LogError("unable to get the canvas of identifer: "+ _type);
// }
//
// popCanvas();
// pushCanvas(theCanvasType);
// }
if (topCanvas)
{
PopCanvas();
}
Push(type);
}
// pop the current login screen, and push the game view. This is for viewing chats offline.
@@ -133,21 +150,27 @@ public class CanvasManager : MonoBehaviour
if (desiredCanvas != null)
{
desiredCanvas.gameObject.SetActive(true);
activeCanvasStack.Push (desiredCanvas);
activeCanvasStack.Push(desiredCanvas);
}
else { Debug.LogWarning("The desired canvas was not found!" + desiredCanvas.ToString()); }
}
public void PopCanvas()
{
var topCanvas = activeCanvasStack.Peek();
if (! topCanvas)
{
Debug.LogWarning("tried to pop empty canvas stack.");
return;
}
//1 remove topmost
topCanvas.gameObject.SetActive(false); //this lince causes error, as the function was called from the login thread!
activeCanvasStack.Pop();
//2 reactivate the one underneath.
if (topCanvas)
{
topCanvas.gameObject.SetActive(true);
}
}
}
+1 -3
View File
@@ -145,7 +145,7 @@ namespace Raindrop.Presenters
//call the ProcessChatInput in the respective manager class.
if (/*chatList.getSelected() == "local chat"*/ true)
{
_chatPresenterManager.LocalLocalChat.ProcessChatInput(input, type);
_chatPresenterManager.LocalChatManager.ProcessChatInput(input, type);
}
//else
@@ -155,8 +155,6 @@ namespace Raindrop.Presenters
// chatHistory.Add(cbxInput.Text);
// chatPointer = chatHistory.Count;
//}
netcom.ChatOut(inputString, ChatType.Normal, 0);
}
private void ClearChatInput()
+32 -11
View File
@@ -12,7 +12,7 @@ public class joystickToCameraBackend : MonoBehaviour
{
LeanJoystick joy;
private RaindropInstance instance;
public float thresh = 0.7f;
public const float thresh = 0.7f;
void Start()
{
@@ -25,22 +25,43 @@ public class joystickToCameraBackend : MonoBehaviour
private void OnJoySet(Vector2 arg0)
{
float vert = arg0.y;
float horz = arg0.x;
float vert = arg0.y ; // updown
float horz = arg0.x; //left right
int horz_clamp = (Mathf.Abs(horz) > thresh) ? 1 :
(Mathf.Abs(horz) < thresh) ? -1 :0;
if (horz_clamp == 0){
if (isDeadZone(vert, horz, thresh))
{
instance.Movement.SetTurningStop();
} else if(horz_clamp == 1){
instance.Movement.SetTurningRight();
instance.Movement.setCameraInputs(null);
}
else
{
instance.Movement.SetTurningLeft();
}
//
// int horz_clamp = (Mathf.Abs(horz) > thresh) ? 1 :
// (Mathf.Abs(horz) < thresh) ? -1 :0;
//
// if (horz_clamp == 0){
// instance.Movement.SetTurningStop();
// } else if(horz_clamp == 1){
// instance.Movement.SetTurningRight();
// }
// else
// {
// instance.Movement.SetTurningLeft();
// }
}
private bool isDeadZone(float vert, float horz, float thresh)
{
//get hypo len
float a = Mathf.Min(vert, horz);
float b = Mathf.Max(vert, horz);
float hypo = b + 0.337f * a;
return hypo < thresh;
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6c060e23f8b04f8da4f8b22c3df8ad70
timeCreated: 1641492039
@@ -0,0 +1,5 @@
public class LandmarkModel
{
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 60f91248461a4b8190dc9fe5e818d380
timeCreated: 1641492294
@@ -0,0 +1,86 @@
using OpenMetaverse;
using OpenMetaverse.Assets;
using Raindrop;
using Raindrop.Netcom;
using Raindrop.ServiceLocator;
public class LandmarkPresenter
{
// public Image image;
public string parcelName;
public string simName;
public string localCoords;
public string parcelDesc;
private LandmarkView view;
private LandmarkModel model;
#region shared data
public object mutex;
public bool modified; //if modified is true, we should update the view.
private InventoryLandmark landmark;
private AssetLandmark decodedLandmark; //currently empty, will be filled by network request later.
private UUID parcelID;
private ParcelInfo parcel;
private Vector3 localPosition;
private bool parcelLocation = false;
// public AssetLandmark Landmark
// {
// set
// {
// this.modified = true;
// this.decodedLandmark = value; //currently empty, will be filled by network request later.
// }
// }
#endregion
#region globalrefs
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
private GridClient client { get { return instance.Client; } }
bool Active => instance.Client.Network.Connected;
#endregion
// todo: someone needs to pass the inventory landmark to me! :)
public LandmarkPresenter(LandmarkView landmarkView, InventoryLandmark invLandmark)
{
view = landmarkView;
// model = new LandmarkModel();
RequestLandmarkFromServer(invLandmark);
}
private void RequestLandmarkFromServer(InventoryLandmark landmarkModel)
{
client.Assets.RequestAsset(landmarkModel.AssetUUID, landmarkModel.AssetType, true, Assets_OnAssetReceived);
}
void Assets_OnAssetReceived(AssetDownload transfer, Asset asset)
{
if (transfer.Success && asset.AssetType == AssetType.Landmark)
{
decodedLandmark = (AssetLandmark)asset;
decodedLandmark.Decode();
localPosition = decodedLandmark.Position;
client.Grid.RequestRegionHandle(decodedLandmark.RegionID);
}
}
private void UpdateInternalData(AssetLandmark lm)
{
lock (mutex)
{
this.parcelName = lm.RegionID.ToString();
modified = true;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 506ed0c8e7dc4c799ffdc64fbc5a5279
timeCreated: 1641492082
@@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
using OpenMetaverse;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class LandmarkView : MonoBehaviour
{
public Image image;
public TMP_Text parcelName;
public TMP_Text simName;
public TMP_Text localCoords;
public TMP_Text parcelDesc;
private LandmarkPresenter presenter;
// Start is called before the first frame update
void Start()
{
Debug.LogError("landmarkclasses: this class is not ready for use!");
//todo : specify uuid.
var invLMrequested= new InventoryLandmark(UUID.Zero);
LandmarkPresenter presenter = new LandmarkPresenter(this, invLMrequested);
}
// Update is called once per frame
void Update()
{
PollPresenterAndUpdate();
}
// access the modified bool in presenter, if it is true, we need to update ourselves.
private void PollPresenterAndUpdate()
{
lock (presenter.mutex)
{
if (presenter.modified == false)
{
return;
}
//update ui.
parcelName.text = presenter.parcelName;
presenter.modified = false;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 413567b9590fa7e4a8bdc0e411130611
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8 -1
View File
@@ -21,20 +21,27 @@ namespace Raindrop.UI.Model
class MapModel
{
// i fetch images.
private MapFetcher mapFetcher;
// i cache images to disk.
private MapCache mapCache;
#region globalrefs
private RaindropInstance instance { get { return ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>(); } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
private GridClient client { get { return instance.Client; } }
bool Active => instance.Client.Network.Connected;
#endregion
#region instance vars
//the current zoom level that the user is requesting.
// 1 - one 256^2 texture is 1 sim.
// ...
// 4 - one 256^2 texture is 8*8 sims.
public int zoomLevel;
#endregion
public MapModel()
{
//mapFetcher = UtilsUnity.ServiceLocator.Instance.Get<MapFetcher>();
+10 -34
View File
@@ -15,22 +15,20 @@ using Raindrop.UI.Model;
namespace Raindrop.UI.Presenters
{
/// <summary>
/// Presenter
/// I am used by
/// 1. mapUI (go)
/// 2. mapScene (go)
/// I do not have an update loop. I am driven by the above 2 players.
/// </summary>
//some key ideas:
/* if my finger is clicking the map, I have intention to navigate and pan the map.
* if my finger is not clicking the map, I have no intention to do anything with the map.
*
* if i tap the map, the informaiton of the coordinate i tap will be displayed as a card.
*
* i only fetch the map if my camera is shooting at it.
*
*/
public class MapScenePresenter
{
private static MapScenePresenter _Instance;
//private MapSceneView mapSceneView;
private MapModel mapModel;
private bool needRepaint;
GridLayer visibleRanges;
public event EventHandler<string> MapClicked;
public virtual void OnMapClick(ulong regionCoords) //protected virtual method
@@ -39,18 +37,7 @@ namespace Raindrop.UI.Presenters
MapClicked?.Invoke(this, regionCoords.ToString() + "to implement sim name and pos as string in event. ");
}
public static MapScenePresenter getInstance()
{
return _Instance ?? (_Instance = new MapScenePresenter());
}
private RaindropInstance instance { get { return ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>(); } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
private GridClient client { get { return instance.Client; } }
bool Active => instance.Client.Network.Connected;
private MapScenePresenter(/*MapSceneView mapSceneView*/)
public MapScenePresenter(MapUIView mapUIView, MapSceneView mapSceneView)
{
//this.mapSceneView = mapSceneView;
@@ -59,17 +46,6 @@ namespace Raindrop.UI.Presenters
mapModel = new MapModel();
}
public void setViewAt(Vector2 at)
{
}
public void reset()
{
throw new NotImplementedException();
}
/// <summary>
/// get a list of region handles that are visible to the camera.
+13 -12
View File
@@ -68,10 +68,7 @@ namespace Raindrop.Map.Model
// obtains the image from URL, decodes it in main thread, the stores data in the appropriate maptile.
public MapTile GetRegionTileExternal(ulong handle, int zoom)
{
if ((zoom > 4) || (zoom < 1))
{
return null;
}
zoom = 1;
if (tryGetMapTile(handle, 1) != null)
{
@@ -90,7 +87,7 @@ namespace Raindrop.Map.Model
regX /= regionSize;
regY /= regionSize;
//int zoom = 1;
MapTile res = null;
MapTile res = new MapTile(256,256);
downloader.QueueDownlad(
new Uri(string.Format("http://map.secondlife.com/map-{0}-{1}-{2}-objects.jpg", zoom, regX, regY)),
20 * 1000,
@@ -117,11 +114,10 @@ namespace Raindrop.Map.Model
{
gottenData.Enqueue(new MapData(handle, responseData));
}
//MapTile tile = mapTilesManager.setEmptyTile(handle); //Tile is a empty tile right now -- we write to it soon.
//run jpeg decoding on the main thread, for now.
//mainThreadInstance.Enqueue(DecodeDataToTexAsync(tile, responseData));
mainThreadInstance.Enqueue(DecodeDataToTexAsync(res, responseData));
lock (tileRequests)
{
@@ -139,7 +135,7 @@ namespace Raindrop.Map.Model
);
return null; // problem: since the callback takes a while to complete, the res is obviously a null when this line is reached.
return res; // inside res, it is notready.
//lock (mapData.sceneTiles)
//{
@@ -153,8 +149,13 @@ namespace Raindrop.Map.Model
{
try
{
Texture2D _tex = output_tile.getTex();
bool success = _tex.LoadImage(responseData);
lock (output_tile.getTex())
{
Texture2D _tex = output_tile.getTex();
bool success = _tex.LoadImage(responseData); //warn: main thread only.
output_tile.isReady = true;
}
}
catch (Exception w)
{
+2
View File
@@ -16,6 +16,8 @@ namespace Raindrop.Map.Model
private ulong gridHandle;
public bool isReady = false;
private static Texture2D emptyTexture = Texture2D.redTexture;
public MapTile(int width, int height)
@@ -63,7 +63,6 @@ namespace Raindrop.UI.Views
private void Awake()
{
cameraView = cameraViewGO.GetComponent<DownwardOrthoCameraView>();
mapPoolPresenter = MapScenePresenter.getInstance();
}
@@ -11,42 +11,41 @@ using OpenMetaverse;
using Raindrop.Map;
using Raindrop.UI;
using Raindrop.UI.Presenters;
using UnityEngine.Serialization;
namespace Raindrop.UI.Views
{
// UI for the map viewing.
public class MapUI : MonoBehaviour
// attach to the UI of map viewer.
public class MapUIView : MonoBehaviour
{
private MapScenePresenter msp => MapScenePresenter.getInstance();
// map manager. keeps track of mapsGOs. creates new mapGOs from prefabs. culls those that are no longer visible. fetches those that need to be viewed.
[SerializeField]
public GameObject mapScene_GameObject;
private MapSceneView mapSceneRenderer;
public MapSceneView mapSceneGraph_Root;
private MapScenePresenter msp;
//reset the view to daboom.
[SerializeField]
public GameObject resetButtonGO;
private Button button;
public Button button;
private void Awake()
{
mapSceneRenderer = mapScene_GameObject.GetComponent<MapSceneView>();
button.onClick.AddListener(OnClick_ResetView);
button = resetButtonGO.GetComponent<Button>();
button.onClick.AddListener(TaskOnClick);
msp = new MapScenePresenter(this, mapSceneGraph_Root);
}
private void TaskOnClick()
private void OnClick_ResetView()
{
mapSceneRenderer.resetView();
mapSceneGraph_Root.resetView();
}
public void setZoom(float value)
{
mapSceneRenderer.setZoom(value);
mapSceneGraph_Root.setZoom(value);
}
public MapScenePresenter getPresenter()
+78 -59
View File
@@ -14,55 +14,32 @@ public class ModalManager : MonoBehaviour
[Tooltip("The generic modal gameobject")]
[SerializeField]
public GameObject GenericModal;
// [SerializeField]
// public GameObject EulaModal;
[SerializeField]
public GameObject LoginStatusModal;
public ModalPresenter genericModalPresenter;
Thread mainThread;
//pool of modals.
private ModalPresenter genericModalPresenter;
// private ModalPresenter eulaModalPresenter;
[SerializeField]
private ModalPresenter loginStatusModal;
private void Awake()
{
//find yo modals in scene.
//foreach(modalPresenter _ in FindObjectsOfType<modalPresenter>())
//{
// genericModal.Add(_);
// _.closeModal();
//}
//if (FindObjectsOfType<modalPresenter>().Length != 0)
//{
// genericModal = FindObjectsOfType<modalPresenter>()[0];
// genericModal.closeModal();
//}
linkModals();
// GameObject GenericModal = Instantiate(GenericModalPrefab) as GameObject;
// GenericModal.transform.SetParent(this.transform);
// modalPresenter = GenericModal.GetComponent<modalPresenter>();
CheckModals();
mainThread = System.Threading.Thread.CurrentThread;
}
private void linkModals()
private void CheckModals()
{
genericModalPresenter = GenericModal.GetComponent<ModalPresenter>();
if (genericModalPresenter == null)
{
Debug.LogError("cannot find the gneric modal");
}
if (loginStatusModal == null)
{
Debug.LogError("cannot find the login modal");
}
}
//
@@ -128,33 +105,33 @@ public class ModalManager : MonoBehaviour
//by default obviously this must be visible; we are updating the login status.
public void setVisibleLoggingInModal(string content)
{
string title = "Logging in status...";
if (isOnMainThread())
{
if (loginStatusModal != null)
{
loginStatusModal.setModalNoActions(title, content);
loginStatusModal.gameObject.SetActive(true);
}
else
{
Debug.LogWarning("unable to get the modalPresenter object!");
}
}
else
{
UnityMainThreadDispatcher.Instance().Enqueue(() => {
//Debug.Log(" dispatching of showing modal");
setVisibleLoggingInModal(content);
});
}
}
// public void setVisibleLoggingInModal(string content)
// {
// string title = "Logging in status...";
//
// if (isOnMainThread())
// {
// if (loginStatusModal != null)
// {
// loginStatusModal.setModalNoActions(title, content);
// loginStatusModal.gameObject.SetActive(true);
// }
// else
// {
// Debug.LogWarning("unable to get the modalPresenter object!");
// }
// }
// else
// {
//
// UnityMainThreadDispatcher.Instance().Enqueue(() => {
// //Debug.Log(" dispatching of showing modal");
// setVisibleLoggingInModal(content);
// });
// }
//
//
// }
private bool isOnMainThread()
@@ -175,7 +152,49 @@ public class ModalManager : MonoBehaviour
}
else
{
Debug.Log("unable to get the modalPresenter object!");
Debug.LogWarning("unable to get the modalPresenter object!");
}
}
public void setLoginModalText(string title, string content)
{
if (loginStatusModal != null)
{
loginStatusModal.setModal(
title,
content,
"OK"
);
showLoginModal();
}
else
{
Debug.LogWarning("unable to get the loginStatusModal object!");
}
}
private void showLoginModal()
{
if (loginStatusModal != null)
{
loginStatusModal.gameObject.SetActive(true);
}
else
{
Debug.LogWarning("unable to get the login modal object!");
}
}
public void fadeLoginModal()
{
if (loginStatusModal != null)
{
loginStatusModal.fadeaway();
}
else
{
Debug.LogWarning("unable to get the login modal object!");
}
}
}
+24 -1
View File
@@ -29,6 +29,8 @@ public class ModalPresenter : MonoBehaviour
public Button CloseButton;
public Button BackgroundButton;
public CanvasRenderer renderer;
private void Start()
{
LinkUIComponents();
@@ -70,8 +72,18 @@ public class ModalPresenter : MonoBehaviour
{
titletext.GetComponent<TMP_Text>().text = title;
contenttext.GetComponent<TMP_Text>().text = content;
this.actionText.GetComponent<TMP_Text>().text = actionText;
if (actionText == null)
{
this.actionText.gameObject.SetActive(false);
}
else
{
this.actionText.gameObject.SetActive(true);
this.actionText.GetComponent<TMP_Text>().text = actionText;
}
}
//special form of setModal
public void setModalNoActions(string title, string content)
{
setModal(title, content, null);
@@ -81,4 +93,15 @@ public class ModalPresenter : MonoBehaviour
{
gameObject.SetActive(false);
}
public void fadeaway()
{
// StartCoroutine(SlowFade_Coroutine(1500));
}
private CanvasRenderer getRenderer()
{
return renderer;
}
}
@@ -164,8 +164,6 @@ namespace Raindrop.Presenters
public void OnChatBtnClick()
{
uimanager.canvasManager.Push(CanvasType.Chat);
}
public void OnMapBtnClick()
{
+153 -85
View File
@@ -32,7 +32,7 @@ namespace Raindrop.Presenters
{
private RaindropInstance instance { get { return ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>(); } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
private UIService uimanager;
private UIService uimanager => ServiceLocator.ServiceLocator.Instance.Get<UIService>();
#region UI elements - the 'view' in MVP
@@ -44,6 +44,9 @@ namespace Raindrop.Presenters
public TMP_Dropdown locationDropdown;
private LoginLocationDropdown loginLocationDropdown; //wraps the above
public TMP_Text credError;
#endregion
#region internal representations
@@ -62,8 +65,11 @@ namespace Raindrop.Presenters
get; set;
}
public ReactiveProperty<string> Login_msg { get; private set; }
private ReactiveProperty<bool> btnLoginEnabled;
public ReactiveProperty<string> loginMsg = new ReactiveProperty<string>(""); //"" is a magic value that is required to prevent showing the modal immediately on load.
private ReactiveProperty<bool> btnLoginEnabled = new ReactiveProperty<bool>(true);
//is empty string if there is no error.
public ReactiveProperty<string> credParserErrorString = new ReactiveProperty<string>();
//public string uninitialised = "(unknown)";
@@ -86,8 +92,7 @@ namespace Raindrop.Presenters
//2 load various loginInformation from the settings.
InitializeConfig();
//GridDropdownGO = this.gameObject.GetComponent<GenericDropdown>().gameObject;
//genericDropdown = GridDropdownGO.GetComponent<GenericDropdown>();
//GridDropdownView.DropdownSelectionChanged += GenericDropdown_DropdownSelectionChanged;
@@ -95,17 +100,27 @@ namespace Raindrop.Presenters
//3 hookup reactive UIs.
LoginButton.onClick.AsObservable().Subscribe(_ => OnLoginBtnClick()); //when clicked, runs this method.
btnLoginEnabled = new ReactiveProperty<bool>(true);
btnLoginEnabled.AsObservable().Subscribe(_ => LoginButton.gameObject.SetActive(_)); //update the login button availabilty according to this boolean.
usernameField.onValueChanged.AsObservable().Subscribe(_ => Username = _); //change username property.
passwordField.onValueChanged.AsObservable().Subscribe(_ => Password = _);
usernameField.onValueChanged.AsObservable().Subscribe(_ =>
{
Username = _;
credParserErrorString.Value = "";
}); //change username property.
passwordField.onValueChanged.AsObservable().Subscribe(_ =>
{
Password = _;
credParserErrorString.Value = "";
}); //change password.
RememberCheckbox.OnValueChangedAsObservable().Subscribe(_ => cbRememberBool = _); //when toggle checkbox, set boolean to the same value as the toggle-state
TOSCheckbox.OnValueChangedAsObservable().Subscribe(_ => cbTOStrue = _); //when toggle checkbox, set boolean to the same value as the toggle-state
Login_msg.AsObservable()./*Where(_ => ! _.Equals(uninitialised)).*/Subscribe(_ => UpdateModalText(_)); //no bug?
loginMsg.AsObservable().Where(_ => ! _.Equals("")).Subscribe(_ => UpdateLoginModalContent("Logging in process...", _));
credParserErrorString.AsObservable().Subscribe(_ => OnCredParseError(_));
//gridDropdown.OnValueChangedAsObservable().Subscribe(_ => gridSelectedItem = _);
//customURLCheckbox.onValueChanged.AsObservable().Subscribe(_ => cbCustomURL = _); //change username property.
@@ -113,21 +128,41 @@ namespace Raindrop.Presenters
//4subscribe to events.
AddNetcomEvents();
//get uimanager service
uimanager = ServiceLocator.ServiceLocator.Instance.Get<UIService>();
}
private void UpdateModalText(string _)
// show the error text.
private void OnCredParseError(string _)
{
credError.text = _;
if (String.IsNullOrEmpty(_))
{
credError.gameObject.SetActive(false);
}
else
{
credError.gameObject.SetActive(true);
}
}
//updates the text in the login modal.
private void UpdateLoginModalContent(string header, string message)
{
if (_ == null)
return;
if (uimanager == null)
return;
if (!uimanager.ready)
return;
uimanager.modalManager.setVisibleLoggingInModal(_);
if (header == "")
{
header = "Logging in... ";
}
uimanager.modalManager.setLoginModalText(header, message);
}
private void Close_LoginModal_Slow()
{
uimanager.modalManager.fadeLoginModal();
}
private void AddNetcomEvents()
@@ -149,53 +184,44 @@ namespace Raindrop.Presenters
public void netcom_ClientLoginStatus(object sender, LoginProgressEventArgs e)
{
string header = "Logging in process...";
switch (e.Status)
{
case LoginStatus.ConnectingToLogin:
Login_msg.GetType().GetProperty("Value").SetValue(Login_msg, "Connecting to login server...");
uimanager.modalManager.showModalNotification("Logging in process...", Login_msg.Value);
//lblLoginStatus.ForeColor = Color.Black;
loginMsg.Value += "Connecting to login server...";
break;
case LoginStatus.ConnectingToSim:
Login_msg.Value = ("Connecting to region...");
uimanager.modalManager.showModalNotification("Logging in process...", Login_msg.Value);
//lblLoginStatus.ForeColor = Color.Black;
loginMsg.Value += ("Connecting to region...");
break;
case LoginStatus.Redirecting:
Login_msg.Value = "Redirecting...";
uimanager.modalManager.showModalNotification("Logging in process...", Login_msg.Value);
//lblLoginStatus.ForeColor = Color.Black;
loginMsg.Value += "Redirecting...";
break;
case LoginStatus.ReadingResponse:
Login_msg.Value = "Reading response...";
uimanager.modalManager.showModalNotification("Logging in process...", Login_msg.Value);
//lblLoginStatus.ForeColor = Color.Black;
loginMsg.Value += "Reading response...";
break;
case LoginStatus.Success:
Login_msg.Value = "Logged in as " + netcom.LoginOptions.FullName;
//lblLoginStatus.ForeColor = Color.FromArgb(0, 128, 128, 255);
//proLogin.Visible = false;
loginMsg.Value += "Logged in as " + netcom.LoginOptions.FullName;
//btnLogin.Text = "Logout";
btnLoginEnabled.Value = false;
instance.Client.Groups.RequestCurrentGroups();
// instance.Client.Groups.RequestCurrentGroups();
Close_LoginModal_Slow();
uimanager.modalManager.showModalNotification("Logging in process...","Logged in !");
uimanager.canvasManager.PopAndPush(CanvasType.Game);
//instance.UI.canvasManager.popCanvas();
LoginButton.interactable = true;
break;
case LoginStatus.Failed:
//lblLoginStatus.ForeColor = Color.Red;
if (e.FailReason == "tos")
{
Login_msg.Value = "Must agree to Terms of Service before logging in";
uimanager.modalManager.showModalNotification("Logging in failed",Login_msg.Value);
loginMsg.Value = "Must agree to Terms of Service before logging in";
uimanager.modalManager.showModalNotification("Logging in failed",loginMsg.Value);
//pnlTos.Visible = true;
//txtTOS.Text = e.Message.Replace("\n", "\r\n");
btnLoginEnabled.Value = true;
@@ -203,22 +229,19 @@ namespace Raindrop.Presenters
}
else
{
Login_msg.Value = e.Message;
uimanager.modalManager.showModalNotification("Logging in failed", Login_msg.Value);
loginMsg.Value = e.Message;
uimanager.modalManager.showModalNotification("Logging in failed", loginMsg.Value);
btnLoginEnabled.Value = true;
LoginButton.interactable = true;
}
//proLogin.Visible = false;
//btnLogin.Text = "Retry";
break;
}
}
public void netcom_ClientLoggedOut(object sender, EventArgs e)
{
Login_msg.Value = "logged out.";
uimanager.modalManager.showModalNotification("Login status", Login_msg.Value);
loginMsg.Value = "logged out.";
uimanager.modalManager.showModalNotification("Login status", loginMsg.Value);
//pnlLoginPrompt.Visible = true;
//pnlLoggingIn.Visible = false;
@@ -230,23 +253,15 @@ namespace Raindrop.Presenters
{
btnLoginEnabled.Value = false;
Login_msg.Value = "Logging out...";
uimanager.modalManager.showModalNotification("Login status", Login_msg.Value);
//lblLoginStatus.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
//proLogin.Visible = true;
loginMsg.Value = "Logging out...";
// uimanager.modalManager.showModalNotification("Login status", Login_msg.Value);
}
public void netcom_ClientLoggingIn(object sender, OverrideEventArgs e)
{
Login_msg.Value = "Logging in...";
uimanager.modalManager.showModalNotification("Login status", Login_msg.Value);
//lblLoginStatus.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
//proLogin.Visible = true;
//pnlLoggingIn.Visible = true;
//pnlLoginPrompt.Visible = false;
loginMsg.Value = "Start to Logging in...";
// uimanager.modalManager.showModalNotification("Login status", Login_msg.Value);
btnLoginEnabled.Value = false;
}
@@ -255,11 +270,11 @@ namespace Raindrop.Presenters
private void initialiseFields()
{
//reset user and pw fields
Username = INIT_USERNAME;
Password = INIT_PASSWORD;
// Username = INIT_USERNAME;
// Password = INIT_PASSWORD;
//login status message for the modal
Login_msg = new ReactiveProperty<string>("...");
// Login_msg = new ReactiveProperty<string>("");
}
@@ -325,21 +340,86 @@ namespace Raindrop.Presenters
}
// slowly turns the button back on again.
IEnumerator EnableButtonCoroutine(float delay)
{
yield return new WaitForSeconds(delay / 1000f);
LoginButton.interactable = true;
}
// 1. open the login status modal.
// 2. create a timeout timer -> on time out, allow user to close the login status modal.
public void OnLoginBtnClick()
{
LoginButton.interactable = false;
//instance.MediaManager.PlayUISound(UISounds.Click);
//sanity
if (Username == INIT_USERNAME || Password == INIT_PASSWORD)
{
Debug.LogError("Either username and password is not defined!");
LoginButton.interactable = true;
//guard username
string parsedFirstname = "";
string parsedLastname = "";
bool isValidUser = splitUserName(Username, out parsedFirstname, out parsedLastname);
if (!isValidUser)
{
credParserErrorString.Value = "bad username. Allowable examples: Kitty Graves , FlyingFox Resident , FlyingFox ";
Debug.LogError(" username error; invalid username input : " + Username);
StartCoroutine(EnableButtonCoroutine(1500));
return;
}
//guard password
if (Password.Length <= 0)
{
credParserErrorString.Value = "bad password";
Debug.LogError(" password error!");
StartCoroutine(EnableButtonCoroutine(1500));
return;
}
//do login.
BeginLogin(parsedFirstname, parsedLastname, Password);
}
BeginLogin();
// input: ***REMOVED*** resident
//
// result:
// first: ***REMOVED*** last: resident
// return: true if success.
private bool splitUserName(string username, out string firstname, out string lastname)
{
//split by the dot or space character.
string[] parts = System.Text.RegularExpressions.Regex.Split(username.Trim(), @"[. ]+");
if (parts.Length == 2)
{
firstname = parts[0];
lastname = parts[1];
}
else if (parts.Length == 1)
{
firstname = username.Trim();
lastname = "Resident";
//first name might be empty string ""
}
else
{
firstname = "";
lastname = "";
credParserErrorString.Value = "bad username";
Debug.Log("bad username: " + username );
return false;
}
if (firstname == "")
{
firstname = "";
lastname = "";
credParserErrorString.Value = "bad username";
Debug.Log("bad username: " + username );
return false;
}
return true;
}
public void OnLogoutBtnClick()
@@ -358,33 +438,21 @@ namespace Raindrop.Presenters
#region Login functions
private void BeginLogin()
private void BeginLogin(string first, string last, string password)
{
string username = Username;
string[] parts = System.Text.RegularExpressions.Regex.Split(username.Trim(), @"[. ]+");
_ = netcom;
if (parts.Length == 2)
{
netcom.LoginOptions.FirstName = parts[0];
netcom.LoginOptions.LastName = parts[1];
}
else
{
netcom.LoginOptions.FirstName = username.Trim();
netcom.LoginOptions.LastName = "Resident";
}
netcom.LoginOptions.FirstName = first;
netcom.LoginOptions.LastName = last;
netcom.LoginOptions.Password = Password;
netcom.LoginOptions.Password = password;
netcom.LoginOptions.Channel = "Channel"; // Channel
netcom.LoginOptions.Version = "Version"; // Version
netcom.AgreeToTos = cbTOStrue;
//startlocation parsing
switch (locationDropdown.value)
{
case 0: //Custom
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f530318ac12a407dab4ce28068dba16c
timeCreated: 1641892238
@@ -0,0 +1,14 @@
using UnityEngine;
namespace Raindrop.Unity3D.CameraAndMovement
{
public class MovementControls
{
private Quaternion cameraDir;
private Transform avatarPose;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 166e9338a2ee4f079e5ab020e0db9a21
timeCreated: 1641892261
@@ -12,9 +12,10 @@ using Vector3 = OpenMetaverse.Vector3;
namespace Raindrop.Presenters
{
//presents objects in the sim as boxes
public class ObjectPresenter : MonoBehaviour
//contains methods to display, update, de-rez the SLobjects as unity objects.
public class ObjectManager : MonoBehaviour
{
public Thread mainThread;
public static Thread mainThread;
public GameObject ObjectPrefab;
private object objectsLock = new object();
@@ -22,37 +23,35 @@ namespace Raindrop.Presenters
= new Dictionary<UUID, GameObject>(); //user UUID -> user gameobject
private RaindropInstance instance { get { return ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>(); } }
//private RaindropNetcom netcom { get { return instance.Netcom; } }
bool Active => instance.Client.Network.Connected;
void Start()
{
mainThread = System.Threading.Thread.CurrentThread;
instance.Client.Objects.ObjectUpdate += ObjectsOnObjectUpdate;
instance.Client.Objects.TerseObjectUpdate += ObjectsOnTerseObjectUpdate;
//instance.Client.Objects.ObjectUpdate += ObjectsOnObjectUpdate; //prims, foilage, attachments (for those that are static and we-just-saw-it)
instance.Client.Objects.TerseObjectUpdate += ObjectsOnTerseObjectUpdate; //prims, avatars (for those that move often and hap-hazardly)
}
private void ObjectsOnTerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
{
GameObject obj;
objects.TryGetValue(e.Prim.ID, out obj);
if (obj != null)
lock (objectsLock)
{
//Debug.Log("object " + e.Prim.ID.ToString() + "has moved");
// Debug.LogWarning("object move to be implemented");
UpdateObjTransforms(e.Prim, obj);
objects.TryGetValue(e.Prim.ID, out obj);
if (obj != null)
{
SetPrimTransformsOnMainThread(e.Prim, obj);
}
else
{
objects[e.Prim.ID] = RezNewObject(e.Prim);
}
}
}
private static void UpdateObjTransforms(Primitive e, GameObject obj)
{
UE.Vector3 pos = RHelp.TKVector3(e.Position);
UE.Quaternion rot = RHelp.TKQuaternion4(e.Rotation);
obj.transform.position = pos;
obj.transform.rotation = rot;
}
private void ObjectsOnObjectUpdate(object sender, PrimEventArgs e)
{
if (e.Simulator != instance.Client.Network.CurrentSim)
@@ -75,7 +74,7 @@ namespace Raindrop.Presenters
}
private bool isOnMainThread()
private static bool isOnMainThread()
{
return mainThread.Equals(System.Threading.Thread.CurrentThread);
}
@@ -89,39 +88,76 @@ namespace Raindrop.Presenters
lock (objectsLock)
{
GameObject primGO = null;
objects.TryGetValue(e.Prim.ID, out primGO);
objects.TryGetValue(e.Prim.ID, out primGO);
if (primGO == null)
{
// Debug.Log("newly seen obj. rezzing " + e.Prim.ID);
if (e.Prim.Text != "" || e.Prim.Text != null )
{
// Debug.Log("prim has no props. " + e.Prim.ID); //this is for most prims.
}
else if (e.Prim.Properties.Name == null)
{
Debug.Log("prim has property, but no name . " + e.Prim.ID); //i have never seen this before.
}
primGO = CreatePrimGameObject(e.Prim);
objects[e.Prim.ID] = primGO;
primGO = RezNewObject(e.Prim);
}
else
{
//Debug.Log("updating obj position. " + e.Prim.ID);
}
SetPrimTransforms(e, primGO);
SetPrimTransformsOnMainThread(e.Prim, primGO);
}
}
private static void SetPrimTransforms(PrimEventArgs e, GameObject primGO)
private GameObject RezNewObject(Primitive e)
{
UE.Vector3 pos = RHelp.TKVector3(e.Prim.Position);
primGO.transform.position = pos;
GameObject primGO = new GameObject();
// Debug.Log("newly seen obj. rezzing " + e.Prim.ID);
if (e.Text != "" || e.Text != null)
{
// Debug.Log("prim has no props. " + e.Prim.ID); //this is for most prims.
}
else if (e.Properties.Name == null)
{
Debug.Log("prim has property, but no name . " + e.ID); //i have never seen this before.
}
if (isOnMainThread())
{
primGO = CreatePrimGameObject(e);
objects[e.ID] = primGO;
return primGO;
} else
{
UnityMainThreadDispatcher.Instance().Enqueue(() =>
{
RezNewObject(e);
});
}
return primGO;
}
// sets object position on the main thread.
private static void SetPrimTransformsOnMainThread(Primitive e, GameObject primGO)
{
//it might be possible that the object is removed at this point. handle it.
if (primGO == null)
{
return; //object is already removed from scene.
}
if (isOnMainThread())
{
SetPrimTransformsOnMainThread(e, primGO);
} else
{
UnityMainThreadDispatcher.Instance().Enqueue(() => {
UE.Vector3 pos = RHelp.TKVector3(e.Position);
primGO.transform.position = pos;
UE.Quaternion rot = RHelp.TKQuaternion4(e.Rotation);
primGO.transform.rotation = rot;
});
}
UE.Quaternion rot = RHelp.TKQuaternion4(e.Prim.Rotation);
primGO.transform.rotation = rot;
}
//make the agent:
+3 -10
View File
@@ -8,17 +8,17 @@ using UnityEngine;
public class LookAtTextUpdater : MonoBehaviour
{
public GameObject mapUIGO;
private MapUI mapUI;
private MapUIView _mapUIView;
private TMPro.TextMeshPro tmp;
private void Awake()
{
mapUI = mapUIGO.GetComponent<MapUI>();
_mapUIView = mapUIGO.GetComponent<MapUIView>();
tmp = this.GetComponent<TMPro.TextMeshPro>();
//sub
mapUI.getPresenter().MapClicked += bl_UserMapClick; // register with an event
_mapUIView.getPresenter().MapClicked += bl_UserMapClick; // register with an event
//mapUI.StartProcess();
}
@@ -31,11 +31,4 @@ public class LookAtTextUpdater : MonoBehaviour
this.tmp.SetText(text);
}
}
// Update is called once per frame
void Update()
{
}
}
+4 -4
View File
@@ -10,7 +10,7 @@ namespace Raindrop.UI.Views
{
private Slider slider;
public GameObject mapUIGO;
private MapUI mapUI;
private MapUIView _mapUIView;
// Start is called before the first frame update
void Start()
@@ -20,7 +20,7 @@ namespace Raindrop.UI.Views
void Awake()
{
mapUI = mapUIGO.GetComponent<MapUI>();
_mapUIView = mapUIGO.GetComponent<MapUIView>();
slider = gameObject.GetComponent<Slider>();
if (slider != null)
{
@@ -30,9 +30,9 @@ namespace Raindrop.UI.Views
}
public void ListenerMethod(float value)
{
if (mapUI != null)
if (_mapUIView != null)
{
mapUI.setZoom(value);
_mapUIView.setZoom(value);
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1b37a2262d77ee8408bafb8c93f160e9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+53
View File
@@ -0,0 +1,53 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 16995157, guid: a811bde74b26b53498b4f6d872b09b6d, type: 3}
m_Name: DOTweenSettings
m_EditorClassIdentifier:
useSafeMode: 1
safeModeOptions:
logBehaviour: 2
nestedTweenFailureBehaviour: 0
timeScale: 1
useSmoothDeltaTime: 0
maxSmoothUnscaledTime: 0.15
rewindCallbackMode: 0
showUnityEditorReport: 0
logBehaviour: 0
drawGizmos: 1
defaultRecyclable: 0
defaultAutoPlay: 3
defaultUpdateType: 0
defaultTimeScaleIndependent: 0
defaultEaseType: 6
defaultEaseOvershootOrAmplitude: 1.70158
defaultEasePeriod: 0
defaultAutoKill: 1
defaultLoopType: 0
debugMode: 0
debugStoreTargetId: 1
showPreviewPanel: 1
storeSettingsLocation: 0
modules:
showPanel: 0
audioEnabled: 1
physicsEnabled: 1
physics2DEnabled: 1
spriteEnabled: 1
uiEnabled: 1
textMeshProEnabled: 0
tk2DEnabled: 0
deAudioEnabled: 0
deUnityExtendedEnabled: 0
epoOutlineEnabled: 0
createASMDEF: 1
showPlayingTweens: 0
showPausedTweens: 0
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5667c09caac32494e96d4328bfda8777
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
+147 -8
View File
@@ -209,6 +209,140 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &1253144801864441802
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2310103206004616297}
- component: {fileID: 7869168484096854760}
- component: {fileID: 8469573130773908255}
m_Layer: 5
m_Name: CredParseErrorText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2310103206004616297
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1253144801864441802}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4000849117327746565}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -409, y: -200}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7869168484096854760
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1253144801864441802}
m_CullTransparentMesh: 1
--- !u!114 &8469573130773908255
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1253144801864441802}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278204159
m_fontColor: {r: 1, g: 0.21227312, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 2
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3775511210413060700
GameObject:
m_ObjectHideFlags: 0
@@ -241,7 +375,7 @@ RectTransform:
m_Children:
- {fileID: 2936312484414191414}
m_Father: {fileID: 4000849117327746565}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@@ -880,7 +1014,7 @@ RectTransform:
m_Children:
- {fileID: 4000849116862329206}
m_Father: {fileID: 4000849117327746565}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@@ -2315,6 +2449,7 @@ RectTransform:
m_Children:
- {fileID: 4000849118651321683}
- {fileID: 4000849117609312322}
- {fileID: 2310103206004616297}
- {fileID: 4000849116890187672}
- {fileID: 4000207759485342017}
m_Father: {fileID: 4000849118368597045}
@@ -2830,8 +2965,8 @@ MonoBehaviour:
m_VerticalScrollbarEventHandler: {fileID: 0}
m_LayoutGroup: {fileID: 0}
m_ScrollSensitivity: 1
m_ContentType: 0
m_InputType: 0
m_ContentType: 7
m_InputType: 2
m_AsteriskChar: 42
m_KeyboardType: 0
m_LineType: 0
@@ -3574,7 +3709,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "Password \u200B"
m_text: "*********\u200B"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@@ -4886,7 +5021,11 @@ MonoBehaviour:
TOSCheckbox: {fileID: 4000849118799321717}
RememberCheckbox: {fileID: 4000849118247386934}
locationDropdown: {fileID: 4000849117287871149}
uninitialised: (unknown)
credError: {fileID: 8469573130773908255}
Login_msg:
value:
credParserErrorString:
value:
--- !u!114 &4000849118352810566
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -5806,14 +5945,14 @@ MonoBehaviour:
m_VerticalScrollbarEventHandler: {fileID: 0}
m_LayoutGroup: {fileID: 0}
m_ScrollSensitivity: 1
m_ContentType: 0
m_ContentType: 5
m_InputType: 0
m_AsteriskChar: 42
m_KeyboardType: 0
m_LineType: 0
m_HideMobileInput: 0
m_HideSoftKeyboard: 0
m_CharacterValidation: 0
m_CharacterValidation: 5
m_RegexValue:
m_GlobalPointSize: 17.03
m_CharacterLimit: 0
+404 -191
View File
@@ -1,5 +1,185 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3844016770729812478
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4976559937668615763}
- component: {fileID: 2397018969964325079}
m_Layer: 5
m_Name: Scrollview
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4976559937668615763
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3844016770729812478}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1961142571956303693}
m_Father: {fileID: 7342915068325230722}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.0014801, y: 78.678}
m_SizeDelta: {x: 707.66, y: 644.9}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2397018969964325079
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3844016770729812478}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Content: {fileID: 7342915068636071278}
m_Horizontal: 1
m_Vertical: 1
m_MovementType: 1
m_Elasticity: 0.1
m_Inertia: 1
m_DecelerationRate: 0.135
m_ScrollSensitivity: 1
m_Viewport: {fileID: 1961142571956303693}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
m_HorizontalScrollbarVisibility: 0
m_VerticalScrollbarVisibility: 0
m_HorizontalScrollbarSpacing: 0
m_VerticalScrollbarSpacing: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &3846479060468564538
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4864090719740254864}
- component: {fileID: 8772847508021831239}
m_Layer: 5
m_Name: Actions
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4864090719740254864
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3846479060468564538}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7342915068219569689}
m_Father: {fileID: 7342915068325230722}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 78.67935}
m_SizeDelta: {x: 0, y: 157.3587}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8772847508021831239
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3846479060468564538}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 4
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &5255639870928371093
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1961142571956303693}
- component: {fileID: 8910065496168062653}
m_Layer: 5
m_Name: Viewport
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1961142571956303693
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5255639870928371093}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7342915068636071278}
m_Father: {fileID: 4976559937668615763}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -50.9231, y: 50.6797}
m_SizeDelta: {x: 605.8237, y: 543.5506}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8910065496168062653
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5255639870928371093}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &7342915067887292614
GameObject:
m_ObjectHideFlags: 0
@@ -116,7 +296,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &7342915067995529456
RectTransform:
m_ObjectHideFlags: 0
@@ -185,16 +365,11 @@ MonoBehaviour:
m_GameObject: {fileID: 7342915067995529471}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c2eeaa71c61350f46902f312854272c9, type: 3}
m_Script: {fileID: 11500000, guid: 86bd9e369dde9514caa91b4db33a0d55, type: 3}
m_Name:
m_EditorClassIdentifier:
LoginButton: {fileID: 0}
usernameField: {fileID: 0}
passwordField: {fileID: 0}
TOSCheckbox: {fileID: 0}
RememberCheckbox: {fileID: 0}
locationDropdown: {fileID: 0}
uninitialised: (unknown)
mapScene_GameObject: {fileID: 0}
resetButtonGO: {fileID: 0}
--- !u!114 &7342915067995529457
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -246,7 +421,7 @@ GameObject:
- component: {fileID: 7342915068219569693}
- component: {fileID: 7342915068219569692}
- component: {fileID: 7342915068219569691}
- component: {fileID: 7342915068219569690}
- component: {fileID: 4018952563485310368}
m_Layer: 5
m_Name: TeleportButton
m_TagString: Untagged
@@ -265,15 +440,14 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7342915068922981049}
- {fileID: 7342915068781555311}
m_Father: {fileID: 7342915068325230722}
m_RootOrder: 1
m_Father: {fileID: 4864090719740254864}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 353.8327, y: -78.67935}
m_SizeDelta: {x: 272.8917, y: 117.8402}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915068219569693
CanvasRenderer:
@@ -357,32 +531,26 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &7342915068219569690
--- !u!114 &4018952563485310368
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068219569688}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 1
m_ChildScaleHeight: 1
m_ReverseArrangement: 0
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: 200
m_PreferredHeight: 100
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &7342915068325230721
GameObject:
m_ObjectHideFlags: 0
@@ -413,15 +581,15 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7342915068636071278}
- {fileID: 7342915068219569689}
- {fileID: 4976559937668615763}
- {fileID: 4864090719740254864}
m_Father: {fileID: 7342915068537289274}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -353.8328, y: 0.000061035}
m_SizeDelta: {x: 707.6654, y: 926.4}
m_AnchoredPosition: {x: -397, y: 0.00025749}
m_SizeDelta: {x: 707.6654, y: 802.2642}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915068325230725
CanvasRenderer:
@@ -468,7 +636,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068325230721}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
@@ -478,14 +646,14 @@ MonoBehaviour:
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_ChildAlignment: 4
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 1
m_ChildScaleHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &7342915068351934241
GameObject:
@@ -517,12 +685,12 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7342915068636071278}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 344.91995, y: -461.08038}
m_SizeDelta: {x: 707.67, y: 406.449}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 707.67, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915068351934244
CanvasRenderer:
@@ -759,10 +927,10 @@ RectTransform:
m_Father: {fileID: 7342915068537289274}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -7.8831787, y: 6.4756165}
m_SizeDelta: {x: 1716.6213, y: 791.2288}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.00036621094, y: 0.00024414062}
m_SizeDelta: {x: 0, y: 0.000061035156}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915068539203956
CanvasRenderer:
@@ -814,6 +982,7 @@ GameObject:
- component: {fileID: 7342915068636071265}
- component: {fileID: 7342915068636071264}
- component: {fileID: 7342915068636071279}
- component: {fileID: 170957775022376801}
m_Layer: 5
m_Name: card
m_TagString: Untagged
@@ -828,20 +997,21 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068636071277}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7342915069169467865}
- {fileID: 1996844810858912792}
- {fileID: 7342915069759069233}
- {fileID: 7342915068351934242}
m_Father: {fileID: 7342915068325230722}
m_Father: {fileID: 1961142571956303693}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 364.0288, y: -410.9211}
m_SizeDelta: {x: 728.0578, y: 821.8423}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915068636071265
CanvasRenderer:
@@ -888,19 +1058,45 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068636071277}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 300
m_MinHeight: 700
m_MinHeight: 300
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &170957775022376801
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068636071277}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &7342915068645020573
GameObject:
m_ObjectHideFlags: 0
@@ -1008,7 +1204,6 @@ GameObject:
- component: {fileID: 7342915068781555311}
- component: {fileID: 7342915068781555298}
- component: {fileID: 7342915068781555297}
- component: {fileID: 7342915068781555296}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
@@ -1028,12 +1223,12 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7342915068219569689}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 201.1952, y: 137.5409}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.000030518, y: -0.0000076294}
m_SizeDelta: {x: 201.19519, y: 137.5409}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915068781555298
CanvasRenderer:
@@ -1132,122 +1327,6 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &7342915068781555296
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068781555310}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 100
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 3
--- !u!1 &7342915068922981048
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7342915068922981049}
- component: {fileID: 7342915068922981052}
- component: {fileID: 7342915068922981051}
- component: {fileID: 7342915068922981050}
m_Layer: 5
m_Name: ChatButtonicon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7342915068922981049
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068922981048}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7342915068219569689}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 131.1952, y: 137.5409}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915068922981052
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068922981048}
m_CullTransparentMesh: 1
--- !u!114 &7342915068922981051
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068922981048}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: c5f82e3046f172741baab1a8365c87f5, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &7342915068922981050
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7342915068922981048}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 30
m_MinHeight: 30
m_PreferredWidth: 30
m_PreferredHeight: 30
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &7342915069169467864
GameObject:
m_ObjectHideFlags: 0
@@ -1280,10 +1359,10 @@ RectTransform:
m_Father: {fileID: 7342915068636071278}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 218, y: -74}
m_SizeDelta: {x: 453.83, y: 122.5707}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 453.83, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915069169467867
CanvasRenderer:
@@ -1693,12 +1772,12 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7342915068636071278}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 217.99995, y: -196.5705}
m_SizeDelta: {x: 453.83, y: 122.5707}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 453.83, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7342915069759069235
CanvasRenderer:
@@ -1797,3 +1876,137 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &8060488502744088855
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1996844810858912792}
- component: {fileID: 2150721158575090154}
- component: {fileID: 138190274413317227}
m_Layer: 5
m_Name: Location name (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1996844810858912792
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8060488502744088855}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7342915068636071278}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 453.83, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2150721158575090154
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8060488502744088855}
m_CullTransparentMesh: 1
--- !u!114 &138190274413317227
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8060488502744088855}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Natoma
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4281742381
m_fontColor: {r: 0.1764706, g: 0.20392157, b: 0.21176471, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 90
m_fontSizeBase: 90
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
+208
View File
@@ -0,0 +1,208 @@
using NUnit.Framework;
using OpenMetaverse;
using Raindrop.Netcom;
using Raindrop.Presenters;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lean.Gui;
using NUnit.Framework.Internal;
using OpenMetaverse.Assets;
using Raindrop.Services;
using TMPro;
using UnityEditor.PackageManager;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using UnityEngine.UI;
namespace Raindrop.Tests
{
/*
* These are UI-intensive tests. the main scene will be loaded.
*
*/
[TestFixture()]
public class RaindropIntegrationTests
{
private bool loggedin;
private bool testfail = false;
private RaindropNetcom netcom { get { return instance.Netcom; } }
private RaindropInstance instance { get { return ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>(); } }
[SetUp]
public void Setup()
{
//load the main scene.
SceneManager.LoadScene("Scenes/MainScene");
}
[TearDown]
public void TearDown()
{
netcom.Logout();
Application.Quit();
}
[UnityTest]
//login UI-backend-UI test
/* 1. [UI] enter creds, press login button
* 2. check backend API, login is true
* 3. [UI] press logout button.
* 4. check is logged out
* 5. passed.
*/
public IEnumerator LoginLogoutTest()
{
//0. is the scene ready?
var gm = GameObject.Find("GameManager");
var vm = GameObject.Find("ViewsManager");
var mm = GameObject.Find("ModalManager");
var go = GameObject.Find("GlobalOverlay");
//1. get the refence to the UI service.
var srvLocator = ServiceLocator.ServiceLocator.Instance;
var UISrv = srvLocator.Get<UIService>();
// srvLocator.Get<UIService>().resetUI();
//1a. accept the eula if needed.
if (UISrv.canvasManager.topCanvas.canvasType == CanvasType.Eula)
{
// well, we need to agree to eula first.
Utils.UI.accepttheeula();
}
//1b. we are on the welcome screen. now navigate to the login screen.
if (UISrv.canvasManager.topCanvas.canvasType == CanvasType.Welcome)
{
yield return new WaitForSeconds(2);
Utils.UI.Click_Button_Welcome2LoginScreen();
}
else
{
Assert.Fail("expected to be on the login screen!");
}
//Extra: set reducedsettings so that we do not use too many dependencies
instance.Client.Settings.ALWAYS_DECODE_OBJECTS = false;
instance.Client.Settings.ALWAYS_REQUEST_OBJECTS = false;
instance.Client.Settings.MULTIPLE_SIMS= false;
instance.Client.Settings.SEND_AGENT_APPEARANCE= false;
instance.Client.Settings.USE_ASSET_CACHE= false;
instance.Client.Settings.STORE_LAND_PATCHES= false;
instance.Client.Settings.STORE_LAND_PATCHES= false;
//1b. we are on the login screen. do login. assert logged in.
Assert.IsTrue(UISrv.canvasManager.topCanvas.canvasType == CanvasType.Login);
yield return new WaitForSeconds(2);
var loginPresenter
= vm.GetComponent<CanvasManager>().getForegroundCanvas().GetComponent<LoginPresenter>();
string _username = "***REMOVED*** Resident";
Utils.UI.Set_TMPInputField_ofGameObjectName("UserTextField", _username);
string _password = "***REMOVED***";
Utils.UI.Set_TMPInputField_ofGameObjectName("PassTextField", _password);
yield return new WaitForSeconds(2);
Utils.UI.ClickButtonByUnityName("LoginBtn");
//assert the backend API; that we are logged in.
yield return new WaitForSeconds(20);
Assert.True(instance.Client.Network.Connected == true, "check API that we are logged in");
//finally, disconnect. assert disconnected.
Utils.UI.Click_DisconnectButton();
yield return new WaitForSeconds(5);
Assert.True(instance.Client.Network.Connected == false, "check API that we are logged out");
Assert.Pass();
// yield break;
}
public async Task GetTestTaskAsync(int delay)
{
Debug.Log("1");
await Task.Delay(TimeSpan.FromMilliseconds(delay));
Debug.Log("2");
//await Task.Run(async () => await Task.Delay(TimeSpan.FromSeconds(delay)));
//Debug.Log("3");
//await Task.Delay(TimeSpan.FromMilliseconds(200));
//Debug.Log("4");
}
public class Utils
{
/*
* A whole bunch of methods to click buttons and type into inputfields.
*/
public class UI
{
public static bool ClickButtonByUnityName(string gameObjectName)
{
var btn = GameObject.Find(gameObjectName);
Assert.IsNotNull(btn, "Missing button " + btn.ToString());
if (btn.GetComponent<Button>())
{
btn.GetComponent<Button>().onClick.Invoke();
return true;
}
if (btn.GetComponent<LeanButton>())
{
btn.GetComponent<LeanButton>().OnClick.Invoke();
return true;
}
return false;
}
public static void Set_TMPInputField_ofGameObjectName(string go_name, string input)
{
var go = GameObject.Find(go_name);
Assert.True(go != null, "unable to find gameobject of name " + go_name);
var tmp = go.GetComponent<TMP_InputField>();
Assert.True(tmp != null, "Gameobject + " + go_name + " does not have TMP inputfield component ");
tmp.ActivateInputField();
tmp.text = input;
tmp.onValueChanged.Invoke(input);
tmp.onSubmit.Invoke(input);
}
public static void Click_DisconnectButton()
{
ClickButtonByUnityName("LogoutBtn");
}
//accept the eula:
/* 1. toggle true
* 2. click "next" btn
*/
// on the welcome screen, click the go button.
public static void accepttheeula()
{
string eulaCheckbox = "AgreeToggle";
var checkboxEULA = GameObject.Find(eulaCheckbox);
Assert.IsNotNull(checkboxEULA, "Missing checkbox " + eulaCheckbox);
checkboxEULA.GetComponent<Toggle>().onValueChanged.Invoke(true);
string eulaCloseBtn = "NextButton";
Assert.IsTrue(RaindropIntegrationTests.Utils.UI.ClickButtonByUnityName(eulaCloseBtn));
}
public static void Click_Button_Welcome2LoginScreen()
{
Assert.IsTrue(RaindropIntegrationTests.Utils.UI.ClickButtonByUnityName("LetsGo!"));
}
}
}
}
}
-112
View File
@@ -1,112 +0,0 @@
using NUnit.Framework;
using OpenMetaverse;
using Raindrop.Netcom;
using Raindrop.Presenters;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Raindrop.Services;
using UnityEngine;
using UnityEngine.TestTools;
namespace Raindrop.Tests
{
[TestFixture()]
public class RaindropTests
{
private bool loggedin;
private bool testfail = false;
private RaindropNetcom netcom { get { return instance.Netcom; } }
private RaindropInstance instance { get { return ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>(); } }
[UnityTest]
//login UI-backend-UI test
public IEnumerator LoginTest()
{
//RaindropClient MainRaindropInstance;
//get the ref to scene
//GameObject gameGameObject =
// MonoBehaviour.Instantiate(Resources.Load<GameObject>("Prefabs/UIMocks"));
//sub to callback
netcom.ClientLoginStatus += new EventHandler<LoginProgressEventArgs>(netcom_ClientLoginStatus);
yield return new WaitForSeconds(1);
//get viewmodel to login.
//getCurrentForeground gives us the loginVM, which we then call onloginbtnclick from.
var servicer = ServiceLocator.ServiceLocator.Instance;
GameObject temp = (GameObject)servicer.Get<UIService>().getCurrentForegroundPresenter();
if (temp == null)
{
testfail = true;
}
Assert.AreEqual(testfail, false);
if (temp.GetComponent<CanvasIdentifier>() != null)
{ //WHATTTTTT IS THIS FUCING SPAHGETTE
temp.GetComponent<LoginPresenter>().Username = "***REMOVED*** Resident";
temp.GetComponent<LoginPresenter>().Password = "***REMOVED***";
temp.GetComponent<LoginPresenter>().OnLoginBtnClick();
}
else
{
testfail = true;
}
//Task.Run(async () =>
//{
// await GetTestTaskAsync(5000);
//}).GetAwaiter().GetResult();
yield return new WaitForSeconds(5);
Assert.AreEqual(loggedin, true);
Assert.AreEqual(testfail, false);
//make sure login was
}
public async Task GetTestTaskAsync(int delay)
{
Debug.Log("1");
await Task.Delay(TimeSpan.FromMilliseconds(delay));
Debug.Log("2");
//await Task.Run(async () => await Task.Delay(TimeSpan.FromSeconds(delay)));
//Debug.Log("3");
//await Task.Delay(TimeSpan.FromMilliseconds(200));
//Debug.Log("4");
}
private void netcom_ClientLoginStatus(object sender, LoginProgressEventArgs e)
{
if (e.Status == LoginStatus.Failed)
{
loggedin = false;
}
else if (e.Status == LoginStatus.Success)
{
loggedin = true;
}
}
}
}
+3 -1
View File
@@ -5,7 +5,9 @@
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"LibreMetaverseAssembly",
"RaindropUnity"
"RaindropUnity",
"LeanGUI",
"Unity.TextMeshPro"
],
"includePlatforms": [],
"excludePlatforms": [],
+20
View File
@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
// use this to set the texture to the plane.
public class TexturePlane : MonoBehaviour
{
private Material mat;
void Start()
{
mat = this.GetComponent<MeshRenderer>().material;
ApplyTexture(Texture2D.blackTexture);
}
public void ApplyTexture(Texture2D tex)
{
mat.SetTexture("_MainTex", tex);
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bcde33ff241848041a3f6518e96a445b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 567724d9a894abf4dbd2a79d14e5b897
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More