public static ResolvedReplacer Resolve(IFieldReplacer replacer) { ResolvedReplacer rep = new ResolvedReplacer(); rep.InstanceInfo = ResolvedInstance.Resolve(replacer.InstanceInfo); if (replacer.FieldReplacements == null) { throw new Exception("No replacements found!"); } foreach (var v in replacer.FieldReplacements) { if (!v.TryResolveTarget(out var field1) || !v.TryResolveSource(out var field2)) { throw new Exception($"Unable to resolve field!"); } rep.FieldToField.Add(field1, field2); } return(rep); }
public static ResolvedInstance Resolve(IInstanceInfo info) { var instance = new ResolvedInstance(); if (info is IRuntimeInstanceInfo rinfo) { instance.Instance = rinfo.OnResolve(); return(instance); } switch (info.idType) { case IDType.IDENTIFIABLE: instance.Instance = GameContext.Instance.LookupDirector.GetPrefab((Identifiable.Id)info.ID); break; default: throw new NotImplementedException(); } return(instance); }