修改main

This commit is contained in:
2025-05-30 14:52:53 +08:00
parent 078f080fcc
commit cd1b718e85
11 changed files with 101 additions and 74 deletions

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: cffabde4e6a86aa4abfd2686fcbfb3b3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,18 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 03dc1bf5b95446838cce6d0fefed81fe, type: 3}
m_Name: DomainConfig
m_EditorClassIdentifier:
domain:
mainPrefab: Prefabs_UI
className: Hello
methodName: Run

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d3b6d9514b4a312439b12cc9c5f52969
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -13,9 +13,7 @@ MonoBehaviour:
m_Name: HotfixMainResDomain m_Name: HotfixMainResDomain
m_EditorClassIdentifier: com.stary.evo.runtime:Stary.Evo:HotfixMainResDomain m_EditorClassIdentifier: com.stary.evo.runtime:Stary.Evo:HotfixMainResDomain
hotfixMainResDomainEntity: hotfixMainResDomainEntity:
domain: MainDomain ipconfig: http://192.168.31.67:9527
ipconfig: http://192.168.31.100:5005/HotRefresh username: admin2023
pathconfig: password: admin@2023
packageVersion: productName: XOSMOPlug_inLibrary
username: UnityHot
password: Unity1234

View File

@@ -12,6 +12,7 @@ namespace R
} }
public static class audios public static class audios
{ {
public const string au_effect_element_pop_mp3 = "Audios_au_effect_element_pop";
public const string au_x_07_ending1_wav = "Audios_au_X_07_ending1"; public const string au_x_07_ending1_wav = "Audios_au_X_07_ending1";
public const string au_x_07_ending2_wav = "Audios_au_X_07_ending2"; public const string au_x_07_ending2_wav = "Audios_au_X_07_ending2";
public const string au_x_07_ending3_wav = "Audios_au_X_07_ending3"; public const string au_x_07_ending3_wav = "Audios_au_X_07_ending3";
@@ -42,6 +43,7 @@ namespace R
public const string guideball_zone_prefab = "Prefabs_GuideBall_Zone"; public const string guideball_zone_prefab = "Prefabs_GuideBall_Zone";
public const string kkcontroller_prefab = "Prefabs_KKController"; public const string kkcontroller_prefab = "Prefabs_KKController";
public const string main_prefab = "Prefabs_Main"; public const string main_prefab = "Prefabs_Main";
public const string progressbarpanel_prefab = "Prefabs_ProgressBarPanel";
public const string videopanel_prefab = "Prefabs_VideoPanel"; public const string videopanel_prefab = "Prefabs_VideoPanel";
public const string watermark_prefab = "Prefabs_Watermark"; public const string watermark_prefab = "Prefabs_Watermark";
} }

View File

@@ -0,0 +1,68 @@
using System;
using Cysharp.Threading.Tasks;
using Stary.Evo;
using Stary.Evo.AudioCore;
using Stary.Evo.InformationSave;
using Stary.Evo.UIFarme;
using UnityEngine;
using UnityEngine.UI;
using YooAsset;
namespace Main
{
public class ProgressBarPanel : BasePanel
{
static readonly string path = "ProgressBarPanel";
private Image _fill;
private Text _fillText;
private Text _fillMessage;
public ProgressBarPanel()
{
}
public override void Initialize(GameObject panelGo)
{
base.Initialize(panelGo);
_fill = activePanel.transform.Find("Fill").GetComponent<Image>();
_fillText = _fill.transform.Find("FillText").GetComponent<Text>();
_fillMessage= _fill.transform.Find("FillMessage").GetComponent<Text>();
_fill.fillAmount = 0;
_fillText.text = "0%";
}
public override void OnEnter()
{
base.OnEnter();
this.RegisterEvent<ProgressBarType,string, float>(ProgressBarType.Add, SetProgressBarValue);
}
public override void OnExit(float delay = 0)
{
base.OnExit(delay);
_fill.fillAmount = 0;
_fillText.text = "0%";
this.UnRegisterEvent<ProgressBarType,string, float>(ProgressBarType.Add, SetProgressBarValue);
}
public async void SetProgressBarValue(string message,float value)
{
_fill.fillAmount = value;
_fillMessage.text = message;
_fillText.text = $"{value:P0}";
if (value >= 1)
{
this.PanelSystem.PopQueue<ProgressBarPanel>();
}
}
public enum ProgressBarType
{
Add,
}
}
}

View File

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

View File

@@ -2,6 +2,6 @@
{ {
public class WebRequestTools public class WebRequestTools
{ {
} }
} }

View File

@@ -11,33 +11,19 @@ namespace Stary.Evo
public class ZipTool public class ZipTool
{ {
// 新增:带进度回调的下载解压方法 // 新增:带进度回调的下载解压方法
public static async UniTask<string[]> DownloadAndUnzipAsync(string url, string extractPath, public static async UniTask DownloadAndUnzipAsync(string fildId, string extractPath,
Action<float> downloadProgress = null, Action<float> unzipProgress = null) Action<float> downloadProgress = null, Action<float> unzipProgress = null)
{ {
string tempPath = Path.Combine(Application.persistentDataPath, "temp.zip"); string tempPath = Path.Combine(Application.persistentDataPath, "temp.zip");
try try
{ {
// 下载ZIP文件 string url = $"{AppConfig.IpConfig}/FileLoad/Download/{fildId}";
using( UnityWebRequest request =WebRequester(url)) await WebRequestSystem.GetFile(url, tempPath,downloadProgress);
{
request.downloadHandler = new DownloadHandlerFile(tempPath);
var operation = request.SendWebRequest();
while (!operation.isDone)
{
downloadProgress?.Invoke(request.downloadProgress);
await UniTask.Yield();
}
if (request.result != UnityWebRequest.Result.Success)
{
throw new Exception($"下载失败:{request.error}");
}
}
// 解压下载的文件 // 解压下载的文件
return await UnzipAsync(tempPath, extractPath, unzipProgress); await UnzipAsync(tempPath, extractPath, unzipProgress);
File.Delete(tempPath);
} }
finally finally
{ {
@@ -50,40 +36,37 @@ namespace Stary.Evo
} }
// 修改:添加进度回调参数 // 修改:添加进度回调参数
public static async UniTask<string[]> UnzipAsync(string zipPath, string extractPath, public static async UniTask UnzipAsync(string zipPath, string extractPath,
Action<float> progressCallback = null) Action<float> progressCallback = null)
{ {
try try
{ {
List<string> pathList = new List<string>();
using (ZipArchive archive = ZipFile.OpenRead(zipPath)) using (ZipArchive archive = ZipFile.OpenRead(zipPath))
{ {
float totalEntries = archive.Entries.Count; float totalEntries = archive.Entries.Count;
float processed = 0; float processed = 0;
foreach (ZipArchiveEntry entry in archive.Entries) foreach (ZipArchiveEntry entry in archive.Entries)
{ {
string filePath = Path.Combine(extractPath, entry.FullName); string filePath = Path.Combine(extractPath, entry.FullName);
Directory.CreateDirectory(Path.GetDirectoryName(filePath)); Directory.CreateDirectory(Path.GetDirectoryName(filePath));
if (!string.IsNullOrEmpty(entry.Name)) if (!string.IsNullOrEmpty(entry.Name))
{ {
using (Stream inputStream = entry.Open()) using (Stream inputStream = entry.Open())
using (FileStream outputStream = File.Create(filePath)) using (FileStream outputStream = File.Create(filePath))
{ {
await inputStream.CopyToAsync(outputStream); await inputStream.CopyToAsync(outputStream);
pathList.Add(outputStream.Name);
} }
} }
processed++; processed++;
float progress = processed / totalEntries; float progress = processed / totalEntries;
progressCallback?.Invoke(progress); progressCallback?.Invoke(progress);
Debug.Log($"解压进度: {progress:P0}");
} }
} }
Debug.Log($"解压完成: {extractPath}"); Debug.Log($"解压完成: {extractPath}");
return pathList.ToArray();
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -91,6 +74,7 @@ namespace Stary.Evo
throw; throw;
} }
} }
/// <summary> /// <summary>
/// 自定义网络请求器需要登录 /// 自定义网络请求器需要登录
/// </summary> /// </summary>
@@ -99,7 +83,7 @@ namespace Stary.Evo
private static UnityWebRequest WebRequester(string url) private static UnityWebRequest WebRequester(string url)
{ {
var request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbGET); var request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbGET);
var authorization = GetAuthorization(AppConfig.USERNAME, AppConfig.PASSWORD); var authorization = GetAuthorization(AppConfig.UserName, AppConfig.PassWord);
request.SetRequestHeader("AUTHORIZATION", authorization); request.SetRequestHeader("AUTHORIZATION", authorization);
return request; return request;
} }
@@ -111,6 +95,4 @@ namespace Stary.Evo
return "Basic " + System.Convert.ToBase64String(bytes); return "Basic " + System.Convert.ToBase64String(bytes);
} }
} }
} }

View File

@@ -108,7 +108,7 @@ namespace Main
int index = -1; int index = -1;
for (int i = 0; i < points.Count; i++) for (int i = 0; i < points.Count; i++)
{ {
if (AppConfig.ASSETPACKGENAME == points[i].Name) if (AppConfig.PackageDomainName == points[i].Name)
{ {
index = i; index = i;
break; break;

View File

@@ -646,7 +646,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 467bc10b56c272043a89b12cbf23b3ef, type: 3} m_Script: {fileID: 11500000, guid: 467bc10b56c272043a89b12cbf23b3ef, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
domain: X_02_01 domain: Main
--- !u!4 &1829387361 --- !u!4 &1829387361
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0