示例#1
0
 public void SetUp()
 {
     _lib = new TagLib();
     _lib.Register(new Tags.Tiles());
     _lib.Register(new Sharp());
     _factory = new FileLocatorFactory().CloneForTagLib(_lib) as FileLocatorFactory;
     new TilesSet();
     _map              = new TilesMap();
     _data             = new Hashtable();
     _model            = new TagModel(_data);
     _nestedAttributes = new AttributeSet(
         "nested",
         new TileAttribute("aAttribute", new StringTile("aAttributeValue"))
         );
     _map.AddTile(new TemplateTile("fileWithAttributes", _factory.Handle("filewithtileattributes.htm", true), _nestedAttributes));
     _attributes = new AttributeSet(
         "main",
         new TileAttribute("simple", new StringTile("simpleValue")),
         new TileAttribute("file", new TemplateTile(null, _factory.Handle("a.htm", true), null)),
         new TileAttribute("fileWithVars", new TemplateTile(null, _factory.Handle("b.htm", true), null)),
         new TileAttribute("fileWithTilesAttributes", new TileReference("fileWithAttributes", _map))
         );
     _model.Decorate().With(_attributes);
     _data["simpleAsProperty"] = "simple";
     _data["some"]             = new Hashtable {
         { "a", "AA" }
     };
 }
        public void Render(Transform parentTransform, TilesMap map)
        {
            groundParent = CreateTransform("Ground Parent", parentTransform);
            waterParent = CreateTransform("Water Parent", parentTransform);

            DrawMap(map);
        }
 public LocationGenerator(TilesMap tilesMap, LocationsMap locationsMap, ObjectsMap objectsMap, Random random)
 {
     this.tilesMap              = tilesMap;
     this.locationsMap          = locationsMap;
     this.objectsMap            = objectsMap;
     this.random                = random;
     this.rouletteWheelSelector = new RouletteWheelSelector(random);
 }
示例#4
0
        public void Render(Transform parentTransform, TilesMap map)
        {
            Grid grid = CreateGrid(parentTransform);

            groundTilemap = CreateTilemap(grid.transform, "Ground Tilemap", SortingLayers.Ground);
            waterTilemap  = CreateTilemap(grid.transform, "Water Tilemap", SortingLayers.Water);
            DrawMap(map);
        }
        public void Clear()
        {
            for (int i = transform.childCount - 1; i >= 0; --i)
            {
                DestroyImmediate(transform.GetChild(i).gameObject);
            }

            Map = null;
        }
示例#6
0
        public void WhenTheTileIsNotAvailableTheFallBackTileShouldBeUsed()
        {
            var fallBack = new StringTile("val");
            var map      = new TilesMap();
            var tile     = new TileReference("name", map, fallBack);

            tile.GuardInit();
            Assert.That(tile.Tile, Is.SameAs(fallBack));
        }
示例#7
0
        public void deserialize(string folderDest, TilesMap map)
        {
            var jss = new JavaScriptSerializer();

            jss.MaxJsonLength = 999999999;

            //get textures content
            string textureContentFilePath = folderDest + "\\" + map.TilesMapName + "textures.json";

            if (File.Exists(textureContentFilePath))
            {
                map.textureContent = (int[])jss.Deserialize(File.ReadAllText(textureContentFilePath), typeof(int[]));
            }

            //get objects content
            string objectContentFilePath = folderDest + "\\" + map.TilesMapName + "objects.json";

            if (File.Exists(objectContentFilePath))
            {
                map.objectContent = (int[])jss.Deserialize(File.ReadAllText(objectContentFilePath), typeof(int[]));
            }

            //get collisions content
            string objectCollisionFilePath = folderDest + "\\" + map.TilesMapName + "collisions.json";

            if (File.Exists(objectCollisionFilePath))
            {
                map.collisionContent = (int[])jss.Deserialize(File.ReadAllText(objectCollisionFilePath), typeof(int[]));
            }

            //get texture sequences content
            string textureSequenceContentFilePath = folderDest + "\\" + map.TilesMapName + "texturesequences.json";

            if (File.Exists(textureSequenceContentFilePath))
            {
                map.textureSequenceContent = (int[])jss.Deserialize(File.ReadAllText(textureSequenceContentFilePath), typeof(int[]));
            }

            //get object sequences content
            string objectSequenceContentFilePath = folderDest + "\\" + map.TilesMapName + "objectsequences.json";

            if (File.Exists(objectSequenceContentFilePath))
            {
                map.objectSequenceContent = (int[])jss.Deserialize(File.ReadAllText(objectSequenceContentFilePath), typeof(int[]));
            }


            //get events content
            string eventsContentFilePath = folderDest + "\\" + map.TilesMapName + "events.json";

            if (File.Exists(eventsContentFilePath))
            {
                map.eventContent = (int[])jss.Deserialize(File.ReadAllText(eventsContentFilePath), typeof(int[]));
            }
            jss = null;
        }
 public void MarkBlockedTiles(TilesMap map)
 {
     for (int i = 0; i < Height; ++i)
     {
         for (int j = 0; j < Width; ++j)
         {
             locationsTiles[i, j] = new LocationTile(map[i, j].HasWaterBiom ? LocationTileType.Water : LocationTileType.Empty);
         }
     }
 }
        public void FlattenShouldBeDoneLazilyToCopeWithNotYetDefinedDefinitions()
        {
            var map        = new TilesMap();
            var firstSet   = new AttributeSet("TILE", new TileAttribute("new", new StringTile("1")));
            var parentTile = new TileReference("reference", map);

            firstSet.MergeTileLazy(parentTile);
            map.AddTile(new TemplateTile("reference", new FileTemplate("a.htm"), new AttributeSet("PARENT", new TileAttribute("parent", new StringTile("2")))));
            Assert.That(firstSet["parent"].Value.Render(new TagModel(null)), Is.EqualTo("2"));
        }
示例#10
0
        public void TilesShouldReturnAllTilesInMap()
        {
            var map = new TilesMap();

            Assert.That(map.Tiles.Count, Is.EqualTo(0));
            map.AddTile(new MockTile("a"));
            Assert.That(map.Tiles.Count, Is.EqualTo(1));
            map.AddTile(new MockTile("b"));
            Assert.That(map.Tiles.Count, Is.EqualTo(2));
        }
示例#11
0
        public void InitOfTileShouldBeLazy()
        {
            var fallBack = new StringTile("val");
            var map      = new TilesMap();
            var tile     = new TileReference("name", map, fallBack);

            Assert.That(tile.Tile, Is.Null);
            tile.Render(new TagModel(new object()));
            Assert.That(tile.Tile, Is.Not.Null);
        }
示例#12
0
        public void GuardShouldInitTile()
        {
            var fallBack = new StringTile("val");
            var map      = new TilesMap();
            var tile     = new TileReference("name", map, fallBack);

            Assert.That(tile.Tile, Is.Null);
            tile.GuardInit();
            Assert.That(tile.Tile, Is.Not.Null);
        }
        public ObjectGenerator(TilesMap map, Random random)
        {
            this.random = random;
            this.map    = map;

            rouletteWheelSelector = new RouletteWheelSelector(random);
            objectsMap            = new ObjectsMap(map.Width, map.Height);
            locationsMap          = new LocationsMap(map.Width, map.Height);
            locationsMap.MarkBlockedTiles(map);
        }
示例#14
0
        public void TheRenderingShouldBeDelegatedToTheReferenceTileInCaseOfFallBack()
        {
            var model    = new TagModel(new object());
            var fallBack = new StringTile("val");
            var map      = new TilesMap();
            var tile     = new TileReference("name", map, fallBack);

            tile.GuardInit();
            Assert.That(tile.Render(model), Is.EqualTo((fallBack.Render(model))));
        }
示例#15
0
        public void LoadMap()
        {
            if (String.IsNullOrEmpty(this._tilesetPath) == false)
            {
                string name   = _tilesetPath.Substring(_tilesetPath.LastIndexOf('\\'));
                var    result = MessageBox.Show(
                    "Do you want save " + name + "?",
                    "Save TileSet", MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button2,
                    MessageBoxOptions.ServiceNotification);
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    TilesMap.Save(_mapController.TilesMap, _tilesetPath);
                }
                _tilesetPath = String.Empty;
            }
            var openfiledialog = new OpenFileDialog();

            openfiledialog.Filter = "XML Files (*.xml)|*.xml";
            var rs = openfiledialog.ShowDialog();

            if (rs != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            Cursor.Current          = Cursors.WaitCursor;
            _mapController.TilesMap = TilesMap.Load(openfiledialog.FileName);
            this._tilesetPath       = openfiledialog.FileName;

            listView1.LargeImageList = _mapController.getImageList();
            listView1.Items.AddRange(_mapController.getListViewItems().ToArray());

            this.InitTableLayout();

            // Khởi tạo ObjectEditor
            this._mapController.InitObjectEditor();
            this._mapController.ObjectEditor.Bind(this.listBoxObject);
            this._mapController.ObjectEditor.ListItem.ListChanged += (object s, ListChangedEventArgs arg) =>
            {
                this.enableSaveButton();
                var mapbound = new Rectangle(0, 0,
                                             this._mapController.TilesMap.GetMapWidth(),
                                             this._mapController.TilesMap.GetMapHeight());
                this._mapController.ObjectEditor.InitQuadTree(0, mapbound);
                _mapController.Draw(mapbound);
                if (toolbar.QuadTree.Pushed)
                {
                    this._mapController.RenderQuadTree();
                }
            };
            _mapController.Draw(getVisibleMap());
            Cursor.Current = Cursors.Default;
            this.disableSaveButton();
        }
示例#16
0
        public void WhenTheTileIsAvailableTheTileShouldBeUsed()
        {
            var source = new MockTile("name");
            var map    = new TilesMap();

            map.AddTile(source);
            var tile = new TileReference(source.Name, map);

            tile.GuardInit();
            Assert.That(tile.Tile, Is.SameAs(source));
        }
示例#17
0
 public void Initialize()
 {
     level1 = new TilesMap();
     level2 = new TilesMap();
     level3 = new TilesMap();
     level4 = new TilesMap();
     level5 = new TilesMap();
     level6 = new TilesMap();
     level7 = new TilesMap();
     level8 = new TilesMap();
 }
示例#18
0
        private void addToPaletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.TilesSelection != null)
            {
                TilesMap currentMap = this.TilesSelection.TilesMapParent;
                if (currentMap != null)
                {
                    for (int i = 0; i < this.TilesSelection.ListModelsSelected.Count; i++)
                    {
                        TileModel model = this.TilesSelection.ListModelsSelected[i];

                        if (model != null)
                        {
                            string finalName = model.Name.Replace("_MODEL", "");
                            if (model.IsTexture == true)
                            {
                                if (!currentMap.IsTileModelExists(currentMap.TileModelsTextureUsed, finalName))
                                {
                                    //Clone gorgon image
                                    Image img = model.GorgonSprite.Image.SaveBitmap();
                                    GorgonLibrary.Graphics.Image  newImage = GorgonLibrary.Graphics.Image.FromBitmap(finalName, img);
                                    GorgonLibrary.Graphics.Sprite sprite   = new GorgonLibrary.Graphics.Sprite(finalName, newImage);
                                    TileModel newModel = new TileModel(finalName, model.surfaceRect.Location, model.surfaceRect.Size,
                                                                       sprite, false, true);
                                    img.Dispose();
                                    img = null;

                                    currentMap.TileModelsTextureUsed.Add(newModel);
                                    currentMap.UpdateGorgonTileModel(newModel, true);
                                }
                            }
                            else
                            {
                                if (!currentMap.IsTileModelExists(currentMap.TileModelsObjectsUsed, finalName))
                                {
                                    //Clone gorgon image
                                    Image img = model.GorgonSprite.Image.SaveBitmap();
                                    GorgonLibrary.Graphics.Image  newImage = GorgonLibrary.Graphics.Image.FromBitmap(finalName, img);
                                    GorgonLibrary.Graphics.Sprite sprite   = new GorgonLibrary.Graphics.Sprite(finalName, newImage);
                                    TileModel newModel = new TileModel(finalName, model.surfaceRect.Location, model.surfaceRect.Size,
                                                                       sprite, false, false);
                                    img.Dispose();
                                    img = null;

                                    currentMap.TileModelsObjectsUsed.Add(newModel);
                                    currentMap.UpdateGorgonTileModel(newModel, true);
                                }
                            }
                        }
                    }
                    GorgonLibrary.Gorgon.Go();
                }
            }
        }
        public void GenerateWaterMap(TilesMap map)
        {
            if (waterBiomes.Length > 0)
            {
                float firstThreshold = waterBiomes[0].WaterThresholding;

                float[,] waterDeepnessMap = noiseGenerator.Generate(waterNoiseMapParameters, map.Width, map.Height);
                List <WaterTile> waterTiles = GetAllWaterTiles(waterDeepnessMap, firstThreshold, out int deepEnoughTilesCount);
                SetWaterMap(map, waterTiles, deepEnoughTilesCount, firstThreshold);
            }
        }
示例#20
0
        public void TestContains()
        {
            var   ts = new TilesMap();
            ITile a  = new MockTile("a");

            Assert.That(ts.Contains("a"), Is.False);

            ts.AddTile(a);

            Assert.That(ts.Contains("a"), Is.True);
        }
示例#21
0
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        Instance = this;
        tilesArr = new Tile[totalRows * totalColomns];
        CreateTileMap();
    }
示例#22
0
        public void TestCache()
        {
            var   ts = new TilesMap();
            ITile a  = new MockTile("a");
            ITile b  = new MockTile("b");

            ts.AddTile(a);
            ts.AddTile(b);

            Assert.That(ts.Get("a"), Is.SameAs(a));
            Assert.That(ts.Get("b"), Is.SameAs(b));
        }
示例#23
0
        public void SameTileShouldBeReturned()
        {
            var   ts = new TilesMap();
            ITile a  = new MockTile("a");
            ITile b  = new MockTile("b");

            ts.AddTile(a);
            ts.AddTile(b);

            Assert.That(ts.Get("a"), Is.SameAs(a));
            Assert.That(ts.Get("b"), Is.SameAs(b));
        }
示例#24
0
        public void SameTileShouldBeReturned()
        {
            var ts = new TilesMap();
            ITile a = new MockTile("a");
            ITile b = new MockTile("b");

            ts.AddTile(a);
            ts.AddTile(b);

            Assert.That(ts.Get("a"), Is.SameAs(a));
            Assert.That(ts.Get("b"), Is.SameAs(b));
        }
示例#25
0
        public void TestCache()
        {
            var ts = new TilesMap();
            ITile a = new MockTile("a");
            ITile b = new MockTile("b");

            ts.AddTile(a);
            ts.AddTile(b);

            Assert.That(ts.Get("a"), Is.SameAs(a));
            Assert.That(ts.Get("b"), Is.SameAs(b));
        }
示例#26
0
        public void WhenTheTileIsAvailableTheTileShouldBeUsedAndNotTheFallBack()
        {
            var fallBack = new StringTile("val");
            var source   = new MockTile("name");
            var map      = new TilesMap();

            map.AddTile(source);
            var tile = new TileReference(source.Name, map, fallBack);

            tile.GuardInit();
            Assert.That(tile.Tile, Is.SameAs(source));
        }
示例#27
0
        public void init(TilesMap map, Form1 mainForm)
        {
            this.currentTilesMap = map;
            this.mainForm        = mainForm;

            this.textureSequenceImageList.Images.Clear();
            this.textureSequenceListView.Items.Clear();
            this.textureSequencePropGrid.SelectedObject = null;

            this.objectSequenceImageList.Images.Clear();
            this.objectSequenceListView.Items.Clear();
            this.objectSequencePropGrid.SelectedObject = null;

            if (map.TextureSequences == null)
            {
                map.TextureSequences = new List <TileSequence>();
            }

            if (map.ObjectSequences == null)
            {
                map.ObjectSequences = new List <TileSequence>();
            }

            for (int i = 0; i < map.TextureSequences.Count; i++)
            {
                TileSequence seq        = map.TextureSequences[i];
                int          indexImage = this.textureSequenceImageList.Images.Count;
                this.textureSequenceImageList.Images.Add(seq.Frames[0].GorgonSprite.Image.SaveBitmap());


                ListViewItem seqItem = new ListViewItem();
                seqItem.Text       = seq.Name;
                seqItem.ImageIndex = indexImage;
                seqItem.Tag        = seq;
                this.textureSequenceListView.Items.Add(seqItem);
            }

            for (int i = 0; i < map.ObjectSequences.Count; i++)
            {
                TileSequence seq        = map.ObjectSequences[i];
                int          indexImage = this.objectSequenceImageList.Images.Count;
                this.objectSequenceImageList.Images.Add(seq.Frames[0].GorgonSprite.Image.SaveBitmap());


                ListViewItem seqItem = new ListViewItem();
                seqItem.Text       = seq.Name;
                seqItem.ImageIndex = indexImage;
                seqItem.Tag        = seq;
                this.objectSequenceListView.Items.Add(seqItem);
            }
        }
示例#28
0
        /// <summary>
        /// Constructor // Olle A 200212
        /// </summary>
        /// <param name="textureUp"></param>
        /// <param name="textureDown"></param>
        /// <param name="textureLeft"></param>
        /// <param name="textureRight"></param>
        /// <param name="tileMap"></param>
        public Player(Texture2D textureUp, Texture2D textureDown, Texture2D textureLeft, Texture2D textureRight, TilesMap tileMap, Highscore scoreboard, string playerName, SpriteFont hudFont)
        {
            texture           = textureDown;
            this.textureUp    = textureUp;
            this.textureDown  = textureDown;
            this.textureLeft  = textureLeft;
            this.textureRight = textureRight;
            this.tileMap      = tileMap;
            this.playerName   = playerName;
            this.hudFont      = hudFont;

            // Set position to start at // Olle A 200212
            TilePosition = tileMap.StartingPosition;
        }
示例#29
0
        public void UnkownTileShouldThrowExceptionThroughIndexed()
        {
            var ts = new TilesMap();

            try
            {
                var x = ts["?"];
                Assert.Fail("Expected exception on " + x);
            }
            catch (TemplateException Te)
            {
                Assert.That(Te.Message, Is.EqualTo(TemplateException.TemplateNotFound("?").Message));
            }
        }
示例#30
0
        public void TheRenderingShouldBeDelegatedToTheReferenceTileInCase()
        {
            var model    = new TagModel(new object());
            var fallBack = new StringTile("val");
            var source   = new MockTile("name");
            var map      = new TilesMap();

            map.AddTile(source);
            var tile = new TileReference(source.Name, map, fallBack);

            tile.GuardInit();
            Assert.That(fallBack.Render(model), Is.Not.EqualTo((source.Render(model))), "Precondition");
            Assert.That(tile.Render(model), Is.EqualTo((source.Render(model))));
        }
    public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
    {
        base.GetTileData(position, tilemap, ref tileData);

        int mask = 0;

        mask += HasRoadTile(new Vector3Int(position.x - 1, position.y + 1, position.z), tilemap) ? 1 : 0;
        mask += HasRoadTile(new Vector3Int(position.x, position.y + 1, position.z), tilemap) ? 2 : 0;
        mask += HasRoadTile(new Vector3Int(position.x + 1, position.y + 1, position.z), tilemap) ? 4 : 0;
        mask += HasRoadTile(new Vector3Int(position.x - 1, position.y, position.z), tilemap) ? 8 : 0;

        mask += HasRoadTile(new Vector3Int(position.x + 1, position.y, position.z), tilemap) ? 16 : 0;
        mask += HasRoadTile(new Vector3Int(position.x - 1, position.y - 1, position.z), tilemap) ? 32 : 0;
        mask += HasRoadTile(new Vector3Int(position.x, position.y - 1, position.z), tilemap) ? 64 : 0;
        mask += HasRoadTile(new Vector3Int(position.x + 1, position.y - 1, position.z), tilemap) ? 128 : 0;

        int spriteIndex = TilesMap.GetTileIndex(mask);
        int rotation    = TilesMap.GetRotationIndex(mask);

        float zRot = 0f;

        switch (rotation)
        {
        case 0:
            zRot = 0f;
            break;

        case 1:
            zRot = -90f;
            break;

        case 2:
            zRot = -180f;
            break;

        case 3:
            zRot = -270f;
            break;
        }
        tileData.transform = Matrix4x4.Rotate(Quaternion.Euler(0f, 0f, zRot));

        try {
            tileData.sprite = sprites [spriteIndex];
        } catch (System.Exception e) {
            Debug.Log(spriteIndex + "    " + position);
        }

        tileData.flags = TileFlags.LockAll;
    }
示例#32
0
        public void WhenTheTileIsNotAvailableAndNoFallBackIsAvailableGuardInitShouldFail()
        {
            var map  = new TilesMap();
            var tile = new TileReference("name", map);

            try
            {
                tile.GuardInit();
                Assert.Fail("Expected exception");
            }
            catch (TemplateException Te)
            {
                Assert.That(Te.Message, Is.EqualTo(TemplateException.TemplateNotFound("name").Message));
            }
        }
示例#33
0
        public void AnExceptionShouldBeThrownWhenEnteringWithTheSameName()
        {
            var ts = new TilesMap();
            ITile a = new MockTile("a");
            ITile b = new MockTile("a");

            ts.AddTile(a);
            try
            {
                ts.AddTile(b);
                Assert.Fail("Expected exception");
            } catch (TileException Te)
            {
                Assert.That(Te.Message, Is.EqualTo(TileException.DoubleDefinition("a").Message));
            }
        }
示例#34
0
	public void AddTile (string name, bool buystat){

		TilesMap NewTile = new TilesMap{ Name = name, BuyStat = buystat};
		TilesMapList.Add (NewTile);

	}
示例#35
0
 public TilesFactory(IResourceLocatorFactory factory)
 {
     _map = new TilesMap();
     _factory = factory;
 }
示例#36
0
 public TileReference(string name, TilesMap map, ITile fallBack)
     : this(name, map)
 {
     _fallBack = fallBack;
 }
示例#37
0
 public void TilesShouldReturnAllTilesInMap()
 {
     var map = new TilesMap();
     Assert.That(map.Tiles.Count, Is.EqualTo(0));
     map.AddTile(new MockTile("a"));
     Assert.That(map.Tiles.Count, Is.EqualTo(1));
     map.AddTile(new MockTile("b"));
     Assert.That(map.Tiles.Count, Is.EqualTo(2));
 }
示例#38
0
 public void UnkownTileShouldThrowExceptionThroughIndexed()
 {
     var ts = new TilesMap();
     try
     {
         var x = ts["?"];
         Assert.Fail("Expected exception on " + x);
     }
     catch (TemplateException Te)
     {
         Assert.That(Te.Message, Is.EqualTo(TemplateException.TemplateNotFound("?").Message));
     }
 }
示例#39
0
        public void TestContains()
        {
            var ts = new TilesMap();
            ITile a = new MockTile("a");

            Assert.That(ts.Contains("a"), Is.False);

            ts.AddTile(a);

            Assert.That(ts.Contains("a"), Is.True);
        }
示例#40
0
 public void SetUp()
 {
     _lib = new TagLib();
     _lib.Register(new Tags.Tiles());
     _lib.Register(new Sharp());
     _factory = new FileLocatorFactory().CloneForTagLib(_lib) as FileLocatorFactory;
     _map = new TilesMap();
     _data = new Hashtable();
     _model = new TagModel(_data);
     _nestedAttributes = new AttributeSet(
         "nested",
         new TileAttribute("aAttribute", new StringTile("aAttributeValue"))
         );
     _map.AddTile(new TemplateTile("fileWithAttributes", _factory.Handle("filewithtileattributes.htm", true),
                                   _nestedAttributes));
     _attributes = new AttributeSet(
         "main",
         new TileAttribute("simple", new StringTile("simpleValue")),
         new TileAttribute("file", new TemplateTile(null, _factory.Handle("a.htm", true), null)),
         new TileAttribute("fileWithVars", new TemplateTile(null, _factory.Handle("b.htm",true), null)),
         new TileAttribute("fileWithTilesAttributes", new TileReference("fileWithAttributes", _map))
         );
     _model.Decorate().With(_attributes);
     _data["simpleAsProperty"] = "simple";
     _data["some"] = new Hashtable {{"a", "AA"}};
 }
示例#41
0
 public void TearDown()
 {
     _map = null;
     _data = null;
     _model = null;
     _attributes = null;
     _nestedAttributes = null;
 }
示例#42
0
 public TileReference(string name, TilesMap map)
 {
     _name = name;
     _map = map;
 }
示例#43
0
 public void UnkownTileShouldReturnNullThrowhSafeGet()
 {
     var ts = new TilesMap();
     Assert.IsNull(ts.SafeGet("?"));
 }
示例#44
0
 public void FlattenShouldBeDoneLazilyToCopeWithNotYetDefinedDefinitions()
 {
     var map = new TilesMap();
     var firstSet = new AttributeSet("TILE", new TileAttribute("new", new StringTile("1")));
     var parentTile = new TileReference("reference", map);
     firstSet.MergeTileLazy(parentTile);
     map.AddTile(new TemplateTile("reference", new FileTemplate("a.htm"), new AttributeSet("PARENT", new TileAttribute("parent", new StringTile("2")))));
     Assert.That(firstSet["parent"].Value.Render(new TagModel(null)), Is.EqualTo("2"));
 }