Пример #1
0
        internal static Cell GetCell(int index, CellType cellType)
        {
            Cell cell = null;

            if (cellType == CellType.StartCell)
            {
                cell = new StartCell();
            }
            if (cellType == CellType.PropertyCell)
            {
                cell = new PropertyCell();
            }
            if (cellType == CellType.JailCell)
            {
                cell = new JailCell();
            }
            if (cellType == CellType.GoToJailCell)
            {
                cell = new GoToJailCell();
            }
            if (cellType == CellType.FreeParking)
            {
                cell = new FreeParking();
            }
            cell.Index = index;
            return(cell);
        }
Пример #2
0
 //Acts as a constructor to create the TableView
 public void Initialize(TableModel paramTB)
 {
     txtName.text  = paramTB.sName;
     txtName.color = paramTB.cColor;
     foreach (PropertyHandler handler in paramTB.phPropertiesArr)
     {
         PropertyCell cell = Instantiate(pcCell, transform.position, transform.rotation, transform);
         cell.transform.localScale = Vector3.one;
         cell.CellInitialize(handler);
     }
 }
Пример #3
0
 public static void PrintCell(Cell cell)
 {
     if (cell.Type == CellType.PropertyCell)
     {
         PropertyCell Cell = (PropertyCell)cell;
         Console.WriteLine(ActionManager.instance.CurrentPlayer.Name + "'s cell : " + Cell.StreetName +
                           ", " + Cell.Value + "$");
     }
     else
     {
         Console.WriteLine(ActionManager.instance.CurrentPlayer.Name + " is on the " + Cell.ToString(cell.Type));
     }
 }
Пример #4
0
        public PropertyCellSection()
        {
            var infoColumn = new GridColumn
            {
                HeaderText = "Name",
                Editable   = false,
                DataCell   = new TextBoxCell {
                    Binding = Binding.Property((MyModel m) => m.Name)
                }
            };
            var valueProperty = Binding.Property((MyModel m) => m.Value);

            var propertyCell = new PropertyCell
            {
                TypeBinding = Binding.Property((MyModel m) => (object)m.Type),
                Types       =
                {
                    new PropertyCellTypeBoolean            {
                        ItemBinding = valueProperty.OfType <bool?>()
                    },
                    new PropertyCellTypeString             {
                        ItemBinding = valueProperty.OfType <string>()
                    },
                    new PropertyCellTypeColor              {
                        ItemBinding = valueProperty.OfType <Color>()
                    },
                    new PropertyCellTypeDateTime           {
                        ItemBinding = valueProperty.OfType <DateTime?>()
                    },
                    new PropertyCellTypeEnum <Orientation> {
                        ItemBinding = valueProperty.OfType <Orientation>()
                    }
                }
            };

            var filtered = new FilterCollection <MyModel>(new []
            {
                new MyModel {
                    Name = "Bool Property (checked)", Type = typeof(bool?), Value = true
                },
                new MyModel {
                    Name = "Bool Property", Type = typeof(bool), Value = false
                },
                new MyModel {
                    Name = "String Property", Type = typeof(string), Value = "hello"
                },
                new MyModel {
                    Name = "Color Property", Type = typeof(Color), Value = Colors.Blue
                },
                new MyModel {
                    Name = "DateTime Property", Type = typeof(DateTime), Value = DateTime.Today
                },
                new MyModel {
                    Name = "Enum Property", Type = typeof(Orientation), Value = Orientation.Vertical
                }
            });

            var valueColumn = new GridColumn
            {
                AutoSize   = true,
                Editable   = true,
                HeaderText = "Value",
                DataCell   = propertyCell,
            };

            var grid = new GridView
            {
                Columns = { infoColumn, valueColumn }
            };


            grid.DataStore = filtered;


            var searchBox = new SearchBox();

            searchBox.TextChanged += (sender, e) => filtered.Filter = m => m.Name.IndexOf(searchBox.Text, StringComparison.OrdinalIgnoreCase) >= 0;

            Content = new StackLayout
            {
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Spacing = 5,
                Padding = 10,
                Items   =
                {
                    searchBox,
                    new StackLayoutItem(grid, expand: true)
                }
            };
        }
Пример #5
0
        private void Configure()
        {
            // name column
            var nameBinding   = Binding.Property((IPropertyEditorModel m) => m.DisplayName);
            var stringBinding = Binding.Delegate((object t) => (object)typeof(string));

            var nameCellTypes = new PropertyCell
            {
                TypeBinding = stringBinding,
                Types       =
                {
                    new ReadOnlyCell {
                        ItemBinding = nameBinding
                    },
                }
            };

            var nameColumn = new GridColumn
            {
                Sortable   = false,
                HeaderText = "Name",
                Editable   = false,
                DataCell   = nameCellTypes
            };

            // type name column
            var typeNameBinding   = Binding.Property((IPropertyEditorModel m) => m.ShortTypeName);
            var typeNameCellTypes = new PropertyCell
            {
                TypeBinding = stringBinding,
                Types       =
                {
                    new ReadOnlyCell {
                        ItemBinding = typeNameBinding
                    },
                }
            };

            var typeNameColumn = new GridColumn
            {
                Sortable   = false,
                HeaderText = "Type",
                Editable   = false,
                DataCell   = typeNameCellTypes
            };

            // value column
            var valueBinding   = Binding.Property((IPropertyEditorModel m) => m.ToolboxValue);
            var valueCellTypes = new PropertyCell
            {
                TypeBinding = Binding.Property((IPropertyEditorModel m) => (object)m.ToolboxType),
                Types       =
                {
                    new NumberCell <byte>        {
                        ItemBinding = valueBinding.OfType <byte>()
                    },
                    new NumberCell <byte?>(false, false, true)
                    {
                        ItemBinding = valueBinding.OfType <byte?>()
                    },

                    new NumberCell <short>       {
                        ItemBinding = valueBinding.OfType <short>()
                    },
                    new NumberCell <short?>(false, false, true)
                    {
                        ItemBinding = valueBinding.OfType <short?>()
                    },

                    new NumberCell <ushort>(false, true)
                    {
                        ItemBinding = valueBinding.OfType <ushort>()
                    },
                    new NumberCell <ushort?>(false, true, true)
                    {
                        ItemBinding = valueBinding.OfType <ushort?>()
                    },

                    new NumberCell <int>         {
                        ItemBinding = valueBinding.OfType <int>()
                    },
                    new NumberCell <int?>(false, false, true)
                    {
                        ItemBinding = valueBinding.OfType <int?>()
                    },

                    new NumberCell <uint>(false, true)
                    {
                        ItemBinding = valueBinding.OfType <uint>()
                    },
                    new NumberCell <uint?>(false, true, true)
                    {
                        ItemBinding = valueBinding.OfType <uint?>()
                    },

                    new NumberCell <long>        {
                        ItemBinding = valueBinding.OfType <long>()
                    },
                    new NumberCell <long?>(false, false, true)
                    {
                        ItemBinding = valueBinding.OfType <long?>()
                    },

                    new NumberCell <ulong>(false, true)
                    {
                        ItemBinding = valueBinding.OfType <ulong>()
                    },
                    new NumberCell <ulong?>(false, true, true)
                    {
                        ItemBinding = valueBinding.OfType <ulong?>()
                    },

                    new NumberCell <float>(true)
                    {
                        ItemBinding = valueBinding.OfType <float>()
                    },
                    new NumberCell <float?>(true, false, true)
                    {
                        ItemBinding = valueBinding.OfType <float?>()
                    },

                    new NumberCell <double>(true)
                    {
                        ItemBinding = valueBinding.OfType <double>()
                    },
                    new NumberCell <double?>(true, false, true)
                    {
                        ItemBinding = valueBinding.OfType <double?>()
                    },

                    new CharCell                 {
                        ItemBinding = valueBinding.OfType <char>()
                    },
                    new BoolCell                 {
                        ItemBinding = valueBinding.OfType <bool>()
                    },

                    new GeneralStringCell        {
                        ItemBinding = valueBinding.OfType <string>()
                    },
                    new ColorCell                {
                        ItemBinding = valueBinding.OfType <Color>()
                    },
                    new PropertyCellTypeDateTime {
                        ItemBinding = valueBinding.OfType <DateTime?>()
                    },
                    new ObjectCell               {
                        ItemBinding = valueBinding.OfType <object>()
                    }
                }
            };

            var valueColumn = new GridColumn
            {
                Width      = 150,
                Resizable  = false,
                Editable   = true,
                HeaderText = "Value",
                DataCell   = valueCellTypes
            };

            RowHeight = AppStyles.GridRowHeight;

            Columns.Add(nameColumn);
            Columns.Add(valueColumn);
            Columns.Add(typeNameColumn);

            TypeNameColumnIndex = Columns.IndexOf(typeNameColumn);
        }
Пример #6
0
		public PropertyCellSection()
		{
			var infoColumn = new GridColumn
			{
				HeaderText = "Name",
				Editable = false,
				DataCell = new TextBoxCell { Binding = Binding.Property((MyModel m) => m.Name) }
			};
			var valueProperty = Binding.Property((MyModel m) => m.Value);

			var propertyCell = new PropertyCell
			{ 
				TypeBinding = Binding.Property((MyModel m) => (object)m.Type),
				Types =
				{
					new PropertyCellTypeBoolean { ItemBinding = valueProperty.OfType<bool?>() },
					new PropertyCellTypeString { ItemBinding = valueProperty.OfType<string>() },
					new PropertyCellTypeColor { ItemBinding = valueProperty.OfType<Color>() },
					new PropertyCellTypeDateTime { ItemBinding = valueProperty.OfType<DateTime?>() },
					new PropertyCellTypeEnum<Orientation> { ItemBinding = valueProperty.OfType<Orientation>() }
				}
			};

			var filtered = new FilterCollection<MyModel>(new []
			{
				new MyModel { Name = "Bool Property (checked)", Type = typeof(bool?), Value = true },
				new MyModel { Name = "Bool Property", Type = typeof(bool), Value = false },
				new MyModel { Name = "String Property", Type = typeof(string), Value = "hello" },
				new MyModel { Name = "Color Property", Type = typeof(Color), Value = Colors.Blue },
				new MyModel { Name = "DateTime Property", Type = typeof(DateTime), Value = DateTime.Today },
				new MyModel { Name = "Enum Property", Type = typeof(Orientation), Value = Orientation.Vertical }
			});

			var valueColumn = new GridColumn
			{
				AutoSize = true,
				Editable = true,
				HeaderText = "Value",
				DataCell = propertyCell,
			};

			var grid = new GridView
			{
				Columns = { infoColumn, valueColumn }
			};


			grid.DataStore = filtered;


			var searchBox = new SearchBox();
			searchBox.TextChanged += (sender, e) => filtered.Filter = m => m.Name.IndexOf(searchBox.Text, StringComparison.OrdinalIgnoreCase) >= 0;

			Content = new StackLayout
			{
				HorizontalContentAlignment = HorizontalAlignment.Stretch,
				Spacing = 5,
				Padding = 10,
				Items =
				{
					searchBox,
					new StackLayoutItem(grid, expand: true)
				}
			};
		}