Initial commit

This commit is contained in:
MuHua-123
2024-11-01 17:14:31 +08:00
commit 5f169b90bb
216 changed files with 24712 additions and 0 deletions
@@ -0,0 +1,21 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public abstract class DataNetwork {
public event Action<string> OnError;
public event Action<string> OnCallback;
public readonly string url;
public DataNetwork(string url) => this.url = url;
public abstract IEnumerator IWebRequest();
public virtual void RequestResultHandle(UnityWebRequest web) {
bool isDone = !web.isDone || web.result != UnityWebRequest.Result.Success;
if (isDone) { OnCallback?.Invoke(web.downloadHandler.text); }
else { OnError?.Invoke(web.downloadHandler.text); }
}
}