// Token: 0x06002877 RID: 10359 RVA: 0x00093C04 File Offset: 0x00091E04
    public bool SetHeldItem(global::RPOSInventoryCell cell)
    {
        global::IInventoryItem heldItem;

        if (cell)
        {
            global::IInventoryItem slotItem = cell.slotItem;
            heldItem = slotItem;
        }
        else
        {
            heldItem = null;
        }
        if (this.SetHeldItem(heldItem))
        {
            try
            {
                Vector3 vector;
                if (global::NGUITools.GetCentroid(cell, out vector))
                {
                    Vector2 vector2 = global::UICamera.FindCameraForLayer(cell.gameObject.layer).cachedCamera.WorldToScreenPoint(vector);
                    this.offsetPoint = vector2 - global::UICamera.lastMousePosition;
                }
            }
            catch
            {
                this.offsetPoint = Vector3.zero;
            }
            return(true);
        }
        return(false);
    }
Beispiel #2
0
    // Token: 0x06002A45 RID: 10821 RVA: 0x0009D00C File Offset: 0x0009B20C
    private void OnAltLand(GameObject landing)
    {
        global::RPOSInventoryCell component = landing.GetComponent <global::RPOSInventoryCell>();

        if (!component)
        {
            return;
        }
        global::RPOS.ItemCellAltClicked(component);
    }
Beispiel #3
0
    // Token: 0x06002A2F RID: 10799 RVA: 0x0009C644 File Offset: 0x0009A844
    protected virtual void CreateCellsOnGameObject(global::Inventory inven, GameObject parent)
    {
        bool flag = inven;
        int  newSize;
        int  num;

        if (flag)
        {
            global::Inventory.Slot.Range range;
            inven.GetSlotsOfKind(global::Inventory.Slot.Kind.Default, out range);
            newSize = range.Count;
            num     = range.End;
        }
        else
        {
            newSize = this.GetNumCells();
            num     = int.MaxValue;
        }
        Array.Resize <global::RPOSInventoryCell>(ref this._inventoryCells, newSize);
        float x = this.CellPrefab.GetComponent <global::RPOSInventoryCell>()._background.transform.localScale.x;
        float y = this.CellPrefab.GetComponent <global::RPOSInventoryCell>()._background.transform.localScale.y;

        for (int i = 0; i < this.NumCellsVertical; i++)
        {
            for (int j = 0; j < this.NumCellsHorizontal; j++)
            {
                byte b = (byte)(this.CellIndexStart + global::RPOSInvCellManager.GetIndex2D(j, i, this.NumCellsHorizontal));
                if ((int)b >= num)
                {
                    return;
                }
                GameObject gameObject = global::NGUITools.AddChild(parent, this.CellPrefab);
                global::RPOSInventoryCell component = gameObject.GetComponent <global::RPOSInventoryCell>();
                component._mySlot           = b;
                component._displayInventory = inven;
                if (this.NumberedCells)
                {
                    component._numberLabel.text = (global::RPOSInvCellManager.GetIndex2D(j, i, this.NumCellsHorizontal) + 1).ToString();
                }
                gameObject.transform.localPosition = new Vector3((float)this.CellOffsetX + ((float)j * x + (float)(j * this.CellSpacing)), -((float)this.CellOffsetY + ((float)i * y + (float)(i * this.CellSpacing))), -2f);
                this._inventoryCells[global::RPOS.GetIndex2D(j, i, this.NumCellsHorizontal)] = gameObject.GetComponent <global::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)(-(float)this.CellSize), (float)(this.CellOffsetY + this.NumCellsVertical * this.CellSize) * 0.5f, 0f);
            }
        }
    }
Beispiel #4
0
    // Token: 0x06002AEE RID: 10990 RVA: 0x0009F5A4 File Offset: 0x0009D7A4
    private void SetCellsLocked(bool isLocked)
    {
        global::RPOSInvCellManager componentInChildren = base.GetComponentInChildren <global::RPOSInvCellManager>();

        for (int i = 0; i < componentInChildren._inventoryCells.Length; i++)
        {
            global::RPOSInventoryCell rposinventoryCell = componentInChildren._inventoryCells[i];
            if (rposinventoryCell)
            {
                rposinventoryCell.SetItemLocked(isLocked);
            }
        }
    }
 // Token: 0x0600287A RID: 10362 RVA: 0x00093DD8 File Offset: 0x00091FD8
 public void ClearHeldItem(global::RPOSInventoryCell fadeToCell)
 {
     if (this.hasItem)
     {
         this.fadingOut = true;
         this.ClearHeldItem();
         try
         {
             Vector3 worldPoint;
             if (global::NGUITools.GetCentroid(fadeToCell, out worldPoint))
             {
                 this.FadeOutToPoint(worldPoint);
             }
             return;
         }
         catch
         {
         }
         this.Opaque();
     }
 }