コード例 #1
0
        /// <summary>
        /// Reloads the file content view.
        /// You can optionally pass if you want to add the current navigated path to the stack.
        /// </summary>
        public void Reload(string path, bool addToStack)
        {
            try {
                List <GBase> files   = SystemCalls.returnFiles(path);
                List <GBase> folders = SystemCalls.returnFolders(path);
                if (addToStack && !(stack.Exists((String str) => { return(str.Equals(path)); })))
                {
                    stack.Add(path);
                }
                controller.getUI.UpdatePathField(path);
                CurrentSelectedFile = null;
                Clear((item) => { components.Remove(item.GetComponent <GComponent>()); });
                switch (GFileBrowser.FileOrder)
                {
                case GFileBrowser.Order.FirstFiles:
                    inst(files, addToComponents);
                    inst(folders, addToComponents);
                    break;

                case GFileBrowser.Order.FirstFolders:
                    inst(folders, addToComponents);
                    inst(files, addToComponents);
                    break;
                }
                recalculateContentSize(files.Count + folders.Count);
            } catch (Exception e) {
                controller.getUI.DisplayError(e);
            }
        }
コード例 #2
0
 /// <summary>
 /// Will delete the file-folder you provide.
 /// </summary>
 public static void DeleteGBase(GBase b)
 {
     if (b.GetType() == typeof(GFolder))
     {
         Directory.Delete(b.Path);
     }
     else if (b.GetType() == typeof(GFile))
     {
         File.Delete(b.Path);
     }
 }
コード例 #3
0
        void addToComponents(GBase b, GameObject go)
        {
            GComponent com = go.GetComponent <GComponent>();

            components.Add(com);
            com.Load(b);
            if (com.Type == typeof(GFile))
            {
                go.GetComponent <UIClickListener>().AddDownListener(UIClickListener.Type.LeftClick, () => {
                    controller.getUI.onFileLeftClicked(com);
                });
            }
            else if (com.Type == typeof(GFolder))
            {
                go.GetComponent <UIClickListener>().AddDownListener(UIClickListener.Type.LeftClick, () => {
                    controller.getUI.onFolderLeftClicked(com);
                });
            }
        }