2025-03-31 11:16:52 +08:00
|
|
|
using System;
|
2026-03-31 15:29:50 +08:00
|
|
|
using System.Collections.Generic;
|
2025-07-02 16:28:08 +08:00
|
|
|
using Sirenix.OdinInspector;
|
2025-07-02 17:58:55 +08:00
|
|
|
using UnityEditor;
|
2025-03-31 11:16:52 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Stary.Evo
|
|
|
|
|
{
|
|
|
|
|
[CreateAssetMenu(fileName = "HotfixMainResDomain", menuName = "Evo/Create HotfixMainResDomain")]
|
|
|
|
|
public class HotfixMainResDomain : ScriptableObject
|
|
|
|
|
{
|
2026-03-31 15:29:50 +08:00
|
|
|
[TabGroup("MainResDomain")]
|
|
|
|
|
[InlineProperty, HideLabel]
|
2025-03-31 11:16:52 +08:00
|
|
|
public HotfixMainResDomainEntity hotfixMainResDomainEntity;
|
2026-03-31 15:29:50 +08:00
|
|
|
|
|
|
|
|
[TabGroup("ProjectInfo")]
|
|
|
|
|
[InlineProperty, HideLabel]
|
2025-07-02 16:28:08 +08:00
|
|
|
public ProjectInfo projectInfo;
|
2026-03-31 15:29:50 +08:00
|
|
|
|
|
|
|
|
[TabGroup("BuildConfig")]
|
|
|
|
|
[InlineProperty, HideLabel]
|
|
|
|
|
public BuildConfig buildConfig;
|
|
|
|
|
|
|
|
|
|
private static HotfixMainResDomain globalInstance;
|
|
|
|
|
public static HotfixMainResDomain Get
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
// 在Resources目录下查找配置
|
|
|
|
|
if (globalInstance == null)
|
|
|
|
|
{
|
|
|
|
|
globalInstance = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
|
|
|
|
|
}
|
|
|
|
|
// 无该配置时尝试创建
|
|
|
|
|
else if (globalInstance == null)
|
|
|
|
|
{
|
|
|
|
|
globalInstance = CreateInstance<HotfixMainResDomain>();
|
|
|
|
|
var path = AssetDatabase.GenerateUniqueAssetPath("Resources/HotfixMainResDomain.asset");
|
|
|
|
|
AssetDatabase.CreateAsset(globalInstance, path);
|
|
|
|
|
AssetDatabase.SaveAssets();
|
|
|
|
|
AssetDatabase.Refresh();
|
|
|
|
|
}
|
|
|
|
|
// 返回热更资源配置
|
|
|
|
|
return globalInstance;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-31 11:16:52 +08:00
|
|
|
}
|
2025-07-02 16:28:08 +08:00
|
|
|
|
2025-03-31 11:16:52 +08:00
|
|
|
[Serializable]
|
|
|
|
|
public class HotfixMainResDomainEntity
|
|
|
|
|
{
|
2025-07-02 16:28:08 +08:00
|
|
|
public string ipconfig = "http://192.168.31.100:5005/HotRefresh";
|
|
|
|
|
public string mainDomainVersion = "";
|
|
|
|
|
public string username = "UnityHot";
|
|
|
|
|
public string password = "Unity1234";
|
|
|
|
|
}
|
2025-07-02 18:14:15 +08:00
|
|
|
|
2025-07-02 16:28:08 +08:00
|
|
|
[Serializable]
|
|
|
|
|
public class ProjectInfo
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 项目中文名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string projectName;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 项目代号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string projectCode;
|
2025-07-02 18:14:15 +08:00
|
|
|
|
2025-07-02 16:28:08 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 项目包名
|
|
|
|
|
/// </summary>
|
2026-03-31 15:29:50 +08:00
|
|
|
[ReadOnly]
|
|
|
|
|
public string projectPackageName;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 资源加载场景
|
|
|
|
|
/// </summary>
|
|
|
|
|
[LabelText("资源加载场景")]
|
|
|
|
|
[Required("如果需要场景作为资源加载过程中的过渡,请将其拖到此处")]
|
|
|
|
|
public SceneAsset loadingScene;
|
2026-03-31 16:46:11 +08:00
|
|
|
|
2026-03-31 15:29:50 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 资源加载场景(路径)
|
|
|
|
|
/// </summary>
|
2026-03-31 16:46:11 +08:00
|
|
|
public string loadingScenePath;
|
2026-03-31 15:29:50 +08:00
|
|
|
}
|
2025-07-02 17:58:55 +08:00
|
|
|
|
2026-03-31 15:29:50 +08:00
|
|
|
[Serializable]
|
|
|
|
|
public class BuildConfig
|
|
|
|
|
{
|
|
|
|
|
[LabelText("包体配置")]
|
|
|
|
|
private List<PackageConfig> packages = new();
|
|
|
|
|
|
|
|
|
|
public PackageConfig Get(string packageID)
|
|
|
|
|
{
|
|
|
|
|
var result = packages.Find(x=>x.packageID==packageID);
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
result = new PackageConfig();
|
|
|
|
|
packages.Add(result);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Set(string packageID, PackageConfigInfo config)
|
|
|
|
|
{
|
|
|
|
|
var package = Get(packageID);
|
|
|
|
|
package.info = config;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class PackageConfig
|
|
|
|
|
{
|
|
|
|
|
[FoldoutGroup("@packageID")]
|
|
|
|
|
[LabelText("包体ID")]
|
|
|
|
|
public string packageID;
|
|
|
|
|
[FoldoutGroup("@packageID")]
|
|
|
|
|
[InlineProperty, HideLabel]
|
|
|
|
|
public PackageConfigInfo info;
|
|
|
|
|
}
|
2025-07-02 17:58:55 +08:00
|
|
|
|
2026-03-31 15:29:50 +08:00
|
|
|
[Serializable]
|
|
|
|
|
public class PackageConfigInfo
|
|
|
|
|
{
|
|
|
|
|
[LabelText("App名称")]
|
|
|
|
|
public string appName;
|
2025-03-31 11:16:52 +08:00
|
|
|
}
|
|
|
|
|
}
|