示例#1
0
        protected override Dictionary<String, Object> OnValidate()
        {
            Boolean typeIsValid = TypeTextBox.TextBox.TextIsValid();
            Boolean tileSetIsValid = CurrentTileList.Count > 0;

            if (!typeIsValid ||
                !tileSetIsValid)
            {
                List<String> errorMessages = new List<String>();
                if (!typeIsValid) errorMessages.Add(InformationDialogBox.Instance.GetTypeErrorStr());
                if (!tileSetIsValid) errorMessages.Add("Wrong TileSet !");
                CallInformationDialogBox(InformationDialogBox.EType.Error, errorMessages.ToArray());

                return base.OnValidate();
            }

            TileSet tileSet = new TileSet();
            tileSet.SetType(TypeTextBox.TextBox.Text);

            foreach (Tile tile in CurrentTileList)
            {
                if (TextureMode)
                {
                    tile.Texture.ToScript();
                    tile.ToScript();
                }

                tileSet.AddTileType(tile.Type);
            }

            return new Dictionary<String, Object>()
            {
                { "TileSet", tileSet }
            };
        }
示例#2
0
        void SetTileSet(TileSet tileSet, Int32 tileSetWidth, ClickEventHandler onClick = null)
        {
            if (tileSet == null)
                return;

            MultiBox.SetSize(tileSetWidth);

            CurrentTileSet = tileSet;

            List<Tile> tiles = new List<Tile>();

            for (Int32 count = 0; count < tileSet.GetTileTypeCount(); ++count)
                tiles.Add(tileSet.GetTileAt(count));

            SetTileSet(tiles, tileSetWidth, onClick);
        }
示例#3
0
文件: TileSet.cs 项目: jpx/blazera
 public TileSet(TileSet copy)
     : base(copy)
 {
     TileTypes = new List<String>(copy.TileTypes);
 }
示例#4
0
 public void SetTileSet(TileSet tileSet, ClickEventHandler onClick = null)
 {
     SetTileSet(tileSet, Width, onClick);
 }