bingo 项目提交

This commit is contained in:
2026-04-20 13:49:36 +08:00
commit ad5920ac6a
5585 changed files with 1216243 additions and 0 deletions
@@ -0,0 +1,11 @@
using System.IO;
using UnityEngine;
namespace Unity.Advertisement.IosSupport.Editor
{
internal interface ISkAdNetworkSource
{
string Path { get; }
Stream Open();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b3b688cb4385c4ed287404f01d47d2cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using System;
using System.IO;
using UnityEngine;
namespace Unity.Advertisement.IosSupport.Editor
{
internal class SkAdNetworkLocalSource : ISkAdNetworkSource
{
public string Path { get; }
public SkAdNetworkLocalSource(string path)
{
Path = path;
}
public Stream Open()
{
return new FileStream(Path, FileMode.Open);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bc26fb3115fcd455f8d1d7b9739bc0f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
namespace Unity.Advertisement.IosSupport.Editor
{
/// <summary>
/// Responsible for finding all SkAdNetwork files on the local filesystem by searching through the users project directory and all includes packages.
/// </summary>
internal class SkAdNetworkLocalSourceProvider
{
private const int k_MaxPackageLookupTimeoutInSeconds = 30;
private string[] m_PackagePaths;
public SkAdNetworkLocalSourceProvider()
{
m_PackagePaths = GetAllPackagePaths();
}
public IEnumerable<SkAdNetworkLocalSource> GetSources(string filename, string extension)
{
return GetLocalFilePaths(filename, extension).Select(x => new SkAdNetworkLocalSource(x)).ToArray();
}
/// <summary>
/// Finds a file on the local filesystem by looking the project directory, and all package directories
/// </summary>
/// <param name="filename">the filename to look for</param>
/// <param name="fileExtension">the filename extension to look for</param>
/// <returns>a full path to the file</returns>
private IEnumerable<string> GetLocalFilePaths(string filename, string fileExtension)
{
return m_PackagePaths
.Prepend(Directory.GetCurrentDirectory())
.SelectMany(path => Directory.GetFiles(path, string.IsNullOrEmpty(fileExtension) ? filename : $"{filename}.{fileExtension}" , SearchOption.AllDirectories))
.ToList();
}
/// <summary>
/// Returns a list of paths to the root folder of each package included in the users project.
/// These may be in different locations on disk depending on where the package is being stored/cached.
/// </summary>
private static string[] GetAllPackagePaths(bool offlineMode = true)
{
var list = UnityEditor.PackageManager.Client.List(offlineMode);
if (list == null)
{
return Array.Empty<string>();
}
var timeSpan = TimeSpan.FromSeconds(k_MaxPackageLookupTimeoutInSeconds);
var startTime = DateTime.Now;
while (!list.IsCompleted && (DateTime.Now - startTime) < timeSpan)
{
Thread.Sleep(10);
}
if (list.Error != null)
{
return Array.Empty<string>();
}
return list.Result.Select(packageInfo => packageInfo.assetPath).ToArray();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5d925f4b6523544bbbfa58d11df1ac49
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using System.IO;
using System.Net;
using UnityEngine;
namespace Unity.Advertisement.IosSupport.Editor
{
internal class SkAdNetworkRemoteSource : ISkAdNetworkSource
{
public string Path { get; }
public SkAdNetworkRemoteSource(string path)
{
Path = path;
}
public Stream Open()
{
return new WebClient().OpenRead(Path);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fc886aae4a1fc42b48e8b6deccb67ab5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: