Пример #1
0
        private static void Resolve(Pair <string, ResolveParams> toResolve)
        {
            string        first  = toResolve.First;
            ResolveParams second = toResolve.Second;

            BaseGen.tmpResolvers.Clear();
            List <RuleDef> list;

            if (BaseGen.rulesBySymbol.TryGetValue(first, out list))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    RuleDef ruleDef = list[i];
                    for (int j = 0; j < ruleDef.resolvers.Count; j++)
                    {
                        SymbolResolver symbolResolver = ruleDef.resolvers[j];
                        if (symbolResolver.CanResolve(second))
                        {
                            BaseGen.tmpResolvers.Add(symbolResolver);
                        }
                    }
                }
            }
            if (!BaseGen.tmpResolvers.Any <SymbolResolver>())
            {
                Log.Warning(string.Concat(new object[]
                {
                    "Could not find any RuleDef for symbol \"",
                    first,
                    "\" with any resolver that could resolve ",
                    second
                }), false);
            }
            else
            {
                SymbolResolver symbolResolver2 = BaseGen.tmpResolvers.RandomElementByWeight((SymbolResolver x) => x.selectionWeight);
                symbolResolver2.Resolve(second);
            }
        }
Пример #2
0
 private static float <Resolve> m__0(SymbolResolver x)
 {
     return(x.selectionWeight);
 }