示例#1
0
        ExpressionAnimationUI CreateUIFromExpressionPath(string path, JSONStorableString store)
        {
            string fileName = PathExt.GetFileNameWithoutExtension(path);

            store.SetVal(sc.NormalizePath(path));

            string jsonString = sc.ReadFileIntoString(path);

            ExpressionAnimation animation = new ExpressionAnimation(morphControl, jsonString);

            JSONStorableAction action = new JSONStorableAction("Play " + fileName, () =>
            {
                PlayExpression(animation);
            });

            RegisterAction(action);

            ExpressionAnimationUI ui = null;

            ui = new ExpressionAnimationUI(this, fileName, animation, () =>
            {
                store.SetVal("");
                uiList.Remove(ui);
                animationLookup.Remove(fileName);
                DeregisterAction(action);
            });



            animationLookup[fileName] = animation;
            expressionChooser.choices = animationLookup.Keys.ToList();
            uiList.Add(ui);
            return(ui);
        }