Skip to content

Commit 8321301

Browse files
committed
Merge commit '5656856fbed4ddea86e83a0c5fed05e8c8041f81'
2 parents 3fc6912 + e072107 commit 8321301

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

Assets/Scripts/Common/MonoSingleton.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Collections;
2-
using System.Collections.Generic;
3-
using UnityEngine;
1+
using UnityEngine;
42

53
public class MonoSingleton<T> : MonoBehaviour where T : MonoSingleton<T>
64
{

Assets/Scripts/Common/ObjectPool.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Collections;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using UnityEngine;
43

54
public class ObjectPool : MonoSingleton<ObjectPool>
@@ -104,4 +103,20 @@ public void RecycleObj(GameObject obj, Transform parent = null)
104103
}
105104
}
106105

106+
/// <summary>
107+
/// 删除对象池
108+
/// </summary>
109+
/// <param name="poolName"></param>
110+
public void DestoryPool(string poolName)
111+
{
112+
if (!_objectDict.ContainsKey(poolName)) return;
113+
List<GameObject> objs = _objectDict[poolName];
114+
for (int i = 0; i < objs.Count;)
115+
{
116+
Destroy(objs[i]);
117+
objs.RemoveAt(i);
118+
}
119+
_objectDict.Remove(poolName);
120+
}
121+
107122
}

Assets/Scripts/TestGraph/UILineGraphManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ private void DrawLine(int index = 0)
135135
Vector2 curPos = _dots[index].localPosition;
136136
Vector2 nextPos = _dots[index + 1].localPosition;
137137
float length = Vector2.Distance(curPos, nextPos);
138-
Vector3 dir = (nextPos.y > curPos.y) ? nextPos - curPos : curPos - nextPos;
139-
float angle = Vector3.Angle(dir.normalized, Vector3.right);
138+
Vector3 dir = curPos - nextPos;
139+
float angle = Vector3.Angle(Vector3.up, dir);
140140
Vector2 center = (curPos + nextPos) / 2;
141141
Image line = ObjectPool.Instance.GetObject(_linePrefab.name, _lineContent).GetComponent<Image>();
142-
line.rectTransform.localEulerAngles = Vector3.forward * (angle + 90);
142+
line.rectTransform.localEulerAngles = Vector3.forward * angle;
143143
line.rectTransform.localPosition = center;
144144
line.rectTransform.sizeDelta = new Vector2(_lineWidth, length);
145145
line.gameObject.SetActive(true);
146146
line.fillAmount = 0;
147-
line.fillOrigin = dir.x > 0 ? 1 : 0;
147+
line.fillOrigin = dir.x > 0 ? 0 : 1;
148148
line.DOFillAmount(1, _tweenTime / _lines.Length).OnComplete(() => DrawLine(index + 1));
149149
_lines[index] = line;
150150
}

0 commit comments

Comments
 (0)