Esempio n. 1
0
        void ExportToScriptableObject()
        {
            string   savePath      = "Assets/Resources/path_root.asset";
            PathRoot scriptableObj = ScriptableObject.CreateInstance <PathRoot>();

            UnityEditor.AssetDatabase.CreateAsset(scriptableObj, savePath);
            Dictionary <string, List <Vector3> > dic = new Dictionary <string, List <Vector3> >();

            for (int i = 0; i < showPathLines.transform.childCount; i++)
            {
                var            path     = showPathLines.transform.GetChild(i);
                bool           isYValid = path.GetComponent <ShowPathLine>().isYValid;
                List <Vector3> posList  = new List <Vector3>();
                for (int j = 0; j < path.childCount; j++)
                {
                    var     pathPos = path.GetChild(j);
                    Vector3 pos     = pathPos.transform.position;
                    if (!isYValid)
                    {
                        pos.y = 0f;
                    }
                    posList.Add(pos);
                }
                dic.Add(path.name, posList);
            }
            scriptableObj.Target = dic;

            UnityEditor.AssetDatabase.SaveAssets();
            UnityEditor.AssetDatabase.Refresh();
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxClient"/> class.
 /// </summary>
 /// <param name="options">The request handler options.</param>
 /// <param name="selectUser">The member id of the selected user. If provided together with
 /// a team access token, actions will be performed on this this user's Dropbox.</param>
 /// <param name="selectAdmin">The member id of the selected admin. If provided together with
 /// a team access token, access is allowed for all team owned contents.</param>
 /// <param name="pathRoot">The path root value used as Dropbox-Api-Path-Root header.</param>
 internal DropboxClient(
     DropboxRequestHandlerOptions options,
     string selectUser  = null,
     string selectAdmin = null,
     PathRoot pathRoot  = null)
     : this(new DropboxRequestHandler(options, selectUser : selectUser, selectAdmin : selectAdmin, pathRoot : pathRoot))
 {
 }
Esempio n. 3
0
        /// <summary>
        /// Set the value for Dropbox-Api-Path-Root header.
        /// </summary>
        /// <param name="pathRoot">The path root object.</param>
        /// <returns>A <see cref="DropboxClient"/> instance with Dropbox-Api-Path-Root header set.</returns>
        public DropboxClient WithPathRoot(PathRoot pathRoot)
        {
            if (pathRoot == null)
            {
                throw new ArgumentNullException("pathRoot");
            }

            return(new DropboxClient(this.requestHandler.WithPathRoot(pathRoot)));
        }
Esempio n. 4
0
 public static string GetRelativeDirectory(string path, PathRoot pathRoot = PathRoot.AssemblyDirectory)
 {
     return(pathRoot switch
     {
         PathRoot.WorkingDirectory => path.Replace(WorkingDirectory, WorkingDirectoryFlag),
         PathRoot.AssemblyDirectory => path.Replace(AssemblyDirectory, AssemblyDirectoryFlag),
         PathRoot.UserDirectory => path.Replace(UserDirectory, UserDirectoryFlag),
         PathRoot.TempDirectory => path.Replace(TempDirectory, TempDirectoryFlag),
         _ => path
     });
Esempio n. 5
0
        static public Options FolderSelect(string title, PathRoot pathRoot, bool parent = false, bool strip_extension = true)
        {
            Options opt = new Options();

            opt.title           = title;
            opt.filter          = null;
            opt.pathRoot        = pathRoot;
            opt.parent          = parent;
            opt.strip_extension = strip_extension;

            return(opt);
        }
        /// <summary>
        /// Set the value for Dropbox-Api-Path-Root header.
        /// </summary>
        /// <param name="pathRoot">The path root object.</param>
        /// <returns>A <see cref="DropboxClient"/> instance with Dropbox-Api-Path-Root header set.</returns>
        internal DropboxRequestHandler WithPathRoot(PathRoot pathRoot)
        {
            if (pathRoot == null)
            {
                throw new ArgumentNullException("pathRoot");
            }

            return(new DropboxRequestHandler(
                       this.options,
                       selectUser: this.selectUser,
                       selectAdmin: this.selectAdmin,
                       pathRoot: pathRoot));
        }
Esempio n. 7
0
        public void LoadScriptableObject()
        {
            PathRoot pathRoot = Resources.Load <PathRoot>("path_root");

            Dictionary <string, List <Vector3> > dic = pathRoot.Target;

            foreach (var kv in dic)
            {
                Debug.Log(kv.Key + "begin");
                for (int i = 0; i < kv.Value.Count; i++)
                {
                    Debug.Log(kv.Value[i]);
                }
                Debug.Log(kv.Key + "end");
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxRequestHandler"/> class.
        /// </summary>
        /// <param name="options">The configuration options for dropbox client.</param>
        /// <param name="selectUser">The member id of the selected user.</param>
        /// <param name="selectAdmin">The member id of the selected admin.</param>
        public DropboxRequestHandler(
            DropboxRequestHandlerOptions options,
            string selectUser  = null,
            string selectAdmin = null,
            PathRoot pathRoot  = null)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            this.options     = options;
            this.selectUser  = selectUser;
            this.selectAdmin = selectAdmin;
            this.pathRoot    = pathRoot;
        }
Esempio n. 9
0
        public bool IsBasePathOf(PathBuilder other, bool caseSensitivePaths)
        {
            Contract.Requires(other != null);

            if (IsRelative != other.IsRelative)
            {
                return(false);
            }

            if (IsUncPath != other.IsUncPath)
            {
                return(false);
            }

            if (PathDepth > other.PathDepth)
            {
                return(false);
            }

            StringComparison stringComparison = caseSensitivePaths ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;

            if (!PathRoot.Equals(other.PathRoot, stringComparison))
            {
                return(false);
            }

            for (int i = 0; i < pathComponents.Count; i++)
            {
                string thisPathComponent  = pathComponents[i];
                string otherPathComponent = other.pathComponents[i];
                if (!thisPathComponent.Equals(otherPathComponent, stringComparison))
                {
                    return(false);
                }
            }

            return(true);
        }