Exemplo n.º 1
0
    override public void ShowGUI()
    {
        method = (AnimMethod)EditorGUILayout.EnumPopup("Method:", method);

        _anim = (Animation)EditorGUILayout.ObjectField("Object:", _anim, typeof(Animation), true);

        clip = (AnimationClip)EditorGUILayout.ObjectField("Clip:", clip, typeof(AnimationClip), true);

        if (method == AnimMethod.PlayCustom)
        {
            playMode  = (AnimPlayMode)EditorGUILayout.EnumPopup("Play mode:", playMode);
            blendMode = (AnimationBlendMode)EditorGUILayout.EnumPopup("Blend mode:", blendMode);
        }

        fadeTime = EditorGUILayout.Slider("Transition time:", fadeTime, 0f, 1f);

        willWait = EditorGUILayout.Toggle("Pause until finish?", willWait);

        AfterRunningOption();
    }
Exemplo n.º 2
0
    public void SetMethodCode(string className, string methodName, string code) //Filip
    {
        int index = methodName.IndexOf("(");

        methodName = methodName.Substring(0, index); // remove "(...)" from method name

        if (string.IsNullOrWhiteSpace(code))
        {
            AnimClass classItem = MethodsCodes.FirstOrDefault(c => c.Name.Equals(className));   //alebo SingleOrDefault
            if (classItem != null)
            {
                AnimMethod methodItem = classItem.Methods.FirstOrDefault(m => m.Name.Equals(methodName));  //alebo SingleOrDefault
                if (methodItem != null)
                {
                    CDMethod Method = OALProgram.Instance.ExecutionSpace.getClassByName(className).getMethodByName(methodName);
                    Method.ExecutableCode = null;

                    classItem.Methods.Remove(methodItem);
                    if (classItem.Methods.Count == 0)
                    {
                        MethodsCodes.Remove(classItem);
                    }
                }
            }
        }
        else
        {
            bool classExist = false;

            foreach (AnimClass classItem in MethodsCodes)
            {
                if (classItem.Name.Equals(className))
                {
                    classExist = true;
                    bool methodExist = false;

                    foreach (AnimMethod methodItem in classItem.Methods)
                    {
                        if (methodItem.Name.Equals(methodName))
                        {
                            methodExist     = true;
                            methodItem.Code = code;
                            break;
                        }
                    }
                    if (!methodExist)
                    {
                        AnimMethod Method = new AnimMethod(methodName, code);
                        classItem.Methods.Add(Method);
                    }
                    break;
                }
            }
            if (!classExist)
            {
                AnimMethod Method = new AnimMethod(methodName, code);
                AnimClass  Class  = new AnimClass(className);
                Class.Methods.Add(Method);
                MethodsCodes.Add(Class);
            }
        }
    }