public TingRunner(RelayTwo pRelay, RoomRunner pRoomRunner) { D.isNull(pRelay); D.isNull(pRoomRunner); _roomRunner = pRoomRunner; _relay = pRelay; Type[] classes = InstantiatorTwo.GetSubclasses(typeof(Ting)); List <Ting> tingsToAdd = new List <Ting>(); foreach (Type t in classes) { TableTwo table = AssertTable(t, pRelay); if (!_loadedTingTables.ContainsKey(table.name)) { //Console.WriteLine("Adding table " + table.name + " for type " + t.Name); tingsToAdd.AddRange(InstantiatorTwo.Process <Ting>(table)); _loadedTingTables.Add(table.name, table); } } foreach (Ting t in tingsToAdd) { AddTing(t); t.SetupBaseRunners(this, _roomRunner); } actionTime = 0; }
public TimetableRunner(RelayTwo pRelay) //, TingRunner pTingRunner) { _timetableTable = pRelay.GetTable(Timetable.TABLE_NAME); foreach (var timetable in InstantiatorTwo.Process <Timetable>(_timetableTable)) { _timetables[timetable.name] = timetable; } }
public SourceCodeDispenser(RelayTwo pRelay) { _sourceCodeTable = pRelay.GetTable(SourceCode.TABLE_NAME); //Console.WriteLine("Getting source code from " + _sourceCodeTable.name); _sourceCodes = InstantiatorTwo.Process <SourceCode>(_sourceCodeTable); foreach (SourceCode sc in _sourceCodes) { //Console.WriteLine("found source code " + sc.name); } }
public ProgramRunner(RelayTwo pRelay) { D.isNull(pRelay); _programTable = pRelay.GetTable(Program.TABLE_NAME); _programsList = InstantiatorTwo.Process <Program>(_programTable); foreach (var program in _programsList) { program.Init(this); _programsDictionary.Add(program.objectId, program); } }
public void NonExistingFieldTest() { RelayLib.RelayTwo r2 = new RelayLib.RelayTwo(); r2.CreateTable(TingTing.Ting.TABLE_NAME); r2.CreateTable(TingTing.Room.TABLE_NAME); RoomRunner rr = new TingTing.RoomRunner(r2); rr.CreateRoom <Room>(WorldCoordinate.UNDEFINED_ROOM); TingTing.TingRunner tr = new TingTing.TingRunner(r2, rr); tr.CreateTing <SomeLesserTing>("TingA", TingTing.WorldCoordinate.NONE); r2.GetTable(TingTing.Ting.TABLE_NAME)[0].Set <string>(TingTing.Ting.CSHARP_CLASS_FIELD_NAME, "TerreTingThongDong"); List <TingTing.Ting> list = InstantiatorTwo.Process <TingTing.Ting>(r2.GetTable(TingTing.Ting.TABLE_NAME)); Console.WriteLine("list length" + list.Count); Assert.NotNull((list[0] as TerreTingThongDong)); Assert.AreSame("Something", (list[0] as TerreTingThongDong).funk); }
public void BasicUsage() { RelayTwo relay = new RelayTwo(); TableTwo table = relay.CreateTable("Stuffs"); table.AddField <string>("name"); table.AddField <string>(RelayObjectTwo.CSHARP_CLASS_FIELD_NAME); table.CreateRow().Set(RelayObjectTwo.CSHARP_CLASS_FIELD_NAME, "Stuff").Set("name", "first"); table.CreateRow().Set(RelayObjectTwo.CSHARP_CLASS_FIELD_NAME, "Stuff").Set("name", "second"); List <Stuff> objects = InstantiatorTwo.Process <Stuff>(table); Assert.AreEqual(2, objects.Count); Stuff first = objects[0]; Stuff second = objects[1]; Assert.AreEqual("first", first.name); Assert.AreEqual("second", second.name); }
public DialogueRunner(RelayTwo pRelay, Language pLanguage) { D.isNull(pRelay); _dialogueTable = pRelay.GetTable(DialogueNode.TABLE_NAME); _language = pLanguage; _dialogueNodes = InstantiatorTwo.Process <DialogueNode>(_dialogueTable); foreach (DialogueNode n in _dialogueNodes) { n.SetRunner(this); if (n is IRegisteredDialogueNode) { IRegisteredDialogueNode ir = n as IRegisteredDialogueNode; _registeredDialogueNodes.Add(ir); } if (n.isOn) { _nodesThatAreOn.Add(n); } AddNodeToNodeForConversationDictionary(n.conversation, n); } RegisterBuiltInAPIExpressions(); }
public RoomRunner(RelayTwo pRelay) { D.isNull(pRelay); _roomTable = pRelay.GetTable(Room.TABLE_NAME); _rooms = InstantiatorTwo.Process <Room>(_roomTable); }