Added GenerateSerial feature.

master
LH 6 years ago
parent 240bddf13e
commit 1be17fb934
  1. 17
      Runtime/Utils.cs

@ -27,5 +27,22 @@ namespace UltraCombos.Frozen.RoyalGallery
string hex = color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2"); string hex = color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2");
return hex; return hex;
} }
public static string GenerateSerial(int dev_id, string page_id)
{
string dev_sid = dev_id.ToString("X");
string date = System.DateTime.Now.ToString("HHmmss");
string res_sid = page_id;
try
{
res_sid = System.Int32.Parse(res_sid).ToString("X");
}
catch (System.FormatException)
{
Debug.LogWarning($"GenerateSerial: rid={res_sid} is not number.");
}
return $"{date}{dev_sid}{res_sid}";
}
} }
} }

Loading…
Cancel
Save