Skip to content

Commit 8817ad3

Browse files
committed
提交
1 parent 594f250 commit 8817ad3

34 files changed

+1414
-469
lines changed

Assets/Script/Core/AudioManager/AudioAsset.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public void Stop()
152152
/// </summary>
153153
public void ResetData()
154154
{
155+
assetName = "";
155156
audioSource.pitch = 1;
156157
flag = "";
157158
}

Assets/Script/Core/AudioManager/AudioPlayerBase.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public virtual void SetSFXVolume(float volume)
4343

4444
public AudioClip GetAudioClip(string name)
4545
{
46-
AudioClip red = ResourceManager.Load<AudioClip>(name);
46+
AudioClip red = AssetsPoolManager.Load<AudioClip>(name);
4747
if (red != null)
4848
{
4949
return red;
@@ -78,12 +78,29 @@ public AudioAsset CreateAudioAssetByPool(GameObject gameObject, bool is3D, Audio
7878
}
7979
public void DestroyAudioAssetByPool(AudioAsset asset)
8080
{
81+
UnloadClip(asset);
8182
audioAssetsPool.Enqueue(asset);
83+
//string name = asset.assetName;
84+
//asset.audioSource.clip = null;
85+
//ResourceManager.UnLoad(name);
86+
// GameObject.DestroyImmediate(asset.audioSource, true);
87+
//Resources.UnloadAsset(asset.audioSource.clip);
8288
}
89+
public void UnloadClip(AudioAsset asset)
90+
{
91+
if (asset.audioSource.clip != null)
92+
{
93+
string name = asset.assetName;
94+
asset.audioSource.clip = null;
95+
AssetsPoolManager.DestroyByPool(name);
96+
}
97+
}
98+
8399
protected void PlayClip(AudioAsset au, string audioName, bool isLoop = true, float volumeScale = 1, float delay = 0f,float pitch =1)
84100
{
85101
//if (au.PlayState == AudioPlayState.Playing)
86102
// au.Stop();
103+
UnloadClip(au);
87104
au.assetName = audioName;
88105
AudioClip ac = GetAudioClip(au.assetName);
89106
au.audioSource.clip = ac;
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor;
5+
6+
public class BundleEditorWindow : EditorWindow
7+
{
8+
9+
#region GUI
10+
11+
//[MenuItem("Window/新打包设置编辑器 &1")]
12+
13+
public static void ShowWindow()
14+
{
15+
EditorWindow.GetWindow(typeof(BundleEditorWindow));
16+
}
17+
18+
void OnEnable()
19+
{
20+
EditorGUIStyleData.Init();
21+
}
22+
23+
string[] toolbarTexts = { "打包", "热更新设置" };
24+
private int toolbarOption;
25+
bool deleteManifestFile = true;
26+
27+
void OnGUI()
28+
{
29+
titleContent.text = "打包设置编辑器";
30+
toolbarOption = GUILayout.Toolbar(toolbarOption, toolbarTexts, GUILayout.Width(Screen.width));
31+
switch (toolbarOption)
32+
{
33+
case 0:
34+
PackageGUI();
35+
break;
36+
37+
case 1:
38+
HotUpdateGUI();
39+
break;
40+
}
41+
}
42+
43+
void PackageGUI()
44+
{
45+
GUILayout.Space(10);
46+
47+
if (GUILayout.Button("生成资源路径文件"))
48+
{
49+
ResourcesConfigManager.CreateResourcesConfig();
50+
}
51+
52+
if (GUILayout.Button("生成 AssetsBundle 设置"))
53+
{
54+
PackageService.SetAssetBundlesName();
55+
}
56+
57+
if (GUILayout.Button("清除 AssetsBundle 设置"))
58+
{
59+
PackageService.ClearAssetBundlesName();
60+
}
61+
62+
GUILayout.Space(10);
63+
64+
deleteManifestFile = GUILayout.Toggle(deleteManifestFile, "打包后删除清单文件");
65+
66+
if (GUILayout.Button("5.0 打包"))
67+
{
68+
PackageService.Package_5_0(deleteManifestFile);
69+
}
70+
}
71+
72+
void HotUpdateGUI()
73+
{
74+
GUILayout.Space(10);
75+
76+
if (!ConfigManager.GetIsExistConfig(HotUpdateManager.c_HotUpdateConfigName))
77+
{
78+
if (GUILayout.Button("热更新设置初始化"))
79+
{
80+
InitHotUpdateConfig();
81+
}
82+
}
83+
else
84+
{
85+
GUILayout.BeginHorizontal();
86+
87+
VersionService.LargeVersion = EditorGUILayout.IntField("large", VersionService.LargeVersion);
88+
VersionService.SmallVersion = EditorGUILayout.IntField("small", VersionService.SmallVersion);
89+
90+
if (GUILayout.Button("保存版本文件"))
91+
{
92+
VersionService.CreateVersionFile();
93+
}
94+
95+
GUILayout.EndHorizontal();
96+
}
97+
}
98+
99+
#endregion
100+
101+
#region 热更新
102+
103+
void InitHotUpdateConfig()
104+
{
105+
Dictionary<string, SingleField> hotUpdateConfig = new Dictionary<string, SingleField>();
106+
hotUpdateConfig.Add(HotUpdateManager.c_testDownLoadPathKey, new SingleField(""));
107+
hotUpdateConfig.Add(HotUpdateManager.c_downLoadPathKey, new SingleField(""));
108+
hotUpdateConfig.Add(HotUpdateManager.c_UseTestDownLoadPathKey, new SingleField(false));
109+
110+
ConfigEditorWindow.SaveData(HotUpdateManager.c_HotUpdateConfigName, hotUpdateConfig);
111+
}
112+
113+
#endregion
114+
}

Assets/Script/Core/Editor/Package/BundleEditorWindow.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Script/Core/Editor/Package/PackageConfigEditorWindow.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ void OnGUI()
139139
{
140140
ResourcesConfigManager.CreateResourcesConfig();
141141
}
142-
142+
if(GUILayout.Button("Create Bundle Names"))
143+
{
144+
//自动设置打包信息
145+
SetAssetsInfo();
146+
}
143147
if (GUILayout.Button("5.0 打包"))
144148
{
145149
NewPackage();

0 commit comments

Comments
 (0)