Beispiel #1
0
        /// <summary>
        /// 添加路径点
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX4_Click(object sender, EventArgs e)
        {
            Node currentNode = patrolTree.SelectedNode;

            if (currentNode != null)
            {
                if (currentNode.Level == 1)
                {
                    currentNode = currentNode.Parent;
                }

                _AtlObjInfo objectInfo    = (_AtlObjInfo)currentNode.Tag;
                Hashtable   infoTable     = Helper.GetInfoTable(objectInfo);
                int         parentIndex   = currentNode.Index;
                int         index         = currentNode.Nodes.Count;
                int         wayPointSetID = int.Parse(infoTable["dwSetID"] as string);

                m_doc.DocLogical.AddOneWayPoint(wayPointSetID, index.ToString());
                editMode = EditMode.AddWayPoint;
            }
            else
            {
                MessageBox.Show("请先选中要添加路径点的路径!", "添加路径点",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 将摄像机移动到对象所在的位置
        /// </summary>
        /// <param name="objectInfo">对象信息</param>
        private void MoveCameraToObject(_AtlObjInfo objectInfo)
        {
            // 移动镜头
            Hashtable infoTable   = Helper.GetInfoTable(objectInfo);
            string    positionStr = infoTable["vPosition"] as string;

            if (positionStr != null) // 有效的坐标
            {
                string[] positionData = positionStr.Split(new char[] { ',' });
                float    positionX    = float.Parse(positionData[0]);
                float    positionY    = float.Parse(positionData[1]);
                float    positionZ    = float.Parse(positionData[2]);

                _AtlVector3 objPos = new _AtlVector3();
                objPos.x = positionX;
                objPos.y = positionY;
                objPos.z = positionZ;

                _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.SetCameraLocation(newpos.x, newpos.y, newpos.z, objPos.x, objPos.y, objPos.z);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 显示对象数据
        /// </summary>
        /// <param name="objectType">对象类型</param>
        private void ShowObjectData(string objectType)
        {
            beginEdit = false;
            string filtValue = objectType;

            dataGridViewX1.Rows.Clear();

            int index = 0;

            for (int i = 0; i < objectInfoArray.Length; i++)
            {
                _AtlObjInfo objectInfo = objectInfoArray[i];
                Hashtable   infoTable  = GetInfoTable(objectInfo);

                if (objectInfo.strType == filtValue)
                {
                    dataGridViewX1.Rows.Add(1);
                    DataGridViewRow newRow = dataGridViewX1.Rows[index];
                    newRow.Cells["Type"].Value = objectInfo.strType;
                    newRow.Cells["Type"].Tag   = objectInfo.strType;

                    for (int j = 0; j < objectInfo.iFieldsCount; j++)
                    {
                        string field = objectInfo.strFields[j];
                        newRow.Cells[field].Value = infoTable[field];
                        newRow.Cells[field].Tag   = infoTable[field];
                    }
                    newRow.Tag = objectInfo;

                    index++;
                }
            }

            beginEdit = true;
        }
Beispiel #4
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="baseDoc">BaseDoc对象</param>
        /// <param name="objectInfoArray">对象数据数组</param>
        public ObjectsEditForm(BaseDoc baseDoc, _AtlObjInfo[] objectInfoArray)
		{
            this.baseDoc = baseDoc;
            this.objectInfoArray = objectInfoArray;
			InitializeComponent();
            Init();
		}        
Beispiel #5
0
        /// <summary>
        /// 初始化成员信息链表
        /// </summary>
        /// <param name="objectType">对象类型</param>
        /// <param name="memberInfoList">成员信息链表</param>
        private void InitMemberInfoList(string objectType, List <Hashtable> memberInfoList)
        {
            int    logicObj     = 0;
            int    representObj = 0;
            int    hasScript    = 0;
            string name         = "";
            string nickName     = "";
            int    memberCount  = 0;

            memberInfoList.Clear();
            baseDoc.DocLogical.GetObjCount(objectType, 0, ref memberCount);

            for (int i = 0; i < memberCount; i++)
            {
                _AtlObjInfo objectInfo = new _AtlObjInfo();
                baseDoc.DocLogical.GetObjDisplayInfo(objectType, i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);

                if (logicObj != 0) // 貌似无效的成员也会读到
                {
                    baseDoc.DocLogical.GetSetObjInfo(objectType, ref objectInfo, logicObj, 1);
                    Hashtable infoTable = Helper.GetInfoTable(objectInfo);
                    memberInfoList.Add(infoTable);
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// 设置分组
        /// </summary>
        /// <param name="groupID">分组ID</param>
        /// <param name="groupType">分组类型</param>
        private void SetGroup(int groupID, GroupType groupType)
        {
            switch (groupType)
            {
            case GroupType.HatredGroup:     // 仇恨组
            {
                SetGroupInfo("TeamID", groupID.ToString());

                for (int i = 0; i < objectInfoList.Count; i++)
                {
                    _AtlObjInfo objectInfo = objectInfoList[i];
                    Hashtable   infoTable  = Helper.GetInfoTable(objectInfo);
                    int         nIndex     = int.Parse(infoTable["nIndex"] as string);

                    baseDoc.DocLogical.AddNpcToAIGroup(nIndex, groupID);
                }

                break;
            }

            case GroupType.RandomGroup:     // 随机组
            {
                SetGroupInfo("RandomID", groupID.ToString());
                break;
            }

            case GroupType.ReviveGroup:     // 重生组
            {
                SetGroupInfo("ReliveID", groupID.ToString());
                break;
            }
            }
        }
Beispiel #7
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        private void Init()
        {
            // 构造数据列
            if (objectInfoArray.Length > 0)
            {
                _AtlObjInfo objectInfo = objectInfoArray[0];
                currentObjectType = objectInfo.strType;

                DataGridViewTextBoxColumn typeColumn = new DataGridViewTextBoxColumn();
                typeColumn.Name       = "Type";
                typeColumn.Tag        = "Type";
                typeColumn.HeaderText = "类别";
                typeColumn.ReadOnly   = true;

                dataGridViewX1.Columns.Add(typeColumn);

                for (int i = 0; i < objectInfo.iFieldsCount; i++)
                {
                    DataGridViewTextBoxColumn newColumn = new DataGridViewTextBoxColumn();
                    newColumn.Name       = objectInfo.strFields[i];
                    newColumn.Tag        = objectInfo.strFields[i];
                    newColumn.HeaderText = GetPropertyDisplayName(objectInfo.strFields[i]);
                    newColumn.ReadOnly   = IsPropertyReadOnly(objectInfo.strFields[i]);

                    dataGridViewX1.Columns.Add(newColumn);
                }

                // 增加数据行
                ShowObjectData(objectInfo.strType);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 初始化重生组
        /// </summary>
        private void InitReviveGroup()
        {
            int    reviveGroupCount = 0;
            string groupName        = "NpcReviveGroup";

            switch (objectType)
            {
            case "NPC":
            {
                break;
            }

            case "Doodad":
            {
                groupName = "DoodadReviveGroup";
                break;
            }
            }

            reviveGroupInfoList.Clear();
            baseDoc.DocLogical.GetObjCount(groupName, 0, ref reviveGroupCount);
            if (reviveGroupCount > 0)
            {
                _AtlObjInfo objectInfo = new _AtlObjInfo();

                for (int i = 0; i < reviveGroupCount; i++)
                {
                    baseDoc.DocLogical.GetObjDisplayInfo(groupName, i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    baseDoc.DocLogical.GetSetObjInfo(groupName, ref objectInfo, logicObj, 1);
                    reviveGroupInfoList.Add(objectInfo);
                }
            }
        }
Beispiel #9
0
        public void AddPolyTreeNode()
        {
            //InitPoly();
            int polyCount = 0;

            m_doc.DocLogical.GetObjCount("LogicalPoly", 0, ref polyCount);

            _AtlObjInfo polyinfo = new _AtlObjInfo();

            m_doc.DocLogical.GetObjDisplayInfo("LogicalPoly", polyCount - 1, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
            m_doc.DocLogical.GetSetObjInfo("LogicalPoly", ref polyinfo, logicObj, 1);
            polyinfo.strValues[3] = "0";
            polyinfo.strValues[1] = name = "未命名";
            m_doc.DocLogical.GetSetObjInfo("LogicalPoly", ref polyinfo, logicObj, 0);
            polyinfo.iLogicObjPtr     = logicObj;
            polyinfo.iRepresentObjPtr = representObj;

            Node polyNode = new Node();

            polyNode.Text = string.Format("{0} ({1})", name, nickName);
            polyNode.Tag  = polyinfo;
            nodePolies.Nodes.Add(polyNode);

            this.advTreePoly.SelectedNode = polyNode;
        }
Beispiel #10
0
        private void buttonDel_Click(object sender, EventArgs e) // 删除
        {
            if (this.advTreePoly.SelectedNode == null)
            {
                MessageBox.Show("未选中任何结点");
                return;
            }

            _AtlObjInfo selectedinfo = (_AtlObjInfo)this.advTreePoly.SelectedNode.Tag;

            if (this.advTreePoly.SelectedNode.Parent.Text == "多边形")
            {
                //m_doc.DocLogical.DeleteSelectedPoly();
                m_doc.DocLogical.DeleteSelectedObject();
                //this.advTreePoly.SelectedNode.Remove();
            }
            else if (this.advTreePoly.SelectedNode.Parent.Text == "笔刷")
            {
                int iMask = Convert.ToInt32(selectedinfo.strValues[4]);
                if (iMask != 0)
                {
                    SceneSceneEditor.DeleteCurrentCellInfo();

                    int iID = Convert.ToInt32(selectedinfo.strValues[0]);
                    m_doc.DocLogical.DeleteOneLogicalBrush(iID);

                    this.advTreePoly.Nodes.Remove(this.advTreePoly.SelectedNode);
                    this.advTreePoly.SelectedNode.Remove();
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// 检查当前选中的对象是否能够旋转 ahpho suntao
        /// </summary>
        /// <returns>是否能够旋转</returns>
        private bool CheckObjectCanRotate()
        {
            bool canRotate = true;

            int entityCount = 0;

            SceneSceneEditor.GetSelectedEntityCount(ref entityCount);

            _AtlObjInfo[] objInfoArray = new _AtlObjInfo[entityCount];
            for (int i = 0; i < entityCount; i++)
            {
                string objectType = objInfoArray[i].strType;
                if (objectType == "NPC" || objectType == "Doodad")
                {
                    ;
                }
                else
                {
                    canRotate = false;
                    break;
                }
            }

            return(canRotate);
        }
Beispiel #12
0
 private void SetLogicSceneEditorBrushState(_AtlObjInfo atlobj)
 {
     SceneSceneEditor.SetEditState(SCENESTATE_CELLLOGICAL);
     SceneSceneEditor.ClearLogicModifyState();
     SceneSceneEditor.SetLogicModifyState(Convert.ToInt32(atlobj.strValues[4]), atlobj.strValues[3]);
     SceneSceneEditor.SetLogicCurrentColor(stringToColor(atlobj.strValues[1]));
     SceneSceneEditor.SetCurrentEditBrushIndex(Convert.ToInt32(atlobj.strValues[0]));
 }
Beispiel #13
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (this.advTreePoly.SelectedNode == null || this.advTreePoly.SelectedNode.Level != 1)
            {
                MessageBox.Show("未选中任何多边形/笔刷结点");
                return;
            }

            _AtlObjInfo selectedinfo = (_AtlObjInfo)this.advTreePoly.SelectedNode.Tag;

            if (this.advTreePoly.SelectedNode.Parent.Text == "多边形")
            {
                selectedinfo.strValues[0] = this.textBoxScript.Text;
                selectedinfo.strValues[5] = this.textBoxHeight.Text;
                int iNewMask = 0
                               + (this.checkBoxBlock.Checked ? LSTATE_BLOCKCHARACTER : 0)
                               + (this.checkBoxPut.Checked ? LSTATE_PUTOBJECT : 0)
                               + (this.checkBoxStall.Checked ? LSTATE_STALL : 0)
                               + (this.checkBoxIndoor.Checked ? LSTATE_INDOOR : 0)
                               + (this.checkBoxRest.Checked ? LSTATE_REST : 0)
                               + (this.checkBoxRideHorse.Checked ? LSTATE_RIDEHORSE : 0);
                selectedinfo.strValues[3] = iNewMask.ToString();
                selectedinfo.strValues[1] = this.textLogicName.Text;
                selectedinfo.strValues[4] = this.colorPicker.Style.BackColor1.Color.ToArgb().ToString();

                SaveLogicInfoUI((_AtlObjInfo)this.advTreePoly.SelectedNode.Tag);
            }
            else if (this.advTreePoly.SelectedNode.Parent.Text == "笔刷")
            {
                int    oldMask   = Convert.ToInt32(selectedinfo.strValues[4]);
                string oldScript = selectedinfo.strValues[3];

                selectedinfo.strValues[3] = this.textBoxScript.Text;
                //selectedinfo.strValues[5] = this.textBoxHeight.Text;
                int iNewMask = 0
                               + (this.checkBoxBlock.Checked ? LSTATE_BLOCKCHARACTER : 0)
                               + (this.checkBoxPut.Checked ? LSTATE_PUTOBJECT : 0)
                               + (this.checkBoxStall.Checked ? LSTATE_STALL : 0)
                               + (this.checkBoxIndoor.Checked ? LSTATE_INDOOR : 0)
                               + (this.checkBoxRest.Checked ? LSTATE_REST : 0)
                               + (this.checkBoxRideHorse.Checked ? LSTATE_RIDEHORSE : 0);
                selectedinfo.strValues[4] = iNewMask.ToString();
                selectedinfo.strValues[2] = this.textLogicName.Text;
                selectedinfo.strValues[1] = this.colorPicker.Style.BackColor1.Color.ToArgb().ToString();

                SaveLogicInfoUI((_AtlObjInfo)this.advTreePoly.SelectedNode.Tag);
                SceneSceneEditor.SetLogicCurrentColor(stringToColor(selectedinfo.strValues[1]));

                // 中途更新笔刷数据,要把原来刷的也改了,不然会有问题。
                SceneSceneEditor.ModifyCurrentCellInfo(SceneSceneEditor.TransToEngineFormat(oldMask), SceneSceneEditor.TransToEngineFormat(iNewMask), oldScript, selectedinfo.strValues[3]);

                SetLogicSceneEditorBrushState(selectedinfo);
            }

            this.advTreePoly.SelectedNode.Text = string.Format("{0}{1}", this.textLogicName.Text, this.textBoxScript.Text.Length > 0 ? " [√]" : string.Empty);
            this.buttonOK.Enabled = false;
        }
Beispiel #14
0
        /// <summary>
        /// 将对象信息转换为数据表
        /// </summary>
        /// <param name="objectInfo">对象信息</param>
        /// <returns>数据表</returns>
        private Hashtable GetInfoTable(_AtlObjInfo objectInfo)
        {
            Hashtable infoTable = new Hashtable();

            for (int i = 0; i < objectInfo.iFieldsCount; i++)
            {
                infoTable[objectInfo.strFields[i]] = objectInfo.strValues[i];
            }

            return infoTable;
        }
Beispiel #15
0
        /// <summary>
        /// 获取对象信息数据表
        /// </summary>
        /// <param name="objectInfo">对象信息</param>
        /// <returns>数据表</returns>
        public static Hashtable GetInfoTable(_AtlObjInfo objectInfo)
        {
            Hashtable infoTable = new Hashtable();

            for (int i = 0; i < objectInfo.iFieldsCount; i++)
            {
                infoTable[objectInfo.strFields[i]] = objectInfo.strValues[i];
            }

            return(infoTable);
        }
Beispiel #16
0
        /// <summary>
        /// 创建重生组
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX9_Click(object sender, EventArgs e)
        {
            int    minValue  = integerInput1.Value;
            int    maxValue  = integerInput2.Value;
            string groupName = textBoxX3.Text;

            if (groupName != "")
            {
                int groupID = 0;

                switch (objectType)
                {
                case "NPC":
                {
                    baseDoc.DocLogical.DecoratedNewOneNpcReviveGroup(ref groupID, groupName, minValue, maxValue);

                    break;
                }

                case "Doodad":
                {
                    baseDoc.DocLogical.DecoratedNewOneDoodadReviveGroup(ref groupID, groupName, minValue, maxValue);

                    break;
                }

                default:
                {
                    MessageBox.Show("没有指定分组类型!", "创建重生组", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                }
                }

                InitReviveGroup();
                FillReviveGroup();
                FillAllGroup();

                // 自动为当前选中的对象设置分组
                _AtlObjInfo groupInfo      = reviveGroupInfoList[reviveGroupInfoList.Count - 1];
                Hashtable   groupInfoTable = Helper.GetInfoTable(groupInfo);
                int         newGroupID     = int.Parse(groupInfoTable["dwGroupID"] as string);
                SetGroup(newGroupID, GroupType.ReviveGroup);

                MessageBox.Show("重生组创建成功!", "创建重生组", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("请先输入分组名称!", "创建重生组", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #17
0
        private _AtlVector3 GetAtlObjPos(_AtlObjInfo obj)
        {
            _AtlVector3 pos;

            pos.x = pos.y = pos.z = 0.0f;
            if (obj.strType == "NPC")
            {
                string[] _str = obj.strValues[16].Split(new char[] { ',' });
                pos.x = (float)(Convert.ToDouble(_str[0]));
                pos.y = (float)(Convert.ToDouble(_str[1]));
                pos.z = (float)(Convert.ToDouble(_str[2]));
            }
            return(pos);
        }
Beispiel #18
0
        private void ToSelectPoly(int logicObj)
        {
            foreach (Node node in this.advTreePoly.Nodes)
            {
                _AtlObjInfo polyinfo = (_AtlObjInfo)node.Tag;
                if (polyinfo.iLogicObjPtr == logicObj)
                {
                    this.advTreePoly.SelectedNode = node;
                }
            }

            advTreePoly_AfterNodeSelect(null, null);
            this.SideCtrlBar.SelectedDockTab = 5;
        }
Beispiel #19
0
        /// <summary>
        /// 编辑分组 ahpho suntao
        /// </summary>
        private void EditGroup()
        {
            int entityCount = -1;

            SceneSceneEditor.GetSelectedEntityCount(ref entityCount);

            List <_AtlObjInfo> objectInfoList = new List <_AtlObjInfo>();
            string             objectType     = "";

            for (int i = 0; i < entityCount; i++)
            {
                int    iLogicObjPtr = 0;
                string objTypeName  = string.Empty;
                m_doc.DocLogical.GetSelectedLogicObjPtr(i, ref iLogicObjPtr, ref objTypeName);
                _AtlObjInfo atlinfo = new _AtlObjInfo();
                atlinfo.bChanged     = 1;
                atlinfo.iLogicObjPtr = iLogicObjPtr;
                //_AtlObjInfo中要储存iLogicObjPtr entityPtr,方便C#对话框保存时 直接exchange去docLogical,
                //再用iLogicObjPtr之逻辑更新entityPtr指向的表现。
                m_doc.DocLogical.GetSetObjInfo(objTypeName, ref atlinfo, iLogicObjPtr, 1);

                if (objectType == "")
                {
                    objectType = atlinfo.strType;
                    objectInfoList.Add(atlinfo);
                }
                else
                {
                    if (atlinfo.strType == objectType)
                    {
                        objectInfoList.Add(atlinfo);
                    }
                }
            }

            if (entityCount > 0)
            {
                GroupForm gForm = new GroupForm();
                gForm.CurrentBaseDoc = m_doc;
                gForm.ObjectType     = objectType;
                gForm.ObjectInfoList = objectInfoList;
                gForm.Init();
                gForm.ShowDialog();
            }
            else
            {
                MessageBox.Show("请先选择要设置分组的对象!", "设置分组", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #20
0
        /// <summary>
        /// 初始化分组链表
        /// </summary>
        /// <param name="groupName">分组名称</param>
        /// <param name="groupInfoList">分组链表</param>
        private void InitGroupInfoList(string groupName, List <_AtlObjInfo> groupInfoList)
        {
            int         groupCount = 0;
            _AtlObjInfo objectInfo = new _AtlObjInfo();

            groupInfoList.Clear();
            baseDoc.DocLogical.GetObjCount(groupName, 0, ref groupCount);

            for (int i = 0; i < groupCount; i++)
            {
                baseDoc.DocLogical.GetObjDisplayInfo(groupName, i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                baseDoc.DocLogical.GetSetObjInfo(groupName, ref objectInfo, logicObj, 1);
                groupInfoList.Add(objectInfo);
            }
        }
Beispiel #21
0
        /// <summary>
        /// 获取字段对应的序号 ahpho suntao
        /// </summary>
        /// <param name="objectInfo">对象信息</param>
        /// <param name="field">字段</param>
        /// <returns>字段对应的序号</returns>
        private int GetFieldIndex(_AtlObjInfo objectInfo, string field)
        {
            int index = -1;

            for (int i = 0; i < objectInfo.iFieldsCount; i++)
            {
                if (objectInfo.strFields[i] == field)
                {
                    index = i;
                    break;
                }
            }

            return(index);
        }
Beispiel #22
0
        /// <summary>
        /// 添加交通路径及小点
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX7_Click(object sender, EventArgs e)
        {
            Node currentNode = trafficTree.SelectedNode;
            int  trafficID   = 0;
            int  addPoint    = 0;

            if (currentNode != null && currentNode.Level == 0)
            {
                _AtlObjInfo objectInfo = (_AtlObjInfo)currentNode.Tag;
                Hashtable   infoTable  = Helper.GetInfoTable(objectInfo);
                trafficID = int.Parse(infoTable["m_dwID"] as string);
            }

            m_doc.DocLogical.DecoratedAddOneTrafficPointSet(trafficID, addPoint);
            editMode = EditMode.AddTrafficPoint;
        }
Beispiel #23
0
        private bool InitPoly()
        {
            this.advTreePoly.Nodes.Clear();
            nodePolies      = new Node();
            nodePolies.Text = "多边形";
            this.advTreePoly.Nodes.Add(nodePolies);
            nodeBrushes      = new Node();
            nodeBrushes.Text = "笔刷";
            this.advTreePoly.Nodes.Add(nodeBrushes);

            // 加载多边形生成结点
            int polyCount = 0;

            m_doc.DocLogical.GetObjCount("LogicalPoly", 0, ref polyCount);
            for (int i = 0; i < polyCount; i++)
            {
                _AtlObjInfo polyinfo = new _AtlObjInfo();
                m_doc.DocLogical.GetObjDisplayInfo("LogicalPoly", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                m_doc.DocLogical.GetSetObjInfo("LogicalPoly", ref polyinfo, logicObj, 1);
                polyinfo.iLogicObjPtr = logicObj;

                Node polyNode = new Node();
                polyNode.Text = string.Format("{0}{1}", name, hasScript != 0 ? " [√]" : string.Empty);
                polyNode.Tag  = polyinfo;
                nodePolies.Nodes.Add(polyNode);
            }

            // 加载逻辑数据生成结点
            int brushCount = 0;

            m_doc.DocLogical.GetObjCount("LogicalBrush", 0, ref brushCount);
            for (int i = 0; i < brushCount; i++)
            {
                _AtlObjInfo Brushinfo = new _AtlObjInfo();
                m_doc.DocLogical.GetObjDisplayInfo("LogicalBrush", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                m_doc.DocLogical.GetSetObjInfo("LogicalBrush", ref Brushinfo, logicObj, 1);
                Brushinfo.iLogicObjPtr = logicObj;

                Node BrushNode = new Node();
                BrushNode.Text = string.Format("{0}{1}", name, hasScript != 0 ? " [√]" : string.Empty);
                BrushNode.Tag  = Brushinfo;
                nodeBrushes.Nodes.Add(BrushNode);
            }


            return(true);
        }
Beispiel #24
0
        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;
            }
        }
Beispiel #25
0
        /// <summary>
        /// 旋转选中的部件
        /// </summary>
        private void RotateSelectedObject()
        {
            string newRotation = null;

            SceneSceneEditor.RotateSelectedObject(ref newRotation);
            if (newRotation != null) // 已经改变朝向
            {
                string[] rotations = newRotation.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                int entityCount = -1;
                SceneSceneEditor.GetSelectedEntityCount(ref entityCount);

                _AtlObjInfo[] objinfos = new _AtlObjInfo[entityCount];
                for (int i = 0; i < entityCount; i++)
                {
                    int    iLogicObjPtr = 0;
                    string objTypeName  = string.Empty;
                    m_doc.DocLogical.GetSelectedLogicObjPtr(i, ref iLogicObjPtr, ref objTypeName);
                    _AtlObjInfo atlinfo = new _AtlObjInfo();
                    atlinfo.bChanged     = 1;
                    atlinfo.iLogicObjPtr = iLogicObjPtr;
                    //_AtlObjInfo中要储存iLogicObjPtr entityPtr,方便C#对话框保存时 直接exchange去docLogical,
                    //再用iLogicObjPtr之逻辑更新entityPtr指向的表现。
                    m_doc.DocLogical.GetSetObjInfo(objTypeName, ref atlinfo, iLogicObjPtr, 1);
                    objinfos[i] = atlinfo;

                    // 写入新的旋转角度信息
                    for (int j = 0; j < atlinfo.iFieldsCount; j++)
                    {
                        if (atlinfo.strFields[j] == "vRotation")
                        {
                            atlinfo.strValues[j] = newRotation;
                        }
                        else if (atlinfo.strFields[j] == "nFaceDirection")
                        {
                            atlinfo.strValues[j] = ConvertRotationToDirection(rotations[i]);
                        }
                    }

                    // 更新对象数据
                    m_doc.DocLogical.GetSetObjInfo(atlinfo.strType, ref atlinfo, atlinfo.iLogicObjPtr, 0);
                    m_doc.DocLogical.UpdateObjRepresentByLogicObj(ref atlinfo, atlinfo.iLogicObjPtr);
                }
            }
        }
Beispiel #26
0
        private bool InitPoly()
        {
            this.advTreePoly.Nodes.Clear();
            nodePolies = new Node();
            nodePolies.Text = "多边形";
            this.advTreePoly.Nodes.Add(nodePolies);
            nodeBrushes = new Node();
            nodeBrushes.Text = "笔刷";
            this.advTreePoly.Nodes.Add(nodeBrushes);

            // 加载多边形生成结点
            int polyCount = 0;
            m_doc.DocLogical.GetObjCount("LogicalPoly", 0, ref polyCount);
            for (int i = 0; i < polyCount; i++)
            {
                _AtlObjInfo polyinfo = new _AtlObjInfo();
                m_doc.DocLogical.GetObjDisplayInfo("LogicalPoly", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                m_doc.DocLogical.GetSetObjInfo("LogicalPoly", ref polyinfo, logicObj, 1);
                polyinfo.iLogicObjPtr = logicObj;

                Node polyNode = new Node();
                polyNode.Text = string.Format("{0}{1}", name, hasScript != 0 ? " [√]" : string.Empty);
                polyNode.Tag = polyinfo;
                nodePolies.Nodes.Add(polyNode);
            }

            // 加载逻辑数据生成结点
            int brushCount = 0;
            m_doc.DocLogical.GetObjCount("LogicalBrush", 0, ref brushCount);
            for (int i = 0; i < brushCount; i++)
            {
                _AtlObjInfo Brushinfo = new _AtlObjInfo();
                m_doc.DocLogical.GetObjDisplayInfo("LogicalBrush", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                m_doc.DocLogical.GetSetObjInfo("LogicalBrush", ref Brushinfo, logicObj, 1);
                Brushinfo.iLogicObjPtr = logicObj;

                Node BrushNode = new Node();
                BrushNode.Text = string.Format("{0}{1}", name, hasScript != 0 ? " [√]" : string.Empty);
                BrushNode.Tag = Brushinfo;
                nodeBrushes.Nodes.Add(BrushNode);
            }


            return true;
        }
Beispiel #27
0
        /// <summary>
        /// 设置当前选中的NPC的分组信息
        /// </summary>
        /// <param name="fieldName">分组字段</param>
        /// <param name="groupID">分组ID</param>
        private void SetGroupInfo(string fieldName, string groupID)
        {
            int    logicObj     = 0;
            int    representObj = 0;
            int    hasScript    = 0;
            string name         = "";
            string nickName     = "";

            for (int i = 0; i < objectInfoList.Count; i++)
            {
                _AtlObjInfo objectInfo = objectInfoList[i];
                Hashtable   infoTable  = Helper.GetInfoTable(objectInfo);
                int         nIndex     = int.Parse(infoTable["nIndex"] as string);

                for (int j = 0; j < objectInfo.strFields.Length; j++)
                {
                    if (objectInfo.strFields[j] == fieldName)
                    {
                        bool reqireUpdate = false;

                        if (objectInfo.strValues[j] == "0" || objectInfo.strValues[j] == "")
                        {
                            reqireUpdate = true;
                        }
                        else
                        {
                            if (objectInfo.strValues[j] != groupID && checkBoxX1.Checked)
                            {
                                reqireUpdate = true;
                            }
                        }

                        if (reqireUpdate)
                        {
                            objectInfo.strValues[j] = groupID;
                            objectInfo.bChanged     = 1;
                            baseDoc.DocLogical.GetObjDisplayInfo(objectType, nIndex, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                            baseDoc.DocLogical.GetSetObjInfo(objectType, ref objectInfo, logicObj, 0);
                        }

                        break;
                    }
                }
            }
        }
Beispiel #28
0
        /// <summary>
        /// 创建随机组
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX5_Click(object sender, EventArgs e)
        {
            string groupName = textBoxX2.Text;

            if (groupName != "")
            {
                List <string> npcInfoList = new List <string>();

                foreach (DataRow dataRow in BaseForm.npcTable.Rows)
                {
                    npcInfoList.Add(string.Format("{0} ({1})", dataRow["Name"].ToString(), dataRow["ID"].ToString()));
                }

                RandomGroupConfigForm rForm = new RandomGroupConfigForm(npcInfoList);

                if (rForm.ShowDialog() == DialogResult.OK)
                {
                    StringBuilder infoString = new StringBuilder();

                    foreach (string s in rForm.NpcTemplateIDList)
                    {
                        infoString.Append(string.Format("{0},", s));
                    }

                    infoString.Remove(infoString.Length - 1, 1);

                    baseDoc.DocLogical.DecoratedNewOneRandomGroup(groupName, infoString.ToString());
                    InitRandomGroup();
                    FillRandomGroup();
                    FillAllGroup();

                    // 自动为当前选中的对象设置分组
                    _AtlObjInfo objectInfo = randomGroupInfoList[randomGroupInfoList.Count - 1];
                    Hashtable   infoTable  = Helper.GetInfoTable(objectInfo);
                    int         groupID    = int.Parse(infoTable["dwGroupID"] as string);
                    SetGroup(groupID, GroupType.RandomGroup);

                    MessageBox.Show("随机组创建成功!", "创建随机组", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("请先输入分组名称!", "创建随机组", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #29
0
        /// <summary>
        /// 交通路径和交通点值改变
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void dataGridViewX2_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (beginEdit && e.RowIndex >= 0)
            {
                DataGridViewCell currentCell = dataGridViewX2[e.ColumnIndex, e.RowIndex];
                _AtlObjInfo      objectInfo  = (_AtlObjInfo)trafficTree.SelectedNode.Tag;
                int parentIndex = 0;
                int index       = trafficTree.SelectedNode.Index;
                int fieldIndex  = GetFieldIndex(objectInfo, currentCell.OwningRow.Tag as string);

                if (trafficTree.SelectedNode.Level == 1) // 编辑路径点
                {
                    parentIndex = trafficTree.SelectedNode.Parent.Index;
                }

                SaveObjectData(currentCell, objectInfo, index, parentIndex);
            }
        }
Beispiel #30
0
        /// <summary>
        /// 初始化随机组
        /// </summary>
        private void InitRandomGroup()
        {
            int randomGroupCount = 0;

            randomGroupInfoList.Clear();
            baseDoc.DocLogical.GetObjCount("NpcRandomGroup", 0, ref randomGroupCount);

            if (randomGroupCount > 0)
            {
                _AtlObjInfo objectInfo = new _AtlObjInfo();

                for (int i = 0; i < randomGroupCount; i++)
                {
                    baseDoc.DocLogical.GetObjDisplayInfo("NpcRandomGroup", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    baseDoc.DocLogical.GetSetObjInfo("NpcRandomGroup", ref objectInfo, logicObj, 1);
                    randomGroupInfoList.Add(objectInfo);
                }
            }
        }
Beispiel #31
0
        /// <summary>
        /// 删除仇恨组
        /// </summary>
        private void DeleteHatredGroup()
        {
            Node currentNode = aiTree.SelectedNode;

            if (currentNode != null)
            {
                Hashtable infoTable = currentNode.Tag as Hashtable;
                string    groupID   = infoTable["dwSetID"] as string;

                // 先更新所有NPC的分组信息
                string groupField = "TeamID";
                int    npcCount   = 0;
                baseDoc.DocLogical.GetObjCount("NPC", 0, ref npcCount);

                for (int i = 0; i < npcCount; i++)
                {
                    _AtlObjInfo objectInfo = new _AtlObjInfo();
                    baseDoc.DocLogical.GetObjDisplayInfo("NPC", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    baseDoc.DocLogical.GetSetObjInfo("NPC", ref objectInfo, logicObj, 1);

                    for (int j = 0; j < objectInfo.strFields.Length; j++)
                    {
                        string fieldName = objectInfo.strFields[j];

                        if (fieldName == groupField)
                        {
                            if (objectInfo.strValues[j] == groupID)
                            {
                                objectInfo.strValues[j] = "0";
                                objectInfo.bChanged     = 1;
                                baseDoc.DocLogical.GetSetObjInfo("NPC", ref objectInfo, logicObj, 0);
                            }

                            break;
                        }
                    }
                }

                // 再删除该分组
                baseDoc.DocLogical.DecoratedDeleteAIGroup(int.Parse(groupID));
                aiTree.Nodes.Remove(currentNode);
            }
        }
Beispiel #32
0
        /// <summary>
        /// 更新对象数据
        /// </summary>
        /// <param name="objectInfo">对象信息</param>
        /// <param name="fieldName">需要更新的字段</param>
        /// <param name="fieldValue">需要更新的值</param>
        /// <param name="index">对象编号</param>
        /// <param name="parentIndex">父对象编号</param>
        private void UpdateObjectInfo(_AtlObjInfo objectInfo, string fieldName, string fieldValue, int index, int parentIndex)
        {
            int fieldIndex = GetFieldIndex(objectInfo, fieldName);

            if (fieldIndex >= 0)
            {
                string oldValue = objectInfo.strValues[fieldIndex];

                if (oldValue != fieldValue)
                {
                    string objectType = objectInfo.strType;
                    objectInfo.bChanged = 1;
                    m_doc.DocLogical.GetObjDisplayInfo(objectType, index, parentIndex, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    objectInfo.strValues[fieldIndex] = fieldValue;
                    m_doc.DocLogical.GetSetObjInfo(objectType, ref objectInfo, logicObj, 0);
                    m_doc.DocLogical.UpdateObjRepresentByLogicObj(ref objectInfo, logicObj);
                }
            }
        }
Beispiel #33
0
        /// <summary>
        /// 刷新交通数据
        /// </summary>
        private void RefreshTraffic()
        {
            trafficTree.Nodes.Clear();

            int trafficCount = 0;

            m_doc.DocLogical.GetObjCount("TrafficLittlePointSet", 0, ref trafficCount);
            if (trafficCount > 0)
            {
                _AtlObjInfo trafficInfo = new _AtlObjInfo();

                for (int i = 0; i < trafficCount; i++)
                {
                    m_doc.DocLogical.GetObjDisplayInfo("TrafficLittlePointSet", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    m_doc.DocLogical.GetSetObjInfo("TrafficLittlePointSet", ref trafficInfo, logicObj, 1);
                    Hashtable trafficInfoTable = Helper.GetInfoTable(trafficInfo);

                    int trafficPointCount = 0;
                    m_doc.DocLogical.GetObjCount("TrafficLittlePoint", i, ref trafficPointCount);

                    Node trafficNode = new Node();
                    trafficNode.Text = string.Format("{0} ({1})", trafficInfoTable["szName"], trafficPointCount.ToString());
                    trafficNode.Tag  = trafficInfo;
                    trafficTree.Nodes.Add(trafficNode);

                    for (int j = 0; j < trafficPointCount; j++)
                    {
                        _AtlObjInfo trafficPointInfo = new _AtlObjInfo();
                        m_doc.DocLogical.GetObjDisplayInfo("TrafficLittlePoint", j, i, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                        m_doc.DocLogical.GetSetObjInfo("TrafficLittlePoint", ref trafficPointInfo, logicObj, 1);
                        Hashtable patrolPointInfoTable = Helper.GetInfoTable(trafficPointInfo);

                        Node trafficPointNode = new Node();
                        trafficPointNode.Text = j.ToString();
                        trafficPointNode.Tag  = trafficPointInfo;
                        trafficNode.Nodes.Add(trafficPointNode);
                    }
                }

                m_doc.DocLogical.RefreshTraffic();
            }
        }
Beispiel #34
0
        /// <summary>
        /// 刷新交通数据
        /// </summary>
        private void RefreshTraffic()
        {
            trafficTree.Nodes.Clear();

            int trafficCount = 0;
            m_doc.DocLogical.GetObjCount("TrafficLittlePointSet", 0, ref trafficCount);
            if (trafficCount > 0)
            {
                _AtlObjInfo trafficInfo = new _AtlObjInfo();

                for (int i = 0; i < trafficCount; i++)
                {
                    m_doc.DocLogical.GetObjDisplayInfo("TrafficLittlePointSet", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    m_doc.DocLogical.GetSetObjInfo("TrafficLittlePointSet", ref trafficInfo, logicObj, 1);
                    Hashtable trafficInfoTable = Helper.GetInfoTable(trafficInfo);

                    int trafficPointCount = 0;
                    m_doc.DocLogical.GetObjCount("TrafficLittlePoint", i, ref trafficPointCount);

                    Node trafficNode = new Node();
                    trafficNode.Text = string.Format("{0} ({1})", trafficInfoTable["szName"], trafficPointCount.ToString());
                    trafficNode.Tag = trafficInfo;
                    trafficTree.Nodes.Add(trafficNode);

                    for (int j = 0; j < trafficPointCount; j++)
                    {
                        _AtlObjInfo trafficPointInfo = new _AtlObjInfo();
                        m_doc.DocLogical.GetObjDisplayInfo("TrafficLittlePoint", j, i, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                        m_doc.DocLogical.GetSetObjInfo("TrafficLittlePoint", ref trafficPointInfo, logicObj, 1);
                        Hashtable patrolPointInfoTable = Helper.GetInfoTable(trafficPointInfo);

                        Node trafficPointNode = new Node();
                        trafficPointNode.Text = j.ToString();
                        trafficPointNode.Tag = trafficPointInfo;
                        trafficNode.Nodes.Add(trafficPointNode);
                    }
                }

                m_doc.DocLogical.RefreshTraffic();
            }
        }
Beispiel #35
0
        /// <summary>
        /// 初始化巡逻路径链表
        /// </summary>
        private void InitPatrolPathTable()
        {
            int patrolCount = 0;
            m_doc.DocLogical.GetObjCount("WayPointSet", 0, ref patrolCount);

            _AtlObjInfo patrolInfo = new _AtlObjInfo();
            patrolPathTable.Rows.Clear();

            for (int i = 0; i < patrolCount; i++)
            {
                int patroPathIndex = i + 1;
                m_doc.DocLogical.GetObjDisplayInfo("WayPointSet", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                m_doc.DocLogical.GetSetObjInfo("WayPointSet", ref patrolInfo, logicObj, 1);
                Hashtable patrolInfoTable = Helper.GetInfoTable(patrolInfo);

                DataRow dataRow = patrolPathTable.NewRow();
                dataRow["ID"] = patroPathIndex.ToString();
                dataRow["Name"] = patrolInfoTable["szName"];
                patrolPathTable.Rows.Add(dataRow);
            }
        }
Beispiel #36
0
        /// <summary>
        /// 刷新路径数据
        /// </summary>
        private void RefreshPatrol()
        {
            patrolTree.Nodes.Clear();

            int patrolCount = 0;
            m_doc.DocLogical.GetObjCount("WayPointSet", 0, ref patrolCount);

            if (patrolCount > 0)
            {
                _AtlObjInfo patrolInfo = new _AtlObjInfo();

                for (int i = 0; i < patrolCount; i++)
                {
                    int logicObj = 0;
                    int representObj = 0;
                    int hasScript = 0;
                    string name = "";
                    string nickName = "";

                    m_doc.DocLogical.GetObjDisplayInfo("WayPointSet", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    m_doc.DocLogical.GetSetObjInfo("WayPointSet", ref patrolInfo, logicObj, 1);
                    Hashtable patrolInfoTable = Helper.GetInfoTable(patrolInfo);

                    // 添加路径树结点
                    Node patrolNode = new Node();
                    patrolNode.Text = string.Format("{0} ({1})", patrolInfoTable["szName"], i.ToString());
                    patrolNode.Tag = patrolInfo;
                    patrolTree.Nodes.Add(patrolNode);

                    int patrolIndex = int.Parse(patrolInfoTable["nIndex"] as string);
                    int patrolPointCount = 0;
                    m_doc.DocLogical.GetObjCount("WayPoint", i, ref patrolPointCount);

                    for (int j = 0; j < patrolPointCount; j++)
                    {
                        _AtlObjInfo patrolPointInfo = new _AtlObjInfo();
                        m_doc.DocLogical.GetObjDisplayInfo("WayPoint", j, i, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                        m_doc.DocLogical.GetSetObjInfo("WayPoint", ref patrolPointInfo, logicObj, 1);
                        Hashtable patrolPointInfoTable = Helper.GetInfoTable(patrolPointInfo);

                        // 刷新路径点类型
                        int wayPointType = 1;

                        if (j == 0)
                        {
                            wayPointType = 0;
                        }
                        else if (j == patrolPointCount - 1)
                        {
                            wayPointType = 2;
                        }

                        m_doc.DocLogical.RefreshWayPoint(representObj, wayPointType);

                        // 添加路径点树结点
                        Node patrolPointNode = new Node();
                        patrolPointNode.Text = j.ToString();
                        patrolPointNode.Tag = patrolPointInfo;
                        patrolNode.Nodes.Add(patrolPointNode);
                    }
                }

                m_doc.DocLogical.RefreshWay();
            }
        }
Beispiel #37
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;
        }
Beispiel #38
0
        /// <summary>
        /// 初始化重生组
        /// </summary>
        private void InitReviveGroup()
        {
            int reviveGroupCount = 0;
            string groupName = "NpcReviveGroup";

            switch(objectType)
            {
                case "NPC":
                    {                        
                        break;
                    }
                case "Doodad":
                    {
                        groupName = "DoodadReviveGroup";
                        break;
                    }
            }

            reviveGroupInfoList.Clear();
            baseDoc.DocLogical.GetObjCount(groupName, 0, ref reviveGroupCount);
            if (reviveGroupCount > 0)
            {
                _AtlObjInfo objectInfo = new _AtlObjInfo();

                for (int i = 0; i < reviveGroupCount; i++)
                {
                    baseDoc.DocLogical.GetObjDisplayInfo(groupName, i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    baseDoc.DocLogical.GetSetObjInfo(groupName, ref objectInfo, logicObj, 1);                    
                    reviveGroupInfoList.Add(objectInfo);                                        
                }
            }
        }
Beispiel #39
0
        /// <summary>
        /// 编辑分组 ahpho suntao
        /// </summary>
        private void EditGroup()
        {
            int entityCount = -1;
            SceneSceneEditor.GetSelectedEntityCount(ref entityCount);

            List<_AtlObjInfo> objectInfoList = new List<_AtlObjInfo>();
            string objectType = "";

            for (int i = 0; i < entityCount; i++)
            {
                int iLogicObjPtr = 0;
                string objTypeName = string.Empty;
                m_doc.DocLogical.GetSelectedLogicObjPtr(i, ref iLogicObjPtr, ref objTypeName);
                _AtlObjInfo atlinfo = new _AtlObjInfo();
                atlinfo.bChanged = 1;
                atlinfo.iLogicObjPtr = iLogicObjPtr;
                //_AtlObjInfo中要储存iLogicObjPtr entityPtr,方便C#对话框保存时 直接exchange去docLogical,
                //再用iLogicObjPtr之逻辑更新entityPtr指向的表现。
                m_doc.DocLogical.GetSetObjInfo(objTypeName, ref atlinfo, iLogicObjPtr, 1);

                if (objectType == "")
                {
                    objectType = atlinfo.strType;
                    objectInfoList.Add(atlinfo);
                }
                else
                {
                    if (atlinfo.strType == objectType)
                    {
                        objectInfoList.Add(atlinfo);
                    }
                }
            }

            if (entityCount > 0)
            {
                GroupForm gForm = new GroupForm();
                gForm.CurrentBaseDoc = m_doc;
                gForm.ObjectType = objectType;
                gForm.ObjectInfoList = objectInfoList;
                gForm.Init();
                gForm.ShowDialog();
            }
            else
            {
                MessageBox.Show("请先选择要设置分组的对象!", "设置分组", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #40
0
        private void buttonX13_Click(object sender, EventArgs e) // 新建
        {
            int nid = 0;
            m_doc.DocLogical.AddOneNewLogicalBrush(ref nid);

            int brushCount = 0;
            m_doc.DocLogical.GetObjCount("LogicalBrush", 0, ref brushCount);

            _AtlObjInfo Brushinfo = new _AtlObjInfo();
            m_doc.DocLogical.GetObjDisplayInfo("LogicalBrush", brushCount - 1, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
            m_doc.DocLogical.GetSetObjInfo("LogicalBrush", ref Brushinfo, logicObj, 1);
            Brushinfo.iLogicObjPtr = logicObj;

            Node BrushNode = new Node();
            BrushNode.Text = string.Format("{0}{1}", name, hasScript != 0 ? " [√]" : string.Empty);
            BrushNode.Tag = Brushinfo;
            nodeBrushes.Nodes.Add(BrushNode);

            this.advTreePoly.SelectedNode = BrushNode;
        }
Beispiel #41
0
        /// <summary>
        /// 删除仇恨组
        /// </summary>
        private void DeleteHatredGroup()
        {
            Node currentNode = aiTree.SelectedNode;

            if (currentNode != null)
            {
                Hashtable infoTable = currentNode.Tag as Hashtable;
                string groupID = infoTable["dwSetID"] as string;

                // 先更新所有NPC的分组信息
                string groupField = "TeamID";
                int npcCount = 0;
                baseDoc.DocLogical.GetObjCount("NPC", 0, ref npcCount);

                for (int i = 0; i < npcCount; i++)
                {
                    _AtlObjInfo objectInfo = new _AtlObjInfo();
                    baseDoc.DocLogical.GetObjDisplayInfo("NPC", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    baseDoc.DocLogical.GetSetObjInfo("NPC", ref objectInfo, logicObj, 1);

                    for (int j = 0; j < objectInfo.strFields.Length; j++)
                    {
                        string fieldName = objectInfo.strFields[j];

                        if (fieldName == groupField)
                        {
                            if (objectInfo.strValues[j] == groupID)
                            {
                                objectInfo.strValues[j] = "0";
                                objectInfo.bChanged = 1;
                                baseDoc.DocLogical.GetSetObjInfo("NPC", ref objectInfo, logicObj, 0);
                            }

                            break;
                        }
                    }
                }

                // 再删除该分组
                baseDoc.DocLogical.DecoratedDeleteAIGroup(int.Parse(groupID));
                aiTree.Nodes.Remove(currentNode);  
            }
        }
Beispiel #42
0
        /// <summary>
        /// 初始化成员信息链表
        /// </summary>
        /// <param name="objectType">对象类型</param>
        /// <param name="memberInfoList">成员信息链表</param>
        private void InitMemberInfoList(string objectType, List<Hashtable> memberInfoList)
        {
            int logicObj = 0;
            int representObj = 0;
            int hasScript = 0;
            string name = "";
            string nickName = "";
            int memberCount = 0;

            memberInfoList.Clear();
            baseDoc.DocLogical.GetObjCount(objectType, 0, ref memberCount);

            for (int i = 0; i < memberCount; i++)
            {
                _AtlObjInfo objectInfo = new _AtlObjInfo();
                baseDoc.DocLogical.GetObjDisplayInfo(objectType, i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);

                if (logicObj != 0) // 貌似无效的成员也会读到
                {
                    baseDoc.DocLogical.GetSetObjInfo(objectType, ref objectInfo, logicObj, 1);
                    Hashtable infoTable = Helper.GetInfoTable(objectInfo);
                    memberInfoList.Add(infoTable);
                }
            }
        }
Beispiel #43
0
        /// <summary>
        /// 检查当前选中的对象是否能够旋转 ahpho suntao
        /// </summary>
        /// <returns>是否能够旋转</returns>
        private bool CheckObjectCanRotate()
        {
            bool canRotate = true;

            int entityCount = 0;
            SceneSceneEditor.GetSelectedEntityCount(ref entityCount);

            _AtlObjInfo[] objInfoArray = new _AtlObjInfo[entityCount];
            for (int i = 0; i < entityCount; i++)
            {
                string objectType = objInfoArray[i].strType;
                if (objectType == "NPC" || objectType == "Doodad")
                {
                    ;
                }
                else
                {
                    canRotate = false;
                    break;
                }
            }

            return canRotate;
        }
Beispiel #44
0
        private void ShowProperties()
        {
            int entityCount = -1;
            SceneSceneEditor.GetSelectedEntityCount(ref entityCount);

            _AtlObjInfo[] objinfos = new _AtlObjInfo[entityCount];
            for (int i = 0; i < entityCount; i++)
            {
                int iLogicObjPtr = 0;
                string objTypeName = string.Empty;
                m_doc.DocLogical.GetSelectedLogicObjPtr(i, ref iLogicObjPtr, ref objTypeName);

                if (iLogicObjPtr != 0)
                {
                    _AtlObjInfo atlinfo = new _AtlObjInfo();
                    atlinfo.bChanged = 1;
                    atlinfo.iLogicObjPtr = iLogicObjPtr;
                    //_AtlObjInfo中要储存iLogicObjPtr entityPtr,方便C#对话框保存时 直接exchange去docLogical,
                    //再用iLogicObjPtr之逻辑更新entityPtr指向的表现。
                    m_doc.DocLogical.GetSetObjInfo(objTypeName, ref atlinfo, iLogicObjPtr, 1);
                    objinfos[i] = atlinfo;
                }
                else
                {
                    //objinfos[i] = _AtlObjInfo; 自定义valueType如何定义empty
                }
            }

            if (EditSelectedObjectsProperty(objinfos))
            {
                for (int i = 0; i < objinfos.Length; i++)
                {
                    _AtlObjInfo objinfo = objinfos[i];
                    //if (objinfo.bChanged != 0)
                    //{
                    m_doc.DocLogical.GetSetObjInfo(objinfo.strType, ref objinfo, objinfo.iLogicObjPtr, 0);
                    m_doc.DocLogical.UpdateObjRepresentByLogicObj(ref objinfo, objinfo.iLogicObjPtr);
                    //}
                }
            }
        }
Beispiel #45
0
        /// <summary>
        /// 保存对象数据
        /// </summary>
        /// <param name="currentCell">当前编辑的单元格</param>
        /// <param name="objectInfo">对象信息</param>
        /// <param name="index">对象编号</param>
        /// <param name="parentIndex">父对象编号</param>
        private void SaveObjectData(DataGridViewCell currentCell, _AtlObjInfo objectInfo, int index, int parentIndex)
        {                            
            string newValue = currentCell.EditedFormattedValue as string;
            string oldValue = currentCell.Tag as string;
            string objectType = objectInfo.strType;                
            int fieldIndex = GetFieldIndex(objectInfo, currentCell.OwningRow.Tag as string);

            if (newValue == oldValue)
            {
                currentCell.Style.Font = normalTextFont;
            }
            else
            {
                currentCell.Style.Font = boldTextFont;
            }

            objectInfo.bChanged = 1;
            m_doc.DocLogical.GetObjDisplayInfo(objectType, index, parentIndex, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
            objectInfo.strValues[fieldIndex] = newValue;
            m_doc.DocLogical.GetSetObjInfo(objectType, ref objectInfo, logicObj, 0);
            m_doc.DocLogical.UpdateObjRepresentByLogicObj(ref objectInfo, logicObj);            
        }
Beispiel #46
0
        /// <summary>
        /// 更新对象数据
        /// </summary>
        /// <param name="objectInfo">对象信息</param>
        /// <param name="fieldName">需要更新的字段</param>
        /// <param name="fieldValue">需要更新的值</param>
        /// <param name="index">对象编号</param>
        /// <param name="parentIndex">父对象编号</param>
        private void UpdateObjectInfo(_AtlObjInfo objectInfo, string fieldName, string fieldValue, int index, int parentIndex)
        {
            int fieldIndex = GetFieldIndex(objectInfo, fieldName);

            if (fieldIndex >= 0)
            {
                string oldValue = objectInfo.strValues[fieldIndex];

                if (oldValue != fieldValue)
                {
                    string objectType = objectInfo.strType;
                    objectInfo.bChanged = 1;
                    m_doc.DocLogical.GetObjDisplayInfo(objectType, index, parentIndex, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    objectInfo.strValues[fieldIndex] = fieldValue;
                    m_doc.DocLogical.GetSetObjInfo(objectType, ref objectInfo, logicObj, 0);
                    m_doc.DocLogical.UpdateObjRepresentByLogicObj(ref objectInfo, logicObj);       
                }
            }
        }
Beispiel #47
0
        /// <summary>
        /// 初始化随机组
        /// </summary>
        private void InitRandomGroup()
        {
            int randomGroupCount = 0;

            randomGroupInfoList.Clear();
            baseDoc.DocLogical.GetObjCount("NpcRandomGroup", 0, ref randomGroupCount);

            if (randomGroupCount > 0)
            {
                _AtlObjInfo objectInfo = new _AtlObjInfo();

                for (int i = 0; i < randomGroupCount; i++)
                {
                    baseDoc.DocLogical.GetObjDisplayInfo("NpcRandomGroup", i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                    baseDoc.DocLogical.GetSetObjInfo("NpcRandomGroup", ref objectInfo, logicObj, 1);
                    randomGroupInfoList.Add(objectInfo);
                }
            }
        }
Beispiel #48
0
 private void ShowBrushInfoUI(_AtlObjInfo info)
 {
     // 状态掩码
     int modifyState = Convert.ToInt32(info.strValues[4]);
     this.checkBoxBlock.Checked = (modifyState & LSTATE_BLOCKCHARACTER) != 0;
     this.checkBoxPut.Checked = (modifyState & LSTATE_PUTOBJECT) != 0;
     this.checkBoxStall.Checked = (modifyState & LSTATE_STALL) != 0;
     this.checkBoxIndoor.Checked = (modifyState & LSTATE_INDOOR) != 0;
     this.checkBoxRest.Checked = (modifyState & LSTATE_REST) != 0;
     this.checkBoxRideHorse.Checked = (modifyState & LSTATE_RIDEHORSE) != 0;
     // 脚本文件
     this.textBoxScript.Text = info.strValues[3];
     // 高度
     this.textBoxHeight.Text = string.Empty;
     // 名字
     this.textLogicName.Text = info.strValues[2];
     // 颜色
     int color = stringToColor(info.strValues[1]);
     this.colorPicker.Style.BackColor1.Color = Color.FromArgb(color);
     this.colorPicker.Style.BackColor2.Color = Color.FromArgb(color);
 }
Beispiel #49
0
        /// <summary>
        /// 旋转选中的部件
        /// </summary>
        private void RotateSelectedObject()
        {
            string newRotation = null;
            SceneSceneEditor.RotateSelectedObject(ref newRotation);
            if(newRotation != null) // 已经改变朝向
            {
                string[] rotations = newRotation.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                int entityCount = -1;
                SceneSceneEditor.GetSelectedEntityCount(ref entityCount);

                _AtlObjInfo[] objinfos = new _AtlObjInfo[entityCount];
                for (int i = 0; i < entityCount; i++)
                {
                    int iLogicObjPtr = 0;
                    string objTypeName = string.Empty;
                    m_doc.DocLogical.GetSelectedLogicObjPtr(i, ref iLogicObjPtr, ref objTypeName);
                    _AtlObjInfo atlinfo = new _AtlObjInfo();
                    atlinfo.bChanged = 1;
                    atlinfo.iLogicObjPtr = iLogicObjPtr;
                    //_AtlObjInfo中要储存iLogicObjPtr entityPtr,方便C#对话框保存时 直接exchange去docLogical,
                    //再用iLogicObjPtr之逻辑更新entityPtr指向的表现。
                    m_doc.DocLogical.GetSetObjInfo(objTypeName, ref atlinfo, iLogicObjPtr, 1);
                    objinfos[i] = atlinfo;

                    // 写入新的旋转角度信息
                    for(int j = 0; j < atlinfo.iFieldsCount; j++)
                    {
                        if(atlinfo.strFields[j] == "vRotation")
                        {
                            atlinfo.strValues[j] = newRotation;                            
                        }
                        else if(atlinfo.strFields[j] == "nFaceDirection")
                        {
                            atlinfo.strValues[j] = ConvertRotationToDirection(rotations[i]);
                        }
                    }

                    // 更新对象数据
                    m_doc.DocLogical.GetSetObjInfo(atlinfo.strType, ref atlinfo, atlinfo.iLogicObjPtr, 0);
                    m_doc.DocLogical.UpdateObjRepresentByLogicObj(ref atlinfo, atlinfo.iLogicObjPtr);
                }
            }
        }
Beispiel #50
0
        /// <summary>
        /// 添加路径
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX2_Click(object sender, EventArgs e)
        {
            InputForm iForm = new InputForm("新建路径", "请输入路径名称");

            if (iForm.ShowDialog() == DialogResult.OK)
            {
                int newWayPointSet = 0;
                m_doc.DocLogical.DecoratedAddOneWayPointSet(ref newWayPointSet, iForm.InputText);

                int index = patrolTree.Nodes.Count;
                _AtlObjInfo patrolInfo = new _AtlObjInfo();
                m_doc.DocLogical.GetObjDisplayInfo("WayPointSet", index, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                m_doc.DocLogical.GetSetObjInfo("WayPointSet", ref patrolInfo, logicObj, 1);

                Node patrolNode = new Node();
                patrolNode.Text = string.Format("{0} ({1})", iForm.InputText, index + 1);
                patrolNode.Tag = patrolInfo;
                patrolTree.Nodes.Add(patrolNode);
                patrolTree.SelectedNode = patrolNode;

                // 刷新路径数据
                InitPatrolPathTable();
            }
        }
Beispiel #51
0
        /// <summary>
        /// 获取字段对应的序号 ahpho suntao
        /// </summary>
        /// <param name="objectInfo">对象信息</param>
        /// <param name="field">字段</param>
        /// <returns>字段对应的序号</returns>
        private int GetFieldIndex(_AtlObjInfo objectInfo, string field)
        {
            int index = -1;

            for(int i = 0; i < objectInfo.iFieldsCount; i++)
            {
                if(objectInfo.strFields[i] == field)
                {
                    index = i;
                    break;
                }
            }

            return index;
        }
Beispiel #52
0
        /// <summary>
        /// 初始化分组链表
        /// </summary>
        /// <param name="groupName">分组名称</param>
        /// <param name="groupInfoList">分组链表</param>
        private void InitGroupInfoList(string groupName, List<_AtlObjInfo> groupInfoList)
        {
            int groupCount = 0;            
            _AtlObjInfo objectInfo = new _AtlObjInfo();

            groupInfoList.Clear();
            baseDoc.DocLogical.GetObjCount(groupName, 0, ref groupCount);            

            for (int i = 0; i < groupCount; i++)
            {
                baseDoc.DocLogical.GetObjDisplayInfo(groupName, i, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
                baseDoc.DocLogical.GetSetObjInfo(groupName, ref objectInfo, logicObj, 1);
                groupInfoList.Add(objectInfo);
            }
        }
Beispiel #53
0
        /// <summary>
        /// 编辑场景中选中对象的属性
        /// </summary>
        public bool EditSelectedObjectsProperty(_AtlObjInfo[] objectInfoArray)
        {
            ObjectsEditForm editFrm = new ObjectsEditForm(m_doc, objectInfoArray);
            DialogResult dr = editFrm.ShowDialog();

            if (dr == DialogResult.OK)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #54
0
        public void AddPolyTreeNode()
        {
            //InitPoly();
            int polyCount = 0;
            m_doc.DocLogical.GetObjCount("LogicalPoly", 0, ref polyCount);

            _AtlObjInfo polyinfo = new _AtlObjInfo();
            m_doc.DocLogical.GetObjDisplayInfo("LogicalPoly", polyCount - 1, 0, ref name, ref nickName, ref hasScript, ref representObj, ref logicObj, ref templateID);
            m_doc.DocLogical.GetSetObjInfo("LogicalPoly", ref polyinfo, logicObj, 1);
            polyinfo.strValues[3] = "0";
            polyinfo.strValues[1] = name = "未命名";
            m_doc.DocLogical.GetSetObjInfo("LogicalPoly", ref polyinfo, logicObj, 0);
            polyinfo.iLogicObjPtr = logicObj;
            polyinfo.iRepresentObjPtr = representObj;

            Node polyNode = new Node();
            polyNode.Text = string.Format("{0} ({1})", name, nickName);
            polyNode.Tag = polyinfo;
            nodePolies.Nodes.Add(polyNode);

            this.advTreePoly.SelectedNode = polyNode;
        }
Beispiel #55
0
 private _AtlVector3 GetAtlObjPos(_AtlObjInfo obj)
 {
     _AtlVector3 pos;
     pos.x = pos.y = pos.z = 0.0f;
     if (obj.strType == "NPC")
     {
         string[] _str = obj.strValues[16].Split(new char[] { ',' });
         pos.x = (float)(Convert.ToDouble(_str[0]));
         pos.y = (float)(Convert.ToDouble(_str[1]));
         pos.z = (float)(Convert.ToDouble(_str[2]));
     }
     return pos;
 }
Beispiel #56
0
 private void SaveLogicInfoUI(_AtlObjInfo info)
 {
     m_doc.DocLogical.GetSetObjInfo(info.strType, ref info, info.iLogicObjPtr, 0);
 }
Beispiel #57
0
        /// <summary>
        /// 将摄像机移动到对象所在的位置
        /// </summary>
        /// <param name="objectInfo">对象信息</param>
        private void MoveCameraToObject(_AtlObjInfo objectInfo)
        {
            // 移动镜头
            Hashtable infoTable = Helper.GetInfoTable(objectInfo);
            string positionStr = infoTable["vPosition"] as string;

            if (positionStr != null) // 有效的坐标
            {
                string[] positionData = positionStr.Split(new char[] { ',' });
                float positionX = float.Parse(positionData[0]);
                float positionY = float.Parse(positionData[1]);
                float positionZ = float.Parse(positionData[2]);

                _AtlVector3 objPos = new _AtlVector3();
                objPos.x = positionX;
                objPos.y = positionY;
                objPos.z = positionZ;

                _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.SetCameraLocation(newpos.x, newpos.y, newpos.z, objPos.x, objPos.y, objPos.z);
            }            
        }
Beispiel #58
0
 private void SetLogicSceneEditorBrushState(_AtlObjInfo atlobj)
 {
     SceneSceneEditor.SetEditState(SCENESTATE_CELLLOGICAL);
     SceneSceneEditor.ClearLogicModifyState();
     SceneSceneEditor.SetLogicModifyState(Convert.ToInt32(atlobj.strValues[4]), atlobj.strValues[3]);
     SceneSceneEditor.SetLogicCurrentColor(stringToColor(atlobj.strValues[1]));
     SceneSceneEditor.SetCurrentEditBrushIndex(Convert.ToInt32(atlobj.strValues[0]));
 }
Beispiel #59
0
        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;
            }
        }