/// <summary> /// Registers a constructor of the given class type. /// </summary> /// <param name="type">Type name this constructor creates.</param> /// <param name="constructor">Constructor method that can create a type instance.</param> public void RegisterConstructor(classKey type, ctor constructor) { if (objectCreators.ContainsKey(type)) { throw new ApplicationException("Constructor already registered"); } objectCreators.Add(type, constructor); }
private static ctor LoadPetBehaviors() { ctor ret = Behav(); foreach (var item in InitGameData.TypeToPet) { ret.Init(item.Value.ObjectId, new State( new PetFollow(), new Prioritize( new StayCloseToSpawn(0.2), new PetWander(0.2, new Cooldown(2000, 1000)) ), new PetHealHP(), new PetHealMP(), new PetShoot() ) ); } return(ret); }
public static void Main(string[] args) { ctor objTest = new ctor(); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(objTest.AppDomainUnhandledException_EventHandler); Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer); try { objTest.RunTest(); } catch (Exception e) { Console.WriteLine(s_strTFAbbrev + " : FAIL The following exception was thorwn in RunTest(): \n" + e.ToString()); objTest._numErrors++; objTest._exitValue = TCSupport.FailExitCode; } //// Finish Diagnostics if (objTest._numErrors == 0) { Console.WriteLine("PASS. "+ s_strTFPath + " " + s_strTFName + " ,numTestcases==" + objTest._numTestcases); } else { Console.WriteLine("FAIL! "+ s_strTFPath + " " + s_strTFName + " ,numErrors==" + objTest._numErrors); if (TCSupport.PassExitCode == objTest._exitValue) { objTest._exitValue = TCSupport.FailExitCode; } } Environment.ExitCode = objTest._exitValue; }
ResolveConstructor ( ctor, cls.Identifier