コード例 #1
0
ファイル: BaseForm.cs プロジェクト: weimingtom/pap2
        /// <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);
        }
コード例 #2
0
ファイル: BaseForm.cs プロジェクト: weimingtom/pap2
        private void buttonJmpToTree_Click(object sender, EventArgs e)
        {
            int entityCount = -1;

            SceneSceneEditor.GetSelectedEntityCount(ref entityCount);
            if (entityCount != 1)
            {
                MessageBox.Show("不能选择2个或以上的对象来使用此功能。");
                return;
            }

            int    iLogicObjPtr = 0;
            string objTypeName  = string.Empty;

            m_doc.DocLogical.GetSelectedLogicObjPtr(0, ref iLogicObjPtr, ref objTypeName);

            switch (objTypeName)
            {
            case "LogicalPoly":
                ToSelectPoly(iLogicObjPtr);
                break;

            default:
                break;
            }
        }
コード例 #3
0
ファイル: BaseForm_Npc.cs プロジェクト: weimingtom/pap2
        /// <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);
            }
        }
コード例 #4
0
ファイル: BaseForm.cs プロジェクト: weimingtom/pap2
        /// <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);
                }
            }
        }
コード例 #5
0
ファイル: BaseForm.cs プロジェクト: weimingtom/pap2
        /// <summary>
        /// 删除选中的对象
        /// </summary>
        private void DeleteSelectedObject()
        {
            int entityCount = -1;

            SceneSceneEditor.GetSelectedEntityCount(ref entityCount);
            if (entityCount > 0)
            {
                DialogResult dialogResult = MessageBox.Show("确定要删除选中的对象吗?", "删除对象",
                                                            MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (dialogResult == DialogResult.OK)
                {
                    //m_doc.DocLogical.DeleteSelectedObject();
                    SceneSceneEditor.DeleteSelectedEntity();
                    RefreshPatrol();
                    RefreshTraffic();
                }
            }
        }
コード例 #6
0
ファイル: BaseForm.cs プロジェクト: weimingtom/pap2
        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);
                    //}
                }
            }
        }