protected virtual void CreateCellsOnGameObject(Inventory inven, GameObject parent) { int numCells; int end; Inventory.Slot.Range range; if (!inven) { numCells = this.GetNumCells(); end = 2147483647; } else { inven.GetSlotsOfKind(Inventory.Slot.Kind.Default, out range); numCells = range.Count; end = range.End; } Array.Resize <RPOSInventoryCell>(ref this._inventoryCells, numCells); Vector3 component = this.CellPrefab.GetComponent <RPOSInventoryCell>()._background.transform.localScale; float single = component.x; Vector3 vector3 = this.CellPrefab.GetComponent <RPOSInventoryCell>()._background.transform.localScale; float single1 = vector3.y; for (int i = 0; i < this.NumCellsVertical; i++) { for (int j = 0; j < this.NumCellsHorizontal; j++) { byte cellIndexStart = (byte)(this.CellIndexStart + RPOSInvCellManager.GetIndex2D(j, i, this.NumCellsHorizontal)); if (cellIndexStart >= end) { return; } GameObject gameObject = NGUITools.AddChild(parent, this.CellPrefab); RPOSInventoryCell str = gameObject.GetComponent <RPOSInventoryCell>(); str._mySlot = cellIndexStart; str._displayInventory = inven; if (this.NumberedCells) { int index2D = RPOSInvCellManager.GetIndex2D(j, i, this.NumCellsHorizontal) + 1; str._numberLabel.text = index2D.ToString(); } gameObject.transform.localPosition = new Vector3((float)this.CellOffsetX + ((float)j * single + (float)(j * this.CellSpacing)), -((float)this.CellOffsetY + ((float)i * single1 + (float)(i * this.CellSpacing))), -2f); this._inventoryCells[RPOS.GetIndex2D(j, i, this.NumCellsHorizontal)] = gameObject.GetComponent <RPOSInventoryCell>(); } } if (this.CenterFromCells) { if (this.NumCellsHorizontal > 1) { base.transform.localPosition = new Vector3((float)(this.CellOffsetX + this.NumCellsHorizontal * this.CellSize + (this.NumCellsHorizontal - 1) * this.CellSpacing) * -0.5f, (float)this.CellSize, 0f); } else if (this.NumCellsVertical > 1) { base.transform.localPosition = new Vector3((float)(-this.CellSize), (float)(this.CellOffsetY + this.NumCellsVertical * this.CellSize) * 0.5f, 0f); } } }
private void SetCellsLocked(bool isLocked) { RPOSInvCellManager componentInChildren = base.GetComponentInChildren <RPOSInvCellManager>(); for (int i = 0; i < componentInChildren._inventoryCells.Length; i++) { RPOSInventoryCell cell = componentInChildren._inventoryCells[i]; if (cell != null) { cell.SetItemLocked(isLocked); } } }
protected override void WindowAwake() { base.WindowAwake(); this.cellMan = base.GetComponentInChildren<RPOSInvCellManager>(); }
protected override void WindowAwake() { base.WindowAwake(); this.cellMan = base.GetComponentInChildren <RPOSInvCellManager>(); }