コード例 #1
0
ファイル: XmlManager.cs プロジェクト: mengtest/actdemo
    bool LoadCloneSceneProperty()
    {
        byte[] asset = ResourceManager.Instance.GetXml("CloneScene");
        if (asset == null)
        {
            return(false);
        }

        TbXmlNode docNode = TbXml.Load(asset).docNode;

        if (docNode == null)
        {
            return(false);
        }

        List <TbXmlNode> xmlNodeList = docNode.GetNodes("CloneScene/Property");
        int xmlNodeListLength        = xmlNodeList.Count;

        if (xmlNodeListLength < 1)
        {
            return(false);
        }

        for (int i = 0; i < xmlNodeListLength; ++i)
        {
            TbXmlNode          node = xmlNodeList[i] as TbXmlNode;
            CloneSceneProperty cs   = new CloneSceneProperty();
            int id = node.GetIntValue("CloneSceneId");

            cs.mCloneSceneMonsterInfoList = new List <CloneSceneProperty.CloneSceneMonsterInfo>();
            List <TbXmlNode> childNode = node.GetNodes("CloneSceneMonsterInfo");
            for (int j = 0; j < childNode.Count; ++j)
            {
                TbXmlNode child = childNode[j] as TbXmlNode;
                CloneSceneProperty.CloneSceneMonsterInfo csm = new CloneSceneProperty.CloneSceneMonsterInfo();
                csm.mMonsterId        = child.GetIntValue("MonsterId");
                csm.mMonsterPosition  = UtilTools.FormatStringVector3(child.GetStringValue("MonsterPosition"));
                csm.mMonsterRotationY = child.GetFloatValue("MonsterRotationY");
                csm.mMonsterScale     = child.GetFloatValue("MonsterScale");

                cs.mCloneSceneMonsterInfoList.Add(csm);
            }

            mCloneScenePropertyDic.Add(id, cs);
        }

        return(true);
    }
コード例 #2
0
ファイル: XmlManager.cs プロジェクト: mengtest/actdemo
    public bool LoadAnimatorSkillProperty()
    {
        byte[] asset = ResourceManager.Instance.GetXml("AnimatorConfig");
        if (asset == null)
        {
            return(false);
        }

        TbXmlNode docNode = TbXml.Load(asset).docNode;

        if (docNode == null)
        {
            return(false);
        }

        List <TbXmlNode> xmlNodeList = docNode.GetNodes("animatorconfig/Property");
        int xmlNodeListLength        = xmlNodeList.Count;

        if (xmlNodeListLength < 1)
        {
            return(false);
        }

        for (int i = 0; i < xmlNodeListLength; ++i)
        {
            TbXmlNode             node = xmlNodeList[i] as TbXmlNode;
            AnimatorSkillProperty asp  = new AnimatorSkillProperty();
            asp.mySkillId            = node.GetIntValue("No");
            asp.mySkillAction        = node.GetIntValue("Action");
            asp.mSkillActionProperty = new Dictionary <int, SkillActionProperty>();

            List <TbXmlNode> childNode = node.GetNodes("Action");
            asp.mySkillActionCount = childNode.Count;

            for (int j = 0; j < asp.mySkillActionCount; ++j)
            {
                TbXmlNode           child = childNode[j] as TbXmlNode;
                SkillActionProperty sap   = new SkillActionProperty();

                sap.ActionNumberId = child.GetIntValue("ActionNumber");

                sap.mSkillTargetType  = (SkillTargetType)child.GetIntValue("TargetType");
                sap.mSkillReleaseType = (SkillReleaseType)child.GetIntValue("SkillReleaseType");
                sap.mSkillFlyRes      = child.GetStringValue("SkillFlyRes");

                sap.mSkillType = (SkillType)child.GetIntValue("SkillType");

                string skillTypeParams = child.GetStringValue("SkillTypeParams");
                if (skillTypeParams == null || skillTypeParams.Equals(""))
                {
                    sap.mSkillTypeParams = new List <float>();
                    sap.mSkillTypeParams.Add(1f);
                }
                else
                {
                    sap.mSkillTypeParams = new List <float>();
                    string[] s = skillTypeParams.Split(',');

                    for (int k = 0; k < s.Length; k++)
                    {
                        sap.mSkillTypeParams.Add(UtilTools.FloatParse(s[k]));
                    }
                }

                sap.mPauseTime      = UtilTools.FloatParse(child.GetStringValue("PauseTime"));
                sap.mCenterOffset   = UtilTools.FormatStringVector3(child.GetStringValue("CenterOffset"));
                sap.mSkillRangeType = (SkillRangeType)child.GetIntValue("SkillRangeType");

                string skillRangeTypeParams = child.GetStringValue("SkillRangeTypeParams");
                if (skillRangeTypeParams == null || skillRangeTypeParams.Equals(""))
                {
                    sap.mSkillRangParametr = null;
                }
                else
                {
                    sap.mSkillRangParametr = new List <float>();
                    string[] s = skillRangeTypeParams.Split(',');
                    for (int k = 0; k < s.Length; k++)
                    {
                        sap.mSkillRangParametr.Add(UtilTools.FloatParse(s[k]));
                    }
                }

                sap.mHurtEffectId = child.GetIntValue("HurtEffect");
                sap.mDamageStatus = child.GetIntValue("DamageStatus");
                sap.mDebuffId     = child.GetIntValue("DebuffId");

                sap.mAttackerPauseTime   = UtilTools.FloatParse(child.GetStringValue("AttackerPauseTime"));
                sap.mCameraShakeNumber   = child.GetIntValue("CameraShakeNumber");
                sap.mCameraShakeDistance = UtilTools.FloatParse(child.GetStringValue("CameraShakeDistance"));
                sap.mCameraShakeSpeed    = UtilTools.FloatParse(child.GetStringValue("CameraShakeSpeed"));
                sap.mRepelType           = child.GetIntValue("RepelType");
                sap.mHurtDir             = child.GetIntValue("HurtDir");
                sap.mShakeRotationX      = UtilTools.FloatParse(child.GetStringValue("RotationX"));
                sap.mShakeDecay          = UtilTools.FloatParse(child.GetStringValue("ShakeDecay"));
                sap.mTopplebackType      = child.GetIntValue("TopplebackType");

                asp.mSkillActionProperty.Add(sap.ActionNumberId, sap);
            }

            if (mSkillPropertyDic.ContainsKey(asp.mySkillId))
            {
                mSkillPropertyDic[asp.mySkillId].mAnimatorSkillProperty = asp;
            }
        }

        return(true);
    }