コード例 #1
0
    private void Refresh(int itemIndex)
    {
        if (this.ItemCount == 0 || this.SlotCount == 0)
        {
            return;
        }

        var posMaker  = new ItemPositionMaker(this);
        var slotIndex = 0;

        foreach (var slot in this.slots)
        {
            if (slot.Visibled = itemIndex < this.items.Count)
            {
                var item = this.items[itemIndex];
                {
                    slot.Pos  = posMaker.NextPos;
                    slot.Item = item;
                    if (this.OnUpdateSlot != null)
                    {
                        this.OnUpdateSlot(
                            slot.InstanceOfCustomSlotManager, item, slotIndex, itemIndex);
                    }
                }
                slotIndex++;
            }
            if (++itemIndex >= this.items.Count && this.circulation)
            {
                itemIndex = 0;
            }
        }
    }
コード例 #2
0
	private void Scroll()
	{
		this.itemStartIndex = 0;
		
		if ((this.currentRowIndex + 1) > this.actualRowCount)
		{
			var outDelta = this.OutOfBoundsDelta;
			if (outDelta == Vector2.zero)
			{
				var s = this.ItemSize;
				if (s.y != 0)
				{
					var y = Mathf.FloorToInt(this.scrolledPos.y / s.y);
					if (y != 0)
					{
						var yy = Mathf.Abs(y);
						this.itemStartIndex = yy * this.colCount;
					}
				}
			}
			else if (outDelta.y > 0)
			{
				var s = this.ItemSize;
				if (s.y != 0)
				{
					var y = Mathf.FloorToInt((this.ScrollArea.height - this.ViewArea.height) / s.y);
					if (y != 0)
					{
						var yy = Mathf.Abs(y);
						this.itemStartIndex = yy * this.colCount;
					}
				}
			}
			else if (outDelta.y < 0)
				this.itemStartIndex = 0;
		}
		
		//Debug.Log (this.itemStartIndex +", "+ this.itemStartIndexOld);
		
		var refresh = this.itemStartIndex != this.itemStartIndexOld;
		var posMaker = new ItemPositionMaker(this);
		var itemIndex = this.itemStartIndex;
		var slotIndex = 0;
		foreach (var slot in this.slots)
		{
			if (slot.Visibled = itemIndex < this.items.Count)
			{
				var item = this.items[itemIndex];
				{
					slot.Pos = posMaker.NextPos;
					slot.Item = item;
					if (refresh)
					{
						if (this.OnUpdateSlot != null)
						{
							this.OnUpdateSlot(
								slot.InstanceOfCustomSlotManager, item, slotIndex, itemIndex);
						}
					}
				}
				slotIndex++;
			}
			if (++itemIndex >= this.items.Count && this.circulation)
				itemIndex = 0;
		}
		if (refresh)
			this.itemStartIndexOld = this.itemStartIndex;
	}
コード例 #3
0
	private void Refresh(int itemIndex)
	{
		if (this.ItemCount == 0 || this.SlotCount == 0)
			return;
		
		var posMaker = new ItemPositionMaker(this);
		var slotIndex = 0;
		foreach (var slot in this.slots)
		{
			if (slot.Visibled = itemIndex < this.items.Count)
			{
				var item = this.items[itemIndex];
				{
					slot.Pos = posMaker.NextPos;
					slot.Item = item;
					if (this.OnUpdateSlot != null)
					{
						this.OnUpdateSlot(
							slot.InstanceOfCustomSlotManager, item, slotIndex, itemIndex);
					}
				}
				slotIndex++;
			}
			if (++itemIndex >= this.items.Count && this.circulation)
				itemIndex = 0;
		}
	}
コード例 #4
0
    private void Scroll()
    {
        this.itemStartIndex = 0;

        if ((this.currentRowIndex + 1) > this.actualRowCount)
        {
            var outDelta = this.OutOfBoundsDelta;
            if (outDelta == Vector2.zero)
            {
                var s = this.ItemSize;
                if (s.y != 0)
                {
                    var y = Mathf.FloorToInt(this.scrolledPos.y / s.y);
                    if (y != 0)
                    {
                        var yy = Mathf.Abs(y);
                        this.itemStartIndex = yy * this.colCount;
                    }
                }
            }
            else if (outDelta.y > 0)
            {
                var s = this.ItemSize;
                if (s.y != 0)
                {
                    var y = Mathf.FloorToInt((this.ScrollArea.height - this.ViewArea.height) / s.y);
                    if (y != 0)
                    {
                        var yy = Mathf.Abs(y);
                        this.itemStartIndex = yy * this.colCount;
                    }
                }
            }
            else if (outDelta.y < 0)
            {
                this.itemStartIndex = 0;
            }
        }

        //Debug.Log (this.itemStartIndex +", "+ this.itemStartIndexOld);

        var refresh   = this.itemStartIndex != this.itemStartIndexOld;
        var posMaker  = new ItemPositionMaker(this);
        var itemIndex = this.itemStartIndex;
        var slotIndex = 0;

        foreach (var slot in this.slots)
        {
            if (slot.Visibled = itemIndex < this.items.Count)
            {
                var item = this.items[itemIndex];
                {
                    slot.Pos  = posMaker.NextPos;
                    slot.Item = item;
                    if (refresh)
                    {
                        if (this.OnUpdateSlot != null)
                        {
                            this.OnUpdateSlot(
                                slot.InstanceOfCustomSlotManager, item, slotIndex, itemIndex);
                        }
                    }
                }
                slotIndex++;
            }
            if (++itemIndex >= this.items.Count && this.circulation)
            {
                itemIndex = 0;
            }
        }
        if (refresh)
        {
            this.itemStartIndexOld = this.itemStartIndex;
        }
    }