LuaUInt32.cs 387 B

12345678910111213141516171819
  1. using System;
  2. using UnityEngine;
  3. public class LuaUInt32
  4. {
  5. public static byte[] FromString(string str)
  6. {
  7. str = str.Replace("#", "");
  8. UInt32 v;
  9. UInt32.TryParse(str, out v);
  10. Debug.Log(v);
  11. return BitConverter.GetBytes(v);
  12. }
  13. public static UInt32 BytesToUInt32(byte[] v)
  14. {
  15. return BitConverter.ToUInt32(v, 0);
  16. }
  17. }