123456789101112131415161718192021222324252627282930313233343536 |
- using System.Collections;
- using UnityEngine;
- namespace GFGGame
- {
- public class VersionUtil
- {
- /// <summary>
- /// 比较目标版本号是否比当前的大
- /// </summary>
- /// <param name="vCurrent"></param>
- /// <param name="vTarget"></param>
- /// <returns></returns>
- public static bool compare(string vCurrent, string vTarget)
- {
- string[] infoTarget = vTarget.Split('.');
- string[] infoCurrent = vCurrent.Split('.');
- if(infoTarget.Length == infoCurrent.Length)
- {
- for(int i = 0; i < infoCurrent.Length; ++i)
- {
- if (int.Parse(infoTarget[i]) > int.Parse(infoCurrent[i]))
- {
- return true;
- }
- else if (int.Parse(infoTarget[i]) < int.Parse(infoCurrent[i]))
- {
- return false;
- }
- }
- }
-
- return false;
- }
- }
- }
|