【添加stream配置】
parent
488f1e8af0
commit
98b1518306
|
@ -1,110 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 42305eec223abab478aefd6f970de194
|
||||
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: 4712a1414ca412d4482e2b542dd85783
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,110 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ee7fd5016d6302543a04615e45f802c6
|
||||
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: 263f5516c18d76546823718924314c55
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -23,8 +23,24 @@ function PackageManager.Initialize()
|
|||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- 获取stream设置
|
||||
if ServerConfigManager.IsSettingActive(ServerConfigManager.SettingConfig.IS_LOAD_STREAMING) then
|
||||
resMgr:LoadStreamingText("PackConfig", function(config)
|
||||
local json = require 'cjson'
|
||||
local data = json.decode(config)
|
||||
this.StreamConfig = data
|
||||
LogError("Load text done!!!")
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- 获取包名
|
||||
function PackageManager.GetPackageID()
|
||||
if this.StreamConfig then
|
||||
return this.StreamConfig.PackID
|
||||
end
|
||||
end
|
||||
-- 获取包名
|
||||
function PackageManager.GetPackageName()
|
||||
return this.PackageName
|
||||
|
@ -37,12 +53,18 @@ function PackageManager.GetRechargeField()
|
|||
end
|
||||
-- 获取登录背景图
|
||||
function PackageManager.GetLoginPanelBg()
|
||||
if this.StreamConfig then
|
||||
return this.StreamConfig.LoginPanelBG
|
||||
end
|
||||
if this.config then
|
||||
return this.config.LoginPanelBg
|
||||
end
|
||||
end
|
||||
-- 获取登录Logo
|
||||
function PackageManager.GetLoginPanelLogo()
|
||||
if this.StreamConfig then
|
||||
return this.StreamConfig.LoginPanelLogo
|
||||
end
|
||||
if this.config then
|
||||
return this.config.LoginLogo
|
||||
end
|
||||
|
@ -55,6 +77,10 @@ function PackageManager.GetCustomEventField()
|
|||
end
|
||||
-- 获取loading图list
|
||||
function PackageManager.GetLoadingList()
|
||||
if this.StreamConfig then
|
||||
local list = string.split(this.StreamConfig.LoadingPanelBG, "#")
|
||||
return list
|
||||
end
|
||||
if this.config then
|
||||
local list = string.split(this.config.LoadingImgList, "#")
|
||||
return list
|
||||
|
|
|
@ -17,7 +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", -- 是否加载外部资源
|
||||
IS_LOAD_STREAMING = "IS_LOAD_STREAMING", -- 是否加载外部资源
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,8 +14,11 @@ function Game.Initialize()
|
|||
Screen.sleepTimeout = U3d.SleepTimeout.NeverSleep
|
||||
this.GlobalEvent = EventManager.New()
|
||||
this.InitManagers()
|
||||
UIManager.OpenPanel(UIName.LoginPanel)
|
||||
UIManager.OpenPanel(UIName.HorseRaceLampView)
|
||||
-- 延迟
|
||||
Timer.New(function()
|
||||
UIManager.OpenPanel(UIName.LoginPanel)
|
||||
UIManager.OpenPanel(UIName.HorseRaceLampView)
|
||||
end, 0.5):Start()
|
||||
end
|
||||
|
||||
--初始化管理器
|
||||
|
|
|
@ -79,7 +79,7 @@ end
|
|||
|
||||
function LoadStreamingTexture(spLoader, name, func)
|
||||
if name and name ~= "" and func then
|
||||
if ServerConfigManager.IsSettingActive(ServerConfigManager.SettingConfig.IS_LOAD_STREAMING_TEXTURE) then
|
||||
if ServerConfigManager.IsSettingActive(ServerConfigManager.SettingConfig.IS_LOAD_STREAMING) then
|
||||
resMgr:LoadStreamingTexture(name, function(sp)
|
||||
if sp then
|
||||
func(sp)
|
||||
|
|
|
@ -191,6 +191,11 @@ namespace GameLogic {
|
|||
{
|
||||
resMgr.LoadStreamingTexture(name, luaFunction);
|
||||
}
|
||||
|
||||
public void LoadStreamingText(string name, LuaFunction luaFunction)
|
||||
{
|
||||
resMgr.LoadStreamingText(name, luaFunction);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,10 +127,11 @@ namespace ResMgr {
|
|||
|
||||
public void LoadStreamingTexture(string name, LuaFunction luaFunction)
|
||||
{
|
||||
StartCoroutine(LoadFromStream(name, luaFunction));
|
||||
StartCoroutine(LoadTextureFromStream(name, luaFunction));
|
||||
}
|
||||
public IEnumerator LoadFromStream(string name, LuaFunction luaFunction)
|
||||
public IEnumerator LoadTextureFromStream(string name, LuaFunction luaFunction)
|
||||
{
|
||||
Debug.Log(Application.streamingAssetsPath + "/Res/" + name + ".png");
|
||||
UnityWebRequest www = UnityWebRequestTexture.GetTexture(Application.streamingAssetsPath + "/Res/"+ name + ".png");
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
|
@ -151,6 +152,32 @@ namespace ResMgr {
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadStreamingText(string name, LuaFunction luaFunction)
|
||||
{
|
||||
StartCoroutine(LoadTextFromStream(name, luaFunction));
|
||||
}
|
||||
public IEnumerator LoadTextFromStream(string name, LuaFunction luaFunction)
|
||||
{
|
||||
Debug.Log(Application.streamingAssetsPath + "/Res/" + name + ".txt");
|
||||
UnityWebRequest www = UnityWebRequest.Get(Application.streamingAssetsPath + "/Res/" + name + ".txt");
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
{
|
||||
Debug.Log(www.error);
|
||||
if (luaFunction != null)
|
||||
{
|
||||
luaFunction.Call(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string tex = www.downloadHandler.text;
|
||||
if (luaFunction != null)
|
||||
{
|
||||
luaFunction.Call(tex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,13 +37,14 @@ namespace GameLogic
|
|||
BeginUpdatePlatform();
|
||||
}
|
||||
|
||||
public IEnumerator LoadFromStream(string name, Action<Sprite> act)
|
||||
public IEnumerator LoadFromStream(Action<Sprite> act)
|
||||
{
|
||||
UnityWebRequest www = UnityWebRequestTexture.GetTexture(Application.streamingAssetsPath + "/Res/" + name + ".png");
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
Debug.Log(Application.streamingAssetsPath + "/Res/PackConfig.txt");
|
||||
UnityWebRequest uwr = UnityWebRequest.Get(Application.streamingAssetsPath + "/Res/PackConfig.txt");
|
||||
yield return uwr.SendWebRequest();
|
||||
if (uwr.isNetworkError || uwr.isHttpError)
|
||||
{
|
||||
Debug.Log(www.error);
|
||||
Debug.Log(uwr.error);
|
||||
if (act != null)
|
||||
{
|
||||
act(null);
|
||||
|
@ -51,12 +52,28 @@ namespace GameLogic
|
|||
}
|
||||
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)
|
||||
Hashtable table = MiniJSON.jsonDecode(uwr.downloadHandler.text) as Hashtable;
|
||||
string bgName = table["UpdatePanelBG"] as string;
|
||||
|
||||
UnityWebRequest www = UnityWebRequestTexture.GetTexture(Application.streamingAssetsPath + "/Res/" + bgName + ".png");
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
{
|
||||
act(sp);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,20 +81,16 @@ namespace GameLogic
|
|||
|
||||
private void OnEnable()
|
||||
{
|
||||
string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value");
|
||||
if(updatePanelBg != null && updatePanelBg != "")
|
||||
Image img = this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent<Image>();
|
||||
img.color = new Color(1f, 1f, 1f, 0f);
|
||||
StartCoroutine(LoadFromStream((Sprite sp) =>
|
||||
{
|
||||
Image img = this.transform.Find("Canvas/LoadingScreen/bg1").GetComponent<Image>();
|
||||
img.color = new Color(1f, 1f, 1f, 0f);
|
||||
StartCoroutine(LoadFromStream(updatePanelBg, (Sprite sp) =>
|
||||
if (sp != null)
|
||||
{
|
||||
if (sp != null)
|
||||
{
|
||||
img.sprite = sp;
|
||||
}
|
||||
img.color = new Color(1f, 1f, 1f, 1f);
|
||||
}));
|
||||
}
|
||||
img.sprite = sp;
|
||||
}
|
||||
img.color = new Color(1f, 1f, 1f, 1f);
|
||||
}));
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@ public class GameLogic_ResourcesManagerWrap
|
|||
L.RegFunction("UnLoadAll", UnLoadAll);
|
||||
L.RegFunction("Reset", Reset);
|
||||
L.RegFunction("LoadStreamingTexture", LoadStreamingTexture);
|
||||
L.RegFunction("LoadStreamingText", LoadStreamingText);
|
||||
L.RegFunction("New", _CreateGameLogic_ResourcesManager);
|
||||
L.RegFunction("__tostring", ToLua.op_ToString);
|
||||
L.RegVar("isLoading", get_isLoading, set_isLoading);
|
||||
|
@ -271,6 +272,24 @@ public class GameLogic_ResourcesManagerWrap
|
|||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int LoadStreamingText(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.LoadStreamingText(arg0, arg1);
|
||||
return 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int get_isLoading(IntPtr L)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"PackID":"XIPU_2",
|
||||
"UpdatePanelBG":"loading_xipu",
|
||||
"LoginPanelBG":"login_xipu",
|
||||
"LoginPanelLogo":"",
|
||||
"LoadingPanelBG":"loading_xipu"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e0329a008458aa34fb72f1b0b6235956
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Before Width: | Height: | Size: 614 KiB After Width: | Height: | Size: 614 KiB |
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1240de5e6b99f7c449f4863c5e61b133
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7934cb466aa1a26478fd4e4cc0481567
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue