示例#1
0
        public virtual CCTableViewCell TableCellAtIndex(CCTableView table, int idx)
        {
            string str = idx.ToString();
            var cell = table.DequeueCell();

            if (cell == null) {
                cell = new CustomTableViewCell();
                var sprite = new CCSprite("Images/Icon");
                sprite.AnchorPoint = CCPoint.Zero;
                sprite.Position = new CCPoint(0, 0);
                cell.AddChild(sprite);

                var label = new CCLabelTTF(str, "Helvetica", 20.0f);
                label.Position = CCPoint.Zero;
                label.AnchorPoint = CCPoint.Zero;
                label.Tag = 123;
                cell.AddChild(label);
            }
            else
            {
                var label = (CCLabelTTF)cell.GetChildByTag(123);
                label.Label = (str);
            }

            return cell;
        }
示例#2
0
        public override bool Init()
        {
            if (!base.Init())
                return false;

            var winSize = CCDirector.SharedDirector.WinSize;

            var tableView = new CCTableView(this, new CCSize(250, 60));
            tableView.Direction = CCScrollViewDirection.Horizontal;
            tableView.Position = new CCPoint(20,winSize.Height/2-30);
            tableView.Delegate = this;
            this.AddChild(tableView);
            tableView.ReloadData();

            tableView = new CCTableView(this, new CCSize(60, 280));
            tableView.Direction = CCScrollViewDirection.Vertical;
            tableView.Position = new CCPoint(winSize.Width - 150, winSize.Height/2 - 120);
            tableView.Delegate = this;
            tableView.VerticalFillOrder = CCTableViewVerticalFillOrder.FillTopDown;
            this.AddChild(tableView);
            tableView.ReloadData();

            // Back Menu
            var itemBack = new CCMenuItemFont("Back", toExtensionsMainLayer);
            itemBack.Position = new CCPoint(winSize.Width - 50, 25);
            var menuBack = new CCMenu(itemBack);
            menuBack.Position = CCPoint.Zero;
            AddChild(menuBack);

            return true;
        }
示例#3
0
 public virtual void TableCellTouched(CCTableView table, CCTableViewCell cell)
 {
     CCLog.Log("cell touched at index: {0}", cell.Index);
 }
示例#4
0
 public virtual int NumberOfCellsInTableView(CCTableView table)
 {
     return 20;
 }
示例#5
0
 public virtual CCSize CellSizeForTable(CCTableView table)
 {
     return new CCSize(60, 60);
 }
示例#6
0
 /**
  * An initialized table view object
  *
  * @param dataSource data source;
  * @param size view size
  * @param container parent object for cells
  * @return table view
  */
 public static CCTableView Create(CCTableViewDataSource dataSource, CCSize size, CCNode container)
 {
     var table = new CCTableView();
     table.InitWithViewSize(size, container);
     table.DataSource = dataSource;
     table._updateContentSize();
     return table;
 }