예제 #1
0
 //TODO see if XCode has a preference for ordering these attributes
 public PBXFileReference(string filePath, TreeEnum tree = TreeEnum.SOURCE_ROOT) : base()
 {
     this.Add(PATH_KEY, filePath);
     this.Add(NAME_KEY, System.IO.Path.GetFileName(filePath));
     this.Add(SOURCETREE_KEY, (string)(System.IO.Path.IsPathRooted(filePath) ? trees[TreeEnum.ABSOLUTE] : trees[tree]));
     this.GuessFileType();
 }
		public PBXFileReference( string filePath, TreeEnum tree = TreeEnum.SOURCE_ROOT ) : base()
		{
			this.Add( PATH_KEY, filePath );
			this.Add( NAME_KEY, System.IO.Path.GetFileName( filePath ) );
			this.Add( SOURCETREE_KEY, (string)( System.IO.Path.IsPathRooted( filePath ) ? trees[TreeEnum.ABSOLUTE] : trees[tree] ) );
			this.GuessFileType();
		}
 public PBXFileReference(string filePath, string fileName = null, TreeEnum tree = TreeEnum.SOURCE_ROOT) : base()
 {
     this.Add(PATH_KEY, filePath);
     //@since 3.9.2 loalization file name
     this.Add(NAME_KEY, fileName == null ? System.IO.Path.GetFileName(filePath) : fileName);
     this.Add(SOURCETREE_KEY, (string)(System.IO.Path.IsPathRooted(filePath) ? trees [TreeEnum.ABSOLUTE] : trees [tree]));
     this.GuessFileType();
 }
예제 #4
0
 void Start()
 {
     saveDraw      = GameObject.FindGameObjectWithTag("ManagerDraw").GetComponent <SaveDraw>();
     ButtonTuoiCay = GameObject.FindGameObjectWithTag("ButtonTuoiCay");
     te            = GameObject.FindGameObjectWithTag("TreeCanvas").GetComponent <TreeEnum>();
     phanTramWater = GameObject.FindGameObjectWithTag("TextWater").GetComponent <TextMeshProUGUI>();
     countItem     = GameObject.FindGameObjectWithTag("LeftBar").GetComponent <CountItemManager>();
     sumScale      = 0;
     StartCoroutine(DownPower(1));
 }
        public PBXFileReference(string filePath, TreeEnum tree = TreeEnum.SOURCE_ROOT) : base()
        {
            string temp     = "\"" + filePath + "\"";
            string fileName = System.IO.Path.GetFileName(filePath);

            this.guid = GenerateFileReferenceGuid(fileName);
            this.Add(PATH_KEY, temp);
            this.Add(NAME_KEY, fileName);
            this.Add(SOURCETREE_KEY, (string)(System.IO.Path.IsPathRooted(filePath) ? trees[TreeEnum.ABSOLUTE] : trees[tree]));
            this.GuessFileType();
        }
예제 #6
0
        public PBXFileReference(string filePath, TreeEnum tree = TreeEnum.SOURCE_ROOT) : base()
        {
            string temp     = "\"" + filePath + "\"";
            string fileName = System.IO.Path.GetFileName(filePath);

            if (fileName.Contains("+"))
            {
                this.Add("fileEncoding", "4");
                fileName = string.Format("\"{0}\"", fileName);
            }
            this.guid = GenerateFileReferenceGuid(fileName);
            this.Add(PATH_KEY, temp);
            this.Add(NAME_KEY, fileName);
            this.Add(SOURCETREE_KEY, (string)(System.IO.Path.IsPathRooted(filePath) ? trees[TreeEnum.ABSOLUTE] : trees[tree]));
            this.GuessFileType();
        }
		public PBXFileReference( string filePath, TreeEnum tree = TreeEnum.SOURCE_ROOT ) : base()
		{
			string temp = "\"" + filePath + "\"";
			string fileName = System.IO.Path.GetFileName (filePath);
			if (fileName.Contains("+")) {
				this.Add ("fileEncoding", "4");
			}

			if (fileName.Contains("+") || fileName.Contains("@")) {
				fileName = string.Format ("\"{0}\"", fileName);
			}

			this.guid = GenerateFileReferenceGuid (fileName);
			this.Add( PATH_KEY, temp );
			this.Add( NAME_KEY, fileName);
			this.Add( SOURCETREE_KEY, (string)( System.IO.Path.IsPathRooted( filePath ) ? trees[TreeEnum.ABSOLUTE] : trees[tree] ) );
			this.GuessFileType();
		}
예제 #8
0
        public static void AddFramework(IIgorModule ModuleInst, string ProjectPath, string Filename, TreeEnum TreeBase, string Path = "", int FileEncoding = -1, string LastKnownFileType = "", string Name = "")
        {
            string FrameworkFileRefGUID = AddNewFileReference(ModuleInst, ProjectPath, Filename, TreeBase, Path, FileEncoding, LastKnownFileType, Name);

            if(IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                if(IgorAssert.EnsureTrue(ModuleInst, CurrentProject != null, "XCodeProj couldn't be loaded."))
                {
                    bool bFoundFrameworksGroup = false;

                    foreach(KeyValuePair<string, PBXGroup> CurrentGroup in CurrentProject.groups)
                    {
                        if(CurrentGroup.Value.name == "Frameworks")
                        {
                            if(IgorAssert.EnsureTrue(ModuleInst, CurrentGroup.Value.ContainsKey("children"), "XCodeProj Frameworks PBXGroup doesn't have a children array."))
                            {
                                object FrameworkChildrenObj = CurrentGroup.Value.data["children"];

                                if(IgorAssert.EnsureTrue(ModuleInst, FrameworkChildrenObj != null, "XCodeProj Frameworks PBXGroup has a children key, but it can't be retrieved."))
                                {
                                    if(IgorAssert.EnsureTrue(ModuleInst, typeof(PBXList).IsAssignableFrom(FrameworkChildrenObj.GetType()), "XCodeProj Frameworks PBXGroup has a children key, but it can't be cast to PBXList."))
                                    {
                                        PBXList FrameworkChildrenList = (PBXList)FrameworkChildrenObj;

                                        if(IgorAssert.EnsureTrue(ModuleInst, FrameworkChildrenList != null, "XCodeProj casted Framework Children List is null."))
                                        {
                                            if(FrameworkChildrenList.Contains(FrameworkFileRefGUID))
                                            {
                                                IgorDebug.Log(ModuleInst, "Framework " + Filename + " has already been added to the Framework Group " + CurrentGroup.Key + ".");
                                            }
                                            else
                                            {
                                                FrameworkChildrenList.Add(FrameworkFileRefGUID);

                                                CurrentGroup.Value.data["children"] = FrameworkChildrenList;

                                                IgorDebug.Log(ModuleInst, "Added the " + Filename + " framework to the Framework Group " + CurrentGroup.Key + ".");
                                            }
                                        }
                                    }
                                }

                                bFoundFrameworksGroup = true;

                                break;
                            }
                        }
                    }

                    IgorAssert.EnsureTrue(ModuleInst, bFoundFrameworksGroup, "Couldn't find a Frameworks PBXGroup in the XCodeProj.");

                    CurrentProject.Save();
                }
            }

            string FrameworkBuildFileGUID = AddNewBuildFile(ModuleInst, ProjectPath, FrameworkFileRefGUID);

            if(IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                if(IgorAssert.EnsureTrue(ModuleInst, CurrentProject != null, "XCodeProj couldn't be loaded."))
                {
                    foreach(KeyValuePair<string, PBXFrameworksBuildPhase> CurrentTarget in CurrentProject.frameworkBuildPhases)
                    {
                        if(IgorAssert.EnsureTrue(ModuleInst, CurrentTarget.Value.ContainsKey("files"), "XCodeProj Framework Build Phase doesn't have a files array."))
                        {
                            object FrameworkFilesObj = CurrentTarget.Value.data["files"];

                            if(IgorAssert.EnsureTrue(ModuleInst, FrameworkFilesObj != null, "XCodeProj Framework Build Phase has a files key, but it can't be retrieved."))
                            {
                                if(IgorAssert.EnsureTrue(ModuleInst, typeof(PBXList).IsAssignableFrom(FrameworkFilesObj.GetType()), "XCodeProj Framework Build Phase has a files key, but it can't be cast to PBXList."))
                                {
                                    PBXList FrameworkFilesList = (PBXList)FrameworkFilesObj;

                                    if(IgorAssert.EnsureTrue(ModuleInst, FrameworkFilesList != null, "XCodeProj casted Framework File List is null."))
                                    {
                                        if(FrameworkFilesList.Contains(FrameworkBuildFileGUID))
                                        {
                                            IgorDebug.Log(ModuleInst, "Framework " + Filename + " has already been added to the Framework Build Phase " + CurrentTarget.Key + ".");
                                        }
                                        else
                                        {
                                            FrameworkFilesList.Add(FrameworkBuildFileGUID);

                                            CurrentTarget.Value.data["files"] = FrameworkFilesList;

                                            IgorDebug.Log(ModuleInst, "Added the " + Filename + " framework to the Framework Build Phase " + CurrentTarget.Key + ".");
                                        }
                                    }
                                }
                            }
                        }
                    }

                    CurrentProject.Save();
                }
            }
        }
예제 #9
0
        public static string AddNewFileReference(IIgorModule ModuleInst, string ProjectPath, string Filename, TreeEnum TreeBase, string Path = "", int FileEncoding = -1, string LastKnownFileType = "", string Name = "")
        {
            if(IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                foreach(KeyValuePair<string, PBXFileReference> CurrentFileRef in CurrentProject.fileReferences)
                {
                    if(CurrentFileRef.Value.name == Filename)
                    {
                        IgorDebug.Log(ModuleInst, "The file " + Filename + " is already referenced in the XCodeProj.");

                        return CurrentFileRef.Value.guid;
                    }
                }

                PBXFileReference NewFile = new PBXFileReference(Filename, TreeBase);

                if(Path != "")
                {
                    if(NewFile.ContainsKey("path"))
                    {
                        NewFile.Remove("path");
                    }

                    NewFile.Add("path", Path);
                }

                if(FileEncoding != -1)
                {
                    if(NewFile.ContainsKey("fileEncoding"))
                    {
                        NewFile.Remove("fileEncoding");
                    }

                    NewFile.Add("fileEncoding", FileEncoding);
                }

                if(LastKnownFileType != "")
                {
                    if(NewFile.ContainsKey("lastKnownFileType"))
                    {
                        NewFile.Remove("lastKnownFileType");
                    }

                    NewFile.Add("lastKnownFileType", LastKnownFileType);
                }

                if(Name != "")
                {
                    if(NewFile.ContainsKey("name"))
                    {
                        NewFile.Remove("name");
                    }

                    NewFile.Add("name", Name);
                }

                CurrentProject.fileReferences.Add(NewFile);

                IgorDebug.Log(ModuleInst, "File " + Filename + " has been added to the XCodeProj.");

                CurrentProject.Save();

                return NewFile.guid;
            }

            return "";
        }
예제 #10
0
 public PBXFileReference(string filePath, string compilerFlags, TreeEnum tree = TreeEnum.SOURCE_ROOT) : this(filePath, tree)
 {
     this.compilerFlags = compilerFlags;
 }
예제 #11
0
        public static void AddFramework(IIgorModule ModuleInst, string ProjectPath, string Filename, TreeEnum TreeBase, string Path = "", int FileEncoding = -1, string LastKnownFileType = "", string Name = "")
        {
            string FrameworkFileRefGUID = AddNewFileReference(ModuleInst, ProjectPath, Filename, TreeBase, Path, FileEncoding, LastKnownFileType, Name);

            if (IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                if (IgorAssert.EnsureTrue(ModuleInst, CurrentProject != null, "XCodeProj couldn't be loaded."))
                {
                    bool bFoundFrameworksGroup = false;

                    foreach (KeyValuePair <string, PBXGroup> CurrentGroup in CurrentProject.groups)
                    {
                        if (CurrentGroup.Value.name == "Frameworks")
                        {
                            if (IgorAssert.EnsureTrue(ModuleInst, CurrentGroup.Value.ContainsKey("children"), "XCodeProj Frameworks PBXGroup doesn't have a children array."))
                            {
                                object FrameworkChildrenObj = CurrentGroup.Value.data["children"];

                                if (IgorAssert.EnsureTrue(ModuleInst, FrameworkChildrenObj != null, "XCodeProj Frameworks PBXGroup has a children key, but it can't be retrieved."))
                                {
                                    if (IgorAssert.EnsureTrue(ModuleInst, typeof(PBXList).IsAssignableFrom(FrameworkChildrenObj.GetType()), "XCodeProj Frameworks PBXGroup has a children key, but it can't be cast to PBXList."))
                                    {
                                        PBXList FrameworkChildrenList = (PBXList)FrameworkChildrenObj;

                                        if (IgorAssert.EnsureTrue(ModuleInst, FrameworkChildrenList != null, "XCodeProj casted Framework Children List is null."))
                                        {
                                            if (FrameworkChildrenList.Contains(FrameworkFileRefGUID))
                                            {
                                                IgorDebug.Log(ModuleInst, "Framework " + Filename + " has already been added to the Framework Group " + CurrentGroup.Key + ".");
                                            }
                                            else
                                            {
                                                FrameworkChildrenList.Add(FrameworkFileRefGUID);

                                                CurrentGroup.Value.data["children"] = FrameworkChildrenList;

                                                IgorDebug.Log(ModuleInst, "Added the " + Filename + " framework to the Framework Group " + CurrentGroup.Key + ".");
                                            }
                                        }
                                    }
                                }

                                bFoundFrameworksGroup = true;

                                break;
                            }
                        }
                    }

                    IgorAssert.EnsureTrue(ModuleInst, bFoundFrameworksGroup, "Couldn't find a Frameworks PBXGroup in the XCodeProj.");

                    CurrentProject.Save();
                }
            }

            string FrameworkBuildFileGUID = AddNewBuildFile(ModuleInst, ProjectPath, FrameworkFileRefGUID);

            if (IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                if (IgorAssert.EnsureTrue(ModuleInst, CurrentProject != null, "XCodeProj couldn't be loaded."))
                {
                    foreach (KeyValuePair <string, PBXFrameworksBuildPhase> CurrentTarget in CurrentProject.frameworkBuildPhases)
                    {
                        if (IgorAssert.EnsureTrue(ModuleInst, CurrentTarget.Value.ContainsKey("files"), "XCodeProj Framework Build Phase doesn't have a files array."))
                        {
                            object FrameworkFilesObj = CurrentTarget.Value.data["files"];

                            if (IgorAssert.EnsureTrue(ModuleInst, FrameworkFilesObj != null, "XCodeProj Framework Build Phase has a files key, but it can't be retrieved."))
                            {
                                if (IgorAssert.EnsureTrue(ModuleInst, typeof(PBXList).IsAssignableFrom(FrameworkFilesObj.GetType()), "XCodeProj Framework Build Phase has a files key, but it can't be cast to PBXList."))
                                {
                                    PBXList FrameworkFilesList = (PBXList)FrameworkFilesObj;

                                    if (IgorAssert.EnsureTrue(ModuleInst, FrameworkFilesList != null, "XCodeProj casted Framework File List is null."))
                                    {
                                        if (FrameworkFilesList.Contains(FrameworkBuildFileGUID))
                                        {
                                            IgorDebug.Log(ModuleInst, "Framework " + Filename + " has already been added to the Framework Build Phase " + CurrentTarget.Key + ".");
                                        }
                                        else
                                        {
                                            FrameworkFilesList.Add(FrameworkBuildFileGUID);

                                            CurrentTarget.Value.data["files"] = FrameworkFilesList;

                                            IgorDebug.Log(ModuleInst, "Added the " + Filename + " framework to the Framework Build Phase " + CurrentTarget.Key + ".");
                                        }
                                    }
                                }
                            }
                        }
                    }

                    CurrentProject.Save();
                }
            }
        }
예제 #12
0
        public static string AddNewFileReference(IIgorModule ModuleInst, string ProjectPath, string Filename, TreeEnum TreeBase, string Path = "", int FileEncoding = -1, string LastKnownFileType = "", string Name = "")
        {
            if (IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                foreach (KeyValuePair <string, PBXFileReference> CurrentFileRef in CurrentProject.fileReferences)
                {
                    if (CurrentFileRef.Value.name == Filename)
                    {
                        IgorDebug.Log(ModuleInst, "The file " + Filename + " is already referenced in the XCodeProj.");

                        return(CurrentFileRef.Value.guid);
                    }
                }

                PBXFileReference NewFile = new PBXFileReference(Filename, TreeBase);

                if (Path != "")
                {
                    if (NewFile.ContainsKey("path"))
                    {
                        NewFile.Remove("path");
                    }

                    NewFile.Add("path", Path);
                }

                if (FileEncoding != -1)
                {
                    if (NewFile.ContainsKey("fileEncoding"))
                    {
                        NewFile.Remove("fileEncoding");
                    }

                    NewFile.Add("fileEncoding", FileEncoding);
                }

                if (LastKnownFileType != "")
                {
                    if (NewFile.ContainsKey("lastKnownFileType"))
                    {
                        NewFile.Remove("lastKnownFileType");
                    }

                    NewFile.Add("lastKnownFileType", LastKnownFileType);
                }

                if (Name != "")
                {
                    if (NewFile.ContainsKey("name"))
                    {
                        NewFile.Remove("name");
                    }

                    NewFile.Add("name", Name);
                }

                CurrentProject.fileReferences.Add(NewFile);

                IgorDebug.Log(ModuleInst, "File " + Filename + " has been added to the XCodeProj.");

                CurrentProject.Save();

                return(NewFile.guid);
            }

            return("");
        }
예제 #13
0
 //1% = 0.005
 // 25 % = 0.125
 void Start()
 {
     te = GameObject.FindGameObjectWithTag("TreeCanvas").GetComponent <TreeEnum>();
 }
예제 #14
0
 void Start()
 {
     HideButton = GameObject.FindGameObjectWithTag("TreeHideButton");
     te         = GameObject.FindGameObjectWithTag("TreeCanvas").GetComponent <TreeEnum>();
 }