打包规则

main
Vinny 2025-10-30 18:40:23 +08:00
parent 4434e6a5a0
commit 8d81b70649
10 changed files with 309 additions and 0 deletions

View File

@ -0,0 +1,127 @@
using UnityEngine;
/// <summary>
/// Flipbook动画启动器
/// 用于非循环的Flipbook动画在对象激活时自动设置_StartTime使动画从当前时间开始播放
/// </summary>
public class FlipbookAnimationStarter : MonoBehaviour
{
[Header("设置")]
[Tooltip("是否在OnEnable时自动设置StartTime")]
public bool autoSetOnEnable = true;
[Tooltip("使用Material实例还是共享Material建议使用实例")]
public bool useMaterialInstance = true;
[Tooltip("是否也处理子对象的Renderer")]
public bool includeChildren = false;
private static readonly int StartTimePropertyID = Shader.PropertyToID("_StartTime");
private MaterialPropertyBlock _propertyBlock;
private Renderer[] _renderers;
private void Awake()
{
// 初始化MaterialPropertyBlock性能更好的方式
_propertyBlock = new MaterialPropertyBlock();
// 获取所有Renderer
if (includeChildren)
{
_renderers = GetComponentsInChildren<Renderer>(true);
}
else
{
var renderer = GetComponent<Renderer>();
_renderers = renderer != null ? new[] { renderer } : new Renderer[0];
}
}
private void OnEnable()
{
if (autoSetOnEnable)
{
SetStartTime();
}
}
/// <summary>
/// 手动设置动画开始时间
/// </summary>
public void SetStartTime()
{
SetStartTime(Time.time);
}
/// <summary>
/// 设置指定的开始时间
/// </summary>
public void SetStartTime(float startTime)
{
foreach (var renderer in _renderers)
{
if (renderer == null) continue;
if (useMaterialInstance)
{
// 方式1: 使用MaterialPropertyBlock推荐不会创建材质实例性能更好
renderer.GetPropertyBlock(_propertyBlock);
_propertyBlock.SetFloat(StartTimePropertyID, startTime);
renderer.SetPropertyBlock(_propertyBlock);
}
else
{
// 方式2: 使用Material实例会创建材质副本
// 注意renderer.material会自动创建材质实例
renderer.material.SetFloat(StartTimePropertyID, startTime);
}
}
}
/// <summary>
/// 重置动画到第一帧
/// </summary>
public void ResetAnimation()
{
SetStartTime(0f);
}
/// <summary>
/// 从当前时间重新播放动画
/// </summary>
public void RestartAnimation()
{
SetStartTime(Time.time);
}
#if UNITY_EDITOR
[ContextMenu("设置StartTime为当前时间")]
private void EditorSetStartTime()
{
if (Application.isPlaying)
{
SetStartTime();
Debug.Log($"已设置 {gameObject.name} 的StartTime为 {Time.time}");
}
else
{
Debug.LogWarning("请在运行时执行此操作");
}
}
[ContextMenu("重置StartTime为0")]
private void EditorResetStartTime()
{
if (Application.isPlaying)
{
ResetAnimation();
Debug.Log($"已重置 {gameObject.name} 的StartTime为0");
}
else
{
Debug.LogWarning("请在运行时执行此操作");
}
}
#endif
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d9aca55876490b6449de8f38a029b7b1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phxh.dev.nld" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<queries>
<package android:name="com.eg.android.AlipayGphone" />
<package android:name="com.alipay.wallet" />
</queries>
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true" >
<activity
android:name="com.phxh.dev.nld.PayActivity">
<meta-data
android:name="unityplayer.UnityActivity"
android:value="true" />
</activity>
</application>
</manifest>

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e67627dae8fb6664abc0325a1e989564
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 42887166198c26f4a88574c85ebbf377
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 99faef125be8c3446a158d4b75c6428a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<!--定义权限-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!--获取wifi状态-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--获取移动网络状态-->
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<!--Unity打包屏蔽权限弹窗-->
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
</activity>
</application>
</manifest>

View File

@ -0,0 +1,49 @@
# 宏定义列表,供脚本添加到 PlayerSettings 的宏定义中
Define_list:
- BI_PHXH # BI
- LOGIN_PHONE # 手机登录
# 应用包名
PackageName: "com.phxh.nlddev"
# 是否海外渠道
IsOversea: false
# 多语言配置
Language: "Lan_CN"
# 当前版本号
Version: "0.8.0"
# BuildCode
BuildCode: 4
# 构建资源远程上传路径
OssRemoteUploadPath: "oss://nld-dev-k8f3h2qr9plmn3b3/client_res/Build"
AssetsEndPoint: "oss-cn-chengdu.aliyuncs.com"
# 阿里云 OSS 配置
ConfigAccessKeyId: "LTAI5tPLKwa1cSD1woBLvNBq"
ConfigAccessKeySecret: "aPvNg3waBzXas8nnn2lo46o1TEQY8X"
ConfigBucketName: "nld-dev-k8f3h2qr9plmn3b3"
ConfigURL: "http://k8f3h2qr9plmn3b3.kedrgame.com"
# http请求配置
AppAccessKey: "0SoE48O9sayjkG8J"
AppKey: "uUi_UI1oMKWo0VOSN1zme17Z70-FlAv3Lcx2mNhoYe4="
# 崩溃监控配置(仅 Android
CrashSight_Android:
id: "669a94ce69" # 崩溃上报的 App ID
key: "d9412717-2416-4270-b8bc-f7a0805f988f" # 崩溃上报的 Key
# TalkingData初始化
TalkingData:
appid: "2D0025FE20F34810BADABEFC00D32D22" # 测试包的App ID
channel: "VinnyTest" # 上报渠道
Packages:
- CrashSight@latest
- TalkingData@0.0.1
- WXPay@1.0.0
- AliPay@0.0.1