コード例 #1
0
        void parseAnimEffectInfo(StreamReader dataStream, GfxSkill skill)
        {
            GfxSkillEffect newSkillEffect = skill.addSkillEffect();
            string         line;

            while (!dataStream.EndOfStream)
            {
                line = dataStream.ReadLine();
                // Ignore comments & blanks
                if (!(line.Length == 0 || line.Substring(0, 2) == "//"))
                {
                    string delim      = "\t";
                    string spaceDelim = " ";
                    line = line.TrimStart(spaceDelim.ToCharArray());
                    line = line.TrimEnd(spaceDelim.ToCharArray());
                    string strline = line.Trim(delim.ToCharArray());
                    if (strline == "}")
                    {
                        // Finished emitter
                        break;
                    }
                    else
                    {
                        // Attribute
                        parseAnimEffectInfoAttrib(strline, newSkillEffect);
                    }
                }
            }
        }
コード例 #2
0
        public GfxSkillEffect  addSkillEffect()
        {
            GfxSkillEffect newSkillEffect = new GfxSkillEffect();

            mSkillEffects.Add(newSkillEffect);
            return(newSkillEffect);
        }
コード例 #3
0
    void Save()
    {
        if (actor.Skill != null)
        {
            string       skillFileName = getCurrentSkillName();
            string       fullFilePath  = AssertBundleCreator.SkillAssetbundlePath + skillFileName + ".txt";
            StreamWriter skillWrite    = new StreamWriter(fullFilePath);
            skillWrite.Flush();
            skillWrite.WriteLine("skill " + skillFileName);
            skillWrite.WriteLine("{");
            skillWrite.WriteLine("\t\tAnimation " + actor.Skill.getAnimateName());
            skillWrite.WriteLine("\t\tBreakTime " + actor.Skill.getParameter("BreakTime"));
            skillWrite.WriteLine("\t\tHitTime " + actor.Skill.getParameter("HitTime"));
            skillWrite.WriteLine("\t\tShakeTime " + actor.Skill.getParameter("ShakeTime"));
            skillWrite.WriteLine("\t\tRepeatEffect " + actor.Skill.getParameter("RepeatEffect"));
            skillWrite.WriteLine("\t\tEnableRibbon " + actor.Skill.getParameter("EnableRibbon"));
            for (int i = 0; i < actor.Skill.getSkillEffectCount(); i++)
            {
                skillWrite.WriteLine("\t\tAnimEffect");
                GFX.GfxSkillEffect skillEffect = actor.Skill.getSkillEffect(i);
                skillWrite.WriteLine("\t\t{");
                skillWrite.WriteLine("\t\t\tAttachTime " + skillEffect.getParameter("AttachTime"));
                skillWrite.WriteLine("\t\t\tAttachPoint " + skillEffect.getParameter("AttachPoint"));
                skillWrite.WriteLine("\t\t\tEffectTemplateName " + skillEffect.getParameter("EffectTemplateName"));
                skillWrite.WriteLine("\t\t\tOffsetPos " + skillEffect.getParameter("OffsetPos"));
                skillWrite.WriteLine("\t\t\tOffsetRotation " + skillEffect.getParameter("OffsetRotation"));
                skillWrite.WriteLine("\t\t\tOffsetScale " + skillEffect.getParameter("OffsetScale"));
                skillWrite.WriteLine("\t\t\tAttach " + skillEffect.getParameter("Attach"));
                skillWrite.WriteLine("\t\t}");
            }

            if (actor.Skill.isHitGroundEffectExist())
            {
                skillWrite.WriteLine("\t\tHitGroundEffect");
                skillWrite.WriteLine("\t\t{");
                skillWrite.WriteLine("\t\t\tAttachTime " + actor.Skill.HitGroundEffect.getParameter("AttachTime"));
                skillWrite.WriteLine("\t\t\tShakeTime " + actor.Skill.HitGroundEffect.getParameter("ShakeTime"));
                skillWrite.WriteLine("\t\t\tAnimation " + actor.Skill.HitGroundEffect.getParameter("Animation"));
                skillWrite.WriteLine("\t\t\tAttachPoint " + actor.Skill.HitGroundEffect.getParameter("AttachPoint"));
                skillWrite.WriteLine("\t\t\tEffectTemplateName " + actor.Skill.HitGroundEffect.getParameter("EffectTemplateName"));
                skillWrite.WriteLine("\t\t\tOffsetPos " + actor.Skill.HitGroundEffect.getParameter("OffsetPos"));
                skillWrite.WriteLine("\t\t\tOffsetRotation " + actor.Skill.HitGroundEffect.getParameter("OffsetRotation"));
                skillWrite.WriteLine("\t\t\tOffsetScale " + actor.Skill.HitGroundEffect.getParameter("OffsetScale"));
                skillWrite.WriteLine("\t\t\tAttach " + actor.Skill.HitGroundEffect.getParameter("Attach"));
                skillWrite.WriteLine("\t\t}");
            }

            skillWrite.WriteLine("}");

            skillWrite.Close();
            EditorUtility.DisplayDialog("Save Skill File", "Success!", "Ok");
        }
        else
        {
            Debug.LogError("skill instance is none");
        }
    }
コード例 #4
0
    void addSkillEffect()
    {
        showSkill();
        GUILayout.BeginHorizontal("box");
        GUILayout.Label("EffectName");
        mEffectName = EditorGUILayout.TextField(mEffectName);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("AttachPoint");
        mLocatorNameIndex = EditorGUILayout.Popup(mLocatorNameIndex, LocatorNames.ToArray());
        //mAttachPoint = EditorGUILayout.TextField(mAttachPoint);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        if (GUILayout.Button("OK"))
        {
            GFX.GfxSkillEffect newSkillEffect = mSkill.addSkillEffect();
            newSkillEffect.setParameter("EffectTemplateName", mEffectName);
            if (LocatorNames[mLocatorNameIndex] == "none")
            {
                newSkillEffect.setParameter("AttachPoint", "");
            }
            else
            {
                newSkillEffect.setParameter("AttachPoint", LocatorNames[mLocatorNameIndex]);
            }

            refreshSkillEffectList();
            lastEffectIndex = 0;
            if (skillIndex != 0)
            {
                stat = GUI_STATUS.CHECKING;
            }
            else
            {
                stat = GUI_STATUS.NONE;
            }
        }

        if (GUILayout.Button("Cancel"))
        {
            lastEffectIndex = 0;
            if (skillIndex != 0)
            {
                stat = GUI_STATUS.CHECKING;
            }
            else
            {
                stat = GUI_STATUS.NONE;
            }
        }
        GUILayout.EndHorizontal();
    }
コード例 #5
0
    void Update()
    {
        if (mObject != null)
        {
            GFX.GfxSystem.Instance.Tick();
            AnimNames = mObject.getAnimationName();
            AnimNames.Sort();
            AnimNames.Insert(0, "none");



            if (isReadyUpdateLocater)
            {
                GameObject go = mObject.getGameObject();
                if (go != null)
                {
                    Transform[] actorBones = go.GetComponentsInChildren <Transform>();
                    foreach (Transform t in actorBones)
                    {
                        if (t.name.IndexOf("Locator") != -1)
                        {
                            LocatorNames.Add(t.name);
                        }
                    }
                }
                isReadyUpdateLocater = false;

                if (mEffects.Count != 0 && mEffects[effectIndex] != "none" && mSkill != null)
                {
                    GFX.GfxSkillEffect curSkillEffect = mSkill.getSkillEffect(effectIndex - 1);
                    if (curSkillEffect != null)
                    {
                        string attachPoint = curSkillEffect.getParameter("AttachPoint");
                        mLocatorNameIndex = LocatorNames.IndexOf(attachPoint);

                        if (mLocatorNameIndex == -1)
                        {
                            mLocatorNameIndex = 0;
                        }
                    }
                }

                if (mSkill != null)
                {
                    string curAnimateName = mSkill.getParameter("Animation");
                    mSkillAnimateNameIndex = AnimNames.IndexOf(curAnimateName);
                    if (mSkillAnimateNameIndex == -1)
                    {
                        mSkillAnimateNameIndex = 0;
                    }
                }
            }
        }
    }
コード例 #6
0
        public GfxSkill(GfxSkill skill)
        {
            mSkillName      = skill.mSkillName;
            mRepeatEffect   = skill.mRepeatEffect;
            mAnimateName    = skill.mAnimateName;
            mHitTimeArray   = new List <float>();
            mBreakTimeArray = new List <float>();
            mShakeTimeArray = new List <float>();
            for (int i = 0; i < skill.mHitTimeArray.Count; i++)
            {
                mHitTimeArray.Add(skill.mHitTimeArray[i]);
            }

            for (int i = 0; i < skill.mBreakTimeArray.Count; i++)
            {
                mBreakTimeArray.Add(skill.mBreakTimeArray[i]);
            }

            for (int i = 0; i < skill.mShakeTimeArray.Count; i++)
            {
                mShakeTimeArray.Add(skill.mShakeTimeArray[i]);
            }

            mSkillEffects = new List <GfxSkillEffect>();
            for (int i = 0; i < skill.mSkillEffects.Count; i++)
            {
                GfxSkillEffect newSkillEffect = new GfxSkillEffect();
                newSkillEffect.Attach         = skill.mSkillEffects[i].Attach;
                newSkillEffect.AttachPoint    = skill.mSkillEffects[i].AttachPoint;
                newSkillEffect.AttachTime     = skill.mSkillEffects[i].AttachTime;
                newSkillEffect.EffectName     = skill.mSkillEffects[i].EffectName;
                newSkillEffect.OffsetPos      = skill.mSkillEffects[i].OffsetPos;
                newSkillEffect.OffsetRotation = skill.mSkillEffects[i].OffsetRotation;
                newSkillEffect.OffsetScale    = skill.mSkillEffects[i].OffsetScale;
                mSkillEffects.Add(newSkillEffect);
            }
            if (skill.mHitGroundEffect != null)
            {
                mHitGroundEffect                = new GfxSkillHitGroundEffect();
                mHitGroundEffect.OffsetPos      = skill.mHitGroundEffect.OffsetPos;
                mHitGroundEffect.OffsetRotation = skill.mHitGroundEffect.OffsetRotation;
                mHitGroundEffect.AttachTime     = skill.mHitGroundEffect.AttachTime;
                mHitGroundEffect.AttachPoint    = skill.mHitGroundEffect.AttachPoint;
                mHitGroundEffect.EffectName     = skill.mHitGroundEffect.EffectName;
                mHitGroundEffect.Attach         = skill.mHitGroundEffect.Attach;
                mHitGroundEffect.AnimateName    = skill.mHitGroundEffect.AnimateName;
                mHitGroundEffect.ShakeTime      = skill.mHitGroundEffect.ShakeTime;
            }
        }
コード例 #7
0
        void parseAnimEffectInfoAttrib(string line, GfxSkillEffect skillEffect)
        {
            // 设置element的属性
            string[] szTemp = line.Split(new string[1] {
                " "
            }, StringSplitOptions.None);

            if (szTemp.Length <= 0)
            {
                Debug.LogError("the number of parameters must be >0! parseAnimEffectInfoAttrib " + line);
                return;
            }

            if (szTemp.Length == 2)
            {
                if (false == skillEffect.setParameter(szTemp[0], szTemp[1]))
                {
                    Debug.LogError("Bad Anim Effect Info attribute line parseAnimEffectInfoAttrib " + line);
                }
            }
            else
            {
                string valueString = "";
                for (int i = 1; i < szTemp.Length; i++)
                {
                    valueString += szTemp[i];
                    if (i + 1 < szTemp.Length)
                    {
                        valueString += " ";
                    }
                }
                if (false == skillEffect.setParameter(szTemp[0], valueString))
                {
                    Debug.LogError("Bad Anim Effect Info Complex attribute line parseAnimEffectInfoAttrib " + line);
                }
            }
        }
コード例 #8
0
 void Save()
 {
     if (mSkill != null)
     {
         string     skillFileName = SkillNames[skillIndex];
         string     fullFilePath  = AssertBundleCreator.SkillAssetbundlePath + skillFileName + ".txt";
         FileStream skillData     = new FileStream(fullFilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write);
         skillData.Flush();
         StreamWriter skillWrite = new StreamWriter(skillData);
         skillWrite.WriteLine("skill " + skillFileName);
         skillWrite.WriteLine("{");
         skillWrite.WriteLine("\t\tAnimation " + mSkill.getAnimateName());
         skillWrite.WriteLine("\t\tBreakTime " + mSkill.getParameter("BreakTime"));
         skillWrite.WriteLine("\t\tHitTime " + mSkill.getParameter("HitTime"));
         skillWrite.WriteLine("\t\tShakeTime " + mSkill.getParameter("ShakeTime"));
         skillWrite.WriteLine("\t\tRepeatEffect " + mSkill.getParameter("RepeatEffect"));
         skillWrite.WriteLine("\t\tEnableRibbon " + mSkill.getParameter("EnableRibbon"));
         for (int i = 0; i < mSkill.getSkillEffectCount(); i++)
         {
             skillWrite.WriteLine("\t\tAnimEffect");
             GFX.GfxSkillEffect skillEffect = mSkill.getSkillEffect(i);
             skillWrite.WriteLine("\t\t{");
             skillWrite.WriteLine("\t\t\tAttachTime " + skillEffect.getParameter("AttachTime"));
             skillWrite.WriteLine("\t\t\tAttachPoint " + skillEffect.getParameter("AttachPoint"));
             skillWrite.WriteLine("\t\t\tEffectTemplateName " + skillEffect.getParameter("EffectTemplateName"));
             skillWrite.WriteLine("\t\t\tOffsetPos " + skillEffect.getParameter("OffsetPos"));
             skillWrite.WriteLine("\t\t\tOffsetRotation " + skillEffect.getParameter("OffsetRotation"));
             skillWrite.WriteLine("\t\t\tOffsetScale " + skillEffect.getParameter("OffsetScale"));
             skillWrite.WriteLine("\t\t\tAttach " + skillEffect.getParameter("Attach"));
             skillWrite.WriteLine("\t\t}");
         }
         skillWrite.WriteLine("}");
         skillWrite.Close();
         skillData.Close();
     }
 }
コード例 #9
0
    void showSkillEffect()
    {
        if (mEffects[effectIndex] != "none")
        {
            if (effectIndex != lastEffectIndex)
            {
                GFX.GfxSkillEffect curSkillEffect = actor.Skill.getSkillEffect(effectIndex - 1);
                mAtttachTime = curSkillEffect.AttachTime;
                string attachPoint = curSkillEffect.getParameter("AttachPoint");
                mLocatorNameIndex = actor.LocatorNames.IndexOf(attachPoint);
                if (mLocatorNameIndex == -1)
                {
                    mLocatorNameIndex = 0;
                }
                mEffectName     = curSkillEffect.getParameter("EffectTemplateName");
                mOffsetPos      = curSkillEffect.OffsetPos;
                mOffsetRotation = new Vector4(curSkillEffect.OffsetRotation.x,
                                              curSkillEffect.OffsetRotation.y,
                                              curSkillEffect.OffsetRotation.z,
                                              curSkillEffect.OffsetRotation.w);
                mOffsetScale = curSkillEffect.OffsetScale;
                mAttach      = curSkillEffect.Attach;
            }
            lastEffectIndex = effectIndex;
            GUILayout.BeginHorizontal("box");
            mAtttachTime = EditorGUILayout.Slider("AttachTime", mAtttachTime, 0f, 10f);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            GUILayout.Label("AttachPoint");
            mLocatorNameIndex = EditorGUILayout.Popup(mLocatorNameIndex, actor.LocatorNames.ToArray());
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            GUILayout.Label("EffectTemplateName");
            mEffectName = GUILayout.TextField(mEffectName);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            mOffsetPos = EditorGUILayout.Vector3Field("OffsetPos", mOffsetPos);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            mOffsetRotation = EditorGUILayout.Vector4Field("OffsetRotation", mOffsetRotation);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            mOffsetScale = EditorGUILayout.Vector3Field("OffsetScale", mOffsetScale);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            mAttach = EditorGUILayout.Toggle("Attach", mAttach);
            GUILayout.EndHorizontal();

            if (GUILayout.Button("SetSkillEffect"))
            {
                GFX.GfxSkillEffect curSkillEffect = actor.Skill.getSkillEffect(effectIndex - 1);
                curSkillEffect.AttachTime = mAtttachTime;
                if (actor.LocatorNames[mLocatorNameIndex] == "none")
                {
                    curSkillEffect.setParameter("AttachPoint", "");
                }
                else
                {
                    curSkillEffect.setParameter("AttachPoint", actor.LocatorNames[mLocatorNameIndex]);
                }

                curSkillEffect.setParameter("EffectTemplateName", mEffectName);
                curSkillEffect.Attach         = mAttach;
                curSkillEffect.OffsetPos      = mOffsetPos;
                curSkillEffect.OffsetRotation = new Quaternion(mOffsetRotation.x, mOffsetRotation.y, mOffsetRotation.z, mOffsetRotation.w);
                curSkillEffect.OffsetScale    = mOffsetScale;
            }
        }

        GUILayout.BeginHorizontal("box");

        GUILayout.BeginHorizontal("box");
        if (GUILayout.Button("AddEffect"))
        {
            stat = GUI_STATUS.ADDEFFECT;
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        if (GUILayout.Button("RemoveEffect"))
        {
            removeSkillEffect();
        }
        GUILayout.EndHorizontal();

        GUILayout.EndHorizontal();
    }