对战房间下载逻辑完善

This commit is contained in:
lishuo 2022-05-13 11:10:37 +08:00
parent 11b131b24a
commit d876c20def
7 changed files with 64 additions and 100 deletions

View File

@ -647,6 +647,7 @@ GameObject:
- component: {fileID: 5639255048692904402} - component: {fileID: 5639255048692904402}
- component: {fileID: 3505476227209113529} - component: {fileID: 3505476227209113529}
- component: {fileID: 7422091722618645967} - component: {fileID: 7422091722618645967}
- component: {fileID: 8626855822450100284}
m_Layer: 5 m_Layer: 5
m_Name: DownloadTask m_Name: DownloadTask
m_TagString: Untagged m_TagString: Untagged
@ -788,6 +789,19 @@ MonoBehaviour:
icon: {fileID: 9077265243619620345} icon: {fileID: 9077265243619620345}
done: {fileID: 2833035141730710535} done: {fileID: 2833035141730710535}
doneTxt: {fileID: 2020518104262420434} doneTxt: {fileID: 2020518104262420434}
canvasGroup: {fileID: 8626855822450100284}
--- !u!225 &8626855822450100284
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6875313112404340189}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &8924649563866869665 --- !u!1 &8924649563866869665
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -60,8 +60,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 0.25490198, g: 0.25882354, b: 0.31764707, a: 1} m_Color: {r: 0.25490198, g: 0.25882354, b: 0.31764707, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_Maskable: 1 m_Maskable: 0
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
@ -148,8 +148,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 0.9764706, g: 0.1882353, b: 0.5254902, a: 1} m_Color: {r: 0.9764706, g: 0.1882353, b: 0.5254902, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_Maskable: 1 m_Maskable: 0
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []

View File

@ -7978,7 +7978,7 @@ MonoBehaviour:
runInbackBtn: {fileID: 1447051198557175767} runInbackBtn: {fileID: 1447051198557175767}
enterBtn: {fileID: 6320479665722077644} enterBtn: {fileID: 6320479665722077644}
cancelBtn: {fileID: 2824374092302951661} cancelBtn: {fileID: 2824374092302951661}
downLoadList: {fileID: 3821102054838323742} downLoadList: {fileID: 0}
downLoadTask: {fileID: 6875313112404340189, guid: 867d36d385cb4d54ea0b2964fc27eb08, downLoadTask: {fileID: 6875313112404340189, guid: 867d36d385cb4d54ea0b2964fc27eb08,
type: 3} type: 3}
--- !u!1 &1706477138700143560 --- !u!1 &1706477138700143560
@ -15152,81 +15152,6 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
radius: 32 radius: 32
--- !u!1 &3821102054838323742
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1958468328858038548}
- component: {fileID: 1920570234021868163}
- component: {fileID: 3590120813709056996}
m_Layer: 5
m_Name: DownLoadList
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1958468328858038548
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3821102054838323742}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3267192231330899612}
m_Father: {fileID: 8086726971969315674}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1920570234021868163
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3821102054838323742}
m_CullTransparentMesh: 0
--- !u!114 &3590120813709056996
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3821102054838323742}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &3864653541716961163 --- !u!1 &3864653541716961163
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -15460,7 +15385,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -265.32333} m_AnchoredPosition: {x: 0, y: -55.999878}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!114 &7742539080963770349 --- !u!114 &7742539080963770349
@ -19974,12 +19899,12 @@ GameObject:
- component: {fileID: 5398684320681796878} - component: {fileID: 5398684320681796878}
- component: {fileID: 6715087671898720660} - component: {fileID: 6715087671898720660}
m_Layer: 5 m_Layer: 5
m_Name: Scroll View m_Name: DownLoadList
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &3267192231330899612 --- !u!224 &3267192231330899612
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -19987,20 +19912,20 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5178086205242994809} m_GameObject: {fileID: 5178086205242994809}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 8129829512238067513} - {fileID: 8129829512238067513}
- {fileID: 5967062115290069149} - {fileID: 5967062115290069149}
- {fileID: 127748209899617015} - {fileID: 127748209899617015}
m_Father: {fileID: 1958468328858038548} m_Father: {fileID: 8086726971969315674}
m_RootOrder: 0 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0} m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -205.5, y: 192.7002} m_AnchoredPosition: {x: -205.5, y: 88}
m_SizeDelta: {x: 291, y: 265.32333} m_SizeDelta: {x: 291, y: 56}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &869953156436115466 --- !u!222 &869953156436115466
CanvasRenderer: CanvasRenderer:
@ -32544,7 +32469,7 @@ RectTransform:
- {fileID: 5131986071346786118} - {fileID: 5131986071346786118}
- {fileID: 2272262597989782707} - {fileID: 2272262597989782707}
- {fileID: 8956479793111350626} - {fileID: 8956479793111350626}
- {fileID: 1958468328858038548} - {fileID: 3267192231330899612}
- {fileID: 2169193144483336959} - {fileID: 2169193144483336959}
- {fileID: 3957760599053026721} - {fileID: 3957760599053026721}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -32610,6 +32535,8 @@ MonoBehaviour:
_searchInputField: {fileID: 756626940907279346} _searchInputField: {fileID: 756626940907279346}
_searchBtn: {fileID: 8721557410508650352} _searchBtn: {fileID: 8721557410508650352}
_noDataFound: {fileID: 4686927349675230379} _noDataFound: {fileID: 4686927349675230379}
_downLoadTask: {fileID: 6875313112404340189, guid: 867d36d385cb4d54ea0b2964fc27eb08,
type: 3}
--- !u!1 &8135655826908012392 --- !u!1 &8135655826908012392
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -50,7 +50,7 @@ class GameRoomDownLoad : MonoBehaviour
if (obj == null) if (obj == null)
{ {
var newtask = Instantiate(downLoadTask, content); var newtask = Instantiate(downLoadTask, content);
newtask.GetComponent<GameRoomDownloadTask>().Init(RoomId, FileName); newtask.GetComponent<GameRoomDownloadTask>().Init(RoomId, FileName,gameObject);
} }
}); });
@ -101,7 +101,7 @@ class GameRoomDownLoad : MonoBehaviour
var content = downLoadList.transform.Find("Viewport/Content"); var content = downLoadList.transform.Find("Viewport/Content");
var newtask = Instantiate(downLoadTask, content); var newtask = Instantiate(downLoadTask, content);
var currentTask = newtask.GetComponent<GameRoomDownloadTask>(); var currentTask = newtask.GetComponent<GameRoomDownloadTask>();
currentTask.Init(RoomId, fileName); currentTask.Init(RoomId, fileName,gameObject);
Loom.Current.StartCoroutine(Utils.DownloadVideo(fileName, url Loom.Current.StartCoroutine(Utils.DownloadVideo(fileName, url
, (p, req) => , (p, req) =>
{ {

View File

@ -29,9 +29,9 @@ class GameRoomDownloadTask : MonoBehaviour
}); });
} }
public void Init(int roomId,string fileName) public void Init(int roomId,string fileName,GameObject downloadPanel)
{ {
modal = FindObjectOfType<GameRoomDownLoad>().gameObject; modal = downloadPanel;
fileNameText = transform.Find("Text").GetComponent<Text>(); fileNameText = transform.Find("Text").GetComponent<Text>();
RoomId = roomId; RoomId = roomId;
fileNameText.text = fileName; fileNameText.text = fileName;

View File

@ -78,19 +78,41 @@ public class GameRoomMapItem : MonoBehaviour, IPointerExitHandler, IPointerEnter
slider.gameObject.SetActive(true); slider.gameObject.SetActive(true);
Loom.Current.StartCoroutine(Utils.DownloadVideo(map.FileName, map.Url, (p, req) => Loom.Current.StartCoroutine(Utils.DownloadVideo(map.FileName, map.Url, (p, req) =>
{ {
slider.value = p; if (gameObject != null)
slider.value = p;
if (Loom.DownLoadTaskList.ContainsKey(map.FileName))
{
Loom.DownLoadTaskList[map.FileName] = p;
}
else
{
Loom.DownLoadTaskList.Add(map.FileName, p);
}
} }
, (p) => , (p) =>
{ {
if (string.IsNullOrEmpty(p)) if (string.IsNullOrEmpty(p))
{ {
slider.value = 100f; var process = 100f;
ShowOutLine(); if (Loom.DownLoadTaskList.ContainsKey(map.FileName))
transform.Find("DownLoadModal").gameObject.SetActive(false); {
Loom.DownLoadTaskList[map.FileName] = process;
}
else
{
Loom.DownLoadTaskList.Add(map.FileName, process);
}
if (gameObject != null)
{
slider.value = process;
ShowOutLine();
transform.Find("DownLoadModal").gameObject.SetActive(false);
}
} }
else else
{ {
Utils.showToast(gameObject, p); if (gameObject != null)
Utils.showToast(gameObject, p);
} }
})); }));
}); });

View File

@ -216,11 +216,12 @@ public class GameRoomListController : PFUIPanel
var downloadPanel = transform.Find("DownloadPanel").gameObject; var downloadPanel = transform.Find("DownloadPanel").gameObject;
if (!downLoadList.activeSelf && !downloadPanel.activeSelf) if (!downLoadList.activeSelf && !downloadPanel.activeSelf)
{ {
var content = downLoadList.transform.Find("Viewport/Content");
foreach (var item in Loom.DownLoadTaskList) foreach (var item in Loom.DownLoadTaskList)
{ {
var content = downLoadList.transform.Find("Viewport/Content");
var newtask = Instantiate(_downLoadTask, content); var newtask = Instantiate(_downLoadTask, content);
newtask.GetComponent<GameRoomDownloadTask>().Init(0, item.Key); newtask.GetComponent<GameRoomDownloadTask>().Init(0, item.Key, downloadPanel);
downLoadList.SetActive(true);
} }
} }
App.Model = "GameRoom"; App.Model = "GameRoom";