diff options
Diffstat (limited to 'Client/Assembly-CSharp/CounterArea.cs')
-rw-r--r-- | Client/Assembly-CSharp/CounterArea.cs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/CounterArea.cs b/Client/Assembly-CSharp/CounterArea.cs new file mode 100644 index 0000000..c399165 --- /dev/null +++ b/Client/Assembly-CSharp/CounterArea.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class CounterArea : MonoBehaviour +{ + public SystemTypes RoomType; + + public ObjectPoolBehavior pool; + + private List<PoolableBehavior> myIcons = new List<PoolableBehavior>(); + + public float XOffset; + + public float YOffset; + + public int MaxWidth = 5; + + public void UpdateCount(int cnt) + { + bool flag = this.myIcons.Count != cnt; + while (this.myIcons.Count < cnt) + { + PoolableBehavior item = this.pool.Get<PoolableBehavior>(); + this.myIcons.Add(item); + } + while (this.myIcons.Count > cnt) + { + PoolableBehavior poolableBehavior = this.myIcons[this.myIcons.Count - 1]; + this.myIcons.RemoveAt(this.myIcons.Count - 1); + poolableBehavior.OwnerPool.Reclaim(poolableBehavior); + } + if (flag) + { + for (int i = 0; i < this.myIcons.Count; i++) + { + int num = i % 5; + int num2 = i / 5; + float num3 = (float)(Mathf.Min(cnt - num2 * 5, 5) - 1) * this.XOffset / -2f; + this.myIcons[i].transform.position = base.transform.position + new Vector3(num3 + (float)num * this.XOffset, (float)num2 * this.YOffset, -1f); + } + } + } +} |