1
This commit is contained in:
34
Unity/Scripts/Network/NetworkCore.cs
Normal file
34
Unity/Scripts/Network/NetworkCore.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System.Text;
|
||||
using UnityEngine.Networking;
|
||||
using System.Threading;
|
||||
namespace BITKit
|
||||
{
|
||||
public class NetworkCore
|
||||
{
|
||||
static Dictionary<string, int> counter = new();
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
static void Reload()
|
||||
{
|
||||
counter.Clear();
|
||||
}
|
||||
[BITCommand]
|
||||
public static async void NetworkStatus()
|
||||
{
|
||||
await UniTask.SwitchToMainThread();
|
||||
StringBuilder stringBuilder = new();
|
||||
foreach (var count in counter)
|
||||
{
|
||||
stringBuilder.Append($"URL:{count.Key}\tCount:{count.Value}");
|
||||
}
|
||||
Debug.Log(stringBuilder);
|
||||
}
|
||||
public static void Add(string url)
|
||||
{
|
||||
counter.Set(url, counter.Get(url) + 1);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user