private void NodeMouseDbClick(object sender, TreeNodeMouseClickEventArgs e) { m_SceneEditor.ClearSelectedEntityList(); int i = -1; if (e.Node.Tag != null) { i = Int32.Parse(e.Node.Tag.ToString()); } int nCount = 0; m_DocLogical.GetObjCount("Doodad", -1, ref nCount); string name = string.Empty; string nickname = string.Empty; int hasscript = 0; int representObjPtr = 0; int logicObjPtr = 0; int templateID = 0; if (i > 0 && i < nCount) { m_DocLogical.GetObjDisplayInfo("Doodad", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); //LogicObj Obj = new LogicObj(name, i, -1, name, nickname, hasscrtpt != 0 ? 1 : 0, representObjPtr, logicObjPtr, templateID); m_SceneEditor.AddSelectedRepresentObject(representObjPtr, 1); _AtlVector3 objPos = new _AtlVector3(); EngineLayer.ATLBase.GetRepresentObjTranslation(representObjPtr, ref objPos); MoveCameraToPosition(objPos); //_AtlVector3 oldpos = new _AtlVector3(), oldlookat = new _AtlVector3(); //SceneSceneEditor.GetCameraPosLookat(ref oldpos, ref oldlookat); //_AtlVector3 delta = new _AtlVector3(); //delta.x = oldlookat.x - oldpos.x; delta.y = oldlookat.y - oldpos.y; delta.z = oldlookat.z - oldpos.z; //_AtlVector3 newpos = new _AtlVector3(); //newpos.x = objPos.x - delta.x; newpos.y = objPos.y - delta.y; newpos.z = objPos.z - delta.z; //SceneSceneEditor.SetCameraPosLookat(ref newpos, ref objPos); m_SceneEditor.UpdateSelectableEntityList(5); //float x = 0; //float y = 0; //float z = 0; //m_DocLogical.GetDoodadPos(logicObjPtr, ref x, ref y, ref z); } //e.Node.Tag; }
public static LO_Map DoImportOneTarget(string strFile, string mapname) { // map对象 LO_Map map = new LO_Map(); map.name = mapname; LogicObj main = new LogicObj("MAIN", 0, -1, mapname, string.Empty, false, 0, 0, -1); map.MAIN = main; // 各种对象 map.NPCs = new LogicObj[m_NpcCount]; map.Doodads = new LogicObj[m_DoodadCount]; map.AIGroups = new LogicObj[m_AIGroupCount]; map.WayPointSets = new LogicObj[m_WayPointSetCount]; map.LogicalPolys = new LogicObj[m_LogicalPolyCount]; map.TrafficPointSets = new LogicObj[m_TrafficLittlePointSetCount]; map.TrafficPoints = new LogicObj[m_TrafficPointCount]; map.NpcReviveGroups = new LogicObj[m_NpcReviveGroupCount]; map.DoodadReviveGroups = new LogicObj[m_DoodadReviveGroupCount]; map.NpcRandomGroups = new LogicObj[m_NpcRandomGroupCount]; map.AISets = new LogicObj[m_AISetCount]; for (int i = 0; i < m_NpcCount; i++) { m_LogicalData.GetObjDisplayInfo("NPC", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj npc = new LogicObj("NPC", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); map.NPCs[i] = npc; } for (int i = 0; i < m_DoodadCount; i++) { m_LogicalData.GetObjDisplayInfo("Doodad", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj doodad = new LogicObj("Doodad", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); map.Doodads[i] = doodad; } for (int i = 0; i < m_AIGroupCount; i++) { m_LogicalData.GetObjDisplayInfo("AIGroup", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj aigroup = new LogicObj("AIGroup", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); int npccount = -1; m_LogicalData.GetObjCount("AIGroupNPC", i, ref npccount); aigroup.kids1 = new LogicObj[npccount]; for (int j = 0; j < npccount; j++) { m_LogicalData.GetObjDisplayInfo("AIGroupNPC", j, i, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj npc = new LogicObj("AIGroupNPC", j, i, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); aigroup.kids1[j] = npc; } map.AIGroups[i] = aigroup; } for (int i = 0; i < m_WayPointSetCount; i++) { m_LogicalData.GetObjDisplayInfo("WayPointSet", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj waypointset = new LogicObj("WayPointSet", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); int waypointcount = -1; m_LogicalData.GetObjCount("WayPoint", i, ref waypointcount); waypointset.kids1 = new LogicObj[waypointcount]; for (int j = 0; j < waypointcount; j++) { m_LogicalData.GetObjDisplayInfo("WayPoint", j, i, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj waypoint = new LogicObj("WayPoint", j, i, "Point" + j.ToString(), string.Empty, false, representObjPtr, logicObjPtr, templateID); waypointset.kids1[j] = waypoint; } map.WayPointSets[i] = waypointset; } for (int i = 0; i < m_LogicalPolyCount; i++) { m_LogicalData.GetObjDisplayInfo("LogicalPoly", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj logicalpoly = new LogicObj("LogicalPoly", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); int vertexcount = -1; m_LogicalData.GetObjCount("LogicalPolyVertex", i, ref vertexcount); logicalpoly.kids1 = new LogicObj[vertexcount]; for (int j = 0; j < vertexcount; j++) { m_LogicalData.GetObjDisplayInfo("LogicalPolyVertex", j, i, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj vertex = new LogicObj("LogicalPolyVertex", j, i, "Vertex" + j.ToString(), string.Empty, false, representObjPtr, logicObjPtr, templateID); logicalpoly.kids1[j] = vertex; } map.LogicalPolys[i] = logicalpoly; } for (int i = 0; i < m_TrafficLittlePointSetCount; i++) { m_LogicalData.GetObjDisplayInfo("TrafficLittlePointSet", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj trafficpointset = new LogicObj("TrafficLittlePointSet", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); int pointcount = -1; m_LogicalData.GetObjCount("TrafficLittlePoint", i, ref pointcount); trafficpointset.kids1 = new LogicObj[pointcount]; for (int j = 0; j < pointcount; j++) { m_LogicalData.GetObjDisplayInfo("TrafficLittlePoint", j, i, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj point = new LogicObj("TrafficLittlePoint", j, i, "Point" + j.ToString(), string.Empty, false, representObjPtr, logicObjPtr, templateID); trafficpointset.kids1[j] = point; } map.TrafficPointSets[i] = trafficpointset; } for (int i = 0; i < m_TrafficPointCount; i++) { m_LogicalData.GetObjDisplayInfo("TrafficPoint", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj trafficpoint = new LogicObj("TrafficPoint", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); map.TrafficPoints[i] = trafficpoint; } for (int i = 0; i < m_NpcReviveGroupCount; i++) { m_LogicalData.GetObjDisplayInfo("NpcReviveGroup", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj npcrevivegroup = new LogicObj("NpcReviveGroup", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); // 因为重生组的成员可以通过直接遍历对象链表获得,额外维护组内单独的成员链表成本太高,所以简化一下。 modify by suntao List <LogicObj> logicObjList = new List <LogicObj>(); for (int j = 0; j < m_NpcCount; j++) { _AtlObjInfo objectInfo = new _AtlObjInfo(); m_LogicalData.GetObjDisplayInfo("NPC", j, 0, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); m_LogicalData.GetSetObjInfo("NPC", ref objectInfo, logicObjPtr, 1); Hashtable infoTable = Helper.GetInfoTable(objectInfo); int groupID = i + 1; if (infoTable["ReliveID"] as string == groupID.ToString()) { LogicObj npc = new LogicObj("NPC", j, 0, name, nickname, false, representObjPtr, logicObjPtr, templateID); logicObjList.Add(npc); } } npcrevivegroup.kids1 = logicObjList.ToArray(); /* * int npccount = -1; * m_LogicalData.GetObjCount("NpcReviveGroupNpc", i, ref npccount); * npcrevivegroup.kids1 = new LogicObj[npccount]; * for (int j = 0; j < npccount; j++) * { * m_LogicalData.GetObjDisplayInfo("NpcReviveGroupNpc", j, i, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); * LogicObj npc = new LogicObj("NpcReviveGroupNpc", j, i, name, nickname, false, representObjPtr, logicObjPtr, templateID); * npcrevivegroup.kids1[j] = npc; * } */ map.NpcReviveGroups[i] = npcrevivegroup; } for (int i = 0; i < m_DoodadReviveGroupCount; i++) { m_LogicalData.GetObjDisplayInfo("DoodadReviveGroup", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj doodadrevivegroup = new LogicObj("DoodadReviveGroup", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); // 因为重生组的成员可以通过直接遍历对象链表获得,额外维护组内单独的成员链表成本太高,所以简化一下。 modify by suntao List <LogicObj> logicObjList = new List <LogicObj>(); for (int j = 0; j < m_DoodadCount; j++) { _AtlObjInfo objectInfo = new _AtlObjInfo(); m_LogicalData.GetObjDisplayInfo("Doodad", j, 0, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); m_LogicalData.GetSetObjInfo("Doodad", ref objectInfo, logicObjPtr, 1); Hashtable infoTable = Helper.GetInfoTable(objectInfo); int groupID = i + 1; if (infoTable["ReliveID"] as string == groupID.ToString()) { LogicObj doodad = new LogicObj("Doodad", j, 0, name, nickname, false, representObjPtr, logicObjPtr, templateID); logicObjList.Add(doodad); } } doodadrevivegroup.kids1 = logicObjList.ToArray(); /* * int doodadcount = -1; * m_LogicalData.GetObjCount("DoodadReviveGroupDoodad", i, ref doodadcount); * doodadrevivegroup.kids1 = new LogicObj[doodadcount]; * for (int j = 0; j < doodadcount; j++) * { * m_LogicalData.GetObjDisplayInfo("DoodadReviveGroupDoodad", j, i, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); * LogicObj doodad = new LogicObj("DoodadReviveGroupDoodad", j, i, name, nickname, false, representObjPtr, logicObjPtr, templateID); * doodadrevivegroup.kids1[j] = doodad; * } */ map.DoodadReviveGroups[i] = doodadrevivegroup; } for (int i = 0; i < m_NpcRandomGroupCount; i++) { m_LogicalData.GetObjDisplayInfo("NpcRandomGroup", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj npcrandomgroup = new LogicObj("NpcRandomGroup", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); map.NpcRandomGroups[i] = npcrandomgroup; } for (int i = 0; i < m_AISetCount; i++) { m_LogicalData.GetObjDisplayInfo("AISet", i, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj aiset = new LogicObj("AISet", i, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); int paramcount = -1; m_LogicalData.GetObjCount("AISetParam", i, ref paramcount); aiset.kids1 = new LogicObj[paramcount]; for (int j = 0; j < paramcount; j++) { m_LogicalData.GetObjDisplayInfo("AISetParam", j, i, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj param = new LogicObj("AISetParam", j, i, "Param" + j.ToString(), string.Empty, false, representObjPtr, logicObjPtr, templateID); aiset.kids1[j] = param; } map.AISets[i] = aiset; } return(map); }
public static void Init(IAtlIEKSceneEditorDocLogical logicaldata) { m_LogicalData = logicaldata; m_LogicalData.GetObjCount("NPC", -1, ref m_NpcCount); m_LogicalData.GetObjCount("Doodad", -1, ref m_DoodadCount); m_LogicalData.GetObjCount("AIGroup", -1, ref m_AIGroupCount); m_LogicalData.GetObjCount("WayPointSet", -1, ref m_WayPointSetCount); m_LogicalData.GetObjCount("LogicalPoly", -1, ref m_LogicalPolyCount); m_LogicalData.GetObjCount("TrafficLittlePointSet", -1, ref m_TrafficLittlePointSetCount); m_LogicalData.GetObjCount("TrafficPoint", -1, ref m_TrafficPointCount); m_LogicalData.GetObjCount("NpcReviveGroup", -1, ref m_NpcReviveGroupCount); m_LogicalData.GetObjCount("DoodadReviveGroup", -1, ref m_DoodadReviveGroupCount); m_LogicalData.GetObjCount("NpcRandomGroup", -1, ref m_NpcRandomGroupCount); m_LogicalData.GetObjCount("AISet", -1, ref m_AISetCount); }