修改main
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cffabde4e6a86aa4abfd2686fcbfb3b3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3b6d9514b4a312439b12cc9c5f52969
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -13,9 +13,7 @@ MonoBehaviour:
|
||||
m_Name: HotfixMainResDomain
|
||||
m_EditorClassIdentifier: com.stary.evo.runtime:Stary.Evo:HotfixMainResDomain
|
||||
hotfixMainResDomainEntity:
|
||||
domain: MainDomain
|
||||
ipconfig: http://192.168.31.100:5005/HotRefresh
|
||||
pathconfig:
|
||||
packageVersion:
|
||||
username: UnityHot
|
||||
password: Unity1234
|
||||
ipconfig: http://192.168.31.67:9527
|
||||
username: admin2023
|
||||
password: admin@2023
|
||||
productName: XOSMOPlug_inLibrary
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace R
|
||||
}
|
||||
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_ending2_wav = "Audios_au_X_07_ending2";
|
||||
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 kkcontroller_prefab = "Prefabs_KKController";
|
||||
public const string main_prefab = "Prefabs_Main";
|
||||
public const string progressbarpanel_prefab = "Prefabs_ProgressBarPanel";
|
||||
public const string videopanel_prefab = "Prefabs_VideoPanel";
|
||||
public const string watermark_prefab = "Prefabs_Watermark";
|
||||
}
|
||||
|
||||
68
Assets/Main/Script/Runtime/LasterDoMain/ProgressBarPanel.cs
Normal file
68
Assets/Main/Script/Runtime/LasterDoMain/ProgressBarPanel.cs
Normal 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,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1795353bee11314b950ef806ab8458f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,6 +2,6 @@
|
||||
{
|
||||
public class WebRequestTools
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,33 +11,19 @@ namespace Stary.Evo
|
||||
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)
|
||||
{
|
||||
string tempPath = Path.Combine(Application.persistentDataPath, "temp.zip");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// 下载ZIP文件
|
||||
using( UnityWebRequest request =WebRequester(url))
|
||||
{
|
||||
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}");
|
||||
}
|
||||
}
|
||||
string url = $"{AppConfig.IpConfig}/FileLoad/Download/{fildId}";
|
||||
await WebRequestSystem.GetFile(url, tempPath,downloadProgress);
|
||||
|
||||
// 解压下载的文件
|
||||
return await UnzipAsync(tempPath, extractPath, unzipProgress);
|
||||
await UnzipAsync(tempPath, extractPath, unzipProgress);
|
||||
File.Delete(tempPath);
|
||||
}
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> pathList = new List<string>();
|
||||
|
||||
using (ZipArchive archive = ZipFile.OpenRead(zipPath))
|
||||
{
|
||||
float totalEntries = archive.Entries.Count;
|
||||
float processed = 0;
|
||||
|
||||
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
string filePath = Path.Combine(extractPath, entry.FullName);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(entry.Name))
|
||||
{
|
||||
using (Stream inputStream = entry.Open())
|
||||
using (FileStream outputStream = File.Create(filePath))
|
||||
{
|
||||
await inputStream.CopyToAsync(outputStream);
|
||||
pathList.Add(outputStream.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
processed++;
|
||||
float progress = processed / totalEntries;
|
||||
progressCallback?.Invoke(progress);
|
||||
Debug.Log($"解压进度: {progress:P0}");
|
||||
}
|
||||
}
|
||||
Debug.Log($"解压完成: {extractPath}");
|
||||
return pathList.ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -91,6 +74,7 @@ namespace Stary.Evo
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义网络请求器需要登录
|
||||
/// </summary>
|
||||
@@ -99,7 +83,7 @@ namespace Stary.Evo
|
||||
private static UnityWebRequest WebRequester(string url)
|
||||
{
|
||||
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);
|
||||
return request;
|
||||
}
|
||||
@@ -111,6 +95,4 @@ namespace Stary.Evo
|
||||
return "Basic " + System.Convert.ToBase64String(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -108,7 +108,7 @@ namespace Main
|
||||
int index = -1;
|
||||
for (int i = 0; i < points.Count; i++)
|
||||
{
|
||||
if (AppConfig.ASSETPACKGENAME == points[i].Name)
|
||||
if (AppConfig.PackageDomainName == points[i].Name)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
|
||||
@@ -646,7 +646,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 467bc10b56c272043a89b12cbf23b3ef, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
domain: X_02_01
|
||||
domain: Main
|
||||
--- !u!4 &1829387361
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Reference in New Issue
Block a user