|
@@ -58,6 +58,7 @@ public class LangChaoRommMinIo : MonoSingleton<LangChaoRommMinIo>
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
stream.Seek(0, SeekOrigin.Begin);
|
|
return bytes;
|
|
return bytes;
|
|
}
|
|
}
|
|
|
|
+ Queue<RoomFileDataBack> backQueue = new Queue<RoomFileDataBack>();
|
|
// File uploader task.
|
|
// File uploader task.
|
|
private async Task Run()
|
|
private async Task Run()
|
|
{
|
|
{
|
|
@@ -77,11 +78,14 @@ public class LangChaoRommMinIo : MonoSingleton<LangChaoRommMinIo>
|
|
.WithObject(Nowfd.objectName)
|
|
.WithObject(Nowfd.objectName)
|
|
.WithExpiry(60 * 60 * 24);
|
|
.WithExpiry(60 * 60 * 24);
|
|
string url = await minio.PresignedGetObjectAsync(args);
|
|
string url = await minio.PresignedGetObjectAsync(args);
|
|
-
|
|
|
|
RoomFileData rfd = new RoomFileData();
|
|
RoomFileData rfd = new RoomFileData();
|
|
rfd.url = url;
|
|
rfd.url = url;
|
|
rfd.bytes = StreamToBytes(stream);
|
|
rfd.bytes = StreamToBytes(stream);
|
|
- Nowfd.callBack(rfd);
|
|
|
|
|
|
+ RoomFileDataBack rfdb = new RoomFileDataBack();
|
|
|
|
+ rfdb.rfd = rfd;
|
|
|
|
+ rfdb.Nowfd = Nowfd;
|
|
|
|
+ backQueue.Enqueue(rfdb);
|
|
|
|
+
|
|
});
|
|
});
|
|
await minio.GetObjectAsync(getObjectArgs);
|
|
await minio.GetObjectAsync(getObjectArgs);
|
|
}
|
|
}
|
|
@@ -144,11 +148,16 @@ public class LangChaoRommMinIo : MonoSingleton<LangChaoRommMinIo>
|
|
fdQueue.Enqueue(getFileData);
|
|
fdQueue.Enqueue(getFileData);
|
|
}
|
|
}
|
|
|
|
|
|
- public class RoomFileData
|
|
|
|
|
|
+ public class RoomFileData
|
|
{
|
|
{
|
|
public byte[] bytes;
|
|
public byte[] bytes;
|
|
public string url;
|
|
public string url;
|
|
}
|
|
}
|
|
|
|
+ public class RoomFileDataBack
|
|
|
|
+ {
|
|
|
|
+ public RoomFileData rfd;
|
|
|
|
+ public GetFileData Nowfd;
|
|
|
|
+ }
|
|
|
|
|
|
GetFileData Nowfd;
|
|
GetFileData Nowfd;
|
|
private void Update()
|
|
private void Update()
|
|
@@ -169,6 +178,13 @@ public class LangChaoRommMinIo : MonoSingleton<LangChaoRommMinIo>
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (backQueue.Count > 0 )
|
|
|
|
+ {
|
|
|
|
+ isUpdate = false;
|
|
|
|
+ RoomFileDataBack rfdb = backQueue.Dequeue();
|
|
|
|
+ rfdb.Nowfd.callBack?.Invoke(rfdb.rfd);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
public class GetFileData
|
|
public class GetFileData
|