private static float HeatGeneration(List <object> effectIds) { if (effectIds == null) { return(0); } foreach (ulong effId in effectIds) { var eff = DataObjectModel.GetObject(effId); if (!String.Equals(eff.Data.ValueOrDefault <ScriptEnum>("effSlotType", null).ToString(), "conSlotEffectOther")) { continue; } // GenerateHeat function only appears in this type of effect var subEffects = eff.Data.ValueOrDefault <List <object> >("effSubEffects", null); foreach (GomObjectData subEff in subEffects) { var effActions = subEff.ValueOrDefault <List <object> >("effActions", null); foreach (GomObjectData effAction in effActions) { if (effAction.ValueOrDefault <ScriptEnum>("effActionName", null).ToString() == "effAction_GenerateHeat") { // Heat = effAction.effFloatParams[effParam_Amount] return((float)((IDictionary <object, object>)effAction.ValueOrDefault <Dictionary <object, object> >("effFloatParams", null)).First(kvp => ((ScriptEnum)kvp.Key).ToString() == "effParam_Amount").Value); } } } } return(0); }
/// <summary>Retrieve the ID for the Map this map note should link to</summary> /// <param name="mpn">The map note that links to a map</param> /// <param name="areaId">Area ID of the linked map</param> /// <param name="sId">SId of the linked map</param> private static void GetLinkedMapId(MapNote mpn, ulong areaId, long sId) { switch (areaId) { case 4611686055156531852: case 4611686048166971304: case 4611686048166971255: case 4611686038902870211: { Console.WriteLine("{0} links to map not in mapAreasProto", mpn.Fqn); return; } } string mapDataPath = String.Format("world.areas.{0}.mapdata", areaId); var mapDataObj = DataObjectModel.GetObject(mapDataPath); if (mapDataObj != null) { List <object> mapPages = (List <object>)mapDataObj.Data.ValueOrDefault <List <object> >("mapDataContainerMapDataList", null); if (mapPages != null) { foreach (GomObjectData mapPage in mapPages) { if (sId == mapPage.ValueOrDefault <long>("mapNameSId", 0)) { var guid = mapPage.ValueOrDefault <long>("mapPageGUID", 0); mpn.LinkedMapId = (int)(guid & 0x7FFFFFFF); return; } } } } }
private void GetSet(bool ignoreCase) { var obj = new DataObjectModel(); IDataObject objIDataObject = obj as IDataObject; object glocalInstance = obj; string propertyName = "Name"; var func = (Func <DataObjectModel, string>)Delegate.CreateDelegate(typeof(Func <DataObjectModel, string>), typeof(DataObjectModel).GetMethod("get_Name")); TestCase tester = new TestCase(); tester.Watcher = (i, name, sw) => { Trace.WriteLine(string.Format("{0}:{1}", name, sw.Elapsed)); }; tester.Build("直接调用时", () => { obj.NameField = obj.Name; }); tester.Build("委托调用时", () => { var value = func(obj); }); tester.Build("接口调用时", () => { objIDataObject.SetValue(propertyName, ignoreCase, objIDataObject.GetValue(propertyName, ignoreCase)); }); tester.Build("工具调用时", () => { EntityTools <DataObjectModel> .SetValue(obj, propertyName, ignoreCase, EntityTools <DataObjectModel> .GetValue(obj, propertyName, ignoreCase)); }); tester.Build("字符串工具", () => { EntityTools <DataObjectModel> .SetValueString(obj, propertyName, ignoreCase, EntityTools <DataObjectModel> .GetValueString(obj, propertyName, ignoreCase)); }); tester.Build("虚接口调用", () => { obj.SetEntityValue(propertyName, ignoreCase, obj.GetEntityValue(propertyName, ignoreCase)); }); tester.StepWatcher = i => { Trace.WriteLine(string.Format("执行{0:###,###,###}次的结果: ", i)); }; int times = 10000; tester.Execute(1000 * times); }
private static void LoadData() { GomObject table = DataObjectModel.GetObject(itmModifierPackageTablePrototypePath); Dictionary <object, object> tableData = table.Data.Get <Dictionary <object, object> >("itmModifierPackages"); item_modpkgprototype_data = new Dictionary <long, Dictionary <string, object> >(); foreach (var kvp in tableData) { long modId = (long)kvp.Key; Dictionary <string, object> map = (Dictionary <string, object>)((GomLib.GomObjectData)kvp.Value).Dictionary; item_modpkgprototype_data[modId] = map; //List<List<int>> qData = new List<List<int>>(); /*foreach (List<object> stats in qlist) * { * var lvlData = new List<int>(); * foreach (long stat in stats) * { * lvlData.Add((int)stat); * } * qData.Add(lvlData); * }*/ //item_modpkgprototype_data.Add((int)quality, qData); } }
public void TestStruct() { DataObjectModel obj = new DataObjectModel(); obj.StructTest.MyEnum = Day.A2; obj.StructTest.MyInt32 = 123; obj.StructTest.MyString = "temp"; MyStruct m; m.MyEnum = Day.A5; m.MyInt32 = 999; m.MyString = "testStruct"; EntityTools <DataObjectModel> .SetValue(obj, "StructTest", false, m); Assert.AreEqual(m.MyEnum, obj.StructTest.MyEnum); Assert.AreEqual(m.MyInt32, obj.StructTest.MyInt32); Assert.AreEqual(m.MyString, obj.StructTest.MyString); MyStruct d = (MyStruct)EntityTools <DataObjectModel> .GetValue(obj, "STRUCTTEST", true); Assert.AreEqual(m.MyEnum, d.MyEnum); Assert.AreEqual(m.MyInt32, d.MyInt32); Assert.AreEqual(m.MyString, d.MyString); }
internal override void Link() { if (DomClassId != 0) { DomClass = DataObjectModel.Get <DomClass>(DomClassId); } }
public void SetValueIgnoreCase() { DataObjectModel obj = new DataObjectModel(); string s = "test1234"; obj.Name = "temp"; EntityTools <DataObjectModel> .SetValue(obj, "namE", true, s); Assert.AreEqual(s, obj.Name); }
public void SetValue() { DataObjectModel obj = new DataObjectModel(); string s = "test1234"; obj.Name = "temp"; EntityTools <DataObjectModel> .SetValue(obj, "Name", false, s); Assert.AreEqual(s, obj.Name); }
public void GetValueIgnoreCase() { DataObjectModel obj = new DataObjectModel(); string s = "test1234"; obj.Name = s; string v = EntityTools <DataObjectModel> .GetValue(obj, "naMe", true) as string; Assert.AreEqual(s, v); }
public static Models.AbilityPackage Load(string fqn) { Models.AbilityPackage pkg = null; if (nameMap.TryGetValue(fqn, out pkg)) { return(pkg); } var obj = DataObjectModel.GetObject(fqn); return(Load(obj)); }
public static Models.AbilityPackage Load(ulong nodeId) { Models.AbilityPackage pkg = null; if (idMap.TryGetValue(nodeId, out pkg)) { return(pkg); } var obj = DataObjectModel.GetObject(nodeId); return(Load(obj)); }
public override object ReadData(GomBinaryReader reader) { ulong instanceId = reader.ReadNumber(); var gomObj = DataObjectModel.Get <GomObject>(instanceId); //if (gomObj != null) //{ // gomObj.Load(); //} return(gomObj); }
public static Models.ClassSpec Load(string fqn) { Models.ClassSpec result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } var obj = DataObjectModel.GetObject(fqn); return(Load(obj)); }
public static Models.MapNote Load(ulong nodeId) { Models.MapNote result; if (idMap.TryGetValue(nodeId, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(nodeId); Models.MapNote mpn = new Models.MapNote(); return(Load(mpn, obj)); }
public static Models.MapNote Load(string fqn) { Models.MapNote result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(fqn); Models.MapNote mpn = new Models.MapNote(); return(Load(mpn, obj)); }
public static Models.Conversation Load(string fqn) { Conversation result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(fqn); Conversation cnv = new Conversation(); return(Load(cnv, obj)); }
public static Models.Conversation Load(ulong nodeId) { Conversation result; if (idMap.TryGetValue(nodeId, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(nodeId); Conversation cnv = new Conversation(); return(Load(cnv, obj)); }
public static Models.Codex Load(ulong nodeId) { Codex result; if (idMap.TryGetValue(nodeId, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(nodeId); Codex cdx = new Codex(); return(Load(cdx, obj)); }
public static Models.Schematic Load(string fqn) { Schematic result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(fqn); Schematic sch = new Schematic(); return(Load(sch, obj)); }
public static Models.Schematic Load(ulong nodeId) { Schematic result; if (idMap.TryGetValue(nodeId, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(nodeId); Schematic sch = new Schematic(); return(Load(sch, obj)); }
public static Models.Quest Load(string fqn) { Quest result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(fqn); Quest qst = new Quest(); return(Load(qst, obj)); }
public static Models.Quest Load(ulong nodeId) { Quest result; if (idMap.TryGetValue(nodeId, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(nodeId); Quest qst = new Quest(); return(Load(qst, obj)); }
public static Models.Placeable Load(string fqn) { Placeable result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(fqn); Placeable plc = new Placeable(); return(Load(plc, obj)); }
public static Placeable Load(ulong nodeId) { Placeable result; if (idMap.TryGetValue(nodeId, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(nodeId); Placeable plc = new Placeable(); return(Load(plc, obj)); }
public static Models.Codex Load(string fqn) { Codex result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(fqn); Codex cdx = new Codex(); return(Load(cdx, obj)); }
public static Models.Ability Load(string fqn) { Ability result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(fqn); Models.Ability abl = new Ability(); return(Load(abl, obj)); }
public static Models.Npc Load(ulong nodeId) { Npc result; if (idMap.TryGetValue(nodeId, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(nodeId); Npc npc = new Npc(); return(Load(npc, obj)); }
public static Models.Ability Load(ulong nodeId) { Ability result; if (idMap.TryGetValue(nodeId, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(nodeId); Models.Ability abl = new Ability(); return(Load(abl, obj)); }
public static Models.Npc Load(string fqn) { Npc result; if (nameMap.TryGetValue(fqn, out result)) { return(result); } GomObject obj = DataObjectModel.GetObject(fqn); Npc npc = new Npc(); return(Load(npc, obj)); }
public void TestEnum() { DataObjectModel obj = new DataObjectModel(); obj.MyDay = Day.A1; EntityTools <DataObjectModel> .SetValue(obj, "MyDay", false, "A2"); Assert.AreEqual(Day.A2, obj.MyDay); Day d = (Day)EntityTools <DataObjectModel> .GetValue(obj, "myDay", true); Assert.AreEqual(d, obj.MyDay); }