mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 01:06:02 +08:00
Added DOTween.onWillLog method to intercept DOTween's logs
This commit is contained in:
parent
4662d6671d
commit
017c577f06
1
.gitignore
vendored
1
.gitignore
vendored
@ -36,6 +36,7 @@ zzTestBuilds
|
||||
*.pdb
|
||||
*.DotSettings
|
||||
|
||||
UnityTests.Unity2019
|
||||
UnityTests.Unity5BETA
|
||||
UnityTests.Unity5 - LastVersionBeforeModules
|
||||
ModulesTest.Unity2018
|
||||
|
||||
@ -360,6 +360,13 @@
|
||||
<summary>DOTween's log behaviour.
|
||||
<para>Default: LogBehaviour.ErrorsOnly</para></summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.DOTween.onWillLog">
|
||||
<summary>Used to intercept DOTween's logs. If this method isn't NULL, DOTween will call it before writing a log via Unity's own Debug log methods.<para/>
|
||||
Return TRUE if you want DOTween to proceed with the log, FALSE otherwise.<para/>
|
||||
This method must return a <code>bool</code> and accept two parameters:<para/>
|
||||
- <code>LogType</code>: the type of Unity log that DOTween is trying to log<para/>
|
||||
- <code>object</code>: the log message that DOTween wants to log</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.DOTween.drawGizmos">
|
||||
<summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active).
|
||||
Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3e15b806a8368742ba6f10e794d7b76
|
||||
timeCreated: 1552647154
|
||||
timeCreated: 1557580623
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
|
||||
Binary file not shown.
26
UnityTests.Unity5/Assets/_Tests/OnWillLog.cs
Normal file
26
UnityTests.Unity5/Assets/_Tests/OnWillLog.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
public class OnWillLog : BrainBase
|
||||
{
|
||||
public bool allowLogs = false;
|
||||
public Transform target;
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
DOTween.onWillLog = OnWillLogCallback;
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
||||
target.DOMoveX(3, 2);
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
Destroy(target.gameObject);
|
||||
}
|
||||
|
||||
bool OnWillLogCallback(LogType logType, object message)
|
||||
{
|
||||
Debug.Log("LOG CAUGHT > " + logType + " > " + message);
|
||||
return allowLogs;
|
||||
}
|
||||
}
|
||||
12
UnityTests.Unity5/Assets/_Tests/OnWillLog.cs.meta
Normal file
12
UnityTests.Unity5/Assets/_Tests/OnWillLog.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d90e8eb596935b46bbb9ad32c9d62e8
|
||||
timeCreated: 1559473596
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
UnityTests.Unity5/Assets/_Tests/OnWillLog.unity
Normal file
BIN
UnityTests.Unity5/Assets/_Tests/OnWillLog.unity
Normal file
Binary file not shown.
4
UnityTests.Unity5/Assets/_Tests/OnWillLog.unity.meta
Normal file
4
UnityTests.Unity5/Assets/_Tests/OnWillLog.unity.meta
Normal file
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46c67c20a3e9b3f4e8d3b6a9f7dcbfc7
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@ -11,24 +11,20 @@ using UnityEngine.UI;
|
||||
|
||||
public class TempTests : BrainBase
|
||||
{
|
||||
public enum TestEnum {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
D,
|
||||
E,
|
||||
z = 100
|
||||
}
|
||||
|
||||
public TestEnum testEnum;
|
||||
public bool useFrom = true;
|
||||
public Transform target;
|
||||
public Transform rotTarget;
|
||||
public Ease easeType = Ease.Linear;
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
if (!useFrom) {
|
||||
target.DOMoveX(2, 2);
|
||||
} else {
|
||||
Vector3 currentPosition = target.position;
|
||||
target.DOMoveX(2, 2).From().SetAutoKill(false);//.OnRewind(() => OnResetTransformFrom(transformToAnimate,currentPosition));
|
||||
}
|
||||
|
||||
target.DORotateQuaternion(rotTarget.rotation, 2).SetEase(easeType);
|
||||
yield return new WaitForSeconds(3f);
|
||||
|
||||
target.DORewind();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -21,20 +21,28 @@ namespace DG.Tweening.Core
|
||||
|
||||
public static void Log(object message)
|
||||
{
|
||||
Debug.Log(_LogPrefix + message);
|
||||
message = _LogPrefix + message;
|
||||
if (DOTween.onWillLog != null && !DOTween.onWillLog(LogType.Log, message)) return;
|
||||
Debug.Log(message);
|
||||
}
|
||||
public static void LogWarning(object message)
|
||||
{
|
||||
Debug.LogWarning(_LogPrefix + message);
|
||||
message = _LogPrefix + message;
|
||||
if (DOTween.onWillLog != null && !DOTween.onWillLog(LogType.Warning, message)) return;
|
||||
Debug.LogWarning(message);
|
||||
}
|
||||
public static void LogError(object message)
|
||||
{
|
||||
Debug.LogError(_LogPrefix + message);
|
||||
message = _LogPrefix + message;
|
||||
if (DOTween.onWillLog != null && !DOTween.onWillLog(LogType.Error, message)) return;
|
||||
Debug.LogError(message);
|
||||
}
|
||||
|
||||
public static void LogReport(object message)
|
||||
{
|
||||
Debug.Log(string.Format("<color=#00B500FF>{0} REPORT ► {1}</color>", _LogPrefix, message));
|
||||
message = string.Format("<color=#00B500FF>{0} REPORT ► {1}</color>", _LogPrefix, message);
|
||||
if (DOTween.onWillLog != null && !DOTween.onWillLog(LogType.Log, message)) return;
|
||||
Debug.Log(message);
|
||||
}
|
||||
|
||||
public static void LogInvalidTween(Tween t)
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
// License Copyright (c) Daniele Giardini.
|
||||
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
||||
|
||||
|
||||
using System;
|
||||
#if COMPATIBLE
|
||||
using DOVector2 = DG.Tweening.Core.Surrogates.Vector2Wrapper;
|
||||
using DOVector3 = DG.Tweening.Core.Surrogates.Vector3Wrapper;
|
||||
@ -32,7 +34,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.2.245"; // Last version before modules: 1.1.755
|
||||
public static readonly string Version = "1.2.250"; // Last version before modules: 1.1.755
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
@ -71,6 +73,12 @@ namespace DG.Tweening
|
||||
set { _logBehaviour = value; Debugger.SetLogPriority(_logBehaviour); }
|
||||
}
|
||||
static LogBehaviour _logBehaviour = LogBehaviour.ErrorsOnly;
|
||||
/// <summary>Used to intercept DOTween's logs. If this method isn't NULL, DOTween will call it before writing a log via Unity's own Debug log methods.<para/>
|
||||
/// Return TRUE if you want DOTween to proceed with the log, FALSE otherwise.<para/>
|
||||
/// This method must return a <code>bool</code> and accept two parameters:<para/>
|
||||
/// - <code>LogType</code>: the type of Unity log that DOTween is trying to log<para/>
|
||||
/// - <code>object</code>: the log message that DOTween wants to log</summary>
|
||||
public static Func<LogType, object, bool> onWillLog;
|
||||
/// <summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active).
|
||||
/// Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary>
|
||||
public static bool drawGizmos = true;
|
||||
|
||||
@ -360,6 +360,13 @@
|
||||
<summary>DOTween's log behaviour.
|
||||
<para>Default: LogBehaviour.ErrorsOnly</para></summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.DOTween.onWillLog">
|
||||
<summary>Used to intercept DOTween's logs. If this method isn't NULL, DOTween will call it before writing a log via Unity's own Debug log methods.<para/>
|
||||
Return TRUE if you want DOTween to proceed with the log, FALSE otherwise.<para/>
|
||||
This method must return a <code>bool</code> and accept two parameters:<para/>
|
||||
- <code>LogType</code>: the type of Unity log that DOTween is trying to log<para/>
|
||||
- <code>object</code>: the log message that DOTween wants to log</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.DOTween.drawGizmos">
|
||||
<summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active).
|
||||
Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user