forked from laicasaane/unity-supplements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSortingLayerId.cs
53 lines (39 loc) · 1.39 KB
/
SortingLayerId.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
namespace UnityEngine
{
[Serializable]
public struct SortingLayerId : IEquatable<SortingLayerId>
{
public int id;
public int layer
=> SortingLayer.GetLayerValueFromID(this.id);
public string name
=> SortingLayer.IDToName(this.id);
public SortingLayerId(int value)
{
this.id = value;
}
public SortingLayerId(string name)
{
this.id = SortingLayer.NameToID(name);
}
public override int GetHashCode()
=> this.id.GetHashCode();
public override bool Equals(object obj)
=> obj is SortingLayerId other && this.id == other.id;
public bool Equals(SortingLayerId other)
=> this.id == other.id;
public override string ToString()
=> this.id.ToString();
public static implicit operator int(SortingLayerId value)
=> value.id;
public static implicit operator SortingLayerId(int value)
=> new SortingLayerId(value);
public static implicit operator SortingLayerId(string value)
=> new SortingLayerId(value);
public static bool operator ==(SortingLayerId lhs, SortingLayerId rhs)
=> lhs.id == rhs.id;
public static bool operator !=(SortingLayerId lhs, SortingLayerId rhs)
=> lhs.id != rhs.id;
}
}