-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 'master'
Develop See merge request sdk_group/store-unity-sdk!366
- Loading branch information
Showing
509 changed files
with
276 additions
and
1,623 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
!xsolla-unity-sdk-latest.unitypackage | ||
|
||
[Ll]ibrary/ | ||
[Tt]emp/ | ||
[Oo]bj/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
72 changes: 72 additions & 0 deletions
72
Assets/Xsolla/Core/Browser/XsollaBrowser/Editor/BrowserPrefabProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System.IO; | ||
using UnityEditor; | ||
using UnityEditor.Build; | ||
using UnityEditor.Build.Reporting; | ||
using UnityEngine; | ||
|
||
namespace Xsolla.XsollaBrowser | ||
{ | ||
public class BrowserPrefabProcessor : IPreprocessBuildWithReport, IPostprocessBuildWithReport | ||
{ | ||
public int callbackOrder { get; } | ||
|
||
private static string SavedOriginPrefabPath; | ||
|
||
public void OnPreprocessBuild(BuildReport report) | ||
{ | ||
SavedOriginPrefabPath = null; | ||
|
||
if (report.summary.platformGroup == BuildTargetGroup.Standalone) | ||
return; | ||
|
||
var originPrefabPath = GetOriginPrefabPath(); | ||
var tempPrefabPath = GetTempPrefabPath(); | ||
|
||
var error = AssetDatabase.MoveAsset(originPrefabPath, tempPrefabPath); | ||
if (!string.IsNullOrEmpty(error)) | ||
{ | ||
Debug.LogError($"Can't move {originPrefabPath} to {tempPrefabPath}: {error}"); | ||
return; | ||
} | ||
|
||
AssetDatabase.Refresh(); | ||
SavedOriginPrefabPath = originPrefabPath; | ||
} | ||
|
||
public void OnPostprocessBuild(BuildReport report) | ||
{ | ||
if (report.summary.platformGroup == BuildTargetGroup.Standalone) | ||
return; | ||
|
||
if (SavedOriginPrefabPath == null) | ||
return; | ||
|
||
var originPrefabPath = SavedOriginPrefabPath; | ||
var tempPrefabPath = GetTempPrefabPath(); | ||
|
||
var error = AssetDatabase.MoveAsset(tempPrefabPath, originPrefabPath); | ||
if (!string.IsNullOrEmpty(error)) | ||
Debug.LogError($"Can't move {tempPrefabPath} to {originPrefabPath}: {error}"); | ||
|
||
AssetDatabase.Refresh(); | ||
SavedOriginPrefabPath = null; | ||
} | ||
|
||
private static string GetOriginPrefabPath() | ||
{ | ||
var guids = AssetDatabase.FindAssets("t:Prefab XsollaWebBrowser"); | ||
if (guids.Length == 0) | ||
throw new FileNotFoundException($"Can't find {nameof(BrowserPrefabProcessor)} script"); | ||
|
||
if (guids.Length > 1) | ||
throw new FileNotFoundException($"Found more than one {nameof(BrowserPrefabProcessor)} script"); | ||
|
||
return AssetDatabase.GUIDToAssetPath(guids[0]); | ||
} | ||
|
||
private static string GetTempPrefabPath() | ||
{ | ||
return Path.Combine("Assets", "XsollaWebBrowser.prefab"); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Assets/Xsolla/Core/Browser/XsollaBrowser/Editor/BrowserPrefabProcessor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.