예제 #1
0
        private void AdjustObjLogicalDir(LogicObj obj, int nDir)
        {
//             if (m_parentFrm.htObjLogicDirIndices.ContainsKey(obj.tyPe) && m_parentFrm.htObjLogicRotationIndices.ContainsKey(obj.tyPe))
//             {
//                 int dirIndex = Convert.ToInt32(m_parentFrm.htObjLogicDirIndices[obj.tyPe]);
//                 int oldDir = Convert.ToInt32(obj.values[dirIndex]);
//                 int newDir = nDir;
//                 obj.values[dirIndex] = newDir.ToString();
//                 obj.fields_changed[dirIndex] = true;
//
//                 int rotationIndex = Convert.ToInt32(m_parentFrm.htObjLogicRotationIndices[obj.tyPe]);
//                 float x = 0.0f, y = 0.0f, z = 0.0f, w = 1.0f;
//                 EngineLayer.ATLBase.QuaternionRotationByNDir(ref x, ref y, ref z, ref w, nDir);
//                 double xx = x, yy = y, zz = z, ww = w;
//                 xx = Math.Round(xx, 6);
//                 yy = Math.Round(yy, 6);
//                 zz = Math.Round(zz, 6);
//                 ww = Math.Round(ww, 6);
//                 string newRotation = string.Format("{0},{1},{2},{3}", xx, yy, zz, ww);
//                 obj.values[rotationIndex] = newRotation;
//
//                 obj.ForcePreviewChange(true, rotationIndex);
//                 obj.ForceInhandChange(true);
//                 this.m_parentFrm.ForceMapChanged();
//                 //this.m_parentFrm.Pg.Refresh();
//             }
        }
예제 #2
0
        private void treeView1_AfterSelNodesRemove(object sender, MWControlSuite.MWPropertyEventArgs e)
        {
            TreeNode node = e.Updated as TreeNode;

            // 检查是否大分类结点
            if (node.Tag is string)
            {
                return;
            }

            LogicObj lobj = node.Tag as LogicObj;

            if (lobj == null) // 删除一组
            {
                LogicObj onechild = node.Nodes[0].Tag as LogicObj;
                if (onechild != null)
                {
                    foreach (TreeNode n in node.Nodes)
                    {
                        this.previewform.m_panel1.RemoveODI(n.Text);
                    }
                }
            }
            else // 删除一个
            {
                this.previewform.m_panel1.RemoveODI(node.Text);
            }
        }
예제 #3
0
        private void AdjustObjLogicalPos(LogicObj obj, PointF pfClientRateAdjust)
        {
//             if (m_parentFrm.htObjScenePosIndices.ContainsKey(obj.tyPe))
//             {
//                 double x = 0.0, y = 0.0;
//                 float height = 0.0f;
//                 // 场景pos
//                 if (m_parentFrm.htObjScenePosIndices[obj.tyPe] != null)
//                 {
//                     int posIndex = Convert.ToInt32(m_parentFrm.htObjScenePosIndices[obj.tyPe]);
//                     string vPosition = obj.values[posIndex];
//                     string[] fields = vPosition.Split(new char[] { ',' });
//                     x = Convert.ToDouble(fields[0]);
//                     y = Convert.ToDouble(fields[2]);
//                     x += pfClientRateAdjust.X * m_parentFrm.curMapWidth * m_panel1.scale;
//                     y -= pfClientRateAdjust.Y * m_parentFrm.curMapHeight * m_panel1.scale;
//                     x = Math.Round(x, 2);
//                     y = Math.Round(y, 2);
//                     height = 0.0f;
//
//                     //Program.Engine.GetHeight((int)m_parentFrm.htScenePtr[m_parentFrm.m_curMapName], (float)x, (float)y, out height);
//                     _AtlVector3 vec3;
//                     vec3.x = (float)x;
//                     vec3.y = 0.0f;
//                     vec3.z = (float)y;
//                     m_parentFrm.SCENE.GetHeight(ref vec3, ref vec3);
//                     height = vec3.y;
//
//                     vPosition = string.Format("{0},{1},{2}", x, height, y);
//                     obj.values[posIndex] = vPosition;
//                     obj.ForcePreviewChange(true, posIndex);
//                 }
//
//                 // 逻辑xyz
//                 if (m_parentFrm.htObjLogicNXIndices[obj.tyPe] != null)
//                 {
//                     float logic_x_start = (float)(Convert.ToDouble(m_parentFrm.DOC.m_AllLogicObj.MAIN.values[11]));
//                     float logic_z_start = (float)(Convert.ToDouble(m_parentFrm.DOC.m_AllLogicObj.MAIN.values[12]));
//                     int lX = 0, lY = 0, lZ = 0;
//                     Helper.SceneToLogical(ref lX, ref lY, ref lZ, (float)x, height, (float)y, 0.0f, logic_x_start, logic_z_start);
//                     int nXIndex = Convert.ToInt32(m_parentFrm.htObjLogicNXIndices[obj.tyPe]);
//                     obj.values[nXIndex] = lX.ToString();
//                     obj.values[nXIndex + 1] = lY.ToString();
//                     obj.values[nXIndex + 2] = lZ.ToString();
//
//                     obj.ForcePreviewChange(true, nXIndex);
//                     obj.ForcePreviewChange(true, nXIndex + 1);
//                     obj.ForcePreviewChange(true, nXIndex + 2);
//                 }
//
//                 obj.ForceInhandChange(true);
//                 this.m_parentFrm.ForceMapChanged();
//                 //this.m_parentFrm.Pg.Refresh();
//             }
        }
예제 #4
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            LogicObj target = e.Node.Tag as LogicObj;

            if (target != null && target.RepresentObjPtr != 0)
            {
                MoveCameraToRepresentObj(target.RepresentObjPtr);
                SelectOnlyRepresentObj(target.RepresentObjPtr);
            }

            previewform.m_panel1.Refresh();
        }
예제 #5
0
 private int LogicObjToDirection(LogicObj target)
 {
     return(-1);
     //             if (htObjLogicDirIndices.ContainsKey(target.tyPe))
     //             {
     //                 string nDirection = target.values[Convert.ToInt32(htObjLogicDirIndices[target.tyPe])];
     //                 return Convert.ToInt32(nDirection);
     //             }
     //             else
     //             {
     //                 return -1;
     //             }
 }
예제 #6
0
파일: MyPanel.cs 프로젝트: uvbs/FullSource
        private void ProcessModifyObjMsg(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;
            LogicObj obj;

            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);
                obj = new LogicObj("NPC", -1, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID);

                string objName         = string.Format("{0} [{1}]", obj.naMe, obj.templateID);
                string fullDisplayName = string.Format("{0} {1} {2}", objName, obj.nickName.Length > 0 ? "[" + obj.nickName + "]" : string.Empty, obj.hasScript ? "[√]" : string.Empty);
                node.Name = objName;
                node.Text = fullDisplayName;
            }
            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);
                obj = new LogicObj("Doodad", -1, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID);

                string objName         = string.Format("{0} [{1}]", obj.naMe, obj.templateID);
                string fullDisplayName = string.Format("{0} {1} {2}", objName, obj.nickName.Length > 0 ? "[" + obj.nickName + "]" : string.Empty, obj.hasScript ? "[√]" : string.Empty);
                node.Name = objName;
                node.Text = fullDisplayName;
            }
            else if ((int)msg.WParam == REPRESENTOBJECT_WAYPOINT)
            {
            }
            else if ((int)msg.WParam == REPRESENTOBJECT_POLY)
            {
                m_baseForm.DOC.DocLogical.GetObjDisplayInfo("LogicalPoly", -1, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID);
                advNode.Name = name;
                advNode.Text = string.Format("{0}{1}", name, hasscript != 0 ? " [√]" : string.Empty);
            }
            else if ((int)msg.WParam == REPRESENTOBJECT_POLY + 1) // REPRESENTOBJECT_BRUSH
            {
                _AtlObjInfo Brushinfo = new _AtlObjInfo();
                m_baseForm.DOC.DocLogical.GetSetObjInfo("LogicalBrush", ref Brushinfo, representObjPtr, 1);
                Brushinfo.iLogicObjPtr = representObjPtr;
                advNode.Tag            = Brushinfo;
            }
        }
예제 #7
0
        private void treeView1_AfterSelNodesAdd(object sender, MWControlSuite.MWPropertyEventArgs e)
        {
            TreeNode node = e.Updated as TreeNode;

            // 显示图片
            ShowMap(Helper.AncestorNodeOf(node).Tag.ToString());

            // 检查是否大分类结点
            if (node.Tag is string)
            {
                return;
            }

            LogicObj lobj = node.Tag as LogicObj;

            if (lobj == null) // 添加一组
            {
                LogicObj onechild = node.Nodes[0].Tag as LogicObj;
                if (onechild != null)
                {
                    foreach (TreeNode n in node.Nodes)
                    {
                        LogicObj oneObj = n.Tag as LogicObj;
                        PointF   pointf = LogicObjPosToImagePointF(oneObj);
                        int      ndir   = LogicObjToDirection(oneObj);
                        if (pointf != PointF.Empty)
                        {
                            ObjDrawInfo odi = new ObjDrawInfo(pointf, ndir, oneObj);
                            this.previewform.m_panel1.AddODI(n.Text, odi);
                        }
                    }
                }
            }
            else // 添加一个
            {
                PointF pointf = LogicObjPosToImagePointF(lobj);
                int    ndir   = LogicObjToDirection(lobj);
                if (pointf != PointF.Empty)
                {
                    ObjDrawInfo odi = new ObjDrawInfo(pointf, ndir, lobj);
                    this.previewform.m_panel1.AddODI(node.Text, odi);
                }
            }
        }
예제 #8
0
 private PointF LogicObjPosToImagePointF(LogicObj target)
 {
     return(PointF.Empty);
     //             if (htObjScenePosIndices.ContainsKey(target.tyPe))
     //             {
     //                 string vPosition = target.values[Convert.ToInt32(htObjScenePosIndices[target.tyPe])];
     //                 string[] fields = vPosition.Split(new char[] { ',' });
     //                 double x = Convert.ToDouble(fields[0]);
     //                 double y = Convert.ToDouble(fields[2]);
     //                 float px = (float)(x / curMapWidth);
     //                 float py = (float)(1.0 - y / curMapHeight);
     //                 PointF pfResult = new PointF(px, py);
     //                 return pfResult;
     //             }
     //             else
     //             {
     //                 return PointF.Empty;
     //             }
 }
예제 #9
0
        public object FindTreeNodeByRepresentObjPtr(int representObjType, int representObjPtr)
        {
            object nodeResult = null;

            if (representObjType == REPRESENTOBJECT_NPC)
            {
                foreach (TreeNode node in LogicHelper.m_NodeNPCs.Nodes)
                {
                    LogicObj npc = node.Tag as LogicObj;
                    if (npc != null && npc.RepresentObjPtr == representObjPtr)
                    {
                        nodeResult = node;
                        break;
                    }

                    foreach (TreeNode n in node.Nodes)
                    {
                        npc = n.Tag as LogicObj;
                        if (npc != null && npc.RepresentObjPtr == representObjPtr)
                        {
                            nodeResult = n;
                            break;
                        }
                    }
                }
            }
            else if (representObjType == REPRESENTOBJECT_DOODAD)
            {
                foreach (TreeNode node in LogicHelper.m_NodeDoodads.Nodes)
                {
                    LogicObj doodad = node.Tag as LogicObj;
                    if (doodad != null && doodad.RepresentObjPtr == representObjPtr)
                    {
                        nodeResult = node;
                        break;
                    }

                    foreach (TreeNode n in node.Nodes)
                    {
                        doodad = n.Tag as LogicObj;
                        if (doodad != null && doodad.RepresentObjPtr == representObjPtr)
                        {
                            nodeResult = n;
                            break;
                        }
                    }
                }
            }
            else if (representObjType == REPRESENTOBJECT_POLY)
            {
                foreach (Node node in this.advTreePoly.Nodes[0].Nodes)
                {
                    _AtlObjInfo atlPolyInfo = (_AtlObjInfo)node.Tag;
                    if (atlPolyInfo.iRepresentObjPtr == representObjPtr)
                    {
                        nodeResult = node;
                        break;
                    }
                }
            }
            else if (representObjType == REPRESENTOBJECT_POLY + 1)
            {
                foreach (Node node in this.nodeBrushes.Nodes)
                {
                    _AtlObjInfo atlBrushInfo = (_AtlObjInfo)node.Tag;
                    if (atlBrushInfo.iLogicObjPtr /*这里没有写错*/ == representObjPtr)
                    {
                        nodeResult = node;
                        break;
                    }
                }
            }

            if (nodeResult == null)
            {
                if (representObjType == REPRESENTOBJECT_NPC || representObjType == REPRESENTOBJECT_DOODAD)
                {
                    throw new Exception("找不到指定树结点。");
                }
            }

            return(nodeResult);
        }
예제 #10
0
파일: MyPanel.cs 프로젝트: viticm/pap2
        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();
        }
예제 #11
0
파일: LogicHelper.cs 프로젝트: viticm/pap2
        public LogicObj lObj; // 对象ref

        public ObjDrawInfo(PointF pos, int dir, LogicObj obj)
        {
            this.pfPos = pos;
            this.nDir = dir;
            this.lObj = obj;
        }
예제 #12
0
파일: LogicHelper.cs 프로젝트: viticm/pap2
        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;
        }
예제 #13
0
파일: Preview.cs 프로젝트: viticm/pap2
        private void AdjustObjLogicalDir(LogicObj obj, int nDir)
        {
//             if (m_parentFrm.htObjLogicDirIndices.ContainsKey(obj.tyPe) && m_parentFrm.htObjLogicRotationIndices.ContainsKey(obj.tyPe))
//             {
//                 int dirIndex = Convert.ToInt32(m_parentFrm.htObjLogicDirIndices[obj.tyPe]);
//                 int oldDir = Convert.ToInt32(obj.values[dirIndex]);
//                 int newDir = nDir;
//                 obj.values[dirIndex] = newDir.ToString();
//                 obj.fields_changed[dirIndex] = true;
// 
//                 int rotationIndex = Convert.ToInt32(m_parentFrm.htObjLogicRotationIndices[obj.tyPe]);
//                 float x = 0.0f, y = 0.0f, z = 0.0f, w = 1.0f;
//                 EngineLayer.ATLBase.QuaternionRotationByNDir(ref x, ref y, ref z, ref w, nDir);
//                 double xx = x, yy = y, zz = z, ww = w;
//                 xx = Math.Round(xx, 6);
//                 yy = Math.Round(yy, 6);
//                 zz = Math.Round(zz, 6);
//                 ww = Math.Round(ww, 6);
//                 string newRotation = string.Format("{0},{1},{2},{3}", xx, yy, zz, ww);
//                 obj.values[rotationIndex] = newRotation;
// 
//                 obj.ForcePreviewChange(true, rotationIndex);
//                 obj.ForceInhandChange(true);
//                 this.m_parentFrm.ForceMapChanged();
//                 //this.m_parentFrm.Pg.Refresh();
//             }
        }
예제 #14
0
파일: Preview.cs 프로젝트: viticm/pap2
        private void AdjustObjLogicalPos(LogicObj obj, PointF pfClientRateAdjust)
        {
//             if (m_parentFrm.htObjScenePosIndices.ContainsKey(obj.tyPe))
//             {
//                 double x = 0.0, y = 0.0;
//                 float height = 0.0f;
//                 // 场景pos
//                 if (m_parentFrm.htObjScenePosIndices[obj.tyPe] != null)
//                 {
//                     int posIndex = Convert.ToInt32(m_parentFrm.htObjScenePosIndices[obj.tyPe]);
//                     string vPosition = obj.values[posIndex];
//                     string[] fields = vPosition.Split(new char[] { ',' });
//                     x = Convert.ToDouble(fields[0]);
//                     y = Convert.ToDouble(fields[2]);
//                     x += pfClientRateAdjust.X * m_parentFrm.curMapWidth * m_panel1.scale;
//                     y -= pfClientRateAdjust.Y * m_parentFrm.curMapHeight * m_panel1.scale;
//                     x = Math.Round(x, 2);
//                     y = Math.Round(y, 2);
//                     height = 0.0f;
// 
//                     //Program.Engine.GetHeight((int)m_parentFrm.htScenePtr[m_parentFrm.m_curMapName], (float)x, (float)y, out height);
//                     _AtlVector3 vec3;
//                     vec3.x = (float)x;
//                     vec3.y = 0.0f;
//                     vec3.z = (float)y;
//                     m_parentFrm.SCENE.GetHeight(ref vec3, ref vec3);
//                     height = vec3.y;
//                     
//                     vPosition = string.Format("{0},{1},{2}", x, height, y);
//                     obj.values[posIndex] = vPosition;
//                     obj.ForcePreviewChange(true, posIndex);
//                 }
//                 
//                 // 逻辑xyz
//                 if (m_parentFrm.htObjLogicNXIndices[obj.tyPe] != null)
//                 {
//                     float logic_x_start = (float)(Convert.ToDouble(m_parentFrm.DOC.m_AllLogicObj.MAIN.values[11]));
//                     float logic_z_start = (float)(Convert.ToDouble(m_parentFrm.DOC.m_AllLogicObj.MAIN.values[12]));
//                     int lX = 0, lY = 0, lZ = 0;
//                     Helper.SceneToLogical(ref lX, ref lY, ref lZ, (float)x, height, (float)y, 0.0f, logic_x_start, logic_z_start);
//                     int nXIndex = Convert.ToInt32(m_parentFrm.htObjLogicNXIndices[obj.tyPe]);
//                     obj.values[nXIndex] = lX.ToString();
//                     obj.values[nXIndex + 1] = lY.ToString();
//                     obj.values[nXIndex + 2] = lZ.ToString();
// 
//                     obj.ForcePreviewChange(true, nXIndex);
//                     obj.ForcePreviewChange(true, nXIndex + 1);
//                     obj.ForcePreviewChange(true, nXIndex + 2);
//                 }
// 
//                 obj.ForceInhandChange(true);
//                 this.m_parentFrm.ForceMapChanged();
//                 //this.m_parentFrm.Pg.Refresh();
//             }
        }
예제 #15
0
파일: MyPanel.cs 프로젝트: uvbs/FullSource
        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();
        }
예제 #16
0
        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);
        }
예제 #17
0
        public LogicObj lObj; // 对象ref

        public ObjDrawInfo(PointF pos, int dir, LogicObj obj)
        {
            this.pfPos = pos;
            this.nDir  = dir;
            this.lObj  = obj;
        }
예제 #18
0
파일: MyPanel.cs 프로젝트: viticm/pap2
        private void ProcessModifyObjMsg(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;
            LogicObj obj;

            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);
                obj = new LogicObj("NPC", -1, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID);
                
                string objName = string.Format("{0} [{1}]", obj.naMe, obj.templateID);
                string fullDisplayName = string.Format("{0} {1} {2}", objName, obj.nickName.Length > 0 ? "[" + obj.nickName + "]" : string.Empty, obj.hasScript ? "[√]" : string.Empty);
                node.Name = objName;
                node.Text = fullDisplayName;
            }
            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);
                obj = new LogicObj("Doodad", -1, -1, name, nickname, hasscript == 0 ? false : true, representObjPtr, logicObjPtr, templateID);

                string objName = string.Format("{0} [{1}]", obj.naMe, obj.templateID);
                string fullDisplayName = string.Format("{0} {1} {2}", objName, obj.nickName.Length > 0 ? "[" + obj.nickName + "]" : string.Empty, obj.hasScript ? "[√]" : string.Empty);
                node.Name = objName;
                node.Text = fullDisplayName;
            }
            else if ((int)msg.WParam == REPRESENTOBJECT_WAYPOINT)
            {

            }
            else if ((int)msg.WParam == REPRESENTOBJECT_POLY)
            {
                m_baseForm.DOC.DocLogical.GetObjDisplayInfo("LogicalPoly", -1, -1, ref name, ref nickname, ref hasscript, ref representObjPtr, ref logicObjPtr, ref templateID);
                advNode.Name = name;
                advNode.Text = string.Format("{0}{1}", name, hasscript != 0 ? " [√]" : string.Empty);
            }
            else if ((int)msg.WParam == REPRESENTOBJECT_POLY + 1) // REPRESENTOBJECT_BRUSH
            {
                _AtlObjInfo Brushinfo = new _AtlObjInfo();
                m_baseForm.DOC.DocLogical.GetSetObjInfo("LogicalBrush", ref Brushinfo, representObjPtr, 1);
                Brushinfo.iLogicObjPtr = representObjPtr;
                advNode.Tag = Brushinfo;
            }
        }