void SetOptions(string variant, string direction, Dictionary <TiletypeVariant, Dictionary <string, Tiletype> > optionList, TiletypeMatch match) { if (variant == "*") { match.difference |= 2; foreach (var item in optionList.Values) { SetOptions(direction, item, match); } } else { try { TiletypeVariant tileVariant = (TiletypeVariant)Enum.Parse(typeof(TiletypeVariant), variant); if (optionList.ContainsKey(tileVariant)) { SetOptions(direction, optionList[tileVariant], match); } } catch (Exception) { Debug.LogError(variant + " is not a valid tile variant."); return; } } }
static void AddTile(TiletypeShape tileShape, TiletypeSpecial tileSpecial, TiletypeMaterial tileMaterial, TiletypeVariant tileVariant, string tileDirection, Tiletype token) { if (tileDefs == null) tileDefs = new Dictionary<TiletypeShape, Dictionary<TiletypeSpecial, Dictionary<TiletypeMaterial, Dictionary<TiletypeVariant, Dictionary<string, Tiletype>>>>>(); if (!tileDefs.ContainsKey(tileShape)) tileDefs[tileShape] = new Dictionary<TiletypeSpecial, Dictionary<TiletypeMaterial, Dictionary<TiletypeVariant, Dictionary<string, Tiletype>>>>(); if (!tileDefs[tileShape].ContainsKey(tileSpecial)) tileDefs[tileShape][tileSpecial] = new Dictionary<TiletypeMaterial, Dictionary<TiletypeVariant, Dictionary<string, Tiletype>>>(); if (!tileDefs[tileShape][tileSpecial].ContainsKey(tileMaterial)) tileDefs[tileShape][tileSpecial][tileMaterial] = new Dictionary<TiletypeVariant, Dictionary<string, Tiletype>>(); if (!tileDefs[tileShape][tileSpecial][tileMaterial].ContainsKey(tileVariant)) tileDefs[tileShape][tileSpecial][tileMaterial][tileVariant] = new Dictionary<string, Tiletype>(); tileDefs[tileShape][tileSpecial][tileMaterial][tileVariant][tileDirection] = token; }
static void AddTile(TiletypeShape tileShape, TiletypeSpecial tileSpecial, TiletypeMaterial tileMaterial, TiletypeVariant tileVariant, string tileDirection, Tiletype token) { if (tileDefs == null) { tileDefs = new Dictionary <TiletypeShape, Dictionary <TiletypeSpecial, Dictionary <TiletypeMaterial, Dictionary <TiletypeVariant, Dictionary <string, Tiletype> > > > >(); } if (!tileDefs.ContainsKey(tileShape)) { tileDefs[tileShape] = new Dictionary <TiletypeSpecial, Dictionary <TiletypeMaterial, Dictionary <TiletypeVariant, Dictionary <string, Tiletype> > > >(); } if (!tileDefs[tileShape].ContainsKey(tileSpecial)) { tileDefs[tileShape][tileSpecial] = new Dictionary <TiletypeMaterial, Dictionary <TiletypeVariant, Dictionary <string, Tiletype> > >(); } if (!tileDefs[tileShape][tileSpecial].ContainsKey(tileMaterial)) { tileDefs[tileShape][tileSpecial][tileMaterial] = new Dictionary <TiletypeVariant, Dictionary <string, Tiletype> >(); } if (!tileDefs[tileShape][tileSpecial][tileMaterial].ContainsKey(tileVariant)) { tileDefs[tileShape][tileSpecial][tileMaterial][tileVariant] = new Dictionary <string, Tiletype>(); } tileDefs[tileShape][tileSpecial][tileMaterial][tileVariant][tileDirection] = token; }