Revert Revert "【包配置】将登录图配置放到streaming文件夹"

dev_chengFeng
JieLing 2021-06-16 10:44:12 +08:00
parent 46c1fb1070
commit b7e78d9d5f
16 changed files with 154 additions and 409 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 MiB

View File

@ -1,121 +0,0 @@
fileFormatVersion: 2
guid: debe0b026ec67894ea4854b4dad48e21
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 65
textureCompression: 1
compressionQuality: 100
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 1
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: d8b82d28f899bb54dadeb644d19aac67
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName: lz4/bgnc/loading_caohua
assetBundleVariant: unity3d

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 MiB

View File

@ -1,110 +0,0 @@
fileFormatVersion: 2
guid: 1f89f317485449b4682324aa3ea3a6c2
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 65
textureCompression: 1
compressionQuality: 100
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 1
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 6065f0ba99fca4f4eb7df038d3995089
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName: lz4/bgnc/login_caohua
assetBundleVariant: unity3d

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 KiB

View File

@ -1,121 +0,0 @@
fileFormatVersion: 2
guid: 0752922022d678449b67d6c59a1bd6cf
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 65
textureCompression: 1
compressionQuality: 100
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 1
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: f31bfb7b5b275f8499950f8d9e08726b
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName: lz4/bgnc/logo_caohua
assetBundleVariant: unity3d

View File

@ -244,7 +244,7 @@ Camera:
field of view: 60
orthographic: 1
orthographic size: 3.6
m_Depth: 100
m_Depth: 99
m_CullingMask:
serializedVersion: 2
m_Bits: 4294966783

View File

@ -896,7 +896,7 @@ Camera:
field of view: 60
orthographic: 1
orthographic size: 3.6
m_Depth: 0
m_Depth: 100
m_CullingMask:
serializedVersion: 2
m_Bits: 4294966527

View File

@ -17,6 +17,7 @@ ServerConfigManager.SettingConfig = {
IS_PLAY_LOGIN_VIDEO = "IS_PLAY_LOGIN_VIDEO", -- 判断是否可以播放登录视频
PACKAGE_CONFIG = "PACKAGE_CONFIG", -- 包配置
IS_NO_TALKING = "IS_NO_TALKING", -- 禁言
IS_LOAD_STREAMING_TEXTURE = "IS_LOAD_STREAMING_TEXTURE", -- 是否加载外部资源
}

View File

@ -59,19 +59,26 @@ function this:InitComponent()
this.versionText = Util.GetGameObject(this.loginPart, "version"):GetComponent("Text")
this.versionText.text = Language[11136]..LoginRoot_Version
-- this.bg1 = Util.GetGameObject(this.gameObject, "bg11"):GetComponent("RawImage")
-- resMgr:SetStreamingTexture(this.bg1, "login_caohua.png")
-- 背景
this.bg = Util.GetGameObject(this.gameObject, "bg"):GetComponent("Image")
this.bgStr = PackageManager.GetLoginPanelBg()
if this.bgStr then
this.bg.sprite = this.spLoader:LoadSprite(this.bgStr)
end
this.bg.color = Color.New(1, 1, 1, 0)
LoadStreamingTexture(this.spLoader, this.bgStr, function(sp)
this.bg.sprite = sp
this.bg.color = Color.New(1, 1, 1, 1)
end)
-- logo
this.logo = Util.GetGameObject(this.gameObject, "logo"):GetComponent("Image")
this.logoStr = PackageManager.GetLoginPanelLogo()
if this.logoStr then
this.logo.gameObject:SetActive(true)
this.logo.sprite = this.spLoader:LoadSprite(this.logoStr)
this.logo:SetNativeSize()
LoadStreamingTexture(this.spLoader, this.logoStr, function(sp)
this.logo.gameObject:SetActive(true)
this.logo.sprite = sp
this.logo:SetNativeSize()
end)
else
this.logo.gameObject:SetActive(false)
end

View File

@ -4,8 +4,6 @@ local this = LoadingPanel
local tipsConfig = ConfigManager.GetConfig(ConfigName.Tips)
--初始化组件(用于子类重写)
function LoadingPanel:InitComponent()
-- 创建sprite加载器
this.spLoader = SpriteLoader.New()
--
this.Slider = Util.GetGameObject(self.gameObject, "Slider"):GetComponent("Slider")
this.Tip = Util.GetGameObject(self.gameObject, "Slider/Image/LoadingText"):GetComponent("Text")
@ -15,23 +13,15 @@ function LoadingPanel:InitComponent()
screenAdapte(Util.GetGameObject(self.gameObject, "bg2"))
end
function LoadingPanel:OnOpen()
function LoadingPanel:OnOpen(sp)
local index = 0
math.randomseed(os.time())
local spName = "loading1"
local sprites = PackageManager.GetLoadingList()
if sprites then
index = math.random(1, #sprites)
spName = sprites[index]
end
this.bg.sprite = this.spLoader:LoadSprite(spName)
this.bg.sprite = sp
math.randomseed(os.time())
index = math.random(1, 20)
this.Tip.text = GetLanguageStrById(tipsConfig[index].Tips)
end
-- 销毁时回收
function LoadingPanel:OnDestroy()
this.spLoader:Destroy()
end
local callList = {}
local curIndex = 0
@ -72,23 +62,37 @@ end
function LoadingPanel.Start()
if #callList <= 1 then
return
-- 创建sprite加载器
this.spLoader = SpriteLoader.New()
local spName = "loading1"
local sprites = PackageManager.GetLoadingList()
if sprites then
math.randomseed(os.time())
local index = math.random(1, #sprites)
spName = sprites[index]
end
UIManager.OpenPanel(UIName.LoadingPanel)
UpdateBeat:Add(update)
lerp = 0
curIndex = 0
this.Slider.maxValue = #callList - 1
this.Slider.value = curIndex
--"你知道嘛:充值会让你变得更强!" --"白驹工作室倾情奉献"
LoadingPanel.OnStep()
LoadStreamingTexture(this.spLoader, spName, function(sp)
if #callList <= 1 then
return
end
UIManager.OpenPanel(UIName.LoadingPanel, sp)
UpdateBeat:Add(update)
lerp = 0
curIndex = 0
this.Slider.maxValue = #callList - 1
this.Slider.value = curIndex
--"你知道嘛:充值会让你变得更强!" --"白驹工作室倾情奉献"
LoadingPanel.OnStep()
end)
end
function LoadingPanel.End()
UpdateBeat:Remove(update)
this:ClosePanel()
callList = {}
this.spLoader:Destroy()
end
return LoadingPanel

View File

@ -75,4 +75,24 @@ function ForceRebuildLayout(_transform)
end
LayoutRebuilder.ForceRebuildLayoutImmediate(_transform)
end
end
function LoadStreamingTexture(spLoader, name, func)
if name and name ~= "" and func then
if ServerConfigManager.IsSettingActive(ServerConfigManager.SettingConfig.IS_LOAD_STREAMING_TEXTURE) then
resMgr:LoadStreamingTexture(name, function(sp)
if sp then
func(sp)
else
name = string.split(name, ".")[1]
local sp = spLoader:LoadSprite(name)
func(sp)
end
end)
else
name = string.split(name, ".")[1]
local sp = spLoader:LoadSprite(name)
func(sp)
end
end
end

View File

@ -187,6 +187,10 @@ namespace GameLogic {
{
}
public void LoadStreamingTexture(string name, LuaFunction luaFunction)
{
resMgr.LoadStreamingTexture(name, luaFunction);
}
}
}

View File

@ -3,6 +3,10 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using GameCore;
using UnityEngine.UI;
using UnityEngine.Networking;
using LuaInterface;
namespace ResMgr {
/// <summary>
@ -119,5 +123,34 @@ namespace ResMgr {
resLoader.Update();
}
#endif
public void LoadStreamingTexture(string name, LuaFunction luaFunction)
{
StartCoroutine(LoadFromStream(name, luaFunction));
}
public IEnumerator LoadFromStream(string name, LuaFunction luaFunction)
{
UnityWebRequest www = UnityWebRequestTexture.GetTexture(Application.streamingAssetsPath + "/Res/"+ name + ".png");
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
if (luaFunction != null)
{
luaFunction.Call(false);
}
}else
{
Texture2D tex = ((DownloadHandlerTexture)www.downloadHandler).texture;
Sprite sp = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0, 0));
if (luaFunction != null)
{
luaFunction.Call(sp);
}
}
}
}
}

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using ResUpdate;
using UnityEngine.Networking;
namespace GameLogic
{
@ -36,39 +37,46 @@ namespace GameLogic
BeginUpdatePlatform();
}
public IEnumerator LoadFromStream(string name, Action<Sprite> act)
{
UnityWebRequest www = UnityWebRequestTexture.GetTexture(Application.streamingAssetsPath + "/Res/" + name + ".png");
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
if (act != null)
{
act(null);
}
}
else
{
Debug.Log("load success");
Texture2D tex = ((DownloadHandlerTexture)www.downloadHandler).texture;
Sprite sp = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0, 0));
if (act != null)
{
act(sp);
}
}
}
private void OnEnable()
{
string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG2.value");
if (updatePanelBg == null || updatePanelBg == "")
string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value");
if(updatePanelBg != null && updatePanelBg != "")
{
updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value");
}
if (updatePanelBg != null && updatePanelBg != "")
{
if (AppConst.bundleMode)
Image img = this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent<Image>();
img.color = new Color(1f, 1f, 1f, 0f);
StartCoroutine(LoadFromStream(updatePanelBg, (Sprite sp) =>
{
string path = AppConst.PersistentDataPath + "lz4/bgnc/" + updatePanelBg + ".unity3d";
if (!File.Exists(path))
if (sp != null)
{
path = AppConst.StreamPath + "lz4/bgnc/" + updatePanelBg + ".unity3d";
img.sprite = sp;
}
bundle = AssetBundle.LoadFromFile(path, 0, GameLogic.AppConst.EncyptBytesLength);
if (bundle == null)
{
XDebug.Log.error(string.Format("{0} 不存在,请检查", path));
return;
}
this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent<Image>().sprite = bundle.LoadAsset<Sprite>(updatePanelBg);
}
else
{
#if UNITY_EDITOR
string path = AppConst.GameResPath + "/BGNC/" + updatePanelBg + ".jpg";
Sprite sp = UnityEditor.AssetDatabase.LoadAssetAtPath<Sprite>(path);
this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent<Image>().sprite = sp;
#endif
}
img.color = new Color(1f, 1f, 1f, 1f);
}));
}
}
private void OnDestroy()
@ -366,10 +374,11 @@ namespace GameLogic
IEnumerator UpdateFinish() {
yield return new WaitForSeconds(0.2f);
App.Instance.StartUp();
yield return new WaitForSeconds(1f);
DestroyImmediate(this.gameObject);
UpdateManager.Instance.UnLoadUpdateAsset();
App.Instance.StartUp();
}
}
}

View File

@ -18,6 +18,7 @@ public class GameLogic_ResourcesManagerWrap
L.RegFunction("HaveAsset", HaveAsset);
L.RegFunction("UnLoadAll", UnLoadAll);
L.RegFunction("Reset", Reset);
L.RegFunction("LoadStreamingTexture", LoadStreamingTexture);
L.RegFunction("New", _CreateGameLogic_ResourcesManager);
L.RegFunction("__tostring", ToLua.op_ToString);
L.RegVar("isLoading", get_isLoading, set_isLoading);
@ -252,6 +253,24 @@ public class GameLogic_ResourcesManagerWrap
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int LoadStreamingTexture(IntPtr L)
{
try
{
ToLua.CheckArgsCount(L, 3);
GameLogic.ResourcesManager obj = (GameLogic.ResourcesManager)ToLua.CheckObject<GameLogic.ResourcesManager>(L, 1);
string arg0 = ToLua.CheckString(L, 2);
LuaFunction arg1 = ToLua.CheckLuaFunction(L, 3);
obj.LoadStreamingTexture(arg0, arg1);
return 0;
}
catch (Exception e)
{
return LuaDLL.toluaL_exception(L, e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int get_isLoading(IntPtr L)
{