Readd missing import files

This commit is contained in:
Lucien
2026-05-07 10:14:44 +02:00
parent ecb44e63d8
commit cd608d5796
810 changed files with 263144 additions and 1 deletions
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace Wing.Utils
{
public static class UtilsExt
{
public static int ToInt(this string s)
{
int ret = 0;
int.TryParse(s, out ret);
return ret;
}
public static float ToFloat(this string s)
{
float ret = 0;
float.TryParse(s, out ret);
return ret;
}
public static Color32 Encode2Color32(this int value,bool renderBack = true)
{
Color32 c = new Color32();
c.r = (byte)((value & 0x000000FF) >> 0);
c.g = (byte)((value & 0x0000FF00) >> 8);
c.b = (byte)((value & 0x00FF0000) >> 16);
c.a = (byte)(renderBack ? 0xFF : 0);
return c;
}
public static int Encode2Int(this Color32 value)
{
int r = value.r << 0;
int g = value.g << 8;
int b = value.b << 16;
return r | g | b;
}
}
}