Exemple #1
0
        public override void OnInspectorGUI()
        {
            pageArgsHolder = ((PageArgsHolder)serializedObject.targetObject).pageArgs;
            EditorGUI.BeginChangeCheck();
            pageArgsHolder.PageToCreate = (PagesEnum)EditorGUILayout.EnumPopup("Page To Create: ", pageArgsHolder.PageToCreate);
            if (EditorGUI.EndChangeCheck())
            {
                pageArgsHolder.ArgumentList.Clear();
                pageArgsHolder.ArgumentList = new List <PageArgs.ArgItemHolder> (PageNavEditorWindow.Settings.PagesCustomArguments[(int)pageArgsHolder.PageToCreate - 1].ArgumentList);
            }
            argumentsListFoldout = EditorGUILayout.Foldout(argumentsListFoldout, "Arguments List:");
            int removeIndex = -1;

            tempList = new List <PageArgs.ArgItemHolder> (pageArgsHolder.ArgumentList);
            if (argumentsListFoldout && pageArgsHolder.PageToCreate != PagesEnum.None)
            {
                for (int index = 0; index < pageArgsHolder.ArgumentList.Count; index++)
                {
                    removeIndex = DrawArgItem(pageArgsHolder.ArgumentList[index], index);
                    if (removeIndex >= 0)
                    {
                        tempList.Remove(pageArgsHolder.ArgumentList[index]);
                    }
                }
                if (GUILayout.Button("Add Argument"))
                {
                    var lala = new PageArgs.ArgItemHolder();
                    lala.name = "Argument " + pageArgsHolder.ArgumentList.Count;
                    tempList.Add(lala);
                }
                pageArgsHolder.ArgumentList = tempList;
            }
        }
Exemple #2
0
 void CreateNewPage(string newPagename)
 {
     if (!PageNames.Contains(newPageName))
     {
         if (!string.IsNullOrEmpty(newPageName))
         {
             Regex rgx = new Regex("[^a-zA-Z]");
             if (!rgx.IsMatch(newPageName))
             {
                 if (!CheckForControllerExistance(newPageName))
                 {
                     settings.PagesPrefabs.Add(CreatePageTemplatePrefab(newPageName));
                     PageNames.Add(newPageName);
                     settings.PagesCacheSettings.Add(true);
                     var pageArgs = new PageArgs();
                     pageArgs.PageToCreate = (PagesEnum)settings.PagesCustomArguments.Count + 1;
                     settings.PagesCustomArguments.Add(pageArgs);
                     settings.PagesTitles.Add(newPagename);
                     EnumFileCreator.CreateOrOverwriteEnum("PagesEnum", PageNames.ToArray(), PagesEnumPath);
                     pageCallBackGuard = false;
                     EditorUtility.DisplayProgressBar("Please wait...", "Waiting for editor to compile scripts", 0.5f);
                     ShowErrorBox = false;
                 }
             }
             else
             {
                 ShowErrorBox = true;
                 errorMessage = "The page name '" + newPageName + "', has invalid characters";
                 Debug.LogError("The page name '" + newPageName + "', has invalid characters");
             }
         }
         else
         {
             ShowErrorBox = true;
             errorMessage = "The pages name cannot be empty!";
             Debug.LogError("The pages name cannot be empty!");
         }
     }
     else
     {
         ShowErrorBox = true;
         errorMessage = "There is already a page named '" + newPageName + "'";
         Debug.LogError("There is already a page named '" + newPageName + "'");
     }
 }
 /// <summary>
 /// Pushses a page to the stack with arguments.
 /// </summary>
 /// <param name="pageArgsHolder">Page arguments holder.</param>
 public void PushPageToStackWithArgs(PageArgs pageArgsHolder)
 {
     PageNav.GetPageNavInstance().PushPageToStackWithArgs(pageArgsHolder.PageToCreate, pageArgsHolder.DictionaryArgs);
 }