Example #1
0
        public static void ShowWiz(Action <plyVarCreateWiz> callback)
        {
            plyVariablesEditor.LoadVarEds();
            plyVarCreateWiz window = EditorWindow.GetWindow <plyVarCreateWiz>(true, "Create Variable", true);

            window.callback = callback;
            window.curr     = -1;
            window.minSize  = new Vector2(250f, 100f);
            window.ShowUtility();
        }
Example #2
0
        public static void ShowWiz(Action <plyVarCreateWiz> callback, string nameString, string forceName = null)
        {
            plyVariablesEditor.LoadVarEds();
            plyVarCreateWiz window = EditorWindow.GetWindow <plyVarCreateWiz>(true, "Create " + nameString, true);

            window.callback  = callback;
            window.curr      = -1;
            window.forceName = forceName;
            window.minSize   = new Vector2(250f, 100f);
            window.ShowUtility();
        }
        private void CreateVariable(plyVarCreateWiz wiz)
        {
            plyVar var = wiz.var;

            wiz.Close();
            this.VariableWasAdded();
            if (!string.IsNullOrEmpty(var.name))
            {
                if (plyEdUtil.StringIsUnique(this.variables.varDefs, var.name))
                {
                    var.ident = this.variables.CreateVariableIdent();
                    this.variables.varDefs.Add(var);
                    this.Save();
                    plyEdUtil.ApplyPrefabInstanceChanges(this.variablesOwner);
                }
                else
                {
                    EditorUtility.DisplayDialog("Variables", "The variable name must be unique.", "OK");
                }
            }
            this.repaint();
        }