Esempio n. 1
0
        private bool InitTableViewTestLayer()
        {

            var winSize = Layer.VisibleBoundsWorldspace.Size;

            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;
        }
Esempio n. 2
0
 public CCSize TableCellSizeForIndex(CCTableView table, int idx)
 {
     if (idx == 2)
     {
         return new CCSize(100, 100);
     }
     return new CCSize(60, 60);
 }
Esempio n. 3
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.Text = (str);
            }


            return cell;
        }
Esempio n. 4
0
 public void TableCellWillRecycle(CCTableView table, CCTableViewCell cell)
 {
 }
Esempio n. 5
0
 public void TableCellUnhighlight(CCTableView table, CCTableViewCell cell)
 {
 }
Esempio n. 6
0
 public virtual void TableCellTouched(CCTableView table, CCTableViewCell cell)
 {
     CCLog.Log("cell touched at index: {0}", cell.Index);
 }
Esempio n. 7
0
 public virtual int NumberOfCellsInTableView(CCTableView table)
 {
     return 20;
 }