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,57 @@
using System.IO;
using System.Text;
using System.Security.Cryptography;
using UnityEngine;
namespace Comgreate
{
public class AESForFileKit
{
private static readonly byte[] Salt = Encoding.UTF8.GetBytes("Sgfsads");
private const int Iterations = 1000;
public static void EncryptFile(string inputPath, string outputPath, string password)
{
var passwordBytes = Encoding.UTF8.GetBytes(password);
var inputStream = new FileStream(inputPath, FileMode.Open, FileAccess.Read);
var outputStream = new FileStream(outputPath, FileMode.Create, FileAccess.Write);
using var aes = new AesManaged();
var key = new Rfc2898DeriveBytes(passwordBytes, Salt, Iterations);
aes.Key = key.GetBytes(aes.KeySize / 8);
aes.IV = key.GetBytes(aes.BlockSize / 8);
using var cryptoStream = new CryptoStream(outputStream, aes.CreateEncryptor(), CryptoStreamMode.Write);
inputStream.CopyTo(cryptoStream);
cryptoStream.FlushFinalBlock();
cryptoStream.Close();
outputStream.Close();
inputStream.Close();
}
public static byte[] DecryptToBytes(string inputPath, string password, out int dataSize)
{
var passwordBytes = Encoding.UTF8.GetBytes(password);
var inputStream = new FileStream(inputPath, FileMode.Open, FileAccess.Read);
var outputMemoryStream = new MemoryStream();
using (var aes = new AesManaged())
{
var key = new Rfc2898DeriveBytes(passwordBytes, Salt, Iterations);
aes.Key = key.GetBytes(aes.KeySize / 8);
aes.IV = key.GetBytes(aes.BlockSize / 8);
using (var cryptoStream = new CryptoStream(inputStream, aes.CreateDecryptor(), CryptoStreamMode.Read))
{
cryptoStream.CopyTo(outputMemoryStream);
}
}
var outputBytes = outputMemoryStream.ToArray();
dataSize = outputBytes.Length;
return outputBytes;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ce61729e384b47d3a0ef884f51a118bd
timeCreated: 1705569379
@@ -0,0 +1,10 @@
namespace BingoBrain
{
public enum CountDownType
{
Second,
Minute,
Hour,
Day
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 34ed4a143324499ab1864f3c64019e16
timeCreated: 1681804392
+157
View File
@@ -0,0 +1,157 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using Object = UnityEngine.Object;
public class EffectPool<T> : IDisposable where T : Enum
{
private Dictionary<T, List<Object>> PoolDic;
private Dictionary<T, Transform> PollPar;
private List<T> temp;
private Transform objectPoolPar;
public Action<T, UnityAction<UnityEngine.Object>> NewObjFunc;
public Action<T, Object> RecObjFunc;
public Action<T, Object> GetObjFunc;
public EffectPool(Transform _objectPoolPar = null)
{
objectPoolPar = _objectPoolPar;
if (objectPoolPar == null)
{
objectPoolPar = new GameObject("ObjectPool").transform;
objectPoolPar.localPosition = Vector3.zero;
objectPoolPar.localEulerAngles = Vector3.zero;
}
PoolDic = new Dictionary<T, List<Object>>();
PollPar = new Dictionary<T, Transform>();
temp = new List<T>();
}
public void GetObject<Obj>(T key, UnityAction<Obj> action) where Obj : Object
{
if (!PoolDic.ContainsKey(key))
{
AddKey(key);
}
if (PoolDic[key].Count > 0)
{
var obj = PoolDic[key][0] as Obj;
PoolDic[key].RemoveAt(0);
GetObjFunc?.Invoke(key, obj);
action?.Invoke(obj);
}
else
{
LoadObject(key, (obj) =>
{
GetObjFunc?.Invoke(key, obj);
action?.Invoke(obj as Obj);
});
}
}
private void AddKey(T key)
{
PoolDic.Add(key, new List<Object>());
Transform par = new GameObject(key.ToString()).transform;
par.SetParent(objectPoolPar);
par.localScale = Vector3.one;
par.localPosition = Vector3.zero;
par.localEulerAngles = Vector3.zero;
PollPar.Add(key, par.transform);
}
private void LoadObject(T key, UnityAction<Object> action)
{
NewObjFunc?.Invoke(key, (obj) =>
{
if (obj != null)
{
GameObject go = obj as GameObject ?? (obj as Component).gameObject;
if (PollPar.TryGetValue(key, out Transform par) && go != null)
{
go.transform.SetParent(par);
}
}
else
{
Debug.LogError(key.ToString() + "创建失败");
}
action?.Invoke(obj);
});
}
public void RecObject(T key, Object obj)
{
if (obj == null) return;
if (!PoolDic.ContainsKey(key))
{
PoolDic.Add(key, new List<Object>());
}
GameObject go = obj as GameObject ?? (obj as Component).gameObject;
if (PollPar.TryGetValue(key, out Transform par))
{
go.transform.parent = (par);
}
RecObjFunc?.Invoke(key, obj);
PoolDic[key].Add(obj);
}
public void RemoveKey(T key)
{
if (PoolDic.ContainsKey(key))
{
foreach (Object item in PoolDic[key])
{
if (item != null)
{
GameObject go = item as GameObject;
if (go == null)
{
Component cot = item as Component;
go = cot.gameObject;
}
GameObject.Destroy(go);
}
}
PoolDic[key].Clear();
PoolDic.Remove(key);
}
}
public void RemoveAll()
{
temp.Clear();
foreach (var item in PoolDic)
{
temp.Add(item.Key);
}
foreach (var item in temp)
{
RemoveKey(item);
}
temp.Clear();
}
public void Dispose()
{
RemoveAll();
PoolDic = null;
PollPar = null;
temp = null;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3de141293f3240ffbdc26570a545e96c
timeCreated: 1681806263
+24
View File
@@ -0,0 +1,24 @@
using System;
using DG.Tweening;
using FairyGUI;
using BingoBrain;
using UnityEngine;
public static class Fade
{
public static GTweener FadeIn(this GObject obj, float duration = 0.3f, float delay = 0)
{
return GlobalHarmony.In(obj, duration, delay);
}
public static GTweener FadeOut(this GObject obj, float duration = 0.3f, float delay = 0)
{
return GlobalHarmony.Out(obj, duration, delay);
}
public static void SetClick(this GObject button, Action action, bool isNetworkCheck = false,
bool isQuickClickCheck = true)
{
GlobalHarmony.CheckClick(button, action, isNetworkCheck, isQuickClickCheck);
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 774c7c1119b44f86819883ab6e9240ec
timeCreated: 1681803724
+71
View File
@@ -0,0 +1,71 @@
using System;
using System.IO;
using System.Text;
using System.Security.Cryptography;
public class MD5Kit
{
public static string GetFileMD5(string file)
{
try
{
var fs = new FileStream(file, FileMode.Open);
MD5 md5 = new MD5CryptoServiceProvider();
var retVal = md5.ComputeHash(fs);
fs.Close();
var sb = new StringBuilder();
foreach (var str in retVal)
{
sb.Append(str.ToString("X2"));
}
return sb.ToString();
}
catch (Exception ex)
{
throw new Exception("GetFileMD5 fail error: " + ex.Message);
}
}
/// <summary>
/// 字符串MD5加密
/// </summary>
/// <param name="text">要加密的字符串</param>
/// <returns>密文</returns>
public static string MD5String1(string text)
{
var buffer = Encoding.Default.GetBytes(text);
var check = new MD5CryptoServiceProvider();
var somme = check.ComputeHash(buffer);
var result = new StringBuilder();
foreach (var a in somme)
{
// 将字节转换成16进制表示的字符串
var value = a.ToString("X");
if (a < 16)
{
result.Append(0);
result.Append(value);
}
else
{
result.Append(value);
}
}
return result.ToString().ToLower();
}
public static string GetStringMD5(string str)
{
if (string.IsNullOrEmpty(str))
{
return null;
}
MD5 md5 = new MD5CryptoServiceProvider();
byte[] bytResult = md5.ComputeHash(Encoding.UTF8.GetBytes(str));
string strResult = BitConverter.ToString(bytResult);
strResult = strResult.Replace("-", string.Empty);
return strResult;
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 63fb3be97697435a930fdf5612aa7a2a
timeCreated: 1705569413
+13
View File
@@ -0,0 +1,13 @@
using System.Collections.Generic;
using UnityEngine;
namespace BingoBrain
{
public static class RandomKit
{
public static int RandomRange(int begin, int end)
{
return Random.Range(begin, end);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 994547655e194797bda00123642fe1b1
timeCreated: 1699942507