private void OnTweenComplete() { index++; //当index累计到9,也就是所有缓动完成后,证明当次背包切换完成 if (index == 9) { while (_oldItemList.Count > 0) { GameTools.Destroy(_oldItemList[0].gameObject); _oldItemList.RemoveAt(0); } _oldItemList.Clear(); index = 0; _isPlaying = false; } }
private void OnTweenComplete() { index++; //当index累计到30,也就是所有缓动完成后,证明当次背包切换完成 if (index == 30) { //用for循环遍历删除元素的时候,要从后往前删,不然会出错,有疑问的童鞋可以尝试一下从前往后删 for (int i = _oldItemList.Count - 1; i >= 0; i--) { GameTools.Destroy(_oldItemList[i].gameObject); } //当然,也可以用下面的这个办法删除所有元素 //while (_olditemList.Count > 0) //{ // GameTools.Destroy(_olditemList[0].gameObject); // _olditemList.RemoveAt(0); //} _oldItemList.Clear(); index = 0; _isPlaying = false; } }
virtual public void Destroy() { GameTools.Destroy(_mono_object); _mono_object = null; }