graph chart引入&骑行结果弹窗
This commit is contained in:
1 parent
40d118cea3
commit
96f3644b5b
2374 files changed
+485161
-2410
No files matched your search
@@ -0,0 +1,61 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// pools gameobjects for repeated use
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
class GameObjectPool<T> where T : MonoBehaviour
|
||||
{
|
||||
List<T> mPool = new List<T>();
|
||||
public void RecycleObject(T obj)
|
||||
{
|
||||
mPool.Add(obj);
|
||||
}
|
||||
|
||||
public T TakeObject()
|
||||
{
|
||||
if (mPool.Count == 0)
|
||||
return default(T);
|
||||
int last = mPool.Count - 1;
|
||||
T res = mPool[last];
|
||||
mPool.RemoveAt(last);
|
||||
if (res.gameObject.activeInHierarchy == false)
|
||||
res.gameObject.SetActive(true);
|
||||
return res;
|
||||
}
|
||||
|
||||
public void DestoryAll()
|
||||
{
|
||||
for (int i = 0; i < mPool.Count; i++)
|
||||
{
|
||||
T t = mPool[i];
|
||||
if (t != null && t.gameObject != null)
|
||||
{
|
||||
ChartCommon.SafeDestroy(t.gameObject);
|
||||
}
|
||||
}
|
||||
mPool.Clear();
|
||||
}
|
||||
|
||||
public void DeactivateObjects()
|
||||
{
|
||||
for (int i = 0; i < mPool.Count; i++)
|
||||
{
|
||||
T t = mPool[i];
|
||||
if (t != null && t.gameObject != null)
|
||||
{
|
||||
if (t.gameObject.activeInHierarchy)
|
||||
t.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user