private string mapName; // 当前场景名 // end ahpho public BaseDoc(BaseForm parent, string filename /*, ref AtlIEKG3DScene baseFormScene*/) { m_form = parent; m_view = parent.VIEW; m_strFileName = filename; if (EditorLayer.UseSO3Logic) { // Init LogicEditor EngineLayer.ATLBase.InitLogicalEditorBase(); LogicsLayer.SO3world.LoadEditorScene(filename); LogicsLayer.SO3world.AttachLogicalSceneTo3DScene(); LogicsLayer.SO3world.NewLogicSceneConnectionAndBindLogicalSceneAndSceneEditor(); } LogicsLayer.SO3world.NewLogicalDataAndAdviseWithSceneEditor(); string strIniFile = m_strFileName + ".Logical"; LogicsLayer.SO3world.LoadLogicalData(strIniFile); // 加载树所要的数据 LogicsLayer.SO3world.GetLogicalDataPtr(ref m_DocLogical); LogicHelper.Init(m_DocLogical); mapName = FileFolderHelper.GetMapName(m_strFileName); m_AllLogicObj = LogicHelper.DoImportOneTarget(strIniFile, mapName); }
private void ProcessDeleteObjMsg(ref Message msg) { int representObjPtr = (int)msg.LParam; object r = m_baseForm.FindTreeNodeByRepresentObjPtr((int)msg.WParam, representObjPtr); TreeNode node = r as TreeNode; DevComponents.AdvTree.Node advNode = r as DevComponents.AdvTree.Node; if (node != null) { node.Parent.Nodes.Remove(node); node.Remove(); } else if (advNode != null) { advNode.Parent.Nodes.Remove(advNode); advNode.Remove(); } LogicHelper.UpdateNodesCountDesc(); }
private void checkShowAll_CheckedChanged(object sender, EventArgs e) { m_bShowAllNpcDoodad = this.checkShowAll.Checked; LogicHelper.LoadTree(m_doc.m_AllLogicObj, this.treeView1, m_bShowAllNpcDoodad); }
public BaseForm(string filename, MainForm parent) { InitializeComponent(); InitVars(); m_parent = parent; m_doc = new BaseDoc(this, filename); m_view = new BaseView(this, this.PANEL.Handle); this.PANEL.m_baseForm = this; m_doc.DocLogical.SetMainViewHwnd((int)this.PANEL.Handle); this.MouseWheel += new MouseEventHandler(this.BaseForm_MouseWheel); this.PanelView.GotFocus += new EventHandler(this.PanelView_GotFocus); this.PanelView.LostFocus += new EventHandler(this.PanelView_LostFocus); this.PanelView.MouseDown += new MouseEventHandler(this.PanelView_MouseDown); this.PanelView.Resize += new EventHandler(this.PanelView_Resize); this.KeyPreview = true; // 顶视图 InitTopView_Tga(filename); InitTopView_Old(); // lua脚本 InitLua(); // ahpho suntao // 初始化路径面板 InitPatrol(); // 初始化交通面板 InitTraffic(); // InitPolyComponents(); InitPoly(); // 初始化sql连接 InitSqlConnection(); // 初始化Npc面板 InitNpc(); EngineLayer.ATLBase.OnResizeNpcWindow(); // 初始化Doodad面板 InitDoodad(); EngineLayer.ATLBase.OnResizeDoodadWindow(); // 初始化预览面板 InitPreviewCanvas(); // end ahpho // loadtree DateTime t_begin = DateTime.Now; LogicHelper.LoadTree(m_doc.m_AllLogicObj, this.treeView1, m_bShowAllNpcDoodad); TimeSpan t_delta = DateTime.Now - t_begin; Debug.WriteLine(t_delta.ToString()); //MessageBox.Show(t_delta.ToString()); // init timer InitRenderTimer(); // 读取路径和阵型信息 DataColumn orderIDColumn = new DataColumn("ID"); DataColumn orderNameColumn = new DataColumn("Name"); DataColumn orderCountColumn = new DataColumn("Count"); npcOrderTable.Columns.Clear(); npcOrderTable.Columns.Add(orderIDColumn); npcOrderTable.Columns.Add(orderNameColumn); npcOrderTable.Columns.Add(orderCountColumn); InitNpcOrderTable(); DataColumn patrolPathIDColumn = new DataColumn("ID"); DataColumn patrolPathNameColumn = new DataColumn("Name"); patrolPathTable.Columns.Clear(); patrolPathTable.Columns.Add(patrolPathIDColumn); patrolPathTable.Columns.Add(patrolPathNameColumn); InitPatrolPathTable(); InitCameraUI(); m_CheckRelive = new CheckRelive(); m_CheckRelive.Init(filename, m_doc.DocLogical, SceneSceneEditor); }
private void ProcessPlaceObjMsg(ref Message msg) { representObjPtr = (int)msg.LParam; if ((int)msg.WParam == REPRESENTOBJECT_NPC) { m_baseForm.DOC.DocLogical.GetObjDisplayInfo("NPC", -1, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj npc = new LogicObj("NPC", -1, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); //string npcName = npc.naMe; string npcName = string.Format("{0} [{1}]", npc.naMe, npc.templateID); string fullDisplayName = string.Format("{0} {1} {2}", npcName, npc.nickName.Length > 0 ? "[" + npc.nickName + "]" : string.Empty, npc.hasScript ? "[√]" : string.Empty); bool bExistThisTemplate = false; foreach (TreeNode node in LogicHelper.m_NodeNPCs.Nodes) { if (node.Text.Contains(npcName)) { if (node.Nodes.Count == 0) { TreeNode oldnewnpcnode = node.Nodes.Add(node.Name, node.Text); oldnewnpcnode.Tag = node.Tag; node.Text = node.Name; node.Tag = null; } // 再添加这一个。 TreeNode newnpcnode = node.Nodes.Add(npcName, fullDisplayName); newnpcnode.Tag = npc; bExistThisTemplate = true; break; } } if (!bExistThisTemplate) { TreeNode newnpcnode = LogicHelper.m_NodeNPCs.Nodes.Add(npcName, fullDisplayName); newnpcnode.Tag = npc; } } else if ((int)msg.WParam == REPRESENTOBJECT_DOODAD) { m_baseForm.DOC.DocLogical.GetObjDisplayInfo("Doodad", -1, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID); LogicObj doodad = new LogicObj("Doodad", -1, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID); //string doodadName = doodad.naMe; string doodadName = string.Format("{0} [{1}]", doodad.naMe, doodad.templateID); string fullDisplayName = string.Format("{0} {1} {2}", doodadName, doodad.nickName.Length > 0 ? "[" + doodad.nickName + "]" : string.Empty, doodad.hasScript ? "[√]" : string.Empty); bool bExistThisTemplate = false; foreach (TreeNode node in LogicHelper.m_NodeDoodads.Nodes) { if (node.Text.Contains(doodadName)) { if (node.Nodes.Count == 0) { TreeNode oldnewdoodadnode = node.Nodes.Add(node.Name, node.Text); oldnewdoodadnode.Tag = node.Tag; node.Text = node.Name; node.Tag = null; } // 再添加这一个 TreeNode newdoodadnode = node.Nodes.Add(doodadName, fullDisplayName); newdoodadnode.Tag = doodad; bExistThisTemplate = true; break; } } if (!bExistThisTemplate) { TreeNode newdoodadnode = LogicHelper.m_NodeDoodads.Nodes.Add(doodadName, fullDisplayName); newdoodadnode.Tag = doodad; } } else if ((int)msg.WParam == REPRESENTOBJECT_POLY) { m_baseForm.AddPolyTreeNode(); } LogicHelper.UpdateNodesCountDesc(); }