public static DrawableStates FetchControlStates(string control, string subtype, params string[] assets) { string fullName = control + "." + subtype; if (controlStates.ContainsKey(fullName)) return controlStates[fullName]; DrawableStatesProxy proxy = new DrawableStatesProxy(null); BuildControlStates(proxy, control, subtype, assets); controlStates.Add(fullName, proxy); return proxy; }
static void BuildControlStates(DrawableStatesProxy proxy, string control, string subtype, params string[] assets) { DrawableStates states = new DrawableStates(); foreach (string state in assets) { Drawable d = FetchDrawable("controls." + control + "." + subtype + "." + state); if (d == null) d = FetchDrawable("controls." + control + ".default." + state); if (d == null) d = Drawable.None; states[state] = d; } proxy.Set(states); }