void SetOptions(string material, string variant, string direction, Dictionary <TiletypeMaterial, Dictionary <TiletypeVariant, Dictionary <string, Tiletype> > > optionList, TiletypeMatch match) { if (material == "*") { match.difference |= 4; foreach (var item in optionList.Values) { SetOptions(variant, direction, item, match); } } else { try { TiletypeMaterial tileMaterial = (TiletypeMaterial)Enum.Parse(typeof(TiletypeMaterial), material); if (optionList.ContainsKey(tileMaterial)) { SetOptions(variant, direction, optionList[tileMaterial], match); } } catch (Exception) { Debug.LogError(material + " is not a valid tile material."); 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; }