예제 #1
0
        public static bool UpdateCore()
        {
            bool bThrewException = false;

            string LocalModulesList = IgorUtils.DownloadFileForUpdate(IgorModulesListFilename);

            try
            {
                if (File.Exists(LocalModulesList))
                {
                    if (File.Exists(InstalledModulesListPath) && HelperDelegates.bIsValid)
                    {
                        IgorUpdater.HelperDelegates.DeleteFile(InstalledModulesListPath);
                    }

                    IgorUpdater.HelperDelegates.CopyFile(LocalModulesList, InstalledModulesListPath);
                }

                UpdatedModules.Clear();

                if (UpdateModule(CoreModuleName, false))
                {
                    return(true);
                }
            }
            catch (TimeoutException to)
            {
                if (!File.Exists(LocalModulesList))
                {
                    Debug.LogError("Igor Error: Caught exception while self-updating.  Exception is " + (to == null ? "NULL exception!" : to.ToString()));

                    bThrewException = true;

                    CleanupTemp();
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Igor Error: Caught exception while updating core.  Exception is " + (e == null ? "NULL exception!" : e.ToString()));

                bThrewException = true;

                CleanupTemp();
            }

            if (!HelperDelegates.IgorJobConfig_GetWasMenuTriggered())
            {
                if (bThrewException)
                {
                    Debug.LogError("Igor Error: Exiting EditorApplication because an exception was thrown.");

                    if (HelperDelegates.bIsValid)
                    {
                        EditorApplication.Exit(-1);
                    }
                }
            }

            return(false);
        }
예제 #2
0
        public virtual void CopyJavaFilesAndReplacePackageName(string RootSourceDir, string RootDestDir)
        {
            List <string> JavaFilesToCopy = IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(RootSourceDir, true, false, true, true, true);

            foreach (string CurrentFile in JavaFilesToCopy)
            {
                if (CurrentFile.EndsWith(".java") || CurrentFile.EndsWith(".aidl"))
                {
                    string RelativeFilePath   = CurrentFile.Substring(RootSourceDir.Length + 1);
                    string NewDestinationPath = Path.Combine(RootDestDir, RelativeFilePath);

                    if (!Directory.Exists(Path.GetDirectoryName(NewDestinationPath)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(NewDestinationPath));
                    }

                    if (!File.Exists(NewDestinationPath))
                    {
                        IgorRuntimeUtils.CopyFile(CurrentFile, NewDestinationPath);

                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "com.facebook.android.R", PlayerSettings.bundleIdentifier + ".R");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "import com.facebook.android.*;", "import com.facebook.android.*;\nimport " + PlayerSettings.bundleIdentifier + ".R;");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "com.facebook.android.BuildConfig", PlayerSettings.bundleIdentifier + ".BuildConfig");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "import com.mikamikem.AndroidUnity.R;", "import " + PlayerSettings.bundleIdentifier + ".R;");
                    }
                }
            }
        }
예제 #3
0
        public static void LauncherProjectBuildLauncher(BuildTarget Target, string BuiltName)
        {
#if !UNITY_4_3
            BuiltName = System.IO.Path.Combine(System.IO.Path.GetFullPath("."), BuiltName);
#endif
            BuildPipeline.BuildPlayer(IgorUtils.GetLevels(), BuiltName, Target, BuildOptions.Development | BuildOptions.AllowDebugging);

            EditorApplication.Exit(0);
        }
예제 #4
0
        public virtual bool Build()
        {
            string BuiltName     = GetBuiltNameForTarget(JobBuildTarget);
            string BuiltBaseName = BuiltName;

            if (BuiltBaseName.Contains("."))
            {
                BuiltBaseName = BuiltName.Substring(0, BuiltBaseName.LastIndexOf('.'));
            }

            string DataFolderName = BuiltBaseName + "_Data";

            if (File.Exists(BuiltName))
            {
                IgorRuntimeUtils.DeleteFile(BuiltName);
            }

            if (Directory.Exists(DataFolderName))
            {
                IgorRuntimeUtils.DeleteDirectory(DataFolderName);
            }

#if !UNITY_4_3
            BuiltName = System.IO.Path.Combine(System.IO.Path.GetFullPath("."), BuiltName);
#endif
            BuildPipeline.BuildPlayer(IgorUtils.GetLevels(), BuiltName, JobBuildTarget, IgorBuildCommon.GetBuildOptions());

            Log("Destination file is: " + BuiltName);

            List <string> BuiltFiles = new List <string>();

            if (Directory.Exists(DataFolderName))
            {
                if (IgorAssert.EnsureTrue(this, File.Exists(BuiltName), "The built file " + BuiltName + " doesn't exist.  Something went wrong during the build step.  Please check the logs!"))
                {
                    BuiltFiles.Add(BuiltName);
                }

                if (IgorAssert.EnsureTrue(this, Directory.Exists(DataFolderName), "The built data directory for the Windows build " + DataFolderName + " doesn't exist.  Something went wrong during the build step.  Please check the logs!"))
                {
                    BuiltFiles.Add(DataFolderName);
                }
            }
            else
            {
                if (IgorAssert.EnsureTrue(this, Directory.Exists(BuiltName), "The built app directory for the Mac build " + BuiltName + " doesn't exist.  Something went wrong during the build step.  Please check the logs!"))
                {
                    BuiltFiles.Add(BuiltName);
                }
            }

            IgorCore.SetNewModuleProducts(BuiltFiles);

            return(true);
        }
예제 #5
0
        public virtual bool InternalCleanupTestable(bool bRunningTestInEditor = false)
        {
            if (!bRunningTestInEditor || (TestRunnerInst.CurrentTest != null && TestRunnerInst.CurrentTest.bForceLoadToFirstSceneInEditor))
            {
                string FirstLevelName = IgorUtils.GetFirstLevelName();

                if (FirstLevelName != "")
                {
                    if (EditorApplication.currentScene != FirstLevelName)
                    {
                        EditorApplication.OpenScene(FirstLevelName);

                        return(false);
                    }
                }
            }

            MonsterStarter[] Starters = GameObject.FindObjectsOfType <MonsterStarter>();

            foreach (MonsterStarter CurrentStarter in Starters)
            {
                GameObject.DestroyImmediate(CurrentStarter.gameObject);
            }

            if (!bRunningTestInEditor)
            {
                string StreamingAssetsFolder = Path.Combine("Assets", Path.Combine("StreamingAssets", Path.Combine("Igor", Path.Combine("Monster", "Config"))));

                if (Directory.Exists(StreamingAssetsFolder))
                {
                    IgorRuntimeUtils.DeleteDirectory(StreamingAssetsFolder);
                }

                string LastValue = IgorJobConfig.GetStringParam(LastDisplayResolutionDialogFlag);

                switch (LastValue)
                {
                case "Disabled":
                    PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.Disabled;
                    break;

                case "Enabled":
                    PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.Enabled;
                    break;

                case "HiddenByDefault":
                    PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.HiddenByDefault;
                    break;
                }
            }

            return(true);
        }
예제 #6
0
        public virtual bool UpdateXCodeProj()
        {
            string FacebookID          = GetParamOrConfigString(FacebookIDFlag, "Your Facebook ID hasn't been set!  Facebook functionality will probably not work correctly.");
            string FacebookDisplayName = GetParamOrConfigString(FacebookDisplayNameFlag, "Your Facebook Display Name hasn't been set!  Facebook functionality will probably not work correctly.");

            List <string> BuildProducts = IgorCore.GetModuleProducts();

            if (IgorAssert.EnsureTrue(this, BuildProducts.Count > 0, "Attempting to update the XCode project, but one was not generated in the build phase!"))
            {
                string ProjectPath = Path.Combine(BuildProducts[0], "Unity-IPhone.xcodeproj");

                string FacebookIntegrationGUID = IgorXCodeProjUtils.AddNewFileReference(this, ProjectPath, "FacebookIntegration.h", TreeEnum.GROUP);

                IgorXCodeProjUtils.SortGUIDIntoGroup(this, ProjectPath, FacebookIntegrationGUID, "Libraries");

                IgorXCodeProjUtils.AddFramework(this, ProjectPath, "FacebookSDK.framework", TreeEnum.GROUP, "Libraries/FacebookSDK.framework", -1, "wrapper.framework", "FacebookSDK.framework");

                IgorXCodeProjUtils.AddFrameworkSearchPath(this, ProjectPath, "$(SRCROOT)/Libraries");

                string PlistPath = Path.Combine(BuildProducts[0], "Info.plist");

                IgorPlistUtils.SetStringValue(this, PlistPath, "FacebookAppID", FacebookID);

                IgorPlistUtils.SetStringValue(this, PlistPath, "FacebookDisplayName", FacebookDisplayName);

                IgorPlistUtils.AddBundleURLType(this, PlistPath, "fb" + FacebookID);

                IgorZip.UnzipArchiveCrossPlatform(this, Path.Combine(Path.GetFullPath("."), Path.Combine("Assets", Path.Combine("Plugins", Path.Combine("iOS", Path.Combine("FacebookSDK", "FacebookSDK.framework.zip"))))), Path.Combine(BuildProducts[0], "Libraries"));

                IgoriOSSourceUtils.AddHeaderToAppControllerSource(this, BuildProducts[0], "../Libraries/FacebookIntegration.h");

                IgoriOSSourceUtils.AddFunctionToAppControllerSource(this, BuildProducts[0], "/* Pre iOS 4.2 support */\n- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url\n{\n\treturn [FBSession.activeSession handleOpenURL:url];\n}\n");

                IgorUtils.ReplaceStringsInFile(this, Path.Combine(BuildProducts[0], Path.Combine("Classes", "UnityAppController.mm")), "AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);\n\treturn YES;", "AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData); return [FBSession.activeSession handleOpenURL:url];");

                IgoriOSSourceUtils.AddSourceToApplicationDidBecomeActive(this, BuildProducts[0], "[FBSession.activeSession handleDidBecomeActive];");
            }

            return(true);
        }
예제 #7
0
        public virtual bool RebuildAmplify()
        {
            string FirstLevelName = IgorUtils.GetFirstLevelName();

            if (FirstLevelName != "")
            {
                if (EditorApplication.currentScene != FirstLevelName)
                {
                    Log("Opening scene " + FirstLevelName);

                    EditorApplication.OpenScene(FirstLevelName);

                    return(false);
                }
            }

            Log("Triggering rebuild of Amplify Texture VTs.");

            TriggerRebuildAllVTsInScene(AmplifyTexture.InternalEditor.Instance);

            return(true);
        }
예제 #8
0
        public static void EditorHandleJobStatus(IgorCore.JobReturnStatus Status)
        {
            if (Status.bDone)
            {
                if (IgorAssert.HasJobFailed())
                {
                    IgorDebug.CoreLogError("Job failed!");
                }
                else
                {
                    IgorDebug.CoreLog("Job's done!");
                }

                float time = IgorUtils.PlayJobsDoneSound();
                System.Threading.Thread t = new System.Threading.Thread(() => WaitToExit(time));
                t.Start();

                while (t.IsAlive)
                {
                }
            }

            if (Status.bFailed)
            {
                IgorJobConfig.SetIsRunning(false);

                if (!Status.bWasStartedManually)
                {
                    EditorApplication.Exit(-1);
                }
            }

            if (!Status.bWasStartedManually && Status.bDone)
            {
                EditorApplication.Exit(0);
            }
        }
예제 #9
0
 public static void AddSourceToApplicationDidBecomeActive(IIgorModule ModuleInst, string PathToProject, string AdditionalSource)
 {
     IgorUtils.ReplaceStringsInFile(ModuleInst, Path.Combine(PathToProject, Path.Combine("Classes", "UnityAppController.mm")),
                                    "printf_console(\"-> applicationDidBecomeActive()\\n\");", AdditionalSource + "\nprintf_console(\"-> applicationDidBecomeActive()\\n\");");
 }
예제 #10
0
 public static void AddFunctionToAppControllerSource(IIgorModule ModuleInst, string PathToProject, string FunctionSource)
 {
     IgorUtils.ReplaceStringsInFile(ModuleInst, Path.Combine(PathToProject, Path.Combine("Classes", "UnityAppController.mm")),
                                    "@implementation UnityAppController", "@implementation UnityAppController\n" + FunctionSource);
 }
예제 #11
0
 public static void AddHeaderToAppControllerSource(IIgorModule ModuleInst, string PathToProject, string HeaderFile)
 {
     IgorUtils.ReplaceStringsInFile(ModuleInst, Path.Combine(PathToProject, Path.Combine("Classes", "UnityAppController.mm")),
                                    "@implementation UnityAppController", "#import \"" + HeaderFile + "\"\n@implementation UnityAppController");
 }
예제 #12
0
        public virtual bool InternalBuildTestable(bool bRunningTestInEditor = false)
        {
            if (!bRunningTestInEditor)
            {
                if (!IgorSetScriptingDefines.ExtraModuleParams.Contains("MONSTER_TEST_RUNTIME"))
                {
                    IgorSetScriptingDefines.ExtraModuleParams += ";MONSTER_TEST_RUNTIME";
                }

                if (!IgorSetScriptingDefines.ExtraModuleParams.Contains("IGOR_RUNTIME"))
                {
                    IgorSetScriptingDefines.ExtraModuleParams += ";IGOR_RUNTIME";
                }

                IgorJobConfig.SetStringParam(LastDisplayResolutionDialogFlag, PlayerSettings.displayResolutionDialog.ToString());

                PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.Disabled;
            }

            if (!bRunningTestInEditor || (TestRunnerInst.CurrentTest != null && TestRunnerInst.CurrentTest.bForceLoadToFirstSceneInEditor))
            {
                string FirstLevelName = IgorUtils.GetFirstLevelName();

                if (FirstLevelName != "")
                {
                    if (EditorApplication.currentScene != FirstLevelName)
                    {
                        EditorApplication.OpenScene(FirstLevelName);

                        return(false);
                    }
                }
            }

            if (MonsterStarter.GetInstance() == null)
            {
                GameObject MonsterStarterInst = new GameObject("MonsterTestStarter");

                MonsterStarterInst.AddComponent <MonsterStarter>();

                EditorApplication.SaveScene();
            }

            if (!bRunningTestInEditor)
            {
                string StreamingAssetsFolder = Path.Combine("Assets", Path.Combine("StreamingAssets", Path.Combine("Igor", Path.Combine("Monster", "Config"))));

                if (Directory.Exists(StreamingAssetsFolder))
                {
                    MonsterDebug.LogError("Attempting to overwrite the " + StreamingAssetsFolder + ", but it already exists!");

                    IgorRuntimeUtils.DeleteDirectory(StreamingAssetsFolder);

                    Directory.CreateDirectory(StreamingAssetsFolder);
                }
                else
                {
                    Directory.CreateDirectory(StreamingAssetsFolder);
                }

                string ConfigRoot = Path.Combine(MonsterTestCore.MonsterLocalDirectoryRoot, "Config");

                if (Directory.Exists(ConfigRoot))
                {
                    IgorRuntimeUtils.DirectoryCopy(ConfigRoot, StreamingAssetsFolder, true);
                }
            }

            return(true);
        }
예제 #13
0
        public static bool UpdateModule(string ModuleName, bool ForceUpdate)
        {
            bool bUpdated = false;

            if (File.Exists(InstalledModulesListPath))
            {
                SharedModuleListInst = IgorModuleList.Load(InstalledModulesListPath);
            }

            if (SharedModuleListInst != null)
            {
                foreach (IgorModuleList.ModuleItem CurrentModule in SharedModuleListInst.Modules)
                {
                    if (CurrentModule.ModuleName == ModuleName)
                    {
                        string ModuleDescriptor        = IgorUtils.DownloadFileForUpdate(RemoteRelativeModuleRoot + CurrentModule.ModuleDescriptorRelativePath);
                        string CurrentModuleDescriptor = Path.Combine(LocalModuleRoot, CurrentModule.ModuleDescriptorRelativePath);

                        if (File.Exists(ModuleDescriptor))
                        {
                            IgorModuleDescriptor CurrentModuleDescriptorInst = null;
                            IgorModuleDescriptor NewModuleDescriptorInst     = IgorModuleDescriptor.Load(ModuleDescriptor);

                            if (File.Exists(CurrentModuleDescriptor))
                            {
                                CurrentModuleDescriptorInst = IgorModuleDescriptor.Load(CurrentModuleDescriptor);
                            }

                            if (NewModuleDescriptorInst != null)
                            {
                                if (UpdatedModules.Contains(NewModuleDescriptorInst.ModuleName))
                                {
                                    return(false);
                                }

                                UpdatedModules.Add(NewModuleDescriptorInst.ModuleName);

                                if (NewModuleDescriptorInst.ModuleDependencies.Count > 0)
                                {
                                    foreach (string CurrentDependency in NewModuleDescriptorInst.ModuleDependencies)
                                    {
                                        bUpdated = UpdateModule(CurrentDependency, ForceUpdate) || bUpdated;
                                    }
                                }

                                int NewVersion = NewModuleDescriptorInst.ModuleVersion;

                                if (CurrentModuleDescriptorInst == null || NewVersion > CurrentModuleDescriptorInst.ModuleVersion || bAlwaysUpdate || ForceUpdate)
                                {
                                    bUpdated = true;
                                    UpdatedContent.Add(ModuleName);

                                    List <string> FilesToDelete = new List <string>();

                                    if (CurrentModuleDescriptorInst != null)
                                    {
                                        IgorUpdater.HelperDelegates.DeleteFile(CurrentModuleDescriptor);

                                        FilesToDelete.AddRange(CurrentModuleDescriptorInst.ModuleFiles);
                                    }

                                    if (!Directory.Exists(Path.GetDirectoryName(CurrentModuleDescriptor)))
                                    {
                                        Directory.CreateDirectory(Path.GetDirectoryName(CurrentModuleDescriptor));
                                    }

                                    IgorUpdater.HelperDelegates.CopyFile(ModuleDescriptor, CurrentModuleDescriptor);

                                    foreach (string ModuleFile in NewModuleDescriptorInst.ModuleFiles)
                                    {
                                        FilesToDelete.Remove(ModuleFile);

                                        bool bIsExternal = false;

                                        string LocalFile = IgorUtils.GetLocalFileFromModuleFilename(ModuleFile);

                                        string FullLocalPath = Path.Combine(LocalModuleRoot, Path.Combine(Path.GetDirectoryName(CurrentModule.ModuleDescriptorRelativePath), LocalFile));

                                        string RemotePath = IgorUtils.GetRemoteFileFromModuleFilename(RemoteRelativeModuleRoot + Path.GetDirectoryName(CurrentModule.ModuleDescriptorRelativePath) + "/", ModuleFile, ref bIsExternal);

                                        if (LocalFile.StartsWith("."))
                                        {
                                            string Base         = Path.Combine(LocalModuleRoot.Replace('/', Path.DirectorySeparatorChar), Path.GetDirectoryName(CurrentModule.ModuleDescriptorRelativePath.Replace('/', Path.DirectorySeparatorChar)));
                                            string NewLocalFile = LocalFile.Replace('/', Path.DirectorySeparatorChar);
                                            int    FirstIndex   = NewLocalFile.IndexOf(".." + Path.DirectorySeparatorChar);

                                            while (FirstIndex != -1)
                                            {
                                                int LastIndex = Base.LastIndexOf(Path.DirectorySeparatorChar);

                                                if (LastIndex != -1)
                                                {
                                                    Base = Base.Substring(0, LastIndex);
                                                }

                                                NewLocalFile = NewLocalFile.Substring(3);

                                                FirstIndex = NewLocalFile.IndexOf(".." + Path.DirectorySeparatorChar);
                                            }

                                            FullLocalPath = Path.Combine(Base, NewLocalFile);
                                            RemotePath    = IgorUtils.GetRemoteFileFromModuleFilename(RemoteRelativeModuleRoot + Path.GetDirectoryName(CurrentModule.ModuleDescriptorRelativePath) + "/", ModuleFile, ref bIsExternal);
                                        }

                                        string TempDownloadPath = "";
                                        if (bIsExternal)
                                        {
                                            if (!bLocalDownload || bDownloadRemoteWhenLocal || !File.Exists(FullLocalPath))
                                            {
                                                if (LocalFile.Contains("../"))
                                                {
                                                    TempDownloadPath = IgorUtils.DownloadFileForUpdate(FullLocalPath, RemotePath);
                                                }
                                                else
                                                {
                                                    TempDownloadPath = IgorUtils.DownloadFileForUpdate(Path.Combine(Path.GetDirectoryName(CurrentModule.ModuleDescriptorRelativePath), LocalFile), RemotePath);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            TempDownloadPath = IgorUtils.DownloadFileForUpdate(RemotePath);
                                        }

                                        if (TempDownloadPath != "")
                                        {
                                            if (File.Exists(FullLocalPath))
                                            {
                                                IgorUpdater.HelperDelegates.DeleteFile(FullLocalPath);
                                            }

                                            if (!Directory.Exists(Path.GetDirectoryName(FullLocalPath)))
                                            {
                                                Directory.CreateDirectory(Path.GetDirectoryName(FullLocalPath));
                                            }

                                            if (File.Exists(TempDownloadPath))
                                            {
                                                IgorUpdater.HelperDelegates.CopyFile(TempDownloadPath, FullLocalPath);
                                            }
                                        }
                                    }

                                    foreach (string FilenameToDelete in FilesToDelete)
                                    {
                                        string LocalFile     = IgorUtils.GetLocalFileFromModuleFilename(FilenameToDelete);
                                        string FullLocalPath = Path.Combine(LocalModuleRoot, Path.Combine(Path.GetDirectoryName(CurrentModule.ModuleDescriptorRelativePath), LocalFile));

                                        if (File.Exists(FullLocalPath))
                                        {
                                            IgorUpdater.HelperDelegates.DeleteFile(FullLocalPath);
                                        }
                                    }
                                }
                            }
                        }

                        return(bUpdated);
                    }
                }
            }

            return(false);
        }
예제 #14
0
        public static bool SelfUpdate(out bool bMajorUpgrade)
        {
            bool bThrewException = false;

            bMajorUpgrade = false;

            string InstalledFilePath = Path.Combine(BaseIgorDirectory, IgorUpdaterFilename);

            try
            {
                string LocalUpdater = IgorUtils.DownloadFileForUpdate(IgorUpdaterURL);

                if (File.Exists(LocalUpdater))
                {
                    int NewVersion      = GetVersionFromUpdaterFile(LocalUpdater);
                    int NewMajorUpgrade = GetMajorUpgradeFromUpdaterFile(LocalUpdater);

                    if (NewMajorUpgrade > MajorUpgrade)
                    {
                        bMajorUpgrade = true;
                    }

                    if (NewVersion > Version || bAlwaysUpdate)
                    {
                        if (File.Exists(InstalledFilePath))
                        {
                            IgorUpdater.HelperDelegates.DeleteFile(InstalledFilePath);
                        }

                        if (!Directory.Exists(Path.GetDirectoryName(InstalledFilePath)))
                        {
                            Directory.CreateDirectory(Path.GetDirectoryName(InstalledFilePath));
                        }

                        IgorUpdater.HelperDelegates.CopyFile(LocalUpdater, InstalledFilePath);

                        return(true);
                    }
                }
            }
            catch (TimeoutException to)
            {
                if (!File.Exists(InstalledFilePath))
                {
                    Debug.LogError("Igor Error: Caught exception while self-updating.  Exception is " + (to == null ? "NULL exception!" : to.ToString()));

                    bThrewException = true;

                    CleanupTemp();
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Igor Error: Caught exception while self-updating.  Exception is " + (e == null ? "NULL exception!" : e.ToString()));

                bThrewException = true;

                CleanupTemp();
            }

            if (!HelperDelegates.IgorJobConfig_GetWasMenuTriggered())
            {
                if (bThrewException)
                {
                    Debug.LogError("Igor Error: Exiting EditorApplication because an exception was thrown.");

                    if (HelperDelegates.bIsValid)
                    {
                        EditorApplication.Exit(-1);
                    }
                }
            }

            return(false);
        }
예제 #15
0
        public virtual bool Build(BuildOptions PlatformSpecificOptions)
        {
            if (!IgorAssert.EnsureTrue(this, GetAndroidSDKPath(this) != "", "Android SDK path is not set!"))
            {
                return(true);
            }

            PlayerSettings.Android.keystorePass = GetParamOrConfigString(AndroidKeystorePassFlag, "Your Android Keystore Password isn't set!  We won't be able to sign your application!");
            PlayerSettings.Android.keyaliasPass = GetParamOrConfigString(AndroidKeyAliasPassFlag, "Your Android Key Alias Password isn't set!  We won't be able to sign your application!");

            if (PlayerSettings.Android.keystorePass == "" || PlayerSettings.Android.keyaliasPass == "")
            {
                return(true);
            }

            FixReadOnlyFilesIn3rdPartyLibs();

            string AndroidProjDirectory = Path.Combine(Path.GetFullPath("."), "Android");

            if (AndroidProjDirectory.Contains(" "))
            {
                AndroidProjDirectory = Path.Combine(Path.GetTempPath() + PlayerSettings.productName, "Android");
            }

            if (Directory.Exists(AndroidProjDirectory))
            {
                IgorRuntimeUtils.DeleteDirectory(AndroidProjDirectory);
            }

            string FullBuiltPath = System.IO.Path.Combine(System.IO.Path.GetFullPath("."), GetBuiltNameForTarget(BuildTarget.Android));

            if (File.Exists(FullBuiltPath))
            {
                IgorRuntimeUtils.DeleteFile(FullBuiltPath);
            }

            // We need to force create the directory before we use it or it will prompt us for a path to build to
            Directory.CreateDirectory(AndroidProjDirectory);

            Log("Android project destination directory is: " + AndroidProjDirectory);

            EditorUserBuildSettings.symlinkLibraries             = true;
            EditorUserBuildSettings.exportAsGoogleAndroidProject = true;

            EditorUserBuildSettings.SetBuildLocation(BuildTarget.Android, AndroidProjDirectory);

            BuildOptions AllOptions = PlatformSpecificOptions | BuildOptions.AcceptExternalModificationsToPlayer;

            AllOptions |= GetExternalBuildOptions(JobBuildTarget);

            BuildPipeline.BuildPlayer(IgorUtils.GetLevels(), AndroidProjDirectory, BuildTarget.Android, AllOptions);

            CopyActivityOverrideSourceFiles(AndroidProjDirectory);

            List <string> BuiltFiles = new List <string>();

            BuiltFiles.Add(AndroidProjDirectory);

            IgorCore.SetNewModuleProducts(BuiltFiles);

            Log("Android Eclipse project has been created.");

            return(true);
        }