您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
30 行
837 B
30 行
837 B
using UnityEngine;
|
|
|
|
namespace Unity.UIWidgets.scheduler {
|
|
public class Priority {
|
|
Priority(int value) {
|
|
_value = value;
|
|
}
|
|
|
|
public int value => _value;
|
|
int _value;
|
|
|
|
public static readonly Priority idle = new Priority(0);
|
|
|
|
public static readonly Priority animation = new Priority(100000);
|
|
|
|
public static readonly Priority touch = new Priority(200000);
|
|
|
|
public static readonly int kMaxOffset = 10000;
|
|
|
|
public static Priority operator +(Priority it, int offset) {
|
|
if (Mathf.Abs(offset) > kMaxOffset) {
|
|
offset = kMaxOffset * (int) Mathf.Sign(offset);
|
|
}
|
|
|
|
return new Priority(it._value + offset);
|
|
}
|
|
|
|
public static Priority operator -(Priority it, int offset) => it + (-offset);
|
|
}
|
|
}
|