コード例 #1
0
        public void InitFromXml(string szXmlName, string szXmlFileName, string szXmlLoop)
        {
            string szWeapon = szXmlName.Substring(0, 3).ToLower();

            this.nWeaponType = WeaponType.WT_NONE;
            for (WeaponType weapon_type = WeaponType.WT_1H_SLASH; weapon_type <= WeaponType.WT_GUNPOWDER; weapon_type++)
            {
                if (szWeapon == ConvertString.GetWeaponTypeStr(weapon_type))
                {
                    this.nWeaponType = weapon_type;
                    break;
                }
            }

            this.szName = szXmlName;

            this.szFileName = szXmlFileName;
            if (szXmlLoop.ToLower() == "loop")
            {
                this.nLoopType = AnimationLoopType.ALT_LOOP;
            }
            else
            {
                this.nLoopType = AnimationLoopType.ALT_LASTFRAME;
            }
        }
コード例 #2
0
ファイル: ModelListData.cs プロジェクト: angel2230/ZZZ
        public void Serialize(bool bToForm, System.Windows.Forms.TreeView treeview)
        {
            // 트리구성
            treeview.Nodes.Clear();

            TreeNode playerNode    = treeview.Nodes.Add(ConvertString.GetModelCategoryStr(ModelCategory.MC_PLAYER));
            TreeNode monsterNode   = treeview.Nodes.Add(ConvertString.GetModelCategoryStr(ModelCategory.MC_MONSTER));
            TreeNode npcNode       = treeview.Nodes.Add(ConvertString.GetModelCategoryStr(ModelCategory.MC_NPC));
            TreeNode weaponNode    = treeview.Nodes.Add(ConvertString.GetModelCategoryStr(ModelCategory.MC_WEAPON));
            TreeNode sfxNode       = treeview.Nodes.Add(ConvertString.GetModelCategoryStr(ModelCategory.MC_SFX));
            TreeNode MapObjectNode = treeview.Nodes.Add(ConvertString.GetModelCategoryStr(ModelCategory.MC_MAP_OBJECT));

            IDictionaryEnumerator htEnum = m_Models.GetEnumerator();

            while (htEnum.MoveNext())
            {
                ModelData data = (ModelData)htEnum.Value;

                int image_index = 1;
                if (data.Edited)
                {
                    image_index = 2;
                }

                if (data.m_nCategory == ModelCategory.MC_PLAYER)
                {
                    TreeNode new_node = new TreeNode(data.m_szName, image_index, image_index);
                    playerNode.Nodes.Add(new_node);
                }
                else if (data.m_nCategory == ModelCategory.MC_MONSTER)
                {
                    TreeNode new_node = new TreeNode(data.m_szName, image_index, image_index);
                    monsterNode.Nodes.Add(new_node);
                }
                else if (data.m_nCategory == ModelCategory.MC_NPC)
                {
                    TreeNode new_node = new TreeNode(data.m_szName, image_index, image_index);
                    npcNode.Nodes.Add(new_node);
                }
                else if (data.m_nCategory == ModelCategory.MC_WEAPON)
                {
                    TreeNode new_node = new TreeNode(data.m_szName, image_index, image_index);
                    weaponNode.Nodes.Add(new_node);
                }
                else if (data.m_nCategory == ModelCategory.MC_SFX)
                {
                    TreeNode new_node = new TreeNode(data.m_szName, image_index, image_index);
                    sfxNode.Nodes.Add(new_node);
                }
                else if (data.m_nCategory == ModelCategory.MC_MAP_OBJECT)
                {
                    TreeNode new_node = new TreeNode(data.m_szName, image_index, image_index);
                    MapObjectNode.Nodes.Add(new_node);
                }
            }
        }
コード例 #3
0
        static public string GetRawAnimationName(WeaponType nWeaponType, string szAniName)
        {
            string szRawName = "";

            if (nWeaponType == WeaponType.WT_NONE)
            {
                szRawName = szAniName;
            }
            else
            {
                szRawName = ConvertString.GetWeaponTypeStr(nWeaponType) + "_" + szAniName;
            }

            return(szRawName);
        }
コード例 #4
0
        public void Set(WeaponType nWeaponType, string szName, string szFileName, AnimationLoopType nLoopType)
        {
            this.nWeaponType = nWeaponType;
            this.szFileName  = szFileName;
            this.nLoopType   = nLoopType;

            string header = "";

            if (nWeaponType != WeaponType.WT_NONE)
            {
                header = ConvertString.GetWeaponTypeStr(nWeaponType) + "_";
            }

            this.szName = header + szName;
        }
コード例 #5
0
        private void Serialize()
        {
            if (m_ModelData == null)
            {
                return;
            }

            if (m_nEditType == EditType.ET_INSERT)
            {
                this.Text = "애니메이션 추가";
            }
            else
            {
                this.Text = "애니메이션 수정";
            }

            cbWeapon.Items.Clear();
            for (WeaponType type = WeaponType.WT_NONE; type <= WeaponType.WT_GUNPOWDER; type++)
            {
                cbWeapon.Items.Add(ConvertString.GetWeaponTypeStr(type));
                if (m_nWeaponType == type)
                {
                    cbWeapon.SelectedIndex = (int)type;
                }
            }

            if (m_nEditType == EditType.ET_INSERT)
            {
                cbWeapon.Enabled = true;
            }
            else
            {
                lblModelName.Text = m_ModelData.m_szName;
                tbAniName.Text    = m_szAniName;
                cbLoop.Checked    = m_bLoop;
                tbFile.Text       = m_szFileName;
                cbWeapon.Enabled  = false;

                if (m_nEditType == EditType.ET_EDIT_WEAPON)
                {
                    tbAniName.Enabled = false;
                }
                else
                {
                    tbAniName.Enabled = true;
                }
            }
        }
コード例 #6
0
ファイル: ModelData.cs プロジェクト: geger009/Raiderz_Public
        public ModelAnimation FindAnimation(WeaponType nWeaponType, string szName)
        {
            string szRawName = ConvertString.GetRawAnimationName(nWeaponType, szName);

            ModelAnimation ani = null;

            for (int i = 0; i < m_Animations.Count; i++)
            {
                ani = (ModelAnimation)m_Animations[i];

                if (ani.RawName == szRawName)
                {
                    return(ani);
                }
            }
            return(null);
        }
コード例 #7
0
ファイル: ModelData.cs プロジェクト: geger009/Raiderz_Public
        public bool RemoveAnimation(WeaponType nWeaponType, string szName)
        {
            string szRawName = ConvertString.GetRawAnimationName(nWeaponType, szName);

            ModelAnimation ani = null;

            for (int i = 0; i < m_Animations.Count; i++)
            {
                ani = (ModelAnimation)m_Animations[i];

                if (ani.RawName == szRawName)
                {
                    m_Animations.RemoveAt(i);

                    SetupWeaponAniNames();                              // 다시 m_WeaponAnimationNames를 재설정한다.
                    m_bEdited = true;
                    return(true);
                }
            }

            return(false);
        }
コード例 #8
0
ファイル: ModelData.cs プロジェクト: geger009/Raiderz_Public
        public void Save()
        {
            if (m_nFileType != FileType.FT_XML)
            {
                return;
            }

            try
            {
                string   path     = Global.szRootPath + m_szPath;
                Encoding encoding = Encoding.UTF8;

                XmlTextWriter tw = new XmlTextWriter(path, encoding);
                tw.Formatting = Formatting.Indented;
                tw.WriteStartDocument();
                tw.WriteStartElement(XML_TOKEN.TAG_XML);

                // AddBaseModel
                tw.WriteComment(" \n    BaseModel \n  ");
                tw.WriteStartElement(XML_TOKEN.TAG_ADD_BASE_MODEL);
                tw.WriteAttributeString(XML_TOKEN.ATTR_NAME, m_BaseModel.szName);
                tw.WriteAttributeString(XML_TOKEN.ATTR_FILENAME, m_BaseModel.szFileName);
                tw.WriteEndElement();                           // XML_TOKEN.TAG_ADD_BASE_MODEL

                tw.WriteComment(" \n    Normal Animation \n  ");
                // AddAnimation (normal)
                for (int i = 0; i < m_Animations.Count; i++)
                {
                    ModelAnimation ani = (ModelAnimation)m_Animations[i];
                    if (ani.nWeaponType == WeaponType.WT_NONE)
                    {
                        tw.WriteStartElement(XML_TOKEN.TAG_ADD_ANIMATION);
                        tw.WriteAttributeString(XML_TOKEN.ATTR_NAME, ani.RawName);
                        tw.WriteAttributeString(XML_TOKEN.ATTR_FILENAME, ani.szFileName);
                        tw.WriteAttributeString(XML_TOKEN.ATTR_MOTION_LOOP_TYPE, ConvertString.GetAnimationLoopTypeStr(ani.nLoopType));
                        tw.WriteEndElement();                           // XML_TOKEN.TAG_ADD_ANIMATION
                    }
                }

                // AddAnimation (weapon)
                tw.WriteComment(" \n    Weapon Animation \n  ");
                for (int i = 0; i < m_Animations.Count; i++)
                {
                    ModelAnimation ani = (ModelAnimation)m_Animations[i];
                    if (ani.nWeaponType != WeaponType.WT_NONE)
                    {
                        tw.WriteStartElement(XML_TOKEN.TAG_ADD_ANIMATION);
                        tw.WriteAttributeString(XML_TOKEN.ATTR_NAME, ani.RawName);
                        tw.WriteAttributeString(XML_TOKEN.ATTR_FILENAME, ani.szFileName);
                        tw.WriteAttributeString(XML_TOKEN.ATTR_MOTION_LOOP_TYPE, ConvertString.GetAnimationLoopTypeStr(ani.nLoopType));
                        tw.WriteEndElement();                           // XML_TOKEN.TAG_ADD_ANIMATION
                    }
                }

                tw.WriteEndElement();                 // XML_TOKEN.TAG_XML
                tw.Flush();
                tw.Close();
            }
            catch (FileNotFoundException e)
            {
            }

            m_bEdited = false;
        }