modify
This commit is contained in:
parent
7522f77830
commit
1a47dff2cf
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c71e8ff5c53e58f4789054d9490f55dc
|
||||
guid: dd1af00397315b3408e4da7fc7269428
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
3
Client/Assets/Editor/Config.meta
Normal file
3
Client/Assets/Editor/Config.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a9ff087f90346bcbad1b94f7e194149
|
||||
timeCreated: 1743562594
|
||||
45
Client/Assets/Editor/Config/LubanConfigGenerate.cs
Normal file
45
Client/Assets/Editor/Config/LubanConfigGenerate.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using AlicizaX.Editor.Extension;
|
||||
|
||||
public static class LubanConfigGenerate
|
||||
{
|
||||
[EditorToolFunction("Config/打表")]
|
||||
static void GenerateLubanConfig()
|
||||
{
|
||||
ExecuteBatch("gen_code_bin_to_client_en.bat");
|
||||
ExecuteBatch("gen_code_bin_to_client_zh.bat");
|
||||
ExecuteBatch("gen_code_bin_to_client_jp.bat");
|
||||
}
|
||||
|
||||
static void ExecuteBatch(string fileName)
|
||||
{
|
||||
// 构建正确路径:向上退两层到工程目录的父级,再进入Data/Config
|
||||
string configPath = Path.GetFullPath(
|
||||
Path.Combine(Application.dataPath, "..", "..", "Data", "Config")
|
||||
);
|
||||
|
||||
ProcessStartInfo psi = new ProcessStartInfo()
|
||||
{
|
||||
FileName = fileName,
|
||||
WorkingDirectory = configPath,
|
||||
UseShellExecute = true,
|
||||
CreateNoWindow = false,
|
||||
WindowStyle = ProcessWindowStyle.Normal
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
using (Process process = Process.Start(psi))
|
||||
{
|
||||
process.WaitForExit(); // 等待执行完成(可选)
|
||||
UnityEngine.Debug.Log($"已执行 {fileName}");
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
UnityEngine.Debug.LogError($"执行失败:{e.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Client/Assets/Editor/Config/LubanConfigGenerate.cs.meta
Normal file
3
Client/Assets/Editor/Config/LubanConfigGenerate.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e180beaee488424499c1b1d387b20f85
|
||||
timeCreated: 1743565098
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 215d7d15d5d6d3a4e891fcc64954fee9
|
||||
guid: 2657228de384d2140aaf733b61af1480
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@ -10,44 +10,24 @@ namespace BuildCLI
|
||||
{
|
||||
public static class JenkinsBuildCLI
|
||||
{
|
||||
[EditorToolFunction("Build/整包构建")]
|
||||
static string[] scenePath = new[] { "Assets/Scenes/Main.unity" };
|
||||
|
||||
[EditorToolFunction("Build/离线/EXE")]
|
||||
public static void TestBuildExe()
|
||||
{
|
||||
BuildOfflineRes();
|
||||
AppBuildParameter parameter = new AppBuildParameter();
|
||||
parameter.DevelopBuild = false;
|
||||
parameter.ShowDebugWnd = true;
|
||||
parameter.OutPutPath = "../Build";
|
||||
parameter.FileName = "Aliciza.exe";
|
||||
parameter.FileName = "SAOK.exe";
|
||||
parameter.Scenes = scenePath;
|
||||
parameter.BuildTarget = BuildTarget.StandaloneWindows;
|
||||
parameter.ResMode = (int)EPlayMode.OfflinePlayMode;
|
||||
parameter.Language = Language.ChineseSimplified;
|
||||
parameter.Language = Language.English;
|
||||
AppBuildHelper.BuildApplication(parameter);
|
||||
}
|
||||
|
||||
[EditorToolFunction("Build/底包构建")]
|
||||
public static void TestBuildOnlineExe()
|
||||
{
|
||||
AppBuildParameter parameter = new AppBuildParameter();
|
||||
parameter.DevelopBuild = false;
|
||||
parameter.OutPutPath = "../Build";
|
||||
parameter.FileName = "Aliciza.exe";
|
||||
parameter.BuildTarget = BuildTarget.StandaloneWindows;
|
||||
parameter.ResMode = (int)EPlayMode.HostPlayMode;
|
||||
parameter.Language = Language.ChineseSimplified;
|
||||
AppBuildHelper.BuildApplication(parameter);
|
||||
}
|
||||
|
||||
[EditorToolFunction("Build/AB构建")]
|
||||
public static void TestBuildRes()
|
||||
{
|
||||
ResourceBuildParameter buildParameter = new ResourceBuildParameter();
|
||||
buildParameter.ResourceBuildTarget = BuildTarget.StandaloneWindows;
|
||||
buildParameter.UseDefaultPackageVersion = true;
|
||||
buildParameter.OutputPath = "../Bundle";
|
||||
buildParameter.BuildMode = ResourceBuildMode.Online;
|
||||
ResourceBuildHelper.BuildResourcePackage(buildParameter);
|
||||
}
|
||||
|
||||
[EditorToolFunction("Build/离线/AB")]
|
||||
public static void BuildOfflineRes()
|
||||
{
|
||||
ResourceBuildParameter buildParameter = new ResourceBuildParameter();
|
||||
@ -57,5 +37,32 @@ namespace BuildCLI
|
||||
buildParameter.BuildMode = ResourceBuildMode.Offline;
|
||||
ResourceBuildHelper.BuildResourcePackage(buildParameter);
|
||||
}
|
||||
|
||||
[EditorToolFunction("Build/在线/EXE")]
|
||||
public static void TestBuildOnlineExe()
|
||||
{
|
||||
AppBuildParameter parameter = new AppBuildParameter();
|
||||
parameter.DevelopBuild = false;
|
||||
parameter.ShowDebugWnd = true;
|
||||
parameter.OutPutPath = "../Build";
|
||||
parameter.FileName = "SAOK.exe";
|
||||
parameter.Scenes = scenePath;
|
||||
parameter.BuildTarget = BuildTarget.StandaloneWindows;
|
||||
parameter.ResMode = (int)EPlayMode.HostPlayMode;
|
||||
parameter.Language = Language.ChineseSimplified;
|
||||
AppBuildHelper.BuildApplication(parameter);
|
||||
}
|
||||
|
||||
[EditorToolFunction("Build/在线/AB")]
|
||||
public static void TestBuildRes()
|
||||
{
|
||||
ResourceBuildParameter buildParameter = new ResourceBuildParameter();
|
||||
buildParameter.ResourceBuildTarget = BuildTarget.StandaloneWindows;
|
||||
buildParameter.UseDefaultPackageVersion = true;
|
||||
buildParameter.OutputPath = "../Bundle";
|
||||
buildParameter.BuildMode = ResourceBuildMode.Online;
|
||||
buildParameter.EncryptionServiceType = string.Empty;
|
||||
ResourceBuildHelper.BuildResourcePackage(buildParameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Client/Assets/Editor/Localization/ExcelDll.meta
Normal file
8
Client/Assets/Editor/Localization/ExcelDll.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acc28b5feb58eb34cb24ca520bedd146
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Client/Assets/Editor/Localization/ExcelDll/EPPlus.dll
Normal file
BIN
Client/Assets/Editor/Localization/ExcelDll/EPPlus.dll
Normal file
Binary file not shown.
50
Client/Assets/Editor/Localization/ExcelDll/EPPlus.dll.meta
Normal file
50
Client/Assets/Editor/Localization/ExcelDll/EPPlus.dll.meta
Normal file
@ -0,0 +1,50 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0417d70792c395458b88be6e0a7396f
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Client/Assets/Editor/Localization/ExcelDll/Excel.dll
Normal file
BIN
Client/Assets/Editor/Localization/ExcelDll/Excel.dll
Normal file
Binary file not shown.
50
Client/Assets/Editor/Localization/ExcelDll/Excel.dll.meta
Normal file
50
Client/Assets/Editor/Localization/ExcelDll/Excel.dll.meta
Normal file
@ -0,0 +1,50 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ab59f4d3a84881498d4fc55763645d2
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.CJK.dll
Normal file
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.CJK.dll
Normal file
Binary file not shown.
50
Client/Assets/Editor/Localization/ExcelDll/I18N.CJK.dll.meta
Normal file
50
Client/Assets/Editor/Localization/ExcelDll/I18N.CJK.dll.meta
Normal file
@ -0,0 +1,50 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9bb4116e4c26d943835d4b0f552cd43
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.MidEast.dll
Normal file
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.MidEast.dll
Normal file
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b731516c168f4634a942d552dbe8c5be
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.Other.dll
Normal file
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.Other.dll
Normal file
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb82ad8b79f06bc438c99ae57af870cb
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.Rare.dll
Normal file
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.Rare.dll
Normal file
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f071f1e440976f4891c9ac2c69e828e
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.West.dll
Normal file
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.West.dll
Normal file
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc269941d69c0a0438efda4ebd119e97
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.dll
Normal file
BIN
Client/Assets/Editor/Localization/ExcelDll/I18N.dll
Normal file
Binary file not shown.
50
Client/Assets/Editor/Localization/ExcelDll/I18N.dll.meta
Normal file
50
Client/Assets/Editor/Localization/ExcelDll/I18N.dll.meta
Normal file
@ -0,0 +1,50 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6685f8a12ad0d2459c4f127655d1e2d
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
WindowsStoreApps:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dead0f737fd23548b36712ca5407498
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
117
Client/Assets/Editor/Localization/ExcelLocalizationExporter.cs
Normal file
117
Client/Assets/Editor/Localization/ExcelLocalizationExporter.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using OfficeOpenXml;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using AlicizaX.Editor.Extension;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
class ExcelLocalizationExporter
|
||||
{
|
||||
// 配置写死路径(按实际需求修改)
|
||||
private const string LocalizationPath = "Assets/Resources/Localization/";
|
||||
private const string HotfixLocalizationPath = "Assets/Bundles/Configs/Localization/";
|
||||
private const string LocalizationDynamicKey = "Assets/Scripts/HotFix/GameBase/LocalizationKey.cs";
|
||||
|
||||
[EditorToolFunction("Config/Dynamic")]
|
||||
public static void GenerateDynamicLocalization()
|
||||
{
|
||||
Export("Assets/Editor/Localization/Localization.xlsx");
|
||||
}
|
||||
|
||||
|
||||
public static void Export(string excelPath)
|
||||
{
|
||||
var fileInfo = new FileInfo(excelPath);
|
||||
using var package = new ExcelPackage(fileInfo);
|
||||
|
||||
foreach (var worksheet in package.Workbook.Worksheets)
|
||||
{
|
||||
// 确定导出目录
|
||||
var outputDir = worksheet.Name.Contains("HotFix", System.StringComparison.OrdinalIgnoreCase)
|
||||
? HotfixLocalizationPath
|
||||
: LocalizationPath;
|
||||
|
||||
Directory.CreateDirectory(outputDir);
|
||||
|
||||
var dimension = worksheet.Dimension;
|
||||
if (dimension == null) continue;
|
||||
|
||||
var languages = new List<string>();
|
||||
for (int col = 2; col <= dimension.End.Column; col++)
|
||||
{
|
||||
languages.Add(worksheet.Cells[1, col].Text.Trim());
|
||||
}
|
||||
|
||||
var langDictionaries = new Dictionary<string, Dictionary<string, string>>();
|
||||
foreach (var lang in languages)
|
||||
{
|
||||
langDictionaries[lang] = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
for (int row = 2; row <= dimension.End.Row; row++)
|
||||
{
|
||||
var keyCell = worksheet.Cells[row, 1];
|
||||
if (keyCell.Value == null) continue;
|
||||
|
||||
var key = keyCell.Text.Trim();
|
||||
if (string.IsNullOrEmpty(key)) continue;
|
||||
|
||||
for (int i = 0; i < languages.Count; i++)
|
||||
{
|
||||
var lang = languages[i];
|
||||
var valueCell = worksheet.Cells[row, i + 2];
|
||||
var value = valueCell.Value?.ToString() ?? string.Empty;
|
||||
langDictionaries[lang][key] = value.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var lang in langDictionaries)
|
||||
{
|
||||
var settings = new JsonSerializerSettings
|
||||
{
|
||||
Formatting = Formatting.None,
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
StringEscapeHandling = StringEscapeHandling.EscapeNonAscii
|
||||
};
|
||||
|
||||
var json = JsonConvert.SerializeObject(lang.Value, settings);
|
||||
var outputPath = Path.Combine(outputDir, $"{lang.Key}.json");
|
||||
File.WriteAllText(outputPath, json);
|
||||
}
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
ExportLocalizationKey();
|
||||
}
|
||||
|
||||
public static void ExportLocalizationKey()
|
||||
{
|
||||
string filePath = "Assets/Bundles/Configs/Localization/ChineseSimplified.json";
|
||||
|
||||
Dictionary<string, string> jsonData = JsonConvert.DeserializeObject<Dictionary<string, string>>(System.IO.File.ReadAllText(filePath));
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("/// <summary>");
|
||||
sb.AppendLine("/// AutoGenerate");
|
||||
sb.AppendLine("/// </summary>");
|
||||
sb.AppendLine("public static class LocalizationKey");
|
||||
sb.AppendLine("{");
|
||||
|
||||
foreach (var item in jsonData)
|
||||
{
|
||||
if (item.Key.Contains("\\")) continue;
|
||||
sb.AppendLine("\t/// <summary>");
|
||||
sb.AppendLine($"\t/// {item.Value}");
|
||||
sb.AppendLine("\t/// </summary>");
|
||||
sb.AppendLine($"\tpublic const string {item.Key} = \"{item.Key}\";");
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("}");
|
||||
System.IO.File.WriteAllText(LocalizationDynamicKey, sb.ToString());
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4009209ebf8b7fc4aae7fb71cd90c03b
|
||||
BIN
Client/Assets/Editor/Localization/Localization.xlsx
Normal file
BIN
Client/Assets/Editor/Localization/Localization.xlsx
Normal file
Binary file not shown.
7
Client/Assets/Editor/Localization/Localization.xlsx.meta
Normal file
7
Client/Assets/Editor/Localization/Localization.xlsx.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8163109452a82545a4618a40f82a0a2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,65 @@
|
||||
using AlicizaX.Localization.Runtime;
|
||||
using AlicizaX;
|
||||
using Paps.UnityToolbarExtenderUIToolkit;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
[MainToolbarElement("LocalizationDropdownField", alignment: ToolbarAlign.Right, order: 0)]
|
||||
public class LocalizationDropdownField : IMGUIContainer
|
||||
{
|
||||
private static GUIContent appConfigBtContent;
|
||||
|
||||
private static readonly string[] _languageTypeNames =
|
||||
{
|
||||
Language.ChineseSimplified.ToString(),
|
||||
Language.English.ToString(),
|
||||
Language.Japanese.ToString(),
|
||||
};
|
||||
|
||||
public void InitializeElement()
|
||||
{
|
||||
appConfigBtContent =
|
||||
EditorGUIUtility.TrTextContentWithIcon("", "",
|
||||
"Settings");
|
||||
onGUIHandler = MyGUIMethod;
|
||||
}
|
||||
|
||||
private void MyGUIMethod()
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
string title = _languageTypeNames[GetPrefsIndex()];
|
||||
appConfigBtContent.text = title;
|
||||
if (EditorGUILayout.DropdownButton(appConfigBtContent, FocusType.Passive, EditorStyles.toolbarPopup, GUILayout.MaxWidth(120)))
|
||||
{
|
||||
DrawEditorToolDropdownMenus();
|
||||
}
|
||||
|
||||
GUILayout.Space(5);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
static void DrawEditorToolDropdownMenus()
|
||||
{
|
||||
int index = GetPrefsIndex();
|
||||
GenericMenu popMenu = new GenericMenu();
|
||||
for (int i = 0; i < _languageTypeNames.Length; i++)
|
||||
{
|
||||
var selected = index == i;
|
||||
var toolAttr = _languageTypeNames[i];
|
||||
popMenu.AddItem(new GUIContent(toolAttr), selected, menuIdx => { ClickToolsSubmenu((int)menuIdx); }, i);
|
||||
}
|
||||
|
||||
popMenu.ShowAsContext();
|
||||
}
|
||||
|
||||
static void ClickToolsSubmenu(int menuIdx)
|
||||
{
|
||||
EditorPrefs.SetInt(LocalizationComponent.PrefsKey, menuIdx + 1);
|
||||
}
|
||||
|
||||
static int GetPrefsIndex()
|
||||
{
|
||||
return EditorPrefs.GetInt(LocalizationComponent.PrefsKey, 1) - 1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2295b86f78274a84a63dc65ab4a69cb1
|
||||
timeCreated: 1742364662
|
||||
26
Client/Assets/Editor/SAOL1.Editor.asmdef
Normal file
26
Client/Assets/Editor/SAOL1.Editor.asmdef
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "SAOL1.Editor",
|
||||
"rootNamespace": "SAOL1.Editor",
|
||||
"references": [
|
||||
"GUID:8d62da4aabd2a19419c7378d23ea5849",
|
||||
"GUID:75b6f2078d190f14dbda4a5b747d709c",
|
||||
"GUID:a19b414bea3b97240a91aeab9a8eab36",
|
||||
"GUID:99a2a63c2a1143c4ba448165a98a5108",
|
||||
"GUID:e34a5702dd353724aa315fb8011f08c3",
|
||||
"GUID:4d1926c9df5b052469a1c63448b7609a",
|
||||
"GUID:acfef7cabed3b0a42b25edb1cd4fa259",
|
||||
"GUID:2373f786d14518f44b0f475db77ba4de",
|
||||
"GUID:82bdcc42401007348aadb37dd5adc131"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": true,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Client/Assets/Editor/SAOL1.Editor.asmdef.meta
Normal file
7
Client/Assets/Editor/SAOL1.Editor.asmdef.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2f984ffec5b59f40977bb0d0b0afbc6
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Client/Assets/Editor/Template.meta
Normal file
8
Client/Assets/Editor/Template.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 009cebed0f276cf4490030907abfa822
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
416
Client/Assets/Editor/Template/UITemplatePanel.prefab
Normal file
416
Client/Assets/Editor/Template/UITemplatePanel.prefab
Normal file
@ -0,0 +1,416 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &391155014370552000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 907499237110470932}
|
||||
- component: {fileID: 1560093894229825085}
|
||||
- component: {fileID: 4731840468700438029}
|
||||
- component: {fileID: 6898308893480071255}
|
||||
m_Layer: 5
|
||||
m_Name: UITemplatePanel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &907499237110470932
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 391155014370552000}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 657135054198889253}
|
||||
- {fileID: 2071464777709478385}
|
||||
- {fileID: 7379194316950781412}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!223 &1560093894229825085
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 391155014370552000}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 1
|
||||
m_AdditionalShaderChannelsFlag: 7
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &4731840468700438029
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 391155014370552000}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 55
|
||||
--- !u!114 &6898308893480071255
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 391155014370552000}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 1920, y: 1080}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!1 &4390318779409622146
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7379194316950781412}
|
||||
- component: {fileID: 2778387066864233462}
|
||||
- component: {fileID: 4568176083037806692}
|
||||
m_Layer: 0
|
||||
m_Name: TextLocalizeDefault
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7379194316950781412
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4390318779409622146}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 907499237110470932}
|
||||
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, y: 0}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2778387066864233462
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4390318779409622146}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4568176083037806692
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4390318779409622146}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bd17b8b605f2ba540bac156b5cf5ac77, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: "\u8BF7\u8F93\u5165\u6635\u79F0 (\u9650\u5341\u5B57\u4EE5\u5185)"
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: b7bdda5fb9422b44ba90b21b9985c16c, type: 2}
|
||||
m_sharedMaterial: {fileID: -7098814193341831791, guid: b7bdda5fb9422b44ba90b21b9985c16c, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, 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: 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_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 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}
|
||||
m_localizationID: INPUTPANEL_NICKNAME
|
||||
--- !u!1 &5504379471084463201
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2071464777709478385}
|
||||
- component: {fileID: 6336580921231272565}
|
||||
- component: {fileID: 1353736730444205859}
|
||||
- component: {fileID: 2186285324861091094}
|
||||
m_Layer: 5
|
||||
m_Name: Img@Time
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2071464777709478385
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5504379471084463201}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 907499237110470932}
|
||||
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, y: 0}
|
||||
m_SizeDelta: {x: 120, y: 120}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6336580921231272565
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5504379471084463201}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1353736730444205859
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5504379471084463201}
|
||||
m_Enabled: 1
|
||||
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: 871027c5d100f954b9136354adae6817, 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!95 &2186285324861091094
|
||||
Animator:
|
||||
serializedVersion: 7
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5504379471084463201}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: 7f77f6ebcc9564d4aafeef6af8b2086d, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_AnimatePhysics: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
--- !u!1 &6705590104215007862
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 657135054198889253}
|
||||
- component: {fileID: 541698302465368760}
|
||||
- component: {fileID: 1217312796379611331}
|
||||
m_Layer: 5
|
||||
m_Name: Mask
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &657135054198889253
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6705590104215007862}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 907499237110470932}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &541698302465368760
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6705590104215007862}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1217312796379611331
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6705590104215007862}
|
||||
m_Enabled: 1
|
||||
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: 0}
|
||||
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
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4581faa155df5854cab0d579934a0c40
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Client/Assets/Plugins/PrimeTween.meta
Normal file
8
Client/Assets/Plugins/PrimeTween.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da2e19a1c5f8b4e2ca7c1785ea338b2e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Client/Assets/Plugins/PrimeTween/Demo.meta
Normal file
8
Client/Assets/Plugins/PrimeTween/Demo.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6cc44d08e8de4cf7878638624e59a94
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5498
Client/Assets/Plugins/PrimeTween/Demo/Demo.unity
Normal file
5498
Client/Assets/Plugins/PrimeTween/Demo/Demo.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Client/Assets/Plugins/PrimeTween/Demo/Demo.unity.meta
Normal file
7
Client/Assets/Plugins/PrimeTween/Demo/Demo.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13170347bc506405f88d3a87bd0982b3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5979
Client/Assets/Plugins/PrimeTween/Demo/Demo_URP.unity
Normal file
5979
Client/Assets/Plugins/PrimeTween/Demo/Demo_URP.unity
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15054139658a5445689224c71f805b10
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Client/Assets/Plugins/PrimeTween/Demo/Scripts.meta
Normal file
8
Client/Assets/Plugins/PrimeTween/Demo/Scripts.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4788bd8dfc445485781b23a4cf21188b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Animatable.cs
Normal file
34
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Animatable.cs
Normal file
@ -0,0 +1,34 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public abstract class Clickable : MonoBehaviour {
|
||||
public virtual void OnClick() {}
|
||||
}
|
||||
|
||||
public abstract class Animatable : Clickable {
|
||||
public abstract Sequence Animate(bool toEndValue);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.CustomEditor(typeof(Clickable), true), UnityEditor.CanEditMultipleObjects]
|
||||
internal class InspectorWithButton : UnityEditor.Editor {
|
||||
GUIStyle boldButtonStyle;
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
DrawDefaultInspector();
|
||||
GUILayout.Space(8);
|
||||
if (boldButtonStyle == null) {
|
||||
boldButtonStyle = new GUIStyle(GUI.skin.button) { fontStyle = FontStyle.Bold };
|
||||
}
|
||||
if (GUILayout.Button("Play Animation", boldButtonStyle)) {
|
||||
foreach (var t in targets) {
|
||||
(t as Clickable).OnClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f631a276db10467c9860e2814855df25
|
||||
timeCreated: 1695283968
|
||||
29
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Baggage.cs
Normal file
29
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Baggage.cs
Normal file
@ -0,0 +1,29 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class Baggage : Animatable {
|
||||
[SerializeField] Transform animationAnchor;
|
||||
Sequence sequence;
|
||||
|
||||
public override void OnClick() {
|
||||
PlayFlipAnimation();
|
||||
}
|
||||
|
||||
public override Sequence Animate(bool _) {
|
||||
return PlayFlipAnimation();
|
||||
}
|
||||
|
||||
Sequence PlayFlipAnimation() {
|
||||
if (!sequence.isAlive) {
|
||||
const float jumpDuration = 0.3f;
|
||||
sequence = Tween.LocalPositionZ(animationAnchor, 0.2f, jumpDuration)
|
||||
.Chain(Tween.LocalEulerAngles(animationAnchor, Vector3.zero, new Vector3(0, 360, 0), 0.9f, Ease.InOutBack))
|
||||
.Chain(Tween.LocalPositionZ(animationAnchor, 0, jumpDuration));
|
||||
}
|
||||
return sequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c7e5a7e59b57b941b930876a7839219
|
||||
guid: 27b542649ab4a463aa343c437387783e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@ -0,0 +1,57 @@
|
||||
#if PRIME_TWEEN_INSTALLED && UNITY_UGUI_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class CameraController : Clickable {
|
||||
[SerializeField] HighlightedElementController highlightedElementController;
|
||||
[SerializeField] SwipeTutorial swipeTutorial;
|
||||
[SerializeField] Camera mainCamera;
|
||||
[SerializeField, Range(0f, 1f)] float cameraShakeStrength = 0.4f;
|
||||
float currentAngle;
|
||||
Vector2? inputBeginPos;
|
||||
bool isAnimating;
|
||||
float curRotationSpeed;
|
||||
|
||||
void OnEnable() {
|
||||
currentAngle = transform.localEulerAngles.y;
|
||||
isAnimating = true;
|
||||
Tween.Custom(this, 0, 5, 2, (target, val) => target.curRotationSpeed = val);
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (isAnimating) {
|
||||
currentAngle += curRotationSpeed * Time.deltaTime;
|
||||
transform.localEulerAngles = new Vector3(0f, currentAngle);
|
||||
}
|
||||
if (highlightedElementController.current == null && InputController.GetDown() && !EventSystem.current.IsPointerOverGameObject()) {
|
||||
inputBeginPos = InputController.screenPosition;
|
||||
}
|
||||
if (InputController.GetUp()) {
|
||||
inputBeginPos = null;
|
||||
}
|
||||
if (inputBeginPos.HasValue) {
|
||||
var deltaMove = InputController.screenPosition - inputBeginPos.Value;
|
||||
if (Mathf.Abs(deltaMove.x) / Screen.width > 0.05f) {
|
||||
isAnimating = false;
|
||||
inputBeginPos = null;
|
||||
currentAngle += Mathf.Sign(deltaMove.x) * 45f;
|
||||
Tween.LocalRotation(transform, new Vector3(0f, currentAngle), 1.5f, Ease.OutCubic);
|
||||
swipeTutorial.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClick() => ShakeCamera();
|
||||
|
||||
public void ShakeCamera() {
|
||||
Shake();
|
||||
}
|
||||
|
||||
internal Sequence Shake(float startDelay = 0) {
|
||||
return Tween.ShakeCamera(mainCamera, cameraShakeStrength, startDelay: startDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f2f29997e7148b98e1d84f3de1011bc
|
||||
timeCreated: 1682326446
|
||||
@ -0,0 +1,57 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class CameraProjectionMatrixAnimation : Clickable {
|
||||
[SerializeField] Camera mainCamera;
|
||||
float interpolationFactor;
|
||||
bool isOrthographic;
|
||||
Tween tween;
|
||||
|
||||
public override void OnClick() => AnimateCameraProjection();
|
||||
|
||||
public void AnimateCameraProjection() {
|
||||
isOrthographic = !isOrthographic;
|
||||
tween.Stop();
|
||||
tween = Tween.Custom(this, interpolationFactor, isOrthographic ? 1 : 0, 0.6f, ease: Ease.InOutSine, onValueChange: (target, t) => {
|
||||
target.InterpolateProjectionMatrix(t);
|
||||
})
|
||||
.OnComplete(this, target => {
|
||||
target.mainCamera.orthographic = target.isOrthographic;
|
||||
target.mainCamera.ResetProjectionMatrix();
|
||||
});
|
||||
}
|
||||
|
||||
void InterpolateProjectionMatrix(float _interpolationFactor) {
|
||||
interpolationFactor = _interpolationFactor;
|
||||
uint width = (uint)Screen.width;
|
||||
uint height = (uint)Screen.height;
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2022_2_OR_NEWER
|
||||
if (!Application.isPlaying) {
|
||||
UnityEditor.PlayModeWindow.GetRenderingResolution(out width, out height);
|
||||
}
|
||||
#endif
|
||||
|
||||
float aspect = (float)width / height;
|
||||
float orthographicSize = mainCamera.orthographicSize;
|
||||
var perspectiveMatrix = Matrix4x4.Perspective(mainCamera.fieldOfView, aspect, mainCamera.nearClipPlane, mainCamera.farClipPlane);
|
||||
var orthoMatrix = Matrix4x4.Ortho(-orthographicSize * aspect, orthographicSize * aspect, -orthographicSize, orthographicSize, mainCamera.nearClipPlane, mainCamera.farClipPlane);
|
||||
Matrix4x4 projectionMatrix = default;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
projectionMatrix[i] = Mathf.Lerp(perspectiveMatrix[i], orthoMatrix[i], _interpolationFactor);
|
||||
}
|
||||
mainCamera.projectionMatrix = projectionMatrix;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying) {
|
||||
UnityEditor.SceneView.RepaintAll();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public bool IsAnimating => tween.isAlive;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 900e84e1426b4fc8a386a58aaee3b4ba
|
||||
timeCreated: 1685260544
|
||||
132
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Demo.cs
Normal file
132
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Demo.cs
Normal file
@ -0,0 +1,132 @@
|
||||
#if PRIME_TWEEN_INSTALLED && UNITY_UGUI_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine.UI;
|
||||
#endif
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class Demo : MonoBehaviour {
|
||||
#if PRIME_TWEEN_INSTALLED && UNITY_UGUI_INSTALLED
|
||||
[SerializeField] AnimateAllType animateAllType; enum AnimateAllType { Sequence, Async, Coroutine }
|
||||
[SerializeField] Slider sequenceTimelineSlider;
|
||||
[SerializeField] Text pausedLabel;
|
||||
[SerializeField] Button animateAllPartsButton;
|
||||
[SerializeField] TypewriterAnimatorExample typewriterAnimatorExample;
|
||||
[SerializeField] Animatable[] animatables;
|
||||
[SerializeField] Wheels wheels;
|
||||
[SerializeField, Range(0.5f, 5f)] float timeScale = 1;
|
||||
bool isAnimatingWithCoroutineOrAsync;
|
||||
public Sequence animateAllSequence;
|
||||
|
||||
void Awake() {
|
||||
PrimeTweenConfig.SetTweensCapacity(100);
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
sequenceTimelineSlider.fillRect.gameObject.SetActive(false);
|
||||
sequenceTimelineSlider.onValueChanged.AddListener(SequenceTimelineSliderChanged);
|
||||
}
|
||||
|
||||
void OnDisable() => sequenceTimelineSlider.onValueChanged.RemoveListener(SequenceTimelineSliderChanged);
|
||||
|
||||
void SequenceTimelineSliderChanged(float sliderValue) {
|
||||
if (!notifySliderChanged) {
|
||||
return;
|
||||
}
|
||||
if (!animateAllSequence.isAlive) {
|
||||
wheels.OnClick();
|
||||
}
|
||||
animateAllSequence.isPaused = true;
|
||||
animateAllSequence.progressTotal = sliderValue;
|
||||
}
|
||||
|
||||
bool notifySliderChanged = true;
|
||||
|
||||
void UpdateSlider() {
|
||||
var isSliderVisible = animateAllType == AnimateAllType.Sequence && !isAnimatingWithCoroutineOrAsync;
|
||||
sequenceTimelineSlider.gameObject.SetActive(isSliderVisible);
|
||||
if (!isSliderVisible) {
|
||||
return;
|
||||
}
|
||||
pausedLabel.gameObject.SetActive(animateAllSequence.isAlive && animateAllSequence.isPaused);
|
||||
var isSequenceAlive = animateAllSequence.isAlive;
|
||||
sequenceTimelineSlider.handleRect.gameObject.SetActive(isSequenceAlive);
|
||||
if (isSequenceAlive) {
|
||||
notifySliderChanged = false;
|
||||
sequenceTimelineSlider.value = animateAllSequence.progressTotal; // Unity 2018 doesn't have SetValueWithoutNotify(), so use notifySliderChanged instead
|
||||
notifySliderChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
Time.timeScale = timeScale;
|
||||
|
||||
animateAllPartsButton.GetComponent<Image>().enabled = !isAnimatingWithCoroutineOrAsync;
|
||||
animateAllPartsButton.GetComponentInChildren<Text>().enabled = !isAnimatingWithCoroutineOrAsync;
|
||||
|
||||
UpdateSlider();
|
||||
}
|
||||
|
||||
public void AnimateAll(bool toEndValue) {
|
||||
if (isAnimatingWithCoroutineOrAsync) {
|
||||
return;
|
||||
}
|
||||
switch (animateAllType) {
|
||||
case AnimateAllType.Sequence:
|
||||
AnimateAllSequence(toEndValue);
|
||||
break;
|
||||
case AnimateAllType.Async:
|
||||
AnimateAllAsync(toEndValue);
|
||||
break;
|
||||
case AnimateAllType.Coroutine:
|
||||
StartCoroutine(AnimateAllCoroutine(toEndValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// Tweens and sequences can be grouped with and chained to other tweens and sequences.
|
||||
/// The advantage of using this method instead of <see cref="AnimateAllAsync"/> and <see cref="AnimateAllCoroutine"/> is the ability to stop/complete/pause the combined sequence.
|
||||
/// Also, this method doesn't generate garbage related to starting a coroutine or awaiting an async method.
|
||||
void AnimateAllSequence(bool toEndValue) {
|
||||
if (animateAllSequence.isAlive) {
|
||||
animateAllSequence.isPaused = !animateAllSequence.isPaused;
|
||||
return;
|
||||
}
|
||||
animateAllSequence = Sequence.Create();
|
||||
#if TEXT_MESH_PRO_INSTALLED
|
||||
animateAllSequence.Group(typewriterAnimatorExample.Animate());
|
||||
#endif
|
||||
float delay = 0f;
|
||||
foreach (var animatable in animatables) {
|
||||
animateAllSequence.Insert(delay, animatable.Animate(toEndValue));
|
||||
delay += 0.6f;
|
||||
}
|
||||
}
|
||||
|
||||
/// Tweens and sequences can be awaited in async methods.
|
||||
async void AnimateAllAsync(bool toEndValue) {
|
||||
isAnimatingWithCoroutineOrAsync = true;
|
||||
foreach (var animatable in animatables) {
|
||||
await animatable.Animate(toEndValue);
|
||||
}
|
||||
isAnimatingWithCoroutineOrAsync = false;
|
||||
}
|
||||
|
||||
/// Tweens and sequences can also be used in coroutines with the help of ToYieldInstruction() method.
|
||||
System.Collections.IEnumerator AnimateAllCoroutine(bool toEndValue) {
|
||||
isAnimatingWithCoroutineOrAsync = true;
|
||||
foreach (var animatable in animatables) {
|
||||
yield return animatable.Animate(toEndValue).ToYieldInstruction();
|
||||
}
|
||||
isAnimatingWithCoroutineOrAsync = false;
|
||||
}
|
||||
#else // PRIME_TWEEN_INSTALLED
|
||||
void Awake() {
|
||||
Debug.LogError("Please install PrimeTween via 'Assets/Plugins/PrimeTween/PrimeTweenInstaller'.");
|
||||
#if !UNITY_2019_1_OR_NEWER
|
||||
Debug.LogError("And add the 'PRIME_TWEEN_INSTALLED' define to the 'Project Settings/Player/Scripting Define Symbols' to run the Demo in Unity 2018.");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: deb3e5100b564344bb27065b64ae01d7
|
||||
guid: 945298e218f9841b08c8270c494cb200
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@ -0,0 +1,35 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class DirectionalLightController : MonoBehaviour {
|
||||
[SerializeField] Light directionalLight;
|
||||
[SerializeField] Camera mainCamera;
|
||||
[SerializeField] Color startColor;
|
||||
[SerializeField] Color endColor;
|
||||
float angleX;
|
||||
float angleY;
|
||||
|
||||
void OnEnable() {
|
||||
// This overload is simpler, but allocates small amount of garbage because 'this' reference is captured in a closure.
|
||||
// It ok to use it once in a while but for hot code paths consider using the overload that accepts 'target' as first parameter.
|
||||
var xRotationSettings = new TweenSettings<float>(45, 10, 10, Ease.Linear, -1, CycleMode.Yoyo);
|
||||
Tween.Custom(xRotationSettings, newX => angleX = newX);
|
||||
|
||||
// This overload is more verbose, but doesn't allocate garbage.
|
||||
var yRotationSettings = new TweenSettings<float>(45, 405, 20, Ease.Linear, -1);
|
||||
Tween.Custom(this, yRotationSettings, (target, newY) => target.angleY = newY);
|
||||
|
||||
var colorSettings = new TweenSettings<Color>(startColor, endColor, 10, Ease.InCirc, -1, CycleMode.Rewind);
|
||||
Tween.LightColor(directionalLight, colorSettings);
|
||||
Tween.CameraBackgroundColor(mainCamera, colorSettings);
|
||||
Tween.Custom(colorSettings, color => RenderSettings.fogColor = color);
|
||||
}
|
||||
|
||||
void Update() {
|
||||
transform.localEulerAngles = new Vector3(angleX, angleY);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db622a6d0e0fa4b68852ef1a7fc60dba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
29
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Door.cs
Normal file
29
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Door.cs
Normal file
@ -0,0 +1,29 @@
|
||||
#if PRIME_TWEEN_INSTALLED && UNITY_UGUI_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class Door : Animatable {
|
||||
[SerializeField] CameraController cameraController;
|
||||
[SerializeField] Transform animationAnchor;
|
||||
bool isClosed;
|
||||
|
||||
public override void OnClick() {
|
||||
Animate(!isClosed);
|
||||
}
|
||||
|
||||
public override Sequence Animate(bool _isClosed) {
|
||||
if (isClosed == _isClosed) {
|
||||
return Sequence.Create();
|
||||
}
|
||||
isClosed = _isClosed;
|
||||
var rotationTween = Tween.LocalRotation(animationAnchor, _isClosed ? new Vector3(0, -90) : Vector3.zero, 0.7f, Ease.InOutElastic);
|
||||
var sequence = Sequence.Create(rotationTween);
|
||||
if (_isClosed) {
|
||||
sequence.Group(cameraController.Shake(0.5f));
|
||||
}
|
||||
return sequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4efa7d4d94464bb0b3e6ea597eb13637
|
||||
timeCreated: 1682159642
|
||||
25
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Headlights.cs
Normal file
25
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Headlights.cs
Normal file
@ -0,0 +1,25 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class Headlights : Animatable {
|
||||
[SerializeField] AnimationCurve ease;
|
||||
[SerializeField] Light[] lights;
|
||||
bool isOn;
|
||||
|
||||
public override void OnClick() {
|
||||
Animate(!isOn);
|
||||
}
|
||||
|
||||
public override Sequence Animate(bool _isOn) {
|
||||
isOn = _isOn;
|
||||
var sequence = Sequence.Create();
|
||||
foreach (var _light in lights) {
|
||||
sequence.Group(Tween.LightIntensity(_light, _isOn ? 0.7f : 0, 0.8f, ease));
|
||||
}
|
||||
return sequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bc81275df8d244a1a7568f9443b5e93
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,17 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class HighlightableElement : MonoBehaviour {
|
||||
[SerializeField] public Transform highlightAnchor;
|
||||
public MeshRenderer[] models { get; private set; }
|
||||
|
||||
void OnEnable() {
|
||||
models = GetComponentsInChildren<MeshRenderer>();
|
||||
foreach (var mr in models) {
|
||||
_ = mr.material; // copy shared material
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fbd7d6a5982d440282a82998473a306
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,67 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using JetBrains.Annotations;
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class HighlightedElementController : MonoBehaviour {
|
||||
[SerializeField] Camera mainCamera;
|
||||
[SerializeField] CameraProjectionMatrixAnimation cameraProjectionMatrixAnimation;
|
||||
[CanBeNull] public HighlightableElement current { get; private set; }
|
||||
|
||||
void Awake() {
|
||||
#if UNITY_2019_1_OR_NEWER && !PHYSICS_MODULE_INSTALLED
|
||||
Debug.LogError("Please install the package needed for Physics.Raycast(): 'Package Manager/Packages/Built-in/Physics' (com.unity.modules.physics).");
|
||||
#endif
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (cameraProjectionMatrixAnimation.IsAnimating) {
|
||||
return;
|
||||
}
|
||||
if (InputController.touchSupported && !InputController.Get()) {
|
||||
SetCurrentHighlighted(null);
|
||||
return;
|
||||
}
|
||||
var ray = mainCamera.ScreenPointToRay(InputController.screenPosition);
|
||||
var highlightableElement = RaycastHighlightableElement(ray);
|
||||
SetCurrentHighlighted(highlightableElement);
|
||||
|
||||
if (current != null && InputController.GetDown()) {
|
||||
current.GetComponent<Animatable>().OnClick();
|
||||
}
|
||||
}
|
||||
|
||||
[CanBeNull]
|
||||
static HighlightableElement RaycastHighlightableElement(Ray ray) {
|
||||
#if !UNITY_2019_1_OR_NEWER || PHYSICS_MODULE_INSTALLED
|
||||
// If you're seeing a compilation error on the next line, please install the package needed for Physics.Raycast(): 'Package Manager/Packages/Built-in/Physics' (com.unity.modules.physics).
|
||||
return Physics.Raycast(ray, out var hit) ? hit.collider.GetComponentInParent<HighlightableElement>() : null;
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetCurrentHighlighted([CanBeNull] HighlightableElement newHighlighted) {
|
||||
if (newHighlighted != current) {
|
||||
if (current != null) {
|
||||
AnimateHighlightedElement(current, false);
|
||||
}
|
||||
current = newHighlighted;
|
||||
if (newHighlighted != null) {
|
||||
AnimateHighlightedElement(newHighlighted, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static readonly int emissionColorPropId = Shader.PropertyToID("_EmissionColor");
|
||||
|
||||
static void AnimateHighlightedElement([NotNull] HighlightableElement highlightable, bool isHighlighted) {
|
||||
Tween.LocalPositionZ(highlightable.highlightAnchor, isHighlighted ? 0.08f : 0, 0.3f);
|
||||
foreach (var model in highlightable.models) {
|
||||
Tween.MaterialColor(model.material, emissionColorPropId, isHighlighted ? Color.white * 0.25f : Color.black, 0.2f, Ease.OutQuad);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e831710f8fb47e4a09c640d573d1358
|
||||
timeCreated: 1682327543
|
||||
114
Client/Assets/Plugins/PrimeTween/Demo/Scripts/InputController.cs
Normal file
114
Client/Assets/Plugins/PrimeTween/Demo/Scripts/InputController.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using UnityEngine;
|
||||
#if INPUT_SYSTEM_INSTALLED && ENABLE_INPUT_SYSTEM
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.EnhancedTouch;
|
||||
using UnityEngine.InputSystem.UI;
|
||||
using TouchPhase = UnityEngine.InputSystem.TouchPhase;
|
||||
using Touch = UnityEngine.InputSystem.EnhancedTouch.Touch;
|
||||
#endif
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class InputController : MonoBehaviour {
|
||||
void Awake() {
|
||||
if (isNewInputSystemEnabled && !isLegacyInputManagerEnabled) {
|
||||
gameObject.SetActive(false);
|
||||
#if INPUT_SYSTEM_INSTALLED && ENABLE_INPUT_SYSTEM
|
||||
var inputModule = gameObject.AddComponent<InputSystemUIInputModule>();
|
||||
inputModule.pointerBehavior = UIPointerBehavior.AllPointersAsIs;
|
||||
EnhancedTouchSupport.Enable();
|
||||
#endif
|
||||
gameObject.SetActive(true);
|
||||
} else {
|
||||
#if UNITY_UGUI_INSTALLED
|
||||
gameObject.AddComponent<UnityEngine.EventSystems.StandaloneInputModule>();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static bool isNewInputSystemEnabled {
|
||||
get {
|
||||
#if INPUT_SYSTEM_INSTALLED && ENABLE_INPUT_SYSTEM
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static bool isLegacyInputManagerEnabled {
|
||||
get {
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static bool touchSupported {
|
||||
get {
|
||||
#if INPUT_SYSTEM_INSTALLED && ENABLE_INPUT_SYSTEM
|
||||
if (isNewInputSystemEnabled) {
|
||||
return Touchscreen.current != null;
|
||||
}
|
||||
#endif
|
||||
return Input.touchSupported;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool GetDown() {
|
||||
#if INPUT_SYSTEM_INSTALLED && ENABLE_INPUT_SYSTEM
|
||||
if (Mouse.current != null) {
|
||||
return Mouse.current.leftButton.wasPressedThisFrame;
|
||||
}
|
||||
if (isNewInputSystemEnabled) {
|
||||
return Touch.activeTouches.Count > 0 && Touch.activeTouches[0].phase == TouchPhase.Began;
|
||||
}
|
||||
#endif
|
||||
return Input.GetMouseButtonDown(0);
|
||||
}
|
||||
|
||||
public static bool Get() {
|
||||
#if INPUT_SYSTEM_INSTALLED && ENABLE_INPUT_SYSTEM
|
||||
if (isNewInputSystemEnabled) {
|
||||
if (Mouse.current != null) {
|
||||
return Mouse.current.leftButton.isPressed;
|
||||
}
|
||||
if (Touch.activeTouches.Count == 0) {
|
||||
return false;
|
||||
}
|
||||
var phase = Touch.activeTouches[0].phase;
|
||||
return phase == TouchPhase.Stationary || phase == TouchPhase.Moved;
|
||||
}
|
||||
#endif
|
||||
return Input.GetMouseButtonDown(0);
|
||||
}
|
||||
|
||||
public static bool GetUp() {
|
||||
#if INPUT_SYSTEM_INSTALLED && ENABLE_INPUT_SYSTEM
|
||||
if (isNewInputSystemEnabled) {
|
||||
if (Mouse.current != null) {
|
||||
return Mouse.current.leftButton.wasReleasedThisFrame;
|
||||
}
|
||||
return Touch.activeTouches.Count > 0 && Touch.activeTouches[0].phase == TouchPhase.Ended;
|
||||
}
|
||||
#endif
|
||||
return Input.GetMouseButtonUp(0);
|
||||
}
|
||||
|
||||
public static Vector2 screenPosition {
|
||||
get {
|
||||
#if INPUT_SYSTEM_INSTALLED && ENABLE_INPUT_SYSTEM
|
||||
if (isNewInputSystemEnabled) {
|
||||
if (Mouse.current != null) {
|
||||
return Mouse.current.position.ReadValue();
|
||||
}
|
||||
var activeTouches = Touch.activeTouches;
|
||||
return activeTouches.Count > 0 ? activeTouches[0].screenPosition : Vector2.zero;
|
||||
}
|
||||
#endif
|
||||
return Input.mousePosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea1502cb33ab4d4ca1fedbdde163c980
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,23 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class JumpAnimation : Clickable {
|
||||
[SerializeField] Transform target;
|
||||
Sequence sequence;
|
||||
|
||||
public override void OnClick() => PlayAnimation();
|
||||
|
||||
public void PlayAnimation() {
|
||||
if (!sequence.isAlive) {
|
||||
const float jumpDuration = 0.3f;
|
||||
sequence = Tween.Scale(target, new Vector3(1.1f, 0.8f, 1.1f), 0.15f, Ease.OutQuad, 2, CycleMode.Yoyo)
|
||||
.Chain(Tween.LocalPositionY(target, 1, jumpDuration))
|
||||
.Chain(Tween.LocalEulerAngles(target, Vector3.zero, new Vector3(0, 360), 1.5f, Ease.InOutBack))
|
||||
.Chain(Tween.LocalPositionY(target, 0, jumpDuration));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 453932c77a72487599d5103bcde610da
|
||||
timeCreated: 1685366944
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8add66110a942479c9b69ed4eb7e777e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,67 @@
|
||||
#if PRIME_TWEEN_INSTALLED && UNITY_UGUI_INSTALLED
|
||||
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||
using UnityEngine.Profiling;
|
||||
#endif
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
/// <summary>
|
||||
/// PrimeTween uses static delegates (lambdas with no external captures) to play animations.
|
||||
/// The first time a particular animation is played, C# runtime caches the delegate for this animation, and the GC.Alloc is shown in Profiler.
|
||||
/// Such allocations are not technically 'garbage' because they are not subject to garbage collection.
|
||||
/// All subsequent calls will use the cached delegate and will never allocate again.
|
||||
///
|
||||
/// To replicate '0B' heap allocations shown in the promo video:
|
||||
/// Disable the 'Project Settings/Editor/Enter Play Mode Settings/Reload Domain' setting.
|
||||
/// Enable Profiler with Deep Profile.
|
||||
/// Run the Demo and play all animations at least once. This will cache the aforementioned static delegates.
|
||||
/// Restart the Demo scene and observe that PrimeTween doesn't allocate heap memory after static delegates warm-up.
|
||||
/// </summary>
|
||||
public class DebugInfo : MonoBehaviour {
|
||||
#pragma warning disable 0414
|
||||
[SerializeField] MeasureMemoryAllocations measureMemoryAllocations;
|
||||
[SerializeField] Text tweensCountText;
|
||||
[SerializeField] Text gcAllocText;
|
||||
#pragma warning restore 0414
|
||||
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||
long curTweensCount = -1;
|
||||
int? curGCAlloc;
|
||||
|
||||
void Start() {
|
||||
gcAllocText.text = string.Empty;
|
||||
if (shouldDisable()) {
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
if (Profiler.enabled && !UnityEditorInternal.ProfilerDriver.deepProfiling) {
|
||||
Debug.LogWarning("Please enable 'Deep Profile' for more accurate memory allocation measurements.");
|
||||
}
|
||||
}
|
||||
|
||||
static bool shouldDisable() {
|
||||
if (!Application.isEditor) {
|
||||
return true;
|
||||
}
|
||||
if (UnityEditor.EditorApplication.isPaused) {
|
||||
return false; // Profiler.enabled returns false if scene is started paused in Unity 2021.3.26
|
||||
}
|
||||
return !Profiler.enabled;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
var newTweensCount = PrimeTweenManager.Instance.lastId;
|
||||
if (curTweensCount != newTweensCount) {
|
||||
curTweensCount = newTweensCount;
|
||||
tweensCountText.text = $"Animations: {newTweensCount}";
|
||||
}
|
||||
var newGCAlloc = measureMemoryAllocations.gcAllocTotal;
|
||||
if (newGCAlloc.HasValue && curGCAlloc != newGCAlloc.Value) {
|
||||
curGCAlloc = newGCAlloc.Value;
|
||||
gcAllocText.text = $"Heap allocations: {UnityEditor.EditorUtility.FormatBytes(newGCAlloc.Value)}";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0ef97c778caf4b70aea23911ded98ab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,152 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Profiling;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine.Profiling;
|
||||
#endif
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class MeasureMemoryAllocations : MonoBehaviour {
|
||||
#pragma warning disable 0414
|
||||
[SerializeField] bool logAllocations;
|
||||
[SerializeField] bool logFiltered;
|
||||
[SerializeField] bool logIgnored;
|
||||
[SerializeField] List<string> filterAllocations = new List<string>();
|
||||
[SerializeField] List<string> ignoreAllocations = new List<string>();
|
||||
#pragma warning restore 0414
|
||||
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||
public int? gcAllocTotal { get; private set; }
|
||||
readonly Stack<int> stack = new Stack<int>();
|
||||
readonly List<int> childrenBuffer = new List<int>();
|
||||
readonly List<int> fullIdPathBuffer = new List<int>();
|
||||
readonly List<int[]> ignoredPaths = new List<int[]>();
|
||||
readonly List<int[]> filteredPaths = new List<int[]>();
|
||||
int lastProcessedFrame = -1;
|
||||
|
||||
void Awake() {
|
||||
filterAllocations.Add("PrimeTween.Runtime");
|
||||
filterAllocations.Add("PrimeTweenDemo");
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
ProfilerDriver.ClearAllFrames();
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (!Profiler.enabled) {
|
||||
return;
|
||||
}
|
||||
var startFrame = Mathf.Max(lastProcessedFrame + 1, ProfilerDriver.firstFrameIndex);
|
||||
for (int i = startFrame; i <= ProfilerDriver.lastFrameIndex; i++) {
|
||||
var gcAlloc = calcGCAllocInFrame(i);
|
||||
if (!gcAlloc.HasValue) {
|
||||
break;
|
||||
}
|
||||
lastProcessedFrame = i;
|
||||
if (gcAllocTotal.HasValue) {
|
||||
gcAllocTotal += gcAlloc.Value;
|
||||
} else {
|
||||
gcAllocTotal = gcAlloc.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int? calcGCAllocInFrame(int frameIndex) {
|
||||
int result = 0;
|
||||
const HierarchyFrameDataView.ViewModes viewMode = HierarchyFrameDataView.ViewModes.MergeSamplesWithTheSameName | HierarchyFrameDataView.ViewModes.HideEditorOnlySamples;
|
||||
using (var data = ProfilerDriver.GetHierarchyFrameDataView(frameIndex, 0, viewMode, HierarchyFrameDataView.columnGcMemory, false)) {
|
||||
if (!data.valid) {
|
||||
return null;
|
||||
}
|
||||
stack.Clear();
|
||||
stack.Push(data.GetRootItemID());
|
||||
while (stack.Count > 0) {
|
||||
var current = stack.Pop();
|
||||
UnityEngine.Assertions.Assert.IsTrue(data.HasItemChildren(current));
|
||||
data.GetItemChildren(current, childrenBuffer);
|
||||
foreach (var childId in childrenBuffer) {
|
||||
var gcAlloc = (int)data.GetItemColumnDataAsSingle(childId, HierarchyFrameDataView.columnGcMemory);
|
||||
if (gcAlloc == 0) {
|
||||
continue;
|
||||
}
|
||||
if (data.HasItemChildren(childId)) {
|
||||
stack.Push(childId);
|
||||
continue;
|
||||
}
|
||||
data.GetItemMarkerIDPath(childId, fullIdPathBuffer);
|
||||
if (ContainsSequence(ignoredPaths, fullIdPathBuffer)) {
|
||||
continue;
|
||||
}
|
||||
if (!ContainsSequence(filteredPaths, fullIdPathBuffer)) {
|
||||
if (shouldFilter()) {
|
||||
filteredPaths.Add(fullIdPathBuffer.ToArray());
|
||||
} else {
|
||||
ignoredPaths.Add(fullIdPathBuffer.ToArray());
|
||||
continue;
|
||||
}
|
||||
bool shouldFilter() {
|
||||
if (filterAllocations.Count == 0) {
|
||||
return true;
|
||||
}
|
||||
var itemPath = data.GetItemPath(childId);
|
||||
foreach (var filter in filterAllocations) {
|
||||
if (itemPath.Contains(filter) && !ignoreAllocations.Any(itemPath.Contains)) {
|
||||
if (logFiltered) {
|
||||
print($"FILTER {itemPath}");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (logIgnored) {
|
||||
print($"IGNORE {itemPath}");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (logAllocations) {
|
||||
print($"GC Alloc in frame {frameIndex}: {EditorUtility.FormatBytes(gcAlloc)}\n" +
|
||||
$"Path: {data.GetItemPath(childId)}\n");
|
||||
}
|
||||
result += gcAlloc;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool ContainsSequence(List<int[]> arrays, List<int> list) {
|
||||
foreach (var arr in arrays) {
|
||||
if (SequenceEqual(arr, list)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
// Unity 2019.4.40 doesn't support static local methods
|
||||
// ReSharper disable once LocalFunctionCanBeMadeStatic
|
||||
bool SequenceEqual(int[] arr, List<int> _list) {
|
||||
if (arr.Length != _list.Count) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < arr.Length; i++) {
|
||||
if (arr[i] != _list[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void Awake() {
|
||||
if (Application.isEditor) {
|
||||
Debug.LogWarning($"{nameof(MeasureMemoryAllocations)} is only supported in Unity 2019.1 or newer.", this);
|
||||
} else {
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6af581ca2a164600b2d47b0f7f7d5570
|
||||
timeCreated: 1686221280
|
||||
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "PrimeTween.Debug",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"PrimeTween.Runtime"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.kyrylokuzyk.primetween",
|
||||
"expression": "1.0.0",
|
||||
"define": "PRIME_TWEEN_INSTALLED"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.ugui",
|
||||
"expression": "1.0.0",
|
||||
"define": "UNITY_UGUI_INSTALLED"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd26724a735bb4282b7fbdef4681eb5f
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "PrimeTween.Demo",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"PrimeTween.Runtime",
|
||||
"Unity.TextMeshPro",
|
||||
"Unity.InputSystem"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.modules.physics",
|
||||
"expression": "1.0.0",
|
||||
"define": "PHYSICS_MODULE_INSTALLED"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.ugui",
|
||||
"expression": "1.0.0",
|
||||
"define": "UNITY_UGUI_INSTALLED"
|
||||
},
|
||||
{
|
||||
"name": "com.kyrylokuzyk.primetween",
|
||||
"expression": "1.0.0",
|
||||
"define": "PRIME_TWEEN_INSTALLED"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.textmeshpro",
|
||||
"expression": "1.0.0",
|
||||
"define": "TEXT_MESH_PRO_INSTALLED"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.inputsystem",
|
||||
"expression": "1.0.0",
|
||||
"define": "INPUT_SYSTEM_INSTALLED"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.ugui",
|
||||
"expression": "2.0.0",
|
||||
"define": "TEXT_MESH_PRO_INSTALLED"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85ffa6ed6408b405d94d60bf1dce1057
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
29
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Road.cs
Normal file
29
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Road.cs
Normal file
@ -0,0 +1,29 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class Road : Animatable {
|
||||
[SerializeField] MeshRenderer roadModel;
|
||||
[SerializeField] AnimationCurve ease;
|
||||
float currentSpeed;
|
||||
|
||||
void Awake() {
|
||||
_ = roadModel.material; // copy shared material
|
||||
}
|
||||
|
||||
public override Sequence Animate(bool isAnimating) {
|
||||
var currentSpeedTween = Tween.Custom(this, currentSpeed, isAnimating ? 0.3f : 0, 1, (_this, val) => _this.currentSpeed = val);
|
||||
var sequence = Sequence.Create(currentSpeedTween);
|
||||
if (isAnimating) {
|
||||
sequence.Group(Tween.LocalPositionY(transform, 0, -0.5f, 0.7f, ease));
|
||||
}
|
||||
return sequence;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
roadModel.material.mainTextureOffset += new Vector2(-1f, 1f) * currentSpeed * Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4e192d6601c4753961099a3db72b66f
|
||||
timeCreated: 1682262719
|
||||
34
Client/Assets/Plugins/PrimeTween/Demo/Scripts/SlidingDoor.cs
Normal file
34
Client/Assets/Plugins/PrimeTween/Demo/Scripts/SlidingDoor.cs
Normal file
@ -0,0 +1,34 @@
|
||||
#if PRIME_TWEEN_INSTALLED && UNITY_UGUI_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class SlidingDoor : Animatable {
|
||||
[SerializeField] Demo demo;
|
||||
[SerializeField] Transform animationAnchor;
|
||||
[SerializeField] Vector3 openedPos, midPos, closedPos;
|
||||
bool isClosed;
|
||||
Sequence sequence;
|
||||
|
||||
public override void OnClick() {
|
||||
if (!demo.animateAllSequence.isAlive) {
|
||||
Animate(!isClosed);
|
||||
}
|
||||
}
|
||||
|
||||
public override Sequence Animate(bool _isClosed) {
|
||||
if (isClosed == _isClosed) {
|
||||
return Sequence.Create();
|
||||
}
|
||||
isClosed = _isClosed;
|
||||
if (sequence.isAlive) {
|
||||
sequence.Stop();
|
||||
}
|
||||
var tweenSettings = new TweenSettings(0.4f, Ease.OutBack, endDelay: 0.1f);
|
||||
sequence = Tween.LocalPosition(animationAnchor, midPos, tweenSettings)
|
||||
.Chain(Tween.LocalPosition(animationAnchor, _isClosed ? closedPos : openedPos, tweenSettings));
|
||||
return sequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c42977785d1b549d59c346556945e0c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,19 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class SqueezeAnimation : Clickable {
|
||||
[SerializeField] Transform target;
|
||||
Tween tween;
|
||||
|
||||
public override void OnClick() => PlayAnimation();
|
||||
|
||||
public void PlayAnimation() {
|
||||
if (!tween.isAlive) {
|
||||
tween = Tween.Scale(target, new Vector3(1.15f, 0.9f, 1.15f), 0.2f, Ease.OutSine, 2, CycleMode.Yoyo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 613ad9fe5121a4b02b556b6b16cad710
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,25 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class SwipeTutorial : MonoBehaviour {
|
||||
Tween tween;
|
||||
|
||||
void OnEnable() {
|
||||
#if !UNITY_2019_1_OR_NEWER || UNITY_UGUI_INSTALLED
|
||||
tween = Tween.Alpha(GetComponent<UnityEngine.UI.Text>(), 1, 0, 1, Ease.InOutSine, -1, CycleMode.Yoyo);
|
||||
#else
|
||||
Debug.LogError("Please install the package and re-open the Demo scene: 'Package Manager/Packages/Unity Registry/Unity UI' (com.unity.ugui).");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Hide() {
|
||||
if (tween.isAlive) {
|
||||
// Stop cycling the animation when it reaches the 'endValue' (0)
|
||||
tween.SetRemainingCycles(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d20b7aac1e6a4f1dbdbe52c7ca1ad4b4
|
||||
timeCreated: 1685344395
|
||||
@ -0,0 +1,18 @@
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo
|
||||
{
|
||||
public class TestAnimation:MonoBehaviour
|
||||
{
|
||||
[SerializeField] Transform animationAnchor;
|
||||
public bool _isClosed;
|
||||
|
||||
[Sirenix.OdinInspector.Button("Test")]
|
||||
public void Test()
|
||||
{
|
||||
var rotationTween = Tween.LocalRotation(animationAnchor, _isClosed ? new Vector3(0, -90) : Vector3.zero, 0.7f, Ease.InOutElastic);
|
||||
var sequence = Sequence.Create(rotationTween);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52c8fdb241904ec08d0206d641fd84cc
|
||||
timeCreated: 1747275178
|
||||
@ -0,0 +1,155 @@
|
||||
#if PRIME_TWEEN_INSTALLED
|
||||
#if TEXT_MESH_PRO_INSTALLED
|
||||
using TMPro;
|
||||
#endif
|
||||
using JetBrains.Annotations;
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
[PublicAPI]
|
||||
public class TypewriterAnimatorExample : MonoBehaviour {
|
||||
enum AnimationType { Simple, WithPunctuations, ByWords }
|
||||
[SerializeField] AnimationType animationType = AnimationType.WithPunctuations;
|
||||
[SerializeField] float charsPerSecond = 40f;
|
||||
[SerializeField] int pauseAfterPunctuation = 20;
|
||||
#if TEXT_MESH_PRO_INSTALLED
|
||||
TextMeshProUGUI text;
|
||||
|
||||
void Awake() {
|
||||
text = gameObject.AddComponent<TextMeshProUGUI>();
|
||||
text.maxVisibleCharacters = 0;
|
||||
text.alignment = TextAlignmentOptions.TopLeft;
|
||||
text.fontSize = 12;
|
||||
text.color = Color.black * 0.8f;
|
||||
text.text = "This text is <color=orange>animated</color> with <b>zero allocations</b>, see <i>'TypewriterAnimatorExample'</i> script for more details.\n\n" +
|
||||
"PrimeTween rocks!";
|
||||
}
|
||||
|
||||
public Tween Animate() {
|
||||
if (!Application.isPlaying) {
|
||||
// 'text' is created in Awake(), so this animation can't be played in Edit mode
|
||||
PrimeTweenConfig.warnZeroDuration = false;
|
||||
var emptyTween = Tween.Delay(0f);
|
||||
PrimeTweenConfig.warnZeroDuration = true;
|
||||
return emptyTween;
|
||||
}
|
||||
switch (animationType) {
|
||||
case AnimationType.Simple:
|
||||
return TypewriterAnimationSimple();
|
||||
case AnimationType.WithPunctuations:
|
||||
return TypewriterAnimationWithPunctuations();
|
||||
case AnimationType.ByWords:
|
||||
return TypewriterAnimationByWords();
|
||||
default:
|
||||
throw new System.Exception();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A simple typewriter animation that uses built-in <see cref="Tween.TextMaxVisibleCharacters()"/> animation method.</summary>
|
||||
public Tween TypewriterAnimationSimple() {
|
||||
text.ForceMeshUpdate();
|
||||
int characterCount = text.textInfo.characterCount;
|
||||
float duration = characterCount / charsPerSecond;
|
||||
return Tween.TextMaxVisibleCharacters(text, 0, characterCount, duration, Ease.Linear);
|
||||
}
|
||||
|
||||
#region TypewriterAnimationWithPunctuations
|
||||
/// <summary>Typewriter animation which inserts pauses after punctuation marks.</summary>
|
||||
public Tween TypewriterAnimationWithPunctuations() {
|
||||
text.ForceMeshUpdate();
|
||||
RemapWithPunctuations(text, int.MaxValue, out int remappedCount, out _);
|
||||
float duration = remappedCount / charsPerSecond;
|
||||
return Tween.Custom(this, 0f, remappedCount, duration, (t, x) => t.UpdateMaxVisibleCharsWithPunctuation(x), Ease.Linear);
|
||||
}
|
||||
|
||||
void UpdateMaxVisibleCharsWithPunctuation(float progress) {
|
||||
int remappedEndIndex = Mathf.RoundToInt(progress);
|
||||
RemapWithPunctuations(text, remappedEndIndex, out _, out int visibleCharsCount);
|
||||
if (text.maxVisibleCharacters != visibleCharsCount) {
|
||||
text.maxVisibleCharacters = visibleCharsCount;
|
||||
// play keyboard typing sound here if needed
|
||||
}
|
||||
}
|
||||
|
||||
void RemapWithPunctuations([NotNull] TMP_Text text, int remappedEndIndex, out int remappedCount, out int visibleCharsCount) {
|
||||
remappedCount = 0;
|
||||
visibleCharsCount = 0;
|
||||
int count = text.textInfo.characterCount;
|
||||
var characterInfos = text.textInfo.characterInfo;
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (remappedCount >= remappedEndIndex) {
|
||||
break;
|
||||
}
|
||||
remappedCount++;
|
||||
visibleCharsCount++;
|
||||
if (IsPunctuationChar(characterInfos[i].character)) {
|
||||
int nextIndex = i + 1;
|
||||
if (nextIndex != count && !IsPunctuationChar(characterInfos[nextIndex].character)) {
|
||||
// add pause after the last subsequent punctuation character
|
||||
remappedCount += Mathf.Max(0, pauseAfterPunctuation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IsPunctuationChar(char c) {
|
||||
return ".,:;!?".IndexOf(c) != -1;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TypewriterAnimationByWords
|
||||
/// <summary>Typewriter animation that shows text word by word.</summary>
|
||||
public Tween TypewriterAnimationByWords() {
|
||||
text.ForceMeshUpdate();
|
||||
RemapWords(text, int.MaxValue, out int numWords, out _);
|
||||
float duration = text.textInfo.characterCount / charsPerSecond;
|
||||
return Tween.Custom(this, 0f, numWords, duration, (t, x) => t.UpdateVisibleWords(x), Ease.Linear);
|
||||
}
|
||||
|
||||
void UpdateVisibleWords(float progress) {
|
||||
int curWordIndex = Mathf.RoundToInt(progress);
|
||||
RemapWords(text, curWordIndex, out _, out int visibleCharsCount);
|
||||
if (text.maxVisibleCharacters != visibleCharsCount) {
|
||||
text.maxVisibleCharacters = visibleCharsCount;
|
||||
// play keyboard typing sound here if needed
|
||||
}
|
||||
}
|
||||
|
||||
static void RemapWords([NotNull] TMP_Text text, int remappedEndIndex, out int remappedCount, out int visibleCharsCount) {
|
||||
visibleCharsCount = 0;
|
||||
int count = text.textInfo.characterCount;
|
||||
if (count == 0) {
|
||||
remappedCount = 0;
|
||||
return;
|
||||
}
|
||||
remappedCount = 1;
|
||||
var characterInfos = text.textInfo.characterInfo;
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (remappedCount >= remappedEndIndex) {
|
||||
return;
|
||||
}
|
||||
remappedCount++;
|
||||
if (IsWordSeparatorChar(characterInfos[i].character)) {
|
||||
int nextIndex = i + 1;
|
||||
if (nextIndex == count || !IsWordSeparatorChar(characterInfos[nextIndex].character)) {
|
||||
remappedCount++;
|
||||
visibleCharsCount = nextIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
visibleCharsCount = count;
|
||||
|
||||
bool IsWordSeparatorChar(char ch) {
|
||||
return " \n".IndexOf(ch) != -1;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#else
|
||||
void Awake() {
|
||||
Debug.LogWarning("Please install TextMeshPro 'com.unity.textmeshpro' to enable TypewriterAnimatorExample.", this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f62b6e70f1114e5d867a36459e0352bf
|
||||
timeCreated: 1702471534
|
||||
38
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Wheels.cs
Normal file
38
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Wheels.cs
Normal file
@ -0,0 +1,38 @@
|
||||
#if PRIME_TWEEN_INSTALLED && UNITY_UGUI_INSTALLED
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PrimeTweenDemo {
|
||||
public class Wheels : Animatable {
|
||||
[SerializeField] Demo demo;
|
||||
[SerializeField] Transform[] wheels;
|
||||
bool isAnimating;
|
||||
Sequence sequence;
|
||||
|
||||
public override void OnClick() {
|
||||
demo.AnimateAll(!isAnimating);
|
||||
}
|
||||
|
||||
public override Sequence Animate(bool _isAnimating) {
|
||||
isAnimating = _isAnimating;
|
||||
// Spinning wheels is an infinite animation, and we should not return it as result of this method.
|
||||
// Instead, we should wrap the SpinWheelsInfinitely() call inside the empty Sequence. This way, the SpinWheelsInfinitely() call can be grouped and chained with other tweens and sequences.
|
||||
return Sequence.Create().ChainCallback(this, target => target.SpinWheelsInfinitely());
|
||||
}
|
||||
|
||||
void SpinWheelsInfinitely() {
|
||||
if (isAnimating) {
|
||||
sequence.Complete();
|
||||
sequence = Sequence.Create(-1);
|
||||
foreach (var wheel in wheels) {
|
||||
sequence.Group(Tween.LocalEulerAngles(wheel, Vector3.zero, new Vector3(360, 0), 1, Ease.Linear));
|
||||
}
|
||||
} else {
|
||||
if (sequence.isAlive) {
|
||||
sequence.SetRemainingCycles(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Wheels.cs.meta
Normal file
11
Client/Assets/Plugins/PrimeTween/Demo/Scripts/Wheels.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6113f6e98f16c489f87f373fc4133597
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7265872bef874265b6a013be67f7ef9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,6 @@
|
||||
Thanks for the model to Fero Andezo (feroz)!
|
||||
Model link:
|
||||
https://skfb.ly/6SZVz
|
||||
|
||||
If you like what Fero does, follow him on Sketchfab:
|
||||
https://sketchfab.com/ferofluid
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 064ca2a5c3a844e29a2223f62216e16e
|
||||
timeCreated: 1683535537
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
@ -0,0 +1,147 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f94c989c837ae4db8bd9b10ab17903ce
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.2 MiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user