예제 #1
0
    /// <summary>
    /// Loop列表,分为-1把最右(上)边一个移到最左(下)边,1把最左(下)边一个移到最右(上)边
    /// </summary>
    /// <param name="dir"></param>
    protected virtual void LoopCell(int dir)
    {
        if (dir == 0)
        {
            return;
        }
        RectTransform MoveCell;
        RectTransform Tarborder;
        Vector2       TarPos;

        if (dir == 1)
        {
            MoveCell  = GetChild(viewRectTran, 0);
            Tarborder = GetChild(viewRectTran, CellCount - 1);
            MoveCell.SetSiblingIndex(CellCount - 1);
        }
        else
        {
            Tarborder = GetChild(viewRectTran, 0);
            MoveCell  = GetChild(viewRectTran, CellCount - 1);
            MoveCell.SetSiblingIndex(0);
        }
        if (MoveAxis == Axis.Horizontal)
        {
            TarPos = Tarborder.localPosition + new Vector3((CellSize.x + Spacing.x) * dir, 0, 0);
        }
        else
        {
            TarPos = (Vector2)Tarborder.localPosition + new Vector2(0, (CellSize.y + Spacing.y) * dir);
        }
        MoveCell.localPosition = TarPos;
    }
예제 #2
0
            public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
            {
                var cell = (MoveCell) tableView.DequeueReusableCell ("History");
                if (cell == null) {
                    cell = new MoveCell (tableView.RowHeight, MoveHistoryView.CellFont);
                }

                var white = Game.MoveHistory [indexPath.Row * 2];
                var black = indexPath.Row * 2 + 1 < Game.MoveHistory.Count ? Game.MoveHistory [indexPath.Row * 2 + 1] : null;

                var text = new StringBuilder ();
                text.Append (white.Description);
                if (black != null) {
                    text.Append ("    ");
                    text.Append (black.Description);
                }

                cell.Number.Text = (indexPath.Row + 1).ToString ();
                cell.White.Text = white.Description;
                cell.Black.Text = black == null ? string.Empty : black.Description;

                return cell;
            }