protected bool _InsertObject(ref XRedpointMgr.stRedpointGameObject[] array, GameObject go, SetRedpointUIHandler callback) { for (int i = 0; i < array.Length; i++) { if (null == array[i].go || array[i].go == go) { array[i].go = go; array[i].callback = callback; return(false); } } XRedpointMgr.stRedpointGameObject[] array2 = new XRedpointMgr.stRedpointGameObject[array.Length << 1]; array.CopyTo(array2, 0); array2[array.Length].go = go; array2[array.Length].callback = callback; array = array2; return(true); }
public void AddSysRedpointUI(int sys, GameObject go, SetRedpointUIHandler callback = null) { if (null == go) { return; } XRedpointMgr.stRedpointGameObject[] array = null; if (this.mSysGameObjectListDic.TryGetValue(sys, out array)) { if (this._InsertObject(ref array, go, callback)) { this.mSysGameObjectListDic[sys] = array; } } else { array = new XRedpointMgr.stRedpointGameObject[4]; array[0].go = go; array[0].callback = callback; this.mSysGameObjectListDic[sys] = array; } go.SetActive(base._GetSysRedpointState(sys)); }
protected void _DeleteObject(ref XRedpointMgr.stRedpointGameObject[] array, GameObject parent) { for (int i = 0; i < array.Length; i++) { if (array[i].go == parent) { XRedpointMgr.stRedpointGameObject stRedpointGameObject = default(XRedpointMgr.stRedpointGameObject); if (i + 1 < array.Length) { for (int j = array.Length - 1; j > i; j--) { if (null != array[j].go) { stRedpointGameObject = array[j]; array[j] = default(XRedpointMgr.stRedpointGameObject); break; } } } array[i] = stRedpointGameObject; } } }