public bool AddPartAndAdjustForXY(bool moveToMax = true, float sizeY = 0f, float posZ = -5f) { bool flag = false; if (this.partObjs.Count > 0 && this.partObjs.Count % this.PARTS_CT_MN == 0) { flag = true; } float num = (float)(this.partObjs.Count % this.PARTS_CT_MN); float x = this._pbd.startX + this._pbd.pitchW * num; float num2 = (float)(this.partObjs.Count / this.PARTS_CT_MN); float y = this._pbd.startY - this._pbd.pitchH * num2; if (flag) { float pitchH = this._pbd.pitchH; this._pbd.lenH += pitchH; base.maxLocate = base.minLocate + this._pbd.lenH - base.ListWindowViewRect.height; if (base.maxLocate <= base.minLocate) { base.maxLocate = base.minLocate; } else { base.EnableScroll = true; } Vector3 vector = this.boxCollider.size; vector.y += pitchH; this.boxCollider.size = vector; vector = this.boxCollider.center; vector.y -= pitchH / 2f; this.boxCollider.center = vector; } GUISelectPanelViewControlUD.ListPartsData listPartsData = new GUISelectPanelViewControlUD.ListPartsData(); listPartsData.idx = this.partObjs.Count; listPartsData.vPos = new Vector3(x, y, posZ); listPartsData.sizeY = sizeY; this.partObjs.Add(listPartsData); for (int i = 0; i < this.partObjs.Count; i++) { this.partObjs[i].csParts = null; } if (moveToMax) { this.selectLoc = base.maxLocate; } for (int i = 0; i < this.csPartsList.Count; i++) { this.csPartsList[i].csParts.gameObject.SetActive(false); this.csPartsList[i].csParts.InactiveParts(); this.csPartsList[i].csParts.IDX = -1; } this.prvStartIDX = -1; base.RefreshView(); return(flag); }
protected override GUISelectPanelViewControlUD.ListPartsData AddBuildPart() { base.AddBuildPart(); if (this.partObjs != null) { GUISelectPanelViewControlUD.ListPartsData listPartsData = new GUISelectPanelViewControlUD.ListPartsData(); listPartsData.idx = this.partObjs.Count; this.partObjs.Add(listPartsData); return(listPartsData); } return(null); }
public void AddPartAndAdjust(bool moveToMax = true, float sizeY = 0f) { float num3; float num4; if (this.useVariableY) { float num = this.partObjs[this.partObjs.Count - 1].sizeY * this._sclY; float num2 = sizeY * this._sclY; num3 = num2 + this.verticalMargin; num4 = num / 2f + num2 / 2f + this.verticalMargin; } else { num3 = this._pbd.pitchH; num4 = this._pbd.pitchH; } base.maxLocate += num3; this._pbd.lenH += num3; Vector3 vector = this.boxCollider.size; vector.y += num3; this.boxCollider.size = vector; vector = this.boxCollider.center; vector.y -= num3 / 2f; this.boxCollider.center = vector; GUISelectPanelViewControlUD.ListPartsData listPartsData = new GUISelectPanelViewControlUD.ListPartsData(); listPartsData.idx = this.partObjs.Count; vector = this.partObjs[this.partObjs.Count - 1].vPos; vector.y -= num4; listPartsData.vPos = vector; listPartsData.sizeY = sizeY; this.partObjs.Add(listPartsData); for (int i = 0; i < this.partObjs.Count; i++) { this.partObjs[i].csParts = null; } if (moveToMax) { this.selectLoc = base.maxLocate; } for (int i = 0; i < this.csPartsList.Count; i++) { this.csPartsList[i].csParts.gameObject.SetActive(false); this.csPartsList[i].csParts.InactiveParts(); this.csPartsList[i].csParts.IDX = -1; } this.prvStartIDX = -1; base.RefreshView(); }
public void RefreshList(int partsCount, int horizontalPartsCount, List <float> sizeYList = null, bool initLoc = true) { int num = partsCount / horizontalPartsCount; if (partsCount % horizontalPartsCount > 0) { num++; } Vector3 localScale = this.selectParts.transform.localScale; GUISelectPanelViewPartsUD.PanelBuildData panelBuildData = this.CalcBuildData(horizontalPartsCount, num, localScale.x, localScale.y, sizeYList); float num2 = panelBuildData.startY; float startX = panelBuildData.startX; this.partObjs.Clear(); int num3 = 0; for (int i = 0; i < partsCount; i++) { GUISelectPanelViewControlUD.ListPartsData listPartsData = this.AddBuildPart(); if (sizeYList != null) { listPartsData.sizeY = sizeYList[num3]; } float x = startX + panelBuildData.pitchW * (float)(num3 % horizontalPartsCount); listPartsData.vPos = new Vector3(x, num2, -5f); if (num3 == partsCount - 1) { break; } num3++; if (num3 % horizontalPartsCount == 0) { if (sizeYList != null) { num2 -= sizeYList[num3 - 1] / 2f + sizeYList[num3] / 2f + this.verticalMargin; } else { num2 -= panelBuildData.pitchH; } } } base.height = panelBuildData.lenH; this.initLocation = initLoc; this.InitMinMaxLocation(-1, 0f); base.InitializeView(); }
protected GUISelectPanelViewControlUD.ListPartsData InsertBuildPart(int loc) { if (this.partObjs != null) { if (loc < 0) { loc = 0; } if (loc > this.partObjs.Count) { loc = this.partObjs.Count; } GUISelectPanelViewControlUD.ListPartsData listPartsData = new GUISelectPanelViewControlUD.ListPartsData(); listPartsData.idx = this.partObjs.Count; this.partObjs.Insert(loc, listPartsData); return(listPartsData); } return(null); }
private void UpdateParts(GUISelectPanelViewControlUD.ListPartsRecycle partsObject, GUISelectPanelViewControlUD.ListPartsData partsData) { partsObject.csParts.gameObject.SetActive(true); if (this.useVariableY) { BoxCollider component = partsObject.csParts.gameObject.GetComponent <BoxCollider>(); if (component != null) { Vector3 size = component.size; size.y = partsData.sizeY; component.size = size; } } partsObject.csParts.SetOriginalPos(partsData.vPos); partsData.csParts = partsObject.csParts; partsObject.csParts.IDX = partsData.idx; partsObject.csParts.SetData(); if (!partsObject.isInit) { partsObject.isInit = true; partsObject.csParts.InitParts(); } else { partsObject.csParts.RefreshParts(); } partsObject.csParts.ShowGUI(); }
public void InsertPartAndAdjust(int idx, float sizeY = 0f) { if (idx < 0) { idx = 0; } if (idx >= this.partObjs.Count) { idx = this.partObjs.Count - 1; } float num; float y; if (this.useVariableY) { num = sizeY * this._sclY + this.verticalMargin; if (idx == 0) { float num2 = (sizeY * this._sclY - this.partObjs[0].sizeY * this._sclY) / 2f; y = this.partObjs[0].vPos.y - num2; } else { y = this.partObjs[idx - 1].vPos.y - (this.partObjs[idx - 1].sizeY * this._sclY / 2f + sizeY * this._sclY / 2f + this.verticalMargin); } } else { num = this._pbd.pitchH; if (idx == 0) { y = this.partObjs[0].vPos.y; } else { y = this.partObjs[idx - 1].vPos.y * this._sclY - this._pbd.pitchH; } } base.maxLocate += num; this._pbd.lenH += num; Vector3 vector = this.boxCollider.size; vector.y += num; this.boxCollider.size = vector; vector = this.boxCollider.center; vector.y -= num / 2f; this.boxCollider.center = vector; GUISelectPanelViewControlUD.ListPartsData listPartsData = new GUISelectPanelViewControlUD.ListPartsData(); listPartsData.idx = idx; vector = this.partObjs[idx].vPos; vector.y = y; listPartsData.vPos = vector; listPartsData.sizeY = sizeY; this.partObjs.Insert(idx, listPartsData); for (int i = idx + 1; i < this.partObjs.Count; i++) { this.partObjs[i].idx++; vector = this.partObjs[i].vPos; vector.y -= num; this.partObjs[i].vPos = vector; } }
public void AllBuild(int count, bool initLoc = true, float sclX = 1f, float sclY = 1f, List <float> sizeYList = null, CMD instCMD = null, bool isResizeListArea = true) { if (this._selectParts != null) { this.GetSelectCollider(); if (!this._selectParts.activeSelf) { this._selectParts.SetActive(true); } } this.initLocation = initLoc; this.InstanceCMD = instCMD; this.InitBuild(); this.partsCount = count; int num = this.partsCount / this.PARTS_CT_MN; if (this.partsCount % this.PARTS_CT_MN > 0) { num++; } if (this.selectCollider != null) { GUISelectPanelViewPartsUD.PanelBuildData panelBuildData = this.CalcBuildData(this.PARTS_CT_MN, num, sclX, sclY, sizeYList); float num2 = panelBuildData.startY; float startX = panelBuildData.startX; int num3 = 0; for (int i = 0; i < this.partsCount; i++) { GUISelectPanelViewControlUD.ListPartsData listPartsData = this.AddBuildPart(); if (sizeYList != null) { listPartsData.sizeY = sizeYList[num3]; } float x = startX + panelBuildData.pitchW * (float)(num3 % this.PARTS_CT_MN); listPartsData.vPos = new Vector3(x, num2, this.ZPos); if (num3 == this.partsCount - 1) { break; } num3++; if (num3 % this.PARTS_CT_MN == 0) { if (sizeYList != null) { num2 -= sizeYList[num3 - 1] / 2f + sizeYList[num3] / 2f + this.verticalMargin; } else { num2 -= panelBuildData.pitchH; } } } base.height = panelBuildData.lenH; this.InitMinMaxLocation(-1, 0f); base.InitViewControl(this.selectParts, panelBuildData.pitchH, this.fRecycleViewMinY, this.fRecycleViewMaxY, this.PARTS_CT_MN, this.RecycleViewSectorSize, isResizeListArea); this.KickEffect(); } if (this._selectParts != null) { this._selectParts.SetActive(false); } }