接入jpsdk
This commit is contained in:
parent
690a5e81e3
commit
969b421427
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8ae0b06cb10ac46d8bb8f5bc0261761c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 17e774d428c22429081ed67105885578
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 116756f4486764b9585fa0e684c1e954
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6ce5a29754994495287804d888b9d4a3
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Joypac;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
public class BannerButton : JPButton
|
||||||
|
{
|
||||||
|
bool show = false;
|
||||||
|
[SerializeField]
|
||||||
|
private Text text = default;
|
||||||
|
public override void Start()
|
||||||
|
{
|
||||||
|
base.Start();
|
||||||
|
text.text = "Banner";
|
||||||
|
}
|
||||||
|
public override void OnClick()
|
||||||
|
{
|
||||||
|
if(show == false)
|
||||||
|
{
|
||||||
|
JoypacAdManager.Instance.ShowBanner();
|
||||||
|
text.text = "HideBanner";
|
||||||
|
show = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JoypacAdManager.Instance.HideBanner();
|
||||||
|
text.text = "Banner";
|
||||||
|
show = true;
|
||||||
|
show = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 70e15a32390af4068935f850828f3c2d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using Joypac;
|
||||||
|
public class InterVideoButton : JPButton
|
||||||
|
{
|
||||||
|
enum IVNumber
|
||||||
|
{
|
||||||
|
Inter1,
|
||||||
|
Inter2,
|
||||||
|
}
|
||||||
|
[SerializeField]
|
||||||
|
IVNumber iVNumber;
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
#if !TWOINTER
|
||||||
|
if (iVNumber == IVNumber.Inter2)
|
||||||
|
{
|
||||||
|
this.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnClick()
|
||||||
|
{
|
||||||
|
switch (iVNumber)
|
||||||
|
{
|
||||||
|
case IVNumber.Inter1:
|
||||||
|
JoypacAdManager.Instance.ShowInterstitial(null, ConstStringKey.JOYPAC_SDK_INTERID, "test1");
|
||||||
|
break;
|
||||||
|
case IVNumber.Inter2:
|
||||||
|
#if TWOINTER
|
||||||
|
JoypacAdManager.Instance.ShowInterstitial(null, ConstStringKey.JOYPAC_SDK_INTERID2,"test2");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a2947b0ff488544b48c0a4a3ebfc2939
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class JoypacDemo : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 564a0c6b3eeda4f7cbb643d11b22b309
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Joypac;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class NativeButton : JPButton
|
||||||
|
{
|
||||||
|
bool show = false;
|
||||||
|
[SerializeField]
|
||||||
|
private Text text = default;
|
||||||
|
[SerializeField]
|
||||||
|
NativeAd nativeAd;
|
||||||
|
public override void Start()
|
||||||
|
{
|
||||||
|
base.Start();
|
||||||
|
text.text = "Native";
|
||||||
|
}
|
||||||
|
public override void OnClick()
|
||||||
|
{
|
||||||
|
if (show == false)
|
||||||
|
{
|
||||||
|
nativeAd.ShowNativeAd();
|
||||||
|
text.text = "HideNative";
|
||||||
|
show = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JoypacAdManager.Instance.HideNative(false);
|
||||||
|
text.text = "Native";
|
||||||
|
show = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d93a36bad8e9d43f288e5392cf291086
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using Joypac;
|
||||||
|
public class RewardVideoButton : JPButton
|
||||||
|
{
|
||||||
|
public override void OnClick()
|
||||||
|
{
|
||||||
|
JPRewardAd.Instance.ShowRV("test", () => { PopupView.Show(null, false, "播放成功!可以给奖励!", true); });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void test()
|
||||||
|
{
|
||||||
|
JPRewardAd.Instance.ShowRV("test", success);
|
||||||
|
}
|
||||||
|
public void success()
|
||||||
|
{
|
||||||
|
//播放成功回调
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 90eba0ed596b44b86976d3ade08162d0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using Joypac;
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
using JoyAdSigle = JoyPacCurrentcyAdSingle;
|
||||||
|
#endif
|
||||||
|
public class SettingPopViewButton : JPButton
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
private JoyAdSigle _currAdSigle;
|
||||||
|
#endif
|
||||||
|
public override void OnClick()
|
||||||
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
|
JoypacAdClient.Instance.ShowSettingPopView();
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
#if ANDROID_GP
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
if (_currAdSigle != null)
|
||||||
|
_currAdSigle.showAgreementPermissionPop();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void test()
|
||||||
|
{
|
||||||
|
// JPRewardAd.Instance.ShowRV("test", success);
|
||||||
|
}
|
||||||
|
public void success()
|
||||||
|
{
|
||||||
|
//播放成功回调
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 37e4f36d79aae43168d20938963a0b80
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3b85081f5097b449eb5b24bcfdec855c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
|
|
@ -0,0 +1,121 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 91c7aa3bcdee0466f9efbf40c929f2e0
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 9
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 56cf23676d44946ce88a87ad8eddfb1a
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6c79de43426684bbd91c017fc25a1be1
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
|
|
@ -0,0 +1,121 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 976be38b9c2df456eb2181d33ac4d8de
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 9
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: b80896c05472a456eaff0f1281909aae
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
|
|
@ -0,0 +1,121 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 76313e85d379943bc9059b2dc49a0817
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 9
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 743485857629c49748ed053a9e499334
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
|
|
@ -0,0 +1,121 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9e0b71bcfadb24b4a8971140c9556bfe
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 9
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- serializedVersion: 2
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 4b5d3032b0db545f4b5b1a2a6c06dd75
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0eb58230e0e1342cc9bee58af2befb62
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dc9cd4f800d5e4d14acd3b6558efcbc9
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,438 @@
|
||||||
|
//#define JPChannel_Save
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
/*create by :闫婷婷
|
||||||
|
* date :2020/7/9
|
||||||
|
*/
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class JPChannelData
|
||||||
|
{
|
||||||
|
public string button_text = "";
|
||||||
|
public BuildTargetGroup buildTargetGroup = BuildTargetGroup.iOS;
|
||||||
|
public string info_plist_name = "";
|
||||||
|
public string channel_macro_definition = "";
|
||||||
|
}
|
||||||
|
[Serializable]
|
||||||
|
public class JPChannelAll
|
||||||
|
{
|
||||||
|
public string info_target_path = "";
|
||||||
|
public const string info_plist_name = "JoypacService-info.plist";
|
||||||
|
public const string info_plist_file = "/" + "JPChannel" + "/" + "info" + "/";
|
||||||
|
public JPChannelData[] channelDatas;
|
||||||
|
}
|
||||||
|
public class JPChannel : EditorWindow
|
||||||
|
{
|
||||||
|
private static JPChannel window = null;
|
||||||
|
private static JPChannelAll channelAll;
|
||||||
|
private static string[] all = new string[2];
|
||||||
|
private static string channel_path = "JPChannel";
|
||||||
|
private static string channel_json_name = "channel.json";
|
||||||
|
private static string info = "info";
|
||||||
|
JPChannel()
|
||||||
|
{
|
||||||
|
this.titleContent = new GUIContent("Joypac Channel");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("Tools/Change Channel")]
|
||||||
|
public static void ShowWindow()
|
||||||
|
{
|
||||||
|
ClearAll();
|
||||||
|
window = EditorWindow.GetWindow(typeof(JPChannel)) as JPChannel;
|
||||||
|
//window.titleContent = new GUIContent("Change Channel");
|
||||||
|
string path = Application.dataPath + "/" + channel_path;
|
||||||
|
|
||||||
|
//已包含国内和海外两个渠道,如有其他渠道,在 "channel.json" 后边加入即可。
|
||||||
|
#if JPChannel_Save
|
||||||
|
JPChannelAll b = new JPChannelAll();
|
||||||
|
b.channelDatas = new JPChannelData[4];
|
||||||
|
b.channelDatas[0] = new JPChannelData();
|
||||||
|
b.channelDatas[1] = new JPChannelData();
|
||||||
|
b.channelDatas[0].buildTargetGroup = BuildTargetGroup.Android;
|
||||||
|
b.channelDatas[0].button_text = "Andoird 国内";
|
||||||
|
b.channelDatas[0].channel_macro_definition = "ANDROID_CN";
|
||||||
|
b.channelDatas[1].buildTargetGroup = BuildTargetGroup.Android;
|
||||||
|
b.channelDatas[1].button_text = "Andoird 海外";
|
||||||
|
b.channelDatas[1].channel_macro_definition = "ANDROID_GP";
|
||||||
|
b.channelDatas[2] = new JPChannelData();
|
||||||
|
b.channelDatas[3] = new JPChannelData();
|
||||||
|
b.channelDatas[2].buildTargetGroup = BuildTargetGroup.iOS;
|
||||||
|
b.channelDatas[2].button_text = "iOS 国内";
|
||||||
|
b.channelDatas[2].channel_macro_definition = "IOS_CN";
|
||||||
|
b.channelDatas[2].buildTargetGroup = BuildTargetGroup.iOS;
|
||||||
|
b.channelDatas[3].button_text = "iOS 海外";
|
||||||
|
b.channelDatas[3].channel_macro_definition = "IOS_OS";
|
||||||
|
for (int i = 0; i < b.channelDatas.Length; ++i)
|
||||||
|
{
|
||||||
|
b.channelDatas[i].info_plist_name = b.channelDatas[i].channel_macro_definition+"_" + JPChannelAll.info_plist_name;
|
||||||
|
}
|
||||||
|
string str = JsonUtility.ToJson(b);
|
||||||
|
Debug.LogError(str);
|
||||||
|
#endif
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
path = path + "/" + channel_json_name;
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
string s = File.ReadAllText(path);
|
||||||
|
var b_data = JsonUtility.FromJson<JPChannelAll>(s);
|
||||||
|
channelAll = b_data;
|
||||||
|
#if JPChannel_Save
|
||||||
|
string str1_data = JsonUtility.ToJson(channelAll);
|
||||||
|
Debug.LogError(str1_data);
|
||||||
|
all[0] = str;
|
||||||
|
System.IO.File.WriteAllLines(path, all);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
#endif
|
||||||
|
if (GetFile(new DirectoryInfo(Application.dataPath), JPChannelAll.info_plist_name) != null)
|
||||||
|
channelAll.info_target_path = GetFile(new DirectoryInfo(Application.dataPath), JPChannelAll.info_plist_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError(path);
|
||||||
|
AssetDatabase.CreateFolder("Assets", channel_path);
|
||||||
|
AssetDatabase.CreateFolder("Assets/" + channel_path, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnGUI()
|
||||||
|
{
|
||||||
|
if (channelAll == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//绘制标题
|
||||||
|
GUILayout.Space(10);
|
||||||
|
GUI.skin.label.fontSize = 24;
|
||||||
|
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
|
||||||
|
GUILayout.Label("Joypac Channel");
|
||||||
|
GUI.skin.label.fontSize = 12;
|
||||||
|
GUI.skin.label.alignment = TextAnchor.MiddleLeft;
|
||||||
|
//绘制文本
|
||||||
|
GUILayout.Space(10);
|
||||||
|
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
|
||||||
|
Change(BuildTargetGroup.iOS);
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
Change(BuildTargetGroup.Android);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
public static void ClearAll()
|
||||||
|
{
|
||||||
|
n = 0;
|
||||||
|
radioInt = 0;
|
||||||
|
first = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool need_differentiate;
|
||||||
|
static bool enable_iap;
|
||||||
|
static bool enable_cross;
|
||||||
|
static string ENABLE_IAP = "ENABLE_IAP";
|
||||||
|
static string CROSS = "CROSS";
|
||||||
|
static bool first = true;
|
||||||
|
static JPChannelData currentData;
|
||||||
|
static bool[] toggle = new bool[20];
|
||||||
|
static int n = 0;
|
||||||
|
static int radioInt = 0;
|
||||||
|
public static void Change(BuildTargetGroup buildTargetGroup)
|
||||||
|
{
|
||||||
|
need_differentiate = EditorGUILayout.Toggle(buildTargetGroup + " 是否有多个渠道 ", need_differentiate);
|
||||||
|
GUILayout.Label("(例如:有国内海外两个渠道,或者其他两个至两个以上渠道)");
|
||||||
|
|
||||||
|
GUILayout.Space(10);
|
||||||
|
|
||||||
|
if (need_differentiate)
|
||||||
|
{
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
foreach (var ar in channelAll.channelDatas)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ar.buildTargetGroup != buildTargetGroup)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//Debug.LogError(ar.button_text);
|
||||||
|
if (toggle[n] != GUI.Toggle(new Rect(25 + n * 120, 100, 100, 30), toggle[n], ar.button_text))
|
||||||
|
{
|
||||||
|
bool value = toggle[n];
|
||||||
|
toggle[n] = !value;
|
||||||
|
if (n != radioInt)
|
||||||
|
{
|
||||||
|
toggle[radioInt] = value;
|
||||||
|
radioInt = n;
|
||||||
|
}
|
||||||
|
if (toggle[n])
|
||||||
|
{
|
||||||
|
first = true;
|
||||||
|
currentData = ar;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
first = true;
|
||||||
|
currentData = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
GUILayout.Space(40);
|
||||||
|
//Debug.LogError(currentData);
|
||||||
|
if (currentData == null)
|
||||||
|
{
|
||||||
|
GUILayout.Label("请选择一个渠道");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#region 设置开关
|
||||||
|
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
first = false;
|
||||||
|
if (/*currentData.channel_macro_definition.Contains("_GP") ||*/ currentData.channel_macro_definition.Contains("_OS"))
|
||||||
|
{
|
||||||
|
enable_iap = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
enable_iap = false;
|
||||||
|
}
|
||||||
|
//if (currentData.channel_macro_definition.Contains("ANDROID"))
|
||||||
|
//{
|
||||||
|
enable_cross = false;
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// enable_cross = true;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
enable_iap = EditorGUILayout.Toggle(enable_iap + " Enable_IAP ", enable_iap);
|
||||||
|
enable_cross = EditorGUILayout.Toggle(enable_cross + " Enable_CROSS ", enable_cross);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
if (GUILayout.Button(currentData.button_text))
|
||||||
|
{
|
||||||
|
String sourcePath = Application.dataPath + JPChannelAll.info_plist_file + currentData.info_plist_name;
|
||||||
|
String targetPath = channelAll.info_target_path;
|
||||||
|
bool isrewrite = true; // true=覆盖已存在的同名文件,false则反之
|
||||||
|
if (File.Exists(sourcePath) && targetPath != null)
|
||||||
|
{
|
||||||
|
System.IO.File.Copy(sourcePath, targetPath, isrewrite);
|
||||||
|
Debug.Log("change " + JPChannelAll.info_plist_name + " to " + currentData.channel_macro_definition + " success ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("please check '" + sourcePath + "' and '" + targetPath + "',Does it exist?");
|
||||||
|
}
|
||||||
|
string str = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentData.buildTargetGroup);
|
||||||
|
Debug.Log("old " + str);
|
||||||
|
str = str.Replace(';' + ENABLE_IAP, null);
|
||||||
|
str = str.Replace(';' + CROSS, null);
|
||||||
|
if (enable_iap) str = ENABLE_IAP + ";" + str;
|
||||||
|
if (enable_cross) str = CROSS + ";" + str;
|
||||||
|
|
||||||
|
for (int i = 0; i < channelAll.channelDatas.Length; ++i)
|
||||||
|
{
|
||||||
|
str = str.Replace(channelAll.channelDatas[i].channel_macro_definition, null);
|
||||||
|
}
|
||||||
|
PlayerSettings.productName = SettingStringsKey.Instance.productName;
|
||||||
|
Debug.Log("Change productName to " + SettingStringsKey.Instance.productName);
|
||||||
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentData.buildTargetGroup,
|
||||||
|
currentData.channel_macro_definition + ";" + str);
|
||||||
|
Debug.Log("new " + PlayerSettings.GetScriptingDefineSymbolsForGroup(currentData.buildTargetGroup));
|
||||||
|
PlayerSettings.SetApplicationIdentifier(buildTargetGroup, SettingStringsKey.Instance.BundleID);
|
||||||
|
Debug.Log("Change bundleID to " + SettingStringsKey.Instance.BundleID);
|
||||||
|
#if UNITY_IOS
|
||||||
|
PlayerSettings.iOS.appleDeveloperTeamID = SettingStringsKey.Instance.DeveloperTeamID;
|
||||||
|
string china = Application.dataPath + "/" + JoypacConst.thirdPath + "pangle_China";
|
||||||
|
//string china_hide = Application.dataPath + "/" + JoypacConst.thirdPath + "Pangle/China~";
|
||||||
|
string global = Application.dataPath + "/" + JoypacConst.thirdPath + "pangle_nonChina";
|
||||||
|
//string global_hide = Application.dataPath + "/" + JoypacConst.thirdPath + "Pangle/Global~";
|
||||||
|
if (currentData.channel_macro_definition.Contains("_OS"))
|
||||||
|
{
|
||||||
|
HidePath(china);
|
||||||
|
ShowPath(global);
|
||||||
|
Debug.Log("头条要区分国内国外");
|
||||||
|
}
|
||||||
|
else if (currentData.channel_macro_definition.Contains("_CN"))
|
||||||
|
{
|
||||||
|
HidePath(global);
|
||||||
|
ShowPath(china);
|
||||||
|
Debug.Log("头条要区分国内国外");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
PlayerSettings.bundleVersion = SettingStringsKey.Instance.bundleVersion;
|
||||||
|
Debug.Log("Change bundleVersion to " + SettingStringsKey.Instance.bundleVersion);
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
//以下属于海外
|
||||||
|
if (currentData.channel_macro_definition.Contains("_GP") || currentData.channel_macro_definition.Contains("_CY")
|
||||||
|
|| currentData.channel_macro_definition.Contains("_HW") || currentData.channel_macro_definition.Contains("_QZ"))
|
||||||
|
{
|
||||||
|
PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevelAuto;
|
||||||
|
Debug.Log("Change targetSdkVersion to " + AndroidSdkVersions.AndroidApiLevelAuto);
|
||||||
|
}
|
||||||
|
else//其余属于国内
|
||||||
|
{
|
||||||
|
PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel28;
|
||||||
|
Debug.Log("Change targetSdkVersion to " + AndroidSdkVersions.AndroidApiLevel28);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("Change " + " to " + currentData.button_text + " Success");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GUILayout.Label(buildTargetGroup + "不需要多个渠道的话,不需要更改Channel,可以关闭此页面啦!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//public static void RemoveHidePath(string showPath)
|
||||||
|
//{
|
||||||
|
// if (System.IO.Directory.Exists(showPath))
|
||||||
|
// {
|
||||||
|
// //删除隐藏
|
||||||
|
// if (System.IO.Directory.Exists(showPath+"~"))
|
||||||
|
// {
|
||||||
|
// Debug.LogError(" 存在 删除文件夹 " + showPath + "~");
|
||||||
|
|
||||||
|
// // System.IO.Directory.Delete(@updateAssets.list[0].LocalUrl);
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// var dir = new System.IO.DirectoryInfo(showPath + "~");
|
||||||
|
// dir.Attributes = dir.Attributes & ~FileAttributes.ReadOnly;
|
||||||
|
// dir.Delete(true);
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// Debug.LogError(string.Format(" 文件夹存在 删除文件夹时 出现错误 【{0}】", ex.Message));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if(System.IO.Directory.Exists(showPath+"~"))
|
||||||
|
// {
|
||||||
|
// System.IO.Directory.Move(showPath + "~", showPath);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Debug.LogError("不存在 " + showPath);
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
public static void HideFile(string path)
|
||||||
|
{
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
File.Move(path, path + "~");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("不存在 " + path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void HidePath(string path)
|
||||||
|
{
|
||||||
|
if (System.IO.Directory.Exists(path))
|
||||||
|
{
|
||||||
|
System.IO.Directory.Move(path, path + "~");
|
||||||
|
}
|
||||||
|
else if (System.IO.Directory.Exists(path + "~"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("不存在 " + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showFile(string path)
|
||||||
|
{
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (File.Exists(path + "~"))
|
||||||
|
{
|
||||||
|
File.Move(path + "~", path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("不存在 " + path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void ShowPath(string path)
|
||||||
|
{
|
||||||
|
if (System.IO.Directory.Exists(path))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (System.IO.Directory.Exists(path + "~"))
|
||||||
|
{
|
||||||
|
System.IO.Directory.Move(path + "~", path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("不存在 " + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void GetFiles(DirectoryInfo directory, string pattern, ref List<string> fileList)
|
||||||
|
{
|
||||||
|
if (directory != null && directory.Exists && !string.IsNullOrEmpty(pattern))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (FileInfo info in directory.GetFiles(pattern))
|
||||||
|
{
|
||||||
|
string path = info.FullName.ToString();
|
||||||
|
fileList.Add(path.Substring(path.IndexOf("Assets")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
foreach (DirectoryInfo info in directory.GetDirectories())
|
||||||
|
{
|
||||||
|
GetFiles(info, pattern, ref fileList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static string GetFile(DirectoryInfo directory, string pattern)
|
||||||
|
{
|
||||||
|
List<string> prefafbPathList = new List<string>();
|
||||||
|
GetFiles(directory, pattern, ref prefafbPathList);
|
||||||
|
if (prefafbPathList.Count == 1)
|
||||||
|
{
|
||||||
|
//Debug.LogError(prefafbPathList[0]);
|
||||||
|
return prefafbPathList[0];
|
||||||
|
}
|
||||||
|
else if (prefafbPathList.Count > 1)
|
||||||
|
{
|
||||||
|
Debug.LogError("存在多个 " + pattern + " 是错误的");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("没有找到 " + pattern + " 是否因为JPsdk版本低,暂不支持");
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 034e08316962c44f7957eccfcf72275d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
{"info_target_path":"","channelDatas":[{"button_text":"Andoird 国内","buildTargetGroup":7,"info_plist_name":"ANDROID_CN_JoypacService-info.plist","channel_macro_definition":"ANDROID_CN"},{"button_text":"Andoird 海外","buildTargetGroup":7,"info_plist_name":"ANDROID_GP_JoypacService-info.plist","channel_macro_definition":"ANDROID_GP"},{"button_text":"iOS 国内","buildTargetGroup":4,"info_plist_name":"IOS_CN_JoypacService-info.plist","channel_macro_definition":"IOS_CN"},{"button_text":"iOS 海外","buildTargetGroup":4,"info_plist_name":"IOS_OS_JoypacService-info.plist","channel_macro_definition":"IOS_OS"}]}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7a455ccca671b41b0a5beef4fb6e2ef6
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 01ea5f3fcb26d441ca2abd9cb81d2dc0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>JoypacAppId</key>
|
||||||
|
<string>0cc787bfde</string>
|
||||||
|
<key>JoypacAppName</key>
|
||||||
|
<string>打败小偷</string>
|
||||||
|
<key>topOnAppId</key>
|
||||||
|
<string>a5e5cd93c49329</string>
|
||||||
|
<key>topOnAppKey</key>
|
||||||
|
<string>d78b587989ce58c20e6df748f53e3f31</string>
|
||||||
|
<key>bannerStatus</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>bannerPlacement</key>
|
||||||
|
<string>b5e5cdc1c064e4</string>
|
||||||
|
<key>nativeStatus</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>nativePlacement</key>
|
||||||
|
<string>b5e5cdbfeb5771</string>
|
||||||
|
<key>splashStatus</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>splashPlacement</key>
|
||||||
|
<string>b5e5cdc0cd7d74</string>
|
||||||
|
<key>JPSplashPlacement</key>
|
||||||
|
<string>打败小偷SP</string>
|
||||||
|
<key>rewardVideoStatus</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>rewardVideoPlacement</key>
|
||||||
|
<string>b5e5cdb8fb04d7</string>
|
||||||
|
<key>interstitialConfig</key>
|
||||||
|
<string>[{"adOrder": "1", "maxTimeInterval": "0", "minTimeInterval": "0", "status": "1", "unitID": "b5e5cdba1689cf", "name": "打败小偷IV"}]</string>
|
||||||
|
<key>Channel</key>
|
||||||
|
<string>CN</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2632024f3dffe4e608641570dee45a1e
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>JoypacAppId</key>
|
||||||
|
<string>0cc787bfde</string>
|
||||||
|
<key>JoypacAppName</key>
|
||||||
|
<string>打败小偷</string>
|
||||||
|
<key>topOnAppId</key>
|
||||||
|
<string>a5e5cd93c49329</string>
|
||||||
|
<key>topOnAppKey</key>
|
||||||
|
<string>d78b587989ce58c20e6df748f53e3f31</string>
|
||||||
|
<key>bannerStatus</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>bannerPlacement</key>
|
||||||
|
<string>b5e5cdc1c064e4</string>
|
||||||
|
<key>nativeStatus</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>nativePlacement</key>
|
||||||
|
<string>b5e5cdbfeb5771</string>
|
||||||
|
<key>splashStatus</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>splashPlacement</key>
|
||||||
|
<string>b5e5cdc0cd7d74</string>
|
||||||
|
<key>JPSplashPlacement</key>
|
||||||
|
<string>打败小偷SP</string>
|
||||||
|
<key>rewardVideoStatus</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>rewardVideoPlacement</key>
|
||||||
|
<string>b5e5cdb8fb04d7</string>
|
||||||
|
<key>interstitialConfig</key>
|
||||||
|
<string>[{"adOrder": "1", "maxTimeInterval": "0", "minTimeInterval": "0", "status": "1", "unitID": "b5e5cdba1689cf", "name": "打败小偷IV"}]</string>
|
||||||
|
<key>Channel</key>
|
||||||
|
<string>OS</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 463aa8548b03c407db88bad6a5f917bb
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 35b92a92885e848328b3b9110894b217
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0167bb673c7b04d1cb3ca0a1451ef38f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cb2477510ad394b8ea412b2b9b2e39a2
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e23b716a8b7e24f029f641fca9177ec0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
|
public class InspectorGameParamsAttribute : Attribute
|
||||||
|
{
|
||||||
|
// 当前属性是面向哪个平台
|
||||||
|
public readonly JPEditorPlatformType PlatformType;
|
||||||
|
|
||||||
|
//当前发布平台
|
||||||
|
public readonly JPReleaseAreaType ReleasePlatformType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 当前属性隶属于哪个组件
|
||||||
|
public readonly JPEditorComponentType ComponentType;
|
||||||
|
|
||||||
|
// 当前属性在面板中显示的名字
|
||||||
|
public readonly string InspectorPropertyLabel;
|
||||||
|
|
||||||
|
// 参数在目标平台中对应的key
|
||||||
|
public readonly string TargetPlatformParameterKey;
|
||||||
|
// tip
|
||||||
|
public readonly string Tip;
|
||||||
|
// 当前属性是否为控制开关,控制其他参数在面板中展示或隐藏
|
||||||
|
public readonly bool IsControllerSwitch;
|
||||||
|
|
||||||
|
// 具体平台参数的属性注解
|
||||||
|
public InspectorGameParamsAttribute(
|
||||||
|
JPEditorPlatformType platformType,
|
||||||
|
JPReleaseAreaType releasePlatformType,
|
||||||
|
|
||||||
|
JPEditorComponentType componentType,
|
||||||
|
string inspectorPropertyLabel,
|
||||||
|
string targetPlatformParameterKey = "",
|
||||||
|
bool isControllerSwitch = false,
|
||||||
|
string tip = null)
|
||||||
|
{
|
||||||
|
this.PlatformType = platformType;
|
||||||
|
this.ComponentType = componentType;
|
||||||
|
this.ReleasePlatformType = releasePlatformType;
|
||||||
|
|
||||||
|
this.InspectorPropertyLabel = inspectorPropertyLabel;
|
||||||
|
this.TargetPlatformParameterKey = targetPlatformParameterKey;
|
||||||
|
this.IsControllerSwitch = isControllerSwitch;
|
||||||
|
Tip = tip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 502948ed643046a5bb7d9fb0e1da55ba
|
||||||
|
timeCreated: 1615346407
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
public enum JPEditorComponentType
|
||||||
|
{
|
||||||
|
Core,// 基础核心模块
|
||||||
|
JoyPacSetting,
|
||||||
|
Pop_Up,
|
||||||
|
AdParams,// Core-Ad-Params
|
||||||
|
AdNet,// 广告网络,穿山甲、广点通、百度等等...
|
||||||
|
Ga_Adjust,// 账号模块
|
||||||
|
AdjustEvent,
|
||||||
|
Push,// Push模块
|
||||||
|
Att,//att弹框模块,仅在无jPframework的情况使用
|
||||||
|
Umeng,
|
||||||
|
GamePlatform, // 摸摸鱼平台
|
||||||
|
Build,// 构建模块
|
||||||
|
BuildPush,//如果有push模块,构建参数需要增加一个推送证书
|
||||||
|
|
||||||
|
Properties,
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 78ab155ba47141378ea9b3624619b069
|
||||||
|
timeCreated: 1615359007
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
using System.ComponentModel;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public enum JPEditorPlatformType
|
||||||
|
{
|
||||||
|
// 安卓平台
|
||||||
|
Android,
|
||||||
|
|
||||||
|
// iOS平台
|
||||||
|
iOS,
|
||||||
|
|
||||||
|
Editor,
|
||||||
|
}
|
||||||
|
public enum JPReleaseAreaType
|
||||||
|
{
|
||||||
|
[HideInInspector]
|
||||||
|
Editor,
|
||||||
|
|
||||||
|
[Description("China")]
|
||||||
|
CN,//国内
|
||||||
|
|
||||||
|
|
||||||
|
[Description("no China")]
|
||||||
|
OS,//海外
|
||||||
|
}
|
||||||
|
|
||||||
|
//public enum JPReleasePeriod
|
||||||
|
//{
|
||||||
|
|
||||||
|
// // 正式发行阶段,
|
||||||
|
// 正式发行阶段
|
||||||
|
//}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fc4d55939b64416cb5d8a9bb3d8b7872
|
||||||
|
timeCreated: 1615346582
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动化管理类.
|
||||||
|
/// </summary>
|
||||||
|
public static class AutomationManager
|
||||||
|
{
|
||||||
|
// 所有自动化prefab的存储路径
|
||||||
|
private static string PrefabPath = Path.Combine(JPPackageManager.AutomationPluginsRelativePath, "Editor/Prefab");
|
||||||
|
|
||||||
|
// 游戏初始化参数prefab存放的位置,此prefab中会存放所有初始化参数
|
||||||
|
private static string JoyPacInitParamsPrefabPath = Path.Combine(PrefabPath, "JoyPacInitParams.prefab");
|
||||||
|
|
||||||
|
// 构建参数prefab路径
|
||||||
|
private static string JoyPacBuildParamsPrefabPath = Path.Combine(PrefabPath, "JoyPacBuildParams.prefab");
|
||||||
|
|
||||||
|
// 保存单个class中的所有字段信息
|
||||||
|
private static Dictionary<Type, List<FieldInfo>> AllFieldInfo = new Dictionary<Type, List<FieldInfo>>();
|
||||||
|
|
||||||
|
|
||||||
|
// 获取游戏中配置的参数
|
||||||
|
public static JoyPacParams JoyPacParams => JoyPacParams.Instance;
|
||||||
|
// 获取游戏中配置的构建参数
|
||||||
|
public static JoyPacBuildParams JoyPacBuildParams => JoyPacBuildParams.Instance;
|
||||||
|
|
||||||
|
// 获取所有有效字段信息(添加了注解的信息)
|
||||||
|
public static IEnumerable<FieldInfo> GetValidFieldInfo<T>(Type type)
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
if (AllFieldInfo.ContainsKey(type))
|
||||||
|
{
|
||||||
|
return AllFieldInfo[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取所有字段信息
|
||||||
|
var fieldInfos = type.GetFields();
|
||||||
|
|
||||||
|
if (fieldInfos.Length > 0)
|
||||||
|
{
|
||||||
|
var validFieldInfos = new List<FieldInfo>();
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
// 自定义了属性则代表有效属性
|
||||||
|
var inspectorGameParamsAttribute = GetAttr<T>(fieldInfo);
|
||||||
|
if (inspectorGameParamsAttribute != null)
|
||||||
|
{
|
||||||
|
validFieldInfos.Add(fieldInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AllFieldInfo.Add(type, validFieldInfos);
|
||||||
|
return AllFieldInfo[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过字段信息获取字段中的自定义注解对象
|
||||||
|
public static T GetAttr<T>(ICustomAttributeProvider fieldInfo)
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
// 第二个参数代表,是否获取父类中的字段
|
||||||
|
var customAttributes = fieldInfo.GetCustomAttributes(typeof(T), false);
|
||||||
|
if (customAttributes.Length > 0)
|
||||||
|
{
|
||||||
|
return customAttributes[0] as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取prefab中引用的对象
|
||||||
|
private static T GetPrefabObj<T>(string prefabPath)
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
var JoyPacParams = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(T)) as T;
|
||||||
|
return JoyPacParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 17a974cd78e834ab59eaf636bc75eabf
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 12aba9b62c46454fb424412296ac3601
|
||||||
|
timeCreated: 1617334267
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: df924547ac3d4cb983c752c0a9fe8a03
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using UnityEditor.Android;
|
||||||
|
using UnityEditor.Build;
|
||||||
|
using UnityEditor.Build.Reporting;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
|
public class BuildListener : IPreprocessBuildWithReport, IPostprocessBuildWithReport, IPostGenerateGradleAndroidProject
|
||||||
|
{
|
||||||
|
public int callbackOrder => 0;
|
||||||
|
|
||||||
|
public void OnPreprocessBuild(BuildReport report)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
UnityEngine.Debug.Log("[JoyPacSDK]: Prepare before packing");
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
Properties.chackProperties();
|
||||||
|
JPPackageManager.chackPath();
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPostprocessBuild(BuildReport report)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPostGenerateGradleAndroidProject(string path)
|
||||||
|
{
|
||||||
|
//Debug.Log("OnPostGenerateGradleAndroidProject");
|
||||||
|
//Debug.Log("Bulid path : " + path);
|
||||||
|
//string path_ = Path.GetFullPath("..");
|
||||||
|
//Debug.Log("Bulid path : " + path_);
|
||||||
|
//string gradlePropertiesFile = path_ + "/gradle/wrapper/gradle-wrapper.properties";
|
||||||
|
//if (File.Exists(gradlePropertiesFile))
|
||||||
|
//{
|
||||||
|
// File.Delete(gradlePropertiesFile);
|
||||||
|
//}
|
||||||
|
//StreamWriter writer = File.CreateText(gradlePropertiesFile);
|
||||||
|
//writer.WriteLine("distributionBase=GRADLE_USER_HOME");
|
||||||
|
//writer.WriteLine("distributionPath=wrapper/dists");
|
||||||
|
//writer.WriteLine("distributionUrl=https'\'://services.gradle.org/distributions/gradle-6.1.1-all.zip");
|
||||||
|
|
||||||
|
//writer.WriteLine("zipStoreBase=GRADLE_USER_HOME");
|
||||||
|
//writer.WriteLine("zipStorePath=wrapper/dists");
|
||||||
|
//writer.Flush();
|
||||||
|
//writer.Close();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bd1bf8bc0ecf4aae88c1a65e45934fc0
|
||||||
|
timeCreated: 1620632638
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using Debug = UnityEngine.Debug;
|
||||||
|
|
||||||
|
public static class BuildScriptManager
|
||||||
|
{
|
||||||
|
// Android构建脚本路径
|
||||||
|
private static string AndroidBuildScriptPath = Path.Combine(
|
||||||
|
Environment.CurrentDirectory,
|
||||||
|
Path.Combine(JPPackageManager.AutomationPluginsRelativePath, "Editor/Build/Editor_Android/export_apk.sh"));
|
||||||
|
|
||||||
|
// iOS构建脚本路径
|
||||||
|
private static string iOSBuildScriptPath = Path.Combine(
|
||||||
|
Environment.CurrentDirectory,
|
||||||
|
Path.Combine(JPPackageManager.AutomationPluginsRelativePath, "Editor/Build/Editor_iOS/export_ipa.sh"));
|
||||||
|
|
||||||
|
// unity加载完成后,修改构建脚本中的内容
|
||||||
|
public static void UpdateBuildScriptContent()
|
||||||
|
{
|
||||||
|
UpdatePlatformScript(AndroidBuildScriptPath, true);
|
||||||
|
UpdatePlatformScript(iOSBuildScriptPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改构建脚本中Unity路径.
|
||||||
|
private static void UpdatePlatformScript(string filePath, bool isAndroid = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
// ignore,文件不存在直接返回.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var readAllLines = File.ReadAllLines(filePath);
|
||||||
|
|
||||||
|
var isUpdate = false;
|
||||||
|
for (var i = 0; i < readAllLines.Length; i++)
|
||||||
|
{
|
||||||
|
var lineText = readAllLines[i];
|
||||||
|
// 1. 动态修改构建脚本中当前unity开发工具路径
|
||||||
|
var processModule = Process.GetCurrentProcess().MainModule;
|
||||||
|
if (processModule != null)
|
||||||
|
{
|
||||||
|
var newIdeText = "UNITY_PATH=" + processModule.FileName;
|
||||||
|
|
||||||
|
if (lineText.Contains("UNITY_PATH=") && lineText != newIdeText)
|
||||||
|
{
|
||||||
|
readAllLines[i] = newIdeText;
|
||||||
|
isUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 动态修改构建脚本中相对路径
|
||||||
|
var newSdkRelativePath =
|
||||||
|
"CurrentScriptRelativePath=" + JPPackageManager.AutomationPluginsRelativePath +
|
||||||
|
(isAndroid ? "/Editor/Build/Editor_Android" : "/Editor/Build/Editor_iOS");
|
||||||
|
|
||||||
|
if (lineText.Contains("CurrentScriptRelativePath=") && lineText != newSdkRelativePath)
|
||||||
|
{
|
||||||
|
readAllLines[i] = newSdkRelativePath;
|
||||||
|
isUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isUpdate)
|
||||||
|
{
|
||||||
|
File.WriteAllLines(filePath, readAllLines, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改文件脚本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">文件路径.</param>
|
||||||
|
/// <param name="key">文件中的key.</param>
|
||||||
|
/// <param name="value">文件中的value.</param>
|
||||||
|
/// <param name="onlyUpdateFirstKey">仅仅修改找到的第一个key.</param>
|
||||||
|
public static void UpdateFileScript(string filePath, string key, string value, bool onlyUpdateFirstKey)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
// ignore,文件不存在直接返回.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var readAllLines = File.ReadAllLines(filePath);
|
||||||
|
|
||||||
|
var isUpdate = false;
|
||||||
|
for (var i = 0; i < readAllLines.Length; i++)
|
||||||
|
{
|
||||||
|
var lineText = readAllLines[i];
|
||||||
|
|
||||||
|
if (lineText.Contains(key))
|
||||||
|
{
|
||||||
|
if (lineText != value)
|
||||||
|
{
|
||||||
|
readAllLines[i] = value;
|
||||||
|
isUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onlyUpdateFirstKey)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isUpdate)
|
||||||
|
{
|
||||||
|
File.WriteAllLines(filePath, readAllLines, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c3381394b9943bbb7664a9b23d97e56
|
||||||
|
timeCreated: 1616150664
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d38e533214b644b53910626ba7a05f8b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Android;
|
||||||
|
using UnityEditor.Callbacks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
|
||||||
|
internal class AndroidPlatformPostProcess
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[PostProcessBuild(999)]
|
||||||
|
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
|
||||||
|
{
|
||||||
|
if (target == BuildTarget.Android)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("[JoyPacSDK]: Starting to perform post build tasks for Android platform.");
|
||||||
|
Debug.Log(pathToBuiltProject);
|
||||||
|
RunPostProcessTasksAndroid(pathToBuiltProject);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RunPostProcessTasksAndroid(string path)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//Debug.Log("Bulid path : " + path);
|
||||||
|
//string appRawPath = Path.Combine(path, "unityLibrary/src/main/res/raw");
|
||||||
|
|
||||||
|
//string appPropertiesPath = Path.Combine(path, "unityLibrary/src/main/res/raw/joypac_games_config.properties");
|
||||||
|
|
||||||
|
//string JoyPacPropertiesPath = Application.dataPath + "/JoyPacSDK/Core/Plugins/Android/joypac_games_config.properties";
|
||||||
|
|
||||||
|
//if (File.Exists(JoyPacPropertiesPath))
|
||||||
|
//{
|
||||||
|
// if (!Directory.Exists(appRawPath))
|
||||||
|
// {
|
||||||
|
|
||||||
|
// Directory.CreateDirectory(appRawPath);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// File.Copy(JoyPacPropertiesPath, appPropertiesPath);
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
// Debug.LogError(JoyPacPropertiesPath + " 文件不存在,请重新生成后重新打包");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//string gradlePropertiesFile = path + "/gradle/wrapper/gradle-wrapper.properties";
|
||||||
|
//Debug.Log(File.Exists(gradlePropertiesFile));
|
||||||
|
////if (File.Exists(gradlePropertiesFile))
|
||||||
|
//{
|
||||||
|
// File.Delete(gradlePropertiesFile);
|
||||||
|
//}
|
||||||
|
//StreamWriter writer = File.CreateText(gradlePropertiesFile);
|
||||||
|
//writer.WriteLine("distributionBase=GRADLE_USER_HOME");
|
||||||
|
//writer.WriteLine("distributionPath=wrapper/dists");
|
||||||
|
//writer.WriteLine("distributionUrl=https'\'://services.gradle.org/distributions/gradle-6.1.1-all.zip");
|
||||||
|
|
||||||
|
//writer.WriteLine("zipStoreBase=GRADLE_USER_HOME");
|
||||||
|
//writer.WriteLine("zipStorePath=wrapper/dists");
|
||||||
|
//writer.Flush();
|
||||||
|
//writer.Close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4b037c6c676ba4585b471779fcab66cc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Build.Reporting;
|
||||||
|
using UnityEngine;
|
||||||
|
using Debug = UnityEngine.Debug;
|
||||||
|
|
||||||
|
// 此处的命名空间也要写在shell脚本中!!!,否则找不到此class
|
||||||
|
namespace ByteDance.Union
|
||||||
|
{
|
||||||
|
public static class BuildApk
|
||||||
|
{
|
||||||
|
// 项目根目录,assets上一级目录
|
||||||
|
private static string ProjectRootDir = Environment.CurrentDirectory;
|
||||||
|
|
||||||
|
// 项目构建目录
|
||||||
|
private static string ProjectBuildDir = Path.Combine(ProjectRootDir, "BuildProductDir");
|
||||||
|
|
||||||
|
// apk目录
|
||||||
|
private static string ApkPath =
|
||||||
|
Path.Combine(ProjectBuildDir, "Android/Products/" + Application.productName + ".apk");
|
||||||
|
|
||||||
|
//[MenuItem(JPMenuName.BUILD_DEBUG_APK)]
|
||||||
|
public static void BuildDebug()
|
||||||
|
{
|
||||||
|
Build(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// [MenuItem(JPMenuName.BUILD_RELEASE_APK)]
|
||||||
|
public static void BuildRelease()
|
||||||
|
{
|
||||||
|
Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Build(bool isDebug = false)
|
||||||
|
{
|
||||||
|
var buildPlayerOptions = default(BuildPlayerOptions);
|
||||||
|
buildPlayerOptions.scenes = GetBuildScenes();
|
||||||
|
buildPlayerOptions.target = BuildTarget.Android;
|
||||||
|
buildPlayerOptions.targetGroup = BuildTargetGroup.Android;
|
||||||
|
buildPlayerOptions.locationPathName = ApkPath;
|
||||||
|
buildPlayerOptions.options =
|
||||||
|
isDebug
|
||||||
|
? (BuildOptions.Development | BuildOptions.ConnectWithProfiler | BuildOptions.AllowDebugging)
|
||||||
|
: BuildOptions.None;
|
||||||
|
|
||||||
|
var buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||||
|
|
||||||
|
var summary = buildReport.summary;
|
||||||
|
if (summary.result == BuildResult.Succeeded)
|
||||||
|
{
|
||||||
|
Debug.Log("Build Apk successes ");
|
||||||
|
var thread = new Thread(InstallApk);
|
||||||
|
thread.Start();
|
||||||
|
}
|
||||||
|
else if (summary.result == BuildResult.Failed)
|
||||||
|
{
|
||||||
|
Debug.LogError("Build Apk failed : " + summary.totalErrors);
|
||||||
|
}
|
||||||
|
else if (summary.result == BuildResult.Cancelled)
|
||||||
|
{
|
||||||
|
Debug.Log("Build Apk cancelled");
|
||||||
|
}
|
||||||
|
else if (summary.result == BuildResult.Unknown)
|
||||||
|
{
|
||||||
|
Debug.Log("Build Apk Unknown...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 安装apk
|
||||||
|
private static void InstallApk()
|
||||||
|
{
|
||||||
|
ExecuteCommandScript("adb install -r " + ApkPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行shell 命令
|
||||||
|
private static void ExecuteCommandScript(string command)
|
||||||
|
{
|
||||||
|
// 配置命令信息,准备执行脚本
|
||||||
|
var psi = new ProcessStartInfo();
|
||||||
|
psi.FileName = "bash";
|
||||||
|
psi.UseShellExecute = false;
|
||||||
|
psi.Arguments = command;
|
||||||
|
|
||||||
|
// 执行对应的shell脚本
|
||||||
|
var process = Process.Start(psi);
|
||||||
|
if (process != null)
|
||||||
|
{
|
||||||
|
process.WaitForExit();
|
||||||
|
process.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError(command + " execute error...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 找出所有需要构建的场景
|
||||||
|
private static string[] GetBuildScenes()
|
||||||
|
{
|
||||||
|
var names = new List<string>();
|
||||||
|
|
||||||
|
foreach (var settingsScene in EditorBuildSettings.scenes)
|
||||||
|
{
|
||||||
|
if (settingsScene == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settingsScene.enabled)
|
||||||
|
{
|
||||||
|
names.Add(settingsScene.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return names.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 89180fb28336945eca2b998d9cdd9a3a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 构建类型,Release 或 Debug
|
||||||
|
BuildType=$1
|
||||||
|
|
||||||
|
# 打印日志方法
|
||||||
|
# shellcheck disable=SC2112
|
||||||
|
function PrintLog() {
|
||||||
|
echo "============== $1 =============="
|
||||||
|
}
|
||||||
|
|
||||||
|
# 检查是否传入了参数,如果传未传入参数则赋予默认值为Release
|
||||||
|
if [ ! "$1" ]; then
|
||||||
|
PrintLog "BuildType is null,default release"
|
||||||
|
BuildType="Release"
|
||||||
|
else
|
||||||
|
PrintLog "BuildType is "${BuildType}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 当前脚本所在路径
|
||||||
|
CurrentScriptPath=$(dirname "$0")
|
||||||
|
|
||||||
|
# 当前脚本所在的相对路径
|
||||||
|
CurrentScriptRelativePath=Assets/JoyPacSDK/Core/Automation/Editor/Build/Editor_Android
|
||||||
|
|
||||||
|
# project path
|
||||||
|
# shellcheck disable=SC2039
|
||||||
|
PROJ_PATH=${CurrentScriptPath//${CurrentScriptRelativePath}//""}
|
||||||
|
|
||||||
|
# 去掉项目路径中最后一个字符"/"
|
||||||
|
PROJ_PATH=${PROJ_PATH%?}
|
||||||
|
|
||||||
|
# unity app path
|
||||||
|
UNITY_PATH=/Applications/Unity/Hub/Editor/2019.4.19f1/Unity.app/Contents/MacOS/Unity
|
||||||
|
|
||||||
|
# 构建日志的输出路径
|
||||||
|
LOG_PATH=$PROJ_PATH/BuildProductDir/Android/Log/BuildApk.log
|
||||||
|
|
||||||
|
# log日志输出目录
|
||||||
|
PrintLog "LOG_PATH = "${LOG_PATH}
|
||||||
|
|
||||||
|
PrintLog "Unity Build Apk Begin"
|
||||||
|
|
||||||
|
if [ ${BuildType} = "Release" ]; then
|
||||||
|
# 构建release apk
|
||||||
|
PrintLog "Build Release Apk"
|
||||||
|
$UNITY_PATH -projectPath $PROJ_PATH -executeMethod ByteDance.Union.BuildApk.BuildRelease -logFile $LOG_PATH -batchMode -quit
|
||||||
|
else
|
||||||
|
# 构建debug apk
|
||||||
|
PrintLog "Build Debug Apk"
|
||||||
|
$UNITY_PATH -projectPath $PROJ_PATH -executeMethod ByteDance.Union.BuildApk.BuildDebug -logFile $LOG_PATH -batchMode -quit
|
||||||
|
fi
|
||||||
|
|
||||||
|
PrintLog "Unity Build Apk Finished"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e54183835bff143b5b514f1b68285059
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f2b4cd3af3604fecbed326f87403169c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,293 @@
|
||||||
|
// mac 电脑才可以打包ipa
|
||||||
|
#if UNITY_EDITOR_OSX && UNITY_IOS
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Build.Reporting;
|
||||||
|
using Debug = UnityEngine.Debug;
|
||||||
|
|
||||||
|
public static class BuildIpa
|
||||||
|
{
|
||||||
|
// 项目根目录,assets上一级目录
|
||||||
|
private static string ProjectRootDir = Environment.CurrentDirectory;
|
||||||
|
|
||||||
|
// 项目构建目录
|
||||||
|
private static string ProjectBuildDir = Path.Combine(ProjectRootDir, "BuildProductDir");
|
||||||
|
|
||||||
|
// xcode构建目录
|
||||||
|
private static string XcodeDir = Path.Combine(ProjectBuildDir, "iOS/XcodeProjectDir");
|
||||||
|
|
||||||
|
// ios 构建产物路径
|
||||||
|
private static string iOSProductsPath = Path.Combine(ProjectBuildDir, "iOS/Products");
|
||||||
|
|
||||||
|
// 准备信息
|
||||||
|
private static string iOSPrepareInfoPath = Path.Combine(ProjectBuildDir, "iOS/PrepareInfo");
|
||||||
|
|
||||||
|
// 导出ipa所需要的配置文件,shell脚本中会用到此文件
|
||||||
|
private static string ExportOptionsInfoPath =
|
||||||
|
Path.Combine(iOSPrepareInfoPath, "ExportOptions.plist");
|
||||||
|
|
||||||
|
// 构建脚本路径
|
||||||
|
private static string BuildIpaScriptPath = Path.Combine(
|
||||||
|
JPPackageManager.GetComponentDir(JPComponenetType.Core),
|
||||||
|
"Automation/Editor/Build/Editor_iOS/export_ipa_from_xcode_project.sh");
|
||||||
|
|
||||||
|
private static string BuildType_Debug = "Debug";
|
||||||
|
private static string BuildType_Release = "Release";
|
||||||
|
|
||||||
|
// 当前构建类型
|
||||||
|
private static string CurrentBuildType;
|
||||||
|
|
||||||
|
|
||||||
|
//[MenuItem(JPMenuName.BUILD_DEBUG_IPA)]
|
||||||
|
public static void BuildDebug()
|
||||||
|
{
|
||||||
|
BuildSummary summary = Export(BuildType_Debug);
|
||||||
|
if (summary.result == BuildResult.Succeeded)
|
||||||
|
{
|
||||||
|
RunBuildIpaShell();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("Xcode 工程导出失败", summary.result.ToString(), "OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// [MenuItem(JPMenuName.BUILD_RELEASE_IPA)]
|
||||||
|
public static void BuildRelease()
|
||||||
|
{
|
||||||
|
BuildSummary summary = Export(BuildType_Release);
|
||||||
|
|
||||||
|
if (summary.result == BuildResult.Succeeded)
|
||||||
|
{
|
||||||
|
RunBuildIpaShell();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("Xcode 工程导出失败", summary.result.ToString(), "OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem(JPMenuName.BUILD_RELEASE_XCODE)]
|
||||||
|
public static void ExportXcodeRelease()
|
||||||
|
{
|
||||||
|
ExportToXcode(BuildType_Release);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem(JPMenuName.BUILD_DEBUG_XCODE)]
|
||||||
|
public static void ExportXcodeDebug()
|
||||||
|
{
|
||||||
|
ExportToXcode(BuildType_Debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ExportToXcode(string buildType)
|
||||||
|
{
|
||||||
|
BuildSummary summary = Export(buildType);
|
||||||
|
if (summary.result == BuildResult.Succeeded)
|
||||||
|
{
|
||||||
|
var exportDir = $"导出路径为 = {XcodeDir}";
|
||||||
|
bool isOk = EditorUtility.DisplayDialog("Xcode 工程导出成功,是否打开目录?",
|
||||||
|
exportDir,
|
||||||
|
"Open",
|
||||||
|
"Cancel");
|
||||||
|
if (isOk)
|
||||||
|
{
|
||||||
|
EditorUtility.RevealInFinder(XcodeDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("Xcode 工程导出失败", summary.result.ToString(), "OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 导出Xcode
|
||||||
|
private static BuildSummary Export(string buildType)
|
||||||
|
{
|
||||||
|
CurrentBuildType = buildType;
|
||||||
|
|
||||||
|
DirPrepare();
|
||||||
|
|
||||||
|
var isDebug = buildType == BuildType_Debug;
|
||||||
|
var buildPlayerOptions = default(BuildPlayerOptions);
|
||||||
|
buildPlayerOptions.scenes = GetBuildScenes();
|
||||||
|
buildPlayerOptions.locationPathName = XcodeDir;
|
||||||
|
buildPlayerOptions.targetGroup = BuildTargetGroup.iOS;
|
||||||
|
buildPlayerOptions.target = BuildTarget.iOS;
|
||||||
|
|
||||||
|
buildPlayerOptions.options =
|
||||||
|
isDebug ? (BuildOptions.Development | BuildOptions.ConnectWithProfiler) : BuildOptions.None;
|
||||||
|
|
||||||
|
var buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||||
|
var summary = buildReport.summary;
|
||||||
|
if (summary.result == BuildResult.Succeeded)
|
||||||
|
{
|
||||||
|
Debug.Log("Export Xcode Project successes : " + (summary.totalSize / 1024 / 1024) + "M");
|
||||||
|
// WriteExportOptionsToPlist();
|
||||||
|
}
|
||||||
|
else if (summary.result == BuildResult.Failed)
|
||||||
|
{
|
||||||
|
Debug.LogError("Export Xcode Project failed : " + summary.totalErrors);
|
||||||
|
}
|
||||||
|
else if (summary.result == BuildResult.Cancelled)
|
||||||
|
{
|
||||||
|
Debug.Log("Export Xcode Project cancelled");
|
||||||
|
}
|
||||||
|
else if (summary.result == BuildResult.Unknown)
|
||||||
|
{
|
||||||
|
Debug.Log("Export Xcode Project Unknown...");
|
||||||
|
}
|
||||||
|
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建ipa
|
||||||
|
// private static void BuildIPA()
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// 目录准备
|
||||||
|
private static void DirPrepare()
|
||||||
|
{
|
||||||
|
// 如果存在此目录则直接删除
|
||||||
|
var xcodeProjectDir = new DirectoryInfo(XcodeDir);
|
||||||
|
if (xcodeProjectDir.Exists)
|
||||||
|
{
|
||||||
|
xcodeProjectDir.Delete(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 信息准备目录创建
|
||||||
|
var prepareInfoDir = new DirectoryInfo(iOSPrepareInfoPath);
|
||||||
|
if (!prepareInfoDir.Exists)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(iOSPrepareInfoPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建结果目录
|
||||||
|
var productsDir = new DirectoryInfo(iOSProductsPath);
|
||||||
|
if (productsDir.Exists)
|
||||||
|
{
|
||||||
|
productsDir.Delete(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Directory.CreateDirectory(iOSProductsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// // 写入导出ipa所需要的参数信息
|
||||||
|
// private static void WriteExportOptionsToPlist()
|
||||||
|
// {
|
||||||
|
// var bundleId = AutomationManager.JoyPacBuildParams.iOS_BundleId;
|
||||||
|
// if (string.IsNullOrEmpty(bundleId))
|
||||||
|
// {
|
||||||
|
// bundleId = Application.identifier;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (string.IsNullOrEmpty(bundleId))
|
||||||
|
// {
|
||||||
|
// throw new ArgumentException("Please Write ios Bundle Id To JoyPacBuildParams Inspector...");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// var mobileProVisionName = AutomationManager.JoyPacBuildParams.iOS_MobileProVisionName;
|
||||||
|
//
|
||||||
|
// if (string.IsNullOrEmpty(mobileProVisionName))
|
||||||
|
// {
|
||||||
|
// throw new ArgumentException(
|
||||||
|
// "Please Write ios mobileProVisionName To JoyPacBuildParams Inspector...");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //
|
||||||
|
// if (!File.Exists(ExportOptionsInfoPath)) {
|
||||||
|
//
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// var doc = new PlistDocument();
|
||||||
|
// var root = doc.root;
|
||||||
|
// var plistElementDict = root.CreateDict("provisioningProfiles");
|
||||||
|
// plistElementDict.SetString(bundleId, mobileProVisionName);
|
||||||
|
//
|
||||||
|
// if (JPPackageManager.HasComponent(JPComponenetType.Push))
|
||||||
|
// {
|
||||||
|
// var pushBundleId = AutomationManager.JoyPacBuildParams.iOS_BundleId + ".NotificationExtension";
|
||||||
|
// var pushProfileName = AutomationManager.JoyPacBuildParams.iOS_Push_Extension_ProVisionName;
|
||||||
|
// plistElementDict.SetString(pushBundleId, pushProfileName);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// doc.WriteToFile(ExportOptionsInfoPath);
|
||||||
|
// Debug.Log("export options 写入plist文件成功");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 运行构建ipa的路径
|
||||||
|
private static void RunBuildIpaShell()
|
||||||
|
{
|
||||||
|
|
||||||
|
Debug.Log("开始执行shell脚本导出ipa");
|
||||||
|
Debug.Log("BuildIpaScriptPath : " + BuildIpaScriptPath);
|
||||||
|
Debug.Log("CurrentBuildType : " + CurrentBuildType);
|
||||||
|
Debug.Log("XcodeDir : " + XcodeDir);
|
||||||
|
|
||||||
|
var command = BuildIpaScriptPath + " " + CurrentBuildType + " " + XcodeDir;
|
||||||
|
ExecuteCommandScript(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行shell 命令
|
||||||
|
private static void ExecuteCommandScript(string command)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (Process myProcess = new Process())
|
||||||
|
{
|
||||||
|
myProcess.StartInfo.FileName = "bash";
|
||||||
|
myProcess.StartInfo.UseShellExecute = false;
|
||||||
|
myProcess.StartInfo.CreateNoWindow = true;
|
||||||
|
myProcess.StartInfo.Arguments = command;
|
||||||
|
myProcess.Start();
|
||||||
|
EditorUtility.DisplayProgressBar("Build IPA", "正在执行编译脚本导出ipa,请耐心等待....", 0.5f);
|
||||||
|
myProcess.WaitForExit();
|
||||||
|
EditorUtility.ClearProgressBar();
|
||||||
|
if (myProcess.ExitCode == 0)
|
||||||
|
{
|
||||||
|
//脚本执行正常
|
||||||
|
bool isOpen = EditorUtility.DisplayDialog("IPA导出成功", $"导出路径为:{iOSProductsPath}", "open", "cancel");
|
||||||
|
if (isOpen)
|
||||||
|
{
|
||||||
|
EditorUtility.RevealInFinder(iOSProductsPath + "/Archive");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("IPA导出失败", "导出失败", "ok");
|
||||||
|
}
|
||||||
|
myProcess.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 找出所有需要构建的场景
|
||||||
|
private static string[] GetBuildScenes()
|
||||||
|
{
|
||||||
|
var names = new List<string>();
|
||||||
|
foreach (var settingsScene in EditorBuildSettings.scenes)
|
||||||
|
{
|
||||||
|
if (settingsScene == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settingsScene.enabled)
|
||||||
|
{
|
||||||
|
names.Add(settingsScene.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return names.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cfc33c0536c04b2c932668157a96a18a
|
||||||
|
timeCreated: 1615530203
|
||||||
|
|
@ -0,0 +1,164 @@
|
||||||
|
|
||||||
|
|
||||||
|
public static class ShellUtil
|
||||||
|
{
|
||||||
|
public static string GetApmShell(string appId)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
"#!/bin/sh\n"
|
||||||
|
+ "################################################################################\n"
|
||||||
|
+ "# 自定义配置\n"
|
||||||
|
+ "###############################################################################\n"
|
||||||
|
+ "# Debug模式编译是否上传,1=上传 0=不上传,默认不上传\n"
|
||||||
|
+ "UPLOAD_DEBUG_SYMBOLS=0\n"
|
||||||
|
+ "\n"
|
||||||
|
+ "# 模拟器编译是否上传,1=上传,0=不上传,默认不上传\n"
|
||||||
|
+ "UPLOAD_SIMULATOR_SYMBOLS=0\n"
|
||||||
|
+ "\n"
|
||||||
|
+ "# APMInsightID:应用云 ID\n"
|
||||||
|
+ $"APMInsight_APP_ID=\"{appId}\"\n"
|
||||||
|
+ "\n"
|
||||||
|
+ "################################################################################\n"
|
||||||
|
+ "# 注意: 如果你不知道此脚本的执行流程和用法,请不要随便修改!\n"
|
||||||
|
+ "################################################################################\n"
|
||||||
|
+ "\n"
|
||||||
|
+ "DSYM_UPLOAD_URL=\"https://datarangers.com.cn/perfguard/api/guest/app/mapping/upload\"\n"
|
||||||
|
+ "\n"
|
||||||
|
+ "if [[ $APMInsight_APP_ID == \"XXX\" ]]; then\n"
|
||||||
|
+ " if [[ $1 ]]; then\n"
|
||||||
|
+ " echo \"APPID: $1\"\n"
|
||||||
|
+ " APMInsight_APP_ID=$1\n"
|
||||||
|
+ " else\n"
|
||||||
|
+ " echo \"No arguments, pass your APMInsightID as the first argument or modify 'APMInsight_APP_ID' in the script.\"\n"
|
||||||
|
+ " exit 0\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ "fi\n"
|
||||||
|
+ "\n"
|
||||||
|
+ "function main() {\n"
|
||||||
|
+ " # 退出执行并打印提示信息\n"
|
||||||
|
+ " warningWithMessage() {\n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " echo -e \"${1}\"\n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " echo \"No upload and over.\"\n"
|
||||||
|
+ " echo \"----------------------------------------------------------------\"\n"
|
||||||
|
+ " UPLOADFLAG=0\n"
|
||||||
|
+ " exit ${2}\n"
|
||||||
|
+ " }\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " UPLOADFLAG=1\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " echo \"Uploading dSYM to APMInsight.\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " echo \"Step 1: Prepare application information.\"\n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " echo \"Product Name: ${PRODUCT_NAME}\"\n"
|
||||||
|
+ " echo \"APMInsight App ID: ${APMInsight_APP_ID}\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " echo \"Step 2: Check the arguments ...\"\n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " ##检查模拟器是否允许上传符号\n"
|
||||||
|
+ " if [ \"$EFFECTIVE_PLATFORM_NAME\" == \"-iphonesimulator\" ]; then\n"
|
||||||
|
+ " if [[ $UPLOAD_SIMULATOR_SYMBOLS -eq 0 ]]; then\n"
|
||||||
|
+ " warningWithMessage \"Warning: Build for simulator and skipping to upload. \n"
|
||||||
|
+ "You can modify 'UPLOAD_SIMULATOR_SYMBOLS' to 1 in the script.\" 0\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " # 检查DEBUG模式是否允许上传符号\n"
|
||||||
|
+ " if [[ ${CONFIGURATION=} == Debug* ]]; then\n"
|
||||||
|
+ " if [[ $UPLOAD_DEBUG_SYMBOLS -eq 0 ]]; then\n"
|
||||||
|
+ " warningWithMessage \"Warning: Build for debug mode and skipping to upload. \n"
|
||||||
|
+ "You can modify 'UPLOAD_DEBUG_SYMBOLS' to 1 in the script.\" 0\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " # 检查必须参数是否设置\n"
|
||||||
|
+ " if [ ! \"${APMInsight_APP_ID}\" ]; then\n"
|
||||||
|
+ " warningWithMessage \"Error: APMInsight App ID not defined.\" 1\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " function uploadDSYM() {\n"
|
||||||
|
+ " DSYM_SRC=\"$1\"\n"
|
||||||
|
+ " if [ ! -d \"$DSYM_SRC\" ]; then\n"
|
||||||
|
+ " warningWithMessage \"dSYM source not found: ${DSYM_SRC}\" 1\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " APPID=\"${APMInsight_APP_ID}\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " ZIP_DIR_PATH=$(dirname ${DSYM_SRC})\n"
|
||||||
|
+ " FILENAME=$(basename ${DSYM_SRC})\n"
|
||||||
|
+ " DSYM_SYMBOL_OUT_ZIP_NAME=\"APMInsight_dSYM_${APPID}.zip\"\n"
|
||||||
|
+ " DSYM_ZIP_FPATH=\"${ZIP_DIR_PATH}/${DSYM_SYMBOL_OUT_ZIP_NAME}\"\n"
|
||||||
|
+ " cd \"${ZIP_DIR_PATH}\"\n"
|
||||||
|
+ " PAD=$(zip -r ${DSYM_SYMBOL_OUT_ZIP_NAME} ${FILENAME})\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " if [ ! -e \"${DSYM_ZIP_FPATH}\" ]; then\n"
|
||||||
|
+ " warningWithMessage \"no dSYM zip archive generated: ${DSYM_ZIP_FPATH}\" 1\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " FILESIZE=$(/usr/bin/stat -f%z ${DSYM_ZIP_FPATH})\n"
|
||||||
|
+ " echo \"dsym size: ${FILESIZE} bytes\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " echo \"Step 3: Upload the zipped dSYM file.\"\n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " MD5ZIP=$(md5 -q ${DSYM_ZIP_FPATH})\n"
|
||||||
|
+ " if [ ! ${#MD5ZIP} -eq 32 ]; then\n"
|
||||||
|
+ " warningWithMessage \"Error: Failed to caculate md5 of zipped file.\" 1\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " echo \"zip md5 : ${MD5ZIP}\"\n"
|
||||||
|
+ " echo \"signature : ${MD5ZIP}\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " echo \"dSYM upload url: ${DSYM_UPLOAD_URL}\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " # Upload dSYM to APMInsight\n"
|
||||||
|
+ " echo \"curl ${DSYM_UPLOAD_URL} -F \\\"file=@${DSYM_ZIP_FPATH}\\\" -F \\\"aid=${APMInsight_APP_ID}\\\" -H \\\"Content-Type: multipart/form-data\\\" -w %{http_code} -v \"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " echo \"--------------------------------\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " # 上传请求\n"
|
||||||
|
+ " STATUS=$(curl ${DSYM_UPLOAD_URL} -F \"file=@${DSYM_ZIP_FPATH}\" -F \"type=Dwarf\" -F \"os=iOS\" -F \"aid=${APMInsight_APP_ID}\" -H \"Content-Type: multipart/form-data\" -w %{http_code} -v)\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " echo \"APMInsight server response: ${STATUS}\"\n"
|
||||||
|
+ "\n"
|
||||||
|
+ " if [ ${STATUS} = \"{\\\"err_detail\\\":\\\"\\\",\\\"data\\\":null,\\\"error_msg\\\":\\\"\\\",\\\"error_no\\\":0}200\" ]; then"
|
||||||
|
+ " echo \"Upload dSYM successfully! Delete ${DSYM_SYMBOL_OUT_ZIP_NAME}.\"\n"
|
||||||
|
+ " if [ -f ${DSYM_SYMBOL_OUT_ZIP_NAME} ]; then\n"
|
||||||
|
+ " rm ${DSYM_SYMBOL_OUT_ZIP_NAME}\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " else\n"
|
||||||
|
+ " echo \"Failed to upload dSYM. Try to upload the file at path ${DSYM_SYMBOL_OUT_ZIP_NAME} manually.\"\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " }\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " # .dSYM文件信息\n"
|
||||||
|
+ " echo \"DSYM FOLDER ${DWARF_DSYM_FOLDER_PATH}\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " DSYM_FOLDER=\"${DWARF_DSYM_FOLDER_PATH}\"\n"
|
||||||
|
+ " \n"
|
||||||
|
+ " for i in {1..10};\n"
|
||||||
|
+ " do\n"
|
||||||
|
+ " sleep 1s\n"
|
||||||
|
+ " # 遍历目录查找当前工程名的文件\n"
|
||||||
|
+ " for dsymFile in $(find \"$DSYM_FOLDER\" -name \"${PRODUCT_NAME}.*.dSYM\"); \n"
|
||||||
|
+ " do\n"
|
||||||
|
+ " # 判断压缩文件的源文件是否存在\n"
|
||||||
|
+ " DSYM_SINGLE_FILE_NAME=\"${dsymFile}/Contents/Resources/DWARF/${PRODUCT_NAME}\"\n"
|
||||||
|
+ " if [ ${UPLOADFLAG} -eq 1 -a -s \"${DSYM_SINGLE_FILE_NAME}\" ]; then\n"
|
||||||
|
+ " echo \"Found dSYM file: $dsymFile\"\n"
|
||||||
|
+ " uploadDSYM $dsymFile\n"
|
||||||
|
+ " break 2\n"
|
||||||
|
+ " fi\n"
|
||||||
|
+ " done\n"
|
||||||
|
+ " done\n"
|
||||||
|
+ "}\n"
|
||||||
|
+ " \n"
|
||||||
|
+ "main\n"
|
||||||
|
+ "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 76a2fec145724291b50c5d2f9108dc9d
|
||||||
|
timeCreated: 1621516898
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 构建类型,Release 或 Debug
|
||||||
|
BuildType=$1
|
||||||
|
|
||||||
|
# 打印日志方法
|
||||||
|
# shellcheck disable=SC2112
|
||||||
|
function PrintLog() {
|
||||||
|
echo "============== $1 =============="
|
||||||
|
}
|
||||||
|
|
||||||
|
# 检查是否传入了参数,如果传未传入参数则赋予默认值为Release
|
||||||
|
if [ ! "$1" ]; then
|
||||||
|
PrintLog "BuildType is null,default release"
|
||||||
|
BuildType="Release"
|
||||||
|
else
|
||||||
|
PrintLog "BuildType is "${BuildType}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 当前脚本所在路径
|
||||||
|
CurrentScriptPath=$(dirname "$0")
|
||||||
|
|
||||||
|
# 当前脚本所在的绝对路径
|
||||||
|
CurrentScriptRelativePath=Assets/JoyPacSDK/Core/Automation/Editor/Build/Editor_iOS
|
||||||
|
|
||||||
|
# project path
|
||||||
|
# shellcheck disable=SC2039
|
||||||
|
PROJ_PATH=${CurrentScriptPath//${CurrentScriptRelativePath}//""}
|
||||||
|
|
||||||
|
# 去掉项目路径中最后一个字符"/"
|
||||||
|
PROJ_PATH=${PROJ_PATH%?}
|
||||||
|
|
||||||
|
# unity app path
|
||||||
|
UNITY_PATH=/Applications/Unity/Hub/Editor/2019.4.19f1/Unity.app/Contents/MacOS/Unity
|
||||||
|
|
||||||
|
# 构建日志的输出路径
|
||||||
|
LOG_PATH=$PROJ_PATH/BuildProductDir/iOS/Log/BuildIpa.log
|
||||||
|
|
||||||
|
# log日志输出目录
|
||||||
|
PrintLog "LOG_PATH = "${LOG_PATH}
|
||||||
|
|
||||||
|
PrintLog "Unity Export XcodeProject Begin"
|
||||||
|
|
||||||
|
if [ ${BuildType} = "Release" ]; then
|
||||||
|
# 构建release ipa
|
||||||
|
PrintLog "Execute ExportXcodeProject.BuildRelease"
|
||||||
|
$UNITY_PATH -projectPath $PROJ_PATH -executeMethod ByteDance.Union.BuildIpa.BuildRelease -logFile $LOG_PATH -batchMode -quit
|
||||||
|
else
|
||||||
|
# 构建debug ipa
|
||||||
|
PrintLog "Execute ExportXcodeProject.BuildDebug"
|
||||||
|
$UNITY_PATH -projectPath $PROJ_PATH -executeMethod ByteDance.Union.BuildIpa.BuildDebug -logFile $LOG_PATH -batchMode -quit
|
||||||
|
fi
|
||||||
|
|
||||||
|
PrintLog "Unity Export XcodeProject Finish"
|
||||||
|
PrintLog "Prepare Build Ipa..."
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 22148540dde2144a192fc86c43f58141
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#构建类型、Debug或Release,外部传入的第一个参数
|
||||||
|
BuildType=$1
|
||||||
|
|
||||||
|
echo "${BuildType}"
|
||||||
|
|
||||||
|
#xcode工程路径,外部传入的第二个参数
|
||||||
|
XcodeProjectPath=$2
|
||||||
|
|
||||||
|
echo "${XcodeProjectPath}"
|
||||||
|
|
||||||
|
# 切换到当前目xcode项目目录
|
||||||
|
# shellcheck disable=SC2164
|
||||||
|
cd "${XcodeProjectPath}"
|
||||||
|
|
||||||
|
#工程名字
|
||||||
|
ProjectName="Unity-iPhone"
|
||||||
|
|
||||||
|
# 构建产物路径
|
||||||
|
ProductsPath=$(dirname "$PWD")/Products
|
||||||
|
|
||||||
|
echo ProductsPath="${ProductsPath}"
|
||||||
|
|
||||||
|
# Archive路径
|
||||||
|
ArchivePath=${ProductsPath}/Archive/${ProjectName}".xcarchive"
|
||||||
|
|
||||||
|
# 导出ipa所需要的配置文件
|
||||||
|
ExportOptionsPath=$(dirname "$PWD")/PrepareInfo/ExportOptions.plist
|
||||||
|
|
||||||
|
#编译工程
|
||||||
|
xcodebuild archive -scheme ${ProjectName} -configuration "${BuildType}" -archivePath "${ArchivePath}" -quiet || exit
|
||||||
|
|
||||||
|
# 从archive中导出ipa
|
||||||
|
xcodebuild \
|
||||||
|
'#从archive中导出ipa' \
|
||||||
|
-exportArchive -archivePath "${ArchivePath}" \
|
||||||
|
'#构建类型,Debug或Release' \
|
||||||
|
-configuration "${BuildType}" \
|
||||||
|
'#archive存在的路径' \
|
||||||
|
-exportArchive "${ArchivePath}" \
|
||||||
|
'#导出Ipa需要的配置文件exportOptions.plist,此文件很重要' \
|
||||||
|
-exportOptionsPlist "${ExportOptionsPath}" \
|
||||||
|
'#导出ipa所在的位置' \
|
||||||
|
-exportPath "${ProductsPath}" \
|
||||||
|
-quiet || exit
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bdb9451d3016149b3a4c6171f3ecf0cb
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,197 @@
|
||||||
|
#if UNITY_EDITOR && UNITY_IOS
|
||||||
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Callbacks;
|
||||||
|
using UnityEditor.iOS.Xcode;
|
||||||
|
using UnityEditor.iOS.Xcode.Extensions;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
internal static class iOSPlatformPostProcess
|
||||||
|
{
|
||||||
|
[PostProcessBuild(999)]
|
||||||
|
private static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
|
||||||
|
{
|
||||||
|
if (target != BuildTarget.iOS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var projPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
|
||||||
|
var proj = new PBXProject();
|
||||||
|
proj.ReadFromString(File.ReadAllText(projPath));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Log("pathToBuiltProject" + pathToBuiltProject);
|
||||||
|
//att弹框
|
||||||
|
EditorAtt(pathToBuiltProject);
|
||||||
|
///添加bundle
|
||||||
|
ChangeBundleFile(proj);
|
||||||
|
|
||||||
|
// proj.WriteToFile(projPath);
|
||||||
|
UpdatePlistInfo(pathToBuiltProject);
|
||||||
|
|
||||||
|
//info.plist
|
||||||
|
CopyInfoPlist(proj, pathToBuiltProject);
|
||||||
|
|
||||||
|
//framework
|
||||||
|
EmbedFramework(proj);
|
||||||
|
File.WriteAllText(projPath, proj.WriteToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ChangeBundleFile(PBXProject proj)
|
||||||
|
{
|
||||||
|
#if UNITY_2019_3_OR_NEWER
|
||||||
|
|
||||||
|
string targetMainGUID = proj.GetUnityMainTargetGuid();
|
||||||
|
|
||||||
|
string target = proj.GetUnityFrameworkTargetGuid();
|
||||||
|
// 2019.3版本以后需要手动添加.bundle到UnityMainTarget
|
||||||
|
string[] relativeAssetsBundlePaths = JoyPacParamsManager.WriteBundlePath();
|
||||||
|
|
||||||
|
foreach (var bundlePath in relativeAssetsBundlePaths)
|
||||||
|
{
|
||||||
|
string guid = proj.FindFileGuidByProjectPath($"Frameworks/{bundlePath}");
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(guid))
|
||||||
|
{
|
||||||
|
proj.RemoveFileFromBuild(target, guid);
|
||||||
|
proj.AddFileToBuild(targetMainGUID, guid);
|
||||||
|
Debug.Log("add bundle: " + ($"Frameworks/{bundlePath}") + " Succeeded");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("add bundle: " + ($"Frameworks/{bundlePath}") + " failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void EmbedFramework(PBXProject proj)
|
||||||
|
{
|
||||||
|
string[] relativeAssetsEmbedFrameworksPaths = JoyPacParamsManager.EmbedFrameworks();
|
||||||
|
#if UNITY_2019_3_OR_NEWER
|
||||||
|
|
||||||
|
string targetMain = proj.GetUnityMainTargetGuid();
|
||||||
|
#else
|
||||||
|
string targetMain = proj.TargetGuidByName("Unity-iPhone");
|
||||||
|
#endif
|
||||||
|
foreach (var bundlePath in relativeAssetsEmbedFrameworksPaths)
|
||||||
|
{
|
||||||
|
string guid = proj.FindFileGuidByProjectPath($"Frameworks/{bundlePath}");
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(guid))
|
||||||
|
{
|
||||||
|
|
||||||
|
PBXProjectExtensions.AddFileToEmbedFrameworks(proj, targetMain, guid);
|
||||||
|
Debug.Log("add EmbedFramework: " + ($"Frameworks/{bundlePath}") + " Succeeded");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("add EmbedFramework: " + ($"Frameworks/{bundlePath}") + " failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CopyInfoPlist(PBXProject proj, string _path)
|
||||||
|
{
|
||||||
|
if (!JPPackageManager.HasComponent(JPComponenetType.JoyPacAd))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
JPReleaseAreaType adinfo = JoyPacParamsManager.GetJPReleaseAreaType();
|
||||||
|
string sourcePath = Application.dataPath + "/" + JPService.info_target_path + "/info/" + adinfo + "/" + JPService.info_plist_name;
|
||||||
|
string targetPath = Application.dataPath + "/Plugin/iOS/" + JPService.info_plist_name;
|
||||||
|
if (!File.Exists(sourcePath))
|
||||||
|
{
|
||||||
|
Debug.LogError(sourcePath + "为空,请检查是否已放入" + JPService.info_plist_name + "文件");
|
||||||
|
Debug.LogError("因检测不到" + JPService.info_plist_name + "文件,所以开始执行删除Xcode工程命令");
|
||||||
|
DeletePath(_path);
|
||||||
|
|
||||||
|
}
|
||||||
|
#if UNITY_2019_3_OR_NEWER
|
||||||
|
string target = proj.GetUnityMainTargetGuid();
|
||||||
|
#else
|
||||||
|
string target = proj.TargetGuidByName("Unity-iPhone");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
File.Copy(sourcePath, Path.Combine(_path, JPService.info_plist_name));
|
||||||
|
proj.AddFileToBuild(target, proj.AddFile(JPService.info_plist_name, JPService.info_plist_name, PBXSourceTree.Source));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除指定目录下的文件以及文件夹
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
public static void DeletePath(string path)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
DirectoryInfo info = new DirectoryInfo(path);
|
||||||
|
FileSystemInfo[] arrInfo = info.GetFileSystemInfos();
|
||||||
|
for (int i = 0; i < arrInfo.Length; ++i)
|
||||||
|
{
|
||||||
|
if (arrInfo[i].Attributes == FileAttributes.Directory)
|
||||||
|
{
|
||||||
|
Directory.Delete(arrInfo[i].ToString(), true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
File.Delete(arrInfo[i].ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//update info.plist
|
||||||
|
private static void UpdatePlistInfo(string projPath)
|
||||||
|
{
|
||||||
|
/* info.plist */
|
||||||
|
var plistPath = Path.Combine(projPath, "Info.plist");
|
||||||
|
var plist = new PlistDocument();
|
||||||
|
plist.ReadFromFile(plistPath);
|
||||||
|
//admob的apppid ,
|
||||||
|
//目前无applovin
|
||||||
|
JoyPacParamsManager.WriteInitParamsToXcodePlist(plist);
|
||||||
|
|
||||||
|
File.WriteAllText(plistPath, plist.WriteToString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void EditorAtt(string _path)
|
||||||
|
{
|
||||||
|
|
||||||
|
//有广告或者不需要att时
|
||||||
|
if (JoyPacParamsManager.isHasComponentJoyPacAd() || !JoyPacParamsManager.isAttEnable())
|
||||||
|
return;
|
||||||
|
JoypacStaticClassHelper UnityAppController = new JoypacStaticClassHelper(_path + "/Classes/UnityAppController.mm");
|
||||||
|
UnityAppController.WriteBelow("#import \"UnityAppController.h\"", "\n#import <AppTrackingTransparency/AppTrackingTransparency.h>");
|
||||||
|
|
||||||
|
string attCode =
|
||||||
|
"if (@available(iOS 14.0, *)){" +
|
||||||
|
"\r[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler: ^(ATTrackingManagerAuthorizationStatus status) {" +
|
||||||
|
"\r dispatch_async(dispatch_get_main_queue(), ^{" +
|
||||||
|
|
||||||
|
"\r UnityPause(0);" +
|
||||||
|
"\r });" +
|
||||||
|
"\r }];" +
|
||||||
|
"\r }\n";
|
||||||
|
|
||||||
|
UnityAppController.WriteBelow("[KeyboardDelegate Initialize];\n", attCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a329cfca07c8f4c9f8b7a49d1803ce48
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Callbacks;
|
||||||
|
public class NewMonoBehaviour : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
// SDK根目录
|
||||||
|
private const string JoyPacSDK = "Assets/JoyPacSDK";
|
||||||
|
private const string Examples = "Assets/Examples";
|
||||||
|
private const string I2 = "Assets/I2";
|
||||||
|
private const string Joypac = "Assets/Joypac";
|
||||||
|
private const string JPChannel = "Assets/JPChannel";
|
||||||
|
private const string Other = "Assets/Other";
|
||||||
|
private const string Plugins = "Assets/Plugins";
|
||||||
|
private const string Resources = "Assets/Resources";
|
||||||
|
|
||||||
|
|
||||||
|
// 导出最终包的unity package前缀.
|
||||||
|
private const string SdkNamePreFix = "JoyPac_SDK";
|
||||||
|
|
||||||
|
|
||||||
|
// [MenuItem("Assets/Adjust/Export Unity Package")]
|
||||||
|
public static void ExportAdjustUnityPackage()
|
||||||
|
{
|
||||||
|
|
||||||
|
List<string> assetsToExport = new List<string>();
|
||||||
|
|
||||||
|
// Adjust Assets.
|
||||||
|
assetsToExport.Add(Examples + "/Scenes/DemoScene.unity");
|
||||||
|
|
||||||
|
|
||||||
|
assetsToExport.Add(Examples + "/Scripts/BannerButton.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Android/AdjustAndroid.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Android/AdjustAndroidManifest.xml");
|
||||||
|
|
||||||
|
// assetsToExport.Add(assetsPath + "/Editor/AdjustEditor.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Editor/AdjustSettings.cs");
|
||||||
|
|
||||||
|
// assetsToExport.Add(assetsPath + "/ExampleGUI/ExampleGUI.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/ExampleGUI/ExampleGUI.prefab");
|
||||||
|
// assetsToExport.Add(assetsPath + "/ExampleGUI/ExampleGUI.unity");
|
||||||
|
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJAttribution.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJConfig.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJEvent.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJEventFailure.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJEventSuccess.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJLogger.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJSessionFailure.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJSessionSuccess.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/ADJSubscription.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/Adjust.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/AdjustiOS.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/AdjustSdk.a");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/AdjustUnity.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/AdjustUnity.mm");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/AdjustUnityDelegate.h");
|
||||||
|
// assetsToExport.Add(assetsPath + "/iOS/AdjustUnityDelegate.mm");
|
||||||
|
|
||||||
|
// assetsToExport.Add(assetsPath + "/Prefab/Adjust.prefab");
|
||||||
|
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/Adjust.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustAppStoreSubscription.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustAttribution.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustConfig.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustEnvironment.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustEvent.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustEventFailure.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustEventSuccess.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustLogLevel.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustPlayStoreSubscription.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustSessionFailure.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustSessionSuccess.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Unity/AdjustUtils.cs");
|
||||||
|
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/AdjustWindows.cs");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/WindowsPcl.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/WindowsUap.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/Stubs/Win10Interface.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/Stubs/Win81Interface.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/Stubs/WinWsInterface.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/W81/AdjustWP81.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/W81/Win81Interface.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/WS/AdjustWS.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/WS/WinWsInterface.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/WU10/AdjustUAP10.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/WU10/Win10Interface.dll");
|
||||||
|
// assetsToExport.Add(assetsPath + "/Windows/Newtonsoft.Json.dll");
|
||||||
|
|
||||||
|
// AssetDatabase.ExportPackage(
|
||||||
|
// assetsToExport.ToArray(),
|
||||||
|
// exportedFileName,
|
||||||
|
// ExportPackageOptions.IncludeDependencies | ExportPackageOptions.Interactive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9600e7a7ec6014d518aadd1820890d16
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class UserBuildSettings : MonoBehaviour
|
||||||
|
{
|
||||||
|
[System.Obsolete]
|
||||||
|
static UserBuildSettings()
|
||||||
|
{
|
||||||
|
EditorUserBuildSettings.activeBuildTargetChanged += OnChangePlatform;
|
||||||
|
}
|
||||||
|
static void OnChangePlatform()
|
||||||
|
{
|
||||||
|
Debug.Log("Has Pro Licence : " + Application.HasProLicense());
|
||||||
|
Debug.Log("Platform : " + EditorUserBuildSettings.activeBuildTarget);
|
||||||
|
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
|
||||||
|
{
|
||||||
|
string str = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android);
|
||||||
|
Debug.Log("old " + str);
|
||||||
|
str = str.Replace("ANDROID_GP", null);
|
||||||
|
|
||||||
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android,
|
||||||
|
"ANDROID_GP" + ";" + str);
|
||||||
|
Debug.Log("new " + PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android));
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Log("当前平台为iOS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: df75b06f7f5284959914c0dbd7575446
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bebd8773399c41318a297d7d4e627aa8
|
||||||
|
timeCreated: 1615294232
|
||||||
|
|
@ -0,0 +1,280 @@
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
|
||||||
|
public abstract class BaseParamsInspector<T> : Editor
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
// 通用标签间的间距
|
||||||
|
private const float COMMON_SPACE = 13f;
|
||||||
|
|
||||||
|
// 最大间距
|
||||||
|
private const float MAX_SPACE = 25f;
|
||||||
|
|
||||||
|
// 目标对象
|
||||||
|
protected T mTargetObject;
|
||||||
|
|
||||||
|
// 字段值改变
|
||||||
|
protected Action<string, object> FieldValueChangeListener;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制参数面板.
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void DrawInspector();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 系统会回调此方法.
|
||||||
|
/// </summary>
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
this.mTargetObject = this.target as T;
|
||||||
|
|
||||||
|
// 绘制整体带边框UI
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
|
||||||
|
// 交给子类去绘制
|
||||||
|
this.DrawInspector();
|
||||||
|
|
||||||
|
// 整体边框绘制结束
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始绘制垂直方向Box.
|
||||||
|
/// </summary>
|
||||||
|
protected void BeginDrawVerticalBox()
|
||||||
|
{
|
||||||
|
EditorGUILayout.BeginVertical("Box", GUILayout.ExpandWidth(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结束绘制垂直方向Box.
|
||||||
|
/// </summary>
|
||||||
|
protected void EndDrawVerticalBox()
|
||||||
|
{
|
||||||
|
EditorGUILayout.EndVertical();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 绘制1级标题
|
||||||
|
protected void DrawH1Title(string title)
|
||||||
|
{
|
||||||
|
DrawAreaTitle(title, Color.red, TextAnchor.MiddleCenter, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制2级标题
|
||||||
|
protected void DrawH2Title(string title)
|
||||||
|
{
|
||||||
|
DrawAreaTitle(title, new Color(128, 138, 135), TextAnchor.MiddleCenter, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制3级标题
|
||||||
|
protected void DrawH3Title(string title)
|
||||||
|
{
|
||||||
|
DrawAreaTitle(title, GetTitleColor(), TextAnchor.MiddleCenter, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前标题颜色
|
||||||
|
private Color GetTitleColor()
|
||||||
|
{
|
||||||
|
return JPEditorPrefsHelper.CurrentSkinType == EditorSkinType.Dark ? new Color(128, 138, 135) : Color.black;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制标题区域.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title">标题.</param>
|
||||||
|
/// <param name="color">字体颜色.</param>
|
||||||
|
/// <param name="textAnchor">对齐方式.</param>
|
||||||
|
/// <param name="fontSize">字体大小.</param>
|
||||||
|
private static void DrawAreaTitle(string title, Color color, TextAnchor textAnchor, int fontSize)
|
||||||
|
{
|
||||||
|
EditorGUILayout.BeginVertical();
|
||||||
|
DrawVerticalSpace(MAX_SPACE);
|
||||||
|
|
||||||
|
var guiStyle = new GUIStyle();
|
||||||
|
guiStyle.fontSize = fontSize;
|
||||||
|
guiStyle.normal.textColor = color;
|
||||||
|
guiStyle.fontStyle = FontStyle.BoldAndItalic;
|
||||||
|
guiStyle.alignment = textAnchor;
|
||||||
|
EditorGUILayout.TextArea(title, guiStyle);
|
||||||
|
EditorGUILayout.EndVertical();
|
||||||
|
DrawVerticalSpace(COMMON_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制文本框控件.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="labelName">标签名称.</param>
|
||||||
|
/// <param name="fieldName">字段名称.</param>
|
||||||
|
protected void DrawTextArea(string labelName, string fieldName)
|
||||||
|
{
|
||||||
|
// 读取字段中设置的文本
|
||||||
|
var text = this.getFieldValue(this.mTargetObject, fieldName) as string;
|
||||||
|
|
||||||
|
var oldText = text;
|
||||||
|
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
|
||||||
|
// 绘制标签名称
|
||||||
|
EditorGUILayout.LabelField(new GUIContent(labelName));
|
||||||
|
|
||||||
|
// 监听文本改变,同时设置到目标对象中
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
text = EditorGUILayout.DelayedTextField(text);
|
||||||
|
var change = EditorGUI.EndChangeCheck() && text != oldText;
|
||||||
|
if (change)
|
||||||
|
{
|
||||||
|
this.NotifyFeildValueChange(fieldName, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制结束标记
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
DrawVerticalSpace(COMMON_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制label
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="labelName"></param>
|
||||||
|
/// <param name="fieldName"></param>
|
||||||
|
protected void DrawLabel(string title, string content, string tip)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(tip))
|
||||||
|
EditorGUILayout.HelpBox(tip, MessageType.Info);
|
||||||
|
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
EditorGUILayout.PrefixLabel(title);
|
||||||
|
GUILayoutOption option = GUILayout.Height(MAX_SPACE);
|
||||||
|
EditorGUILayout.SelectableLabel(content, option);
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
DrawVerticalSpace(COMMON_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制开关类型控件.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="labelName">标签名称.</param>
|
||||||
|
/// <param name="fieldName">字段名称.</param>
|
||||||
|
protected void DrawToggle(
|
||||||
|
string labelName, string fieldName)
|
||||||
|
{
|
||||||
|
var value = (bool)this.getFieldValue(this.mTargetObject, fieldName);
|
||||||
|
var oldValue = value;
|
||||||
|
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
|
||||||
|
// 监听开关状态改变,同时设置到目标对象中
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
||||||
|
value = EditorGUILayout.Toggle(new GUIContent(labelName), value);
|
||||||
|
var change = EditorGUI.EndChangeCheck() && oldValue != value;
|
||||||
|
if (change)
|
||||||
|
{
|
||||||
|
this.NotifyFeildValueChange(fieldName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
DrawVerticalSpace(COMMON_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制枚举类型选择框.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="labelName">标签名称.</param>
|
||||||
|
/// <param name="fieldName">字段名称.</param>
|
||||||
|
protected void DrawEnumPopup(string labelName, string fieldName)
|
||||||
|
{
|
||||||
|
var value = (Enum)this.getFieldValue(this.mTargetObject, fieldName);
|
||||||
|
|
||||||
|
var oldValue = value;
|
||||||
|
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
||||||
|
value = EditorGUILayout.EnumPopup(labelName, value);
|
||||||
|
|
||||||
|
var change = EditorGUI.EndChangeCheck() && !Equals(value, oldValue);
|
||||||
|
|
||||||
|
if (change)
|
||||||
|
{
|
||||||
|
this.NotifyFeildValueChange(fieldName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
DrawVerticalSpace(COMMON_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制垂直方向间距.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pixels">间距.</param>
|
||||||
|
private static void DrawVerticalSpace(float pixels)
|
||||||
|
{
|
||||||
|
GUILayout.Space(pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NotifyFeildValueChange(string fieldName, object value)
|
||||||
|
{
|
||||||
|
this.FieldValueChangeListener?.Invoke(fieldName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取字段信息.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="t">目标对象.</param>
|
||||||
|
/// <param name="fieldName">字段名称.</param>
|
||||||
|
/// <returns>字段信息.</returns>
|
||||||
|
protected FieldInfo GetFieldInfo(T t, string fieldName)
|
||||||
|
{
|
||||||
|
if (t == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("target object is null.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(fieldName))
|
||||||
|
{
|
||||||
|
Debug.LogError(t.GetType() + " is null.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var type = t.GetType();
|
||||||
|
var myFieldInfo = type.GetField(fieldName);
|
||||||
|
return myFieldInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取对象中字段的值.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="t">目标对象.</param>
|
||||||
|
/// <param name="fieldName">字段名称.</param>
|
||||||
|
/// <returns>字段对应的值.</returns>
|
||||||
|
private object getFieldValue(T t, string fieldName)
|
||||||
|
{
|
||||||
|
var fieldInfo = this.GetFieldInfo(t, fieldName);
|
||||||
|
return fieldInfo != null ? fieldInfo.GetValue(this.mTargetObject) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新目标对象中字段的值.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">目标对象.</param>
|
||||||
|
/// <param name="fieldName">字段名.</param>
|
||||||
|
/// <param name="value">字段值.</param>
|
||||||
|
protected void RefreshFieldValue(T obj, string fieldName, object value)
|
||||||
|
{
|
||||||
|
var fieldInfo = this.GetFieldInfo(obj, fieldName);
|
||||||
|
if (fieldInfo != null)
|
||||||
|
{
|
||||||
|
fieldInfo.SetValue(obj, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 43475b77e9b94cd5b9187e562d82a9cd
|
||||||
|
timeCreated: 1615184657
|
||||||
|
|
@ -0,0 +1,340 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[CustomEditor(typeof(JoyPacBuildParams))]
|
||||||
|
public class JoyPacBuildParamsInspector : BaseParamsInspector<JoyPacBuildParams>
|
||||||
|
{
|
||||||
|
|
||||||
|
// 面板中参数绘制
|
||||||
|
protected override void DrawInspector()
|
||||||
|
{
|
||||||
|
// 注册字段值改变的监听
|
||||||
|
this.FieldValueChangeListener = this.FieldValueChange;
|
||||||
|
|
||||||
|
var joyPacBuildParams = this.mTargetObject;
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
this.DrawiOSBuildParams(joyPacBuildParams);
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
this.DrawAndroidBuildParams(joyPacBuildParams);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Button();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 绘制iOS平台构建参数
|
||||||
|
private void DrawiOSBuildParams(JoyPacBuildParams joyPacBuildParams)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
|
||||||
|
this.DrawH1Title("iOS Platform Build Params");
|
||||||
|
|
||||||
|
JPReleaseAreaType releaseAreaType = JoyPacParamsManager.GetJPReleaseAreaType();
|
||||||
|
switch (releaseAreaType)
|
||||||
|
{
|
||||||
|
case JPReleaseAreaType.Editor:
|
||||||
|
this.DrawH2Title("请选择CN或者OS,如需切换请选择[JoyPacSDK-参数配置-打开参数面板切换] \n 【 Select CN or OS, \n if you need to switch, please select \n [JoyPacSDK- Parameter configuration - Open parameter ]panel to switch】");
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.CN:
|
||||||
|
this.DrawH2Title("当前为国内平台,如需切换请选择[JoyPacSDK-参数配置-打开参数面板切换] \n 【 The current platform is China, \n if you need to switch, please select \n [JoyPacSDK- Parameter configuration - Open parameter ]panel to switch】");
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.OS:
|
||||||
|
this.DrawH2Title("当前为海外平台,如需切换请选择[JoyPacSDK-参数配置-打开参数面板切换] \n The current platform is no China, \n if you need to switch, please select \n [JoyPacSDK- Parameter configuration - Open parameter ]panel to switch");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetBuildParamsFieldInfoByPlatformType(JPEditorPlatformType.iOS, releaseAreaType, JPEditorComponentType.JoyPacSetting);
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
switch (releaseAreaType)
|
||||||
|
{
|
||||||
|
case JPReleaseAreaType.CN:
|
||||||
|
if (fieldInfo.Name == "iOSCN_DeveloperTeamID")
|
||||||
|
{
|
||||||
|
if (joyPacBuildParams.iOSCN_Automaticall_Sign)
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.OS:
|
||||||
|
if (fieldInfo.Name == "iOSOS_DeveloperTeamID")
|
||||||
|
{
|
||||||
|
if (joyPacBuildParams.iOSOS_Automaticall_Sign)
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 绘制Android平台构建参数
|
||||||
|
private void DrawAndroidBuildParams(JoyPacBuildParams joyPacBuildParams)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
|
||||||
|
this.DrawH1Title("Android Platform Build Params");
|
||||||
|
|
||||||
|
JPReleaseAreaType releaseAreaType = JoyPacParamsManager.GetJPReleaseAreaType();
|
||||||
|
switch (releaseAreaType)
|
||||||
|
{
|
||||||
|
case JPReleaseAreaType.Editor:
|
||||||
|
this.DrawH2Title("请选择CN或者OS,如需切换请选择[JoyPacSDK-参数配置-打开参数面板切换] \n 【 Select CN or OS, \n if you need to switch, please select \n [JoyPacSDK- Parameter configuration - Open parameter ]panel to switch】");
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.CN:
|
||||||
|
this.DrawH2Title("当前为国内平台,如需切换请选择[JoyPacSDK-参数配置-打开参数面板切换] \n 【 The current platform is China, \n if you need to switch, please select \n [JoyPacSDK- Parameter configuration - Open parameter ]panel to switch】");
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.OS:
|
||||||
|
this.DrawH2Title("当前为海外平台,如需切换请选择[JoyPacSDK-参数配置-打开参数面板切换] \n The current platform is no China, \n if you need to switch, please select \n [JoyPacSDK- Parameter configuration - Open parameter ]panel to switch");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetBuildParamsFieldInfoByPlatformType(JPEditorPlatformType.Android, releaseAreaType, JPEditorComponentType.JoyPacSetting);
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
switch (releaseAreaType)
|
||||||
|
{
|
||||||
|
case JPReleaseAreaType.CN:
|
||||||
|
if (fieldInfo.Name == "iOSCN_DeveloperTeamID")
|
||||||
|
{
|
||||||
|
if (joyPacBuildParams.iOSCN_Automaticall_Sign)
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.OS:
|
||||||
|
if (fieldInfo.Name == "iOSOS_DeveloperTeamID")
|
||||||
|
{
|
||||||
|
if (joyPacBuildParams.iOSOS_Automaticall_Sign)
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button()
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("更新"))
|
||||||
|
{
|
||||||
|
bool isAuto_Sign = JoyPacSettingUpDate();
|
||||||
|
string con = "Change productName to:" + SettingStringsKey.Instance.productName +
|
||||||
|
" \n Change bundleVersion to: " + SettingStringsKey.Instance.bundleVersion +
|
||||||
|
"\n Change BundleID to: " + SettingStringsKey.Instance.BundleID;
|
||||||
|
|
||||||
|
string message = "";
|
||||||
|
#if UNITY_IOS
|
||||||
|
if (isAuto_Sign)
|
||||||
|
{
|
||||||
|
message = con + "\n Change appleEnableAutomaticSigning to: " + isAuto_Sign.ToString() +
|
||||||
|
"\n Change appleDeveloperTeamID to: " + SettingStringsKey.Instance.DeveloperTeamID;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message = con + "\n Change appleEnableAutomaticSigning to: " + isAuto_Sign.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
message = con + "\n Change targetSdkVersion to " + AndroidSdkVersions.AndroidApiLevel30;
|
||||||
|
#endif
|
||||||
|
if (EditorUtility.DisplayDialog("提示", message, "Yes", "No")) //显示对话框
|
||||||
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
|
Change(BuildTargetGroup.iOS, isAuto_Sign);
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
Change(BuildTargetGroup.Android, false);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Setting参数处理
|
||||||
|
|
||||||
|
public static bool JoyPacSettingUpDate()
|
||||||
|
{
|
||||||
|
bool isAuto_Sign = false;
|
||||||
|
StringKeyManger.Instance.ClearStringKeyDic(StringKeyManger.Instance.BuildSettingKey);
|
||||||
|
JPReleaseAreaType releaseAreaType = JoyPacParamsManager.GetJPReleaseAreaType();
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
IEnumerable<FieldInfo> JoyPacSettingFieldInfo = JoyPacParamsManager.GetBuildParamsFieldInfoByPlatformType(JPEditorPlatformType.iOS, releaseAreaType, JPEditorComponentType.JoyPacSetting);
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
IEnumerable<FieldInfo> JoyPacSettingFieldInfo = JoyPacParamsManager.GetBuildParamsFieldInfoByPlatformType(JPEditorPlatformType.Android, releaseAreaType, JPEditorComponentType.JoyPacSetting);
|
||||||
|
#elif UNITY_EDITOR
|
||||||
|
IEnumerable<FieldInfo> JoyPacSettingFieldInfo = JoyPacParamsManager.GetBuildParamsFieldInfoByPlatformType(JPEditorPlatformType.Editor, releaseAreaType, JPEditorComponentType.JoyPacSetting);
|
||||||
|
#endif
|
||||||
|
foreach (var info in JoyPacSettingFieldInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (info.FieldType == typeof(string))
|
||||||
|
{
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
string jsonKey = info.Name.Remove(0, JoyPacParamsManager.RemoveCount);
|
||||||
|
|
||||||
|
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
string jsonKey = info.Name.Remove(0, JoyPacParamsManager.RemoveCount);
|
||||||
|
#elif UNITY_EDITOR
|
||||||
|
string jsonKey = "";
|
||||||
|
#endif
|
||||||
|
StringKeyManger.Instance.AddStringKeyDic(jsonKey, (string)info.GetValue(AutomationManager.JoyPacBuildParams), StringKeyManger.Instance.BuildSettingKey);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (info.FieldType == (typeof(bool)))
|
||||||
|
{
|
||||||
|
isAuto_Sign = (bool)info.GetValue(AutomationManager.JoyPacBuildParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
StringKeyManger.Instance.SerializeDictionaryToJsonString(StringKeyManger.Instance.BuildSettingKey, StringKeyManger.Instance.BuildJsonPath);
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
return isAuto_Sign;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 更新Setting
|
||||||
|
public static void Change(BuildTargetGroup buildTargetGroup, bool isAuto_Sign)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
PlayerSettings.productName = SettingStringsKey.Instance.productName;
|
||||||
|
PlayerSettings.bundleVersion = SettingStringsKey.Instance.bundleVersion;
|
||||||
|
PlayerSettings.SetApplicationIdentifier(buildTargetGroup, SettingStringsKey.Instance.BundleID);
|
||||||
|
#if UNITY_IOS
|
||||||
|
PlayerSettings.iOS.appleEnableAutomaticSigning = isAuto_Sign;
|
||||||
|
if (isAuto_Sign)
|
||||||
|
PlayerSettings.iOS.appleDeveloperTeamID = SettingStringsKey.Instance.DeveloperTeamID;
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel30;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void DrawIosPushBuildParams(JPReleaseAreaType releaseAreaType)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH1Title("iOS Platform Push Build Params");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetBuildParamsFieldInfoByPlatformType(JPEditorPlatformType.iOS, releaseAreaType, JPEditorComponentType.BuildPush);
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字段值被修改后调用的方法.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fieldName">字段名称.</param>
|
||||||
|
/// <param name="value">修改后的值.</param>
|
||||||
|
///
|
||||||
|
private void FieldValueChange(string fieldName, object value)
|
||||||
|
{
|
||||||
|
var buildParams = AutomationManager.JoyPacBuildParams;
|
||||||
|
this.RefreshFieldValue(buildParams, fieldName, value);
|
||||||
|
EditorUtility.SetDirty(buildParams);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
string val = value.ToString();
|
||||||
|
if (val == null || val == "")
|
||||||
|
return;
|
||||||
|
if (IsSpace(val.Substring(0, 1)))
|
||||||
|
JPPackageManager.ShowTips("Error", "value = " + val + " 第一个字符串为空格,请检查是否正确");
|
||||||
|
|
||||||
|
if (IsSpace(val.Substring(val.Length - 1, 1)))
|
||||||
|
JPPackageManager.ShowTips("Error", "value = " + val + " 最后一个字符串为空格,请检查是否正确");
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsSpace(string name)
|
||||||
|
{
|
||||||
|
if (name.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制不同字段类型的控件.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fieldInfo">字段信息.</param>
|
||||||
|
/// <param name="isContinueDraw">是否继续绘制.</param>
|
||||||
|
private void DrawComponentByFieldInfo(FieldInfo fieldInfo, bool isContinueDraw = true)
|
||||||
|
{
|
||||||
|
var attr = JoyPacParamsManager.GetInitFieldAttr(fieldInfo);
|
||||||
|
|
||||||
|
// 不是控制开关并且外部条件不继续绘制则不绘制
|
||||||
|
if (!attr.IsControllerSwitch && !isContinueDraw)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(attr.Tip))
|
||||||
|
{
|
||||||
|
EditorGUILayout.HelpBox(attr.Tip, MessageType.Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fieldInfo.FieldType == typeof(bool))
|
||||||
|
{
|
||||||
|
this.DrawToggle(attr.InspectorPropertyLabel, fieldInfo.Name);
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType == typeof(JoyPacParams.LoginMode))
|
||||||
|
{
|
||||||
|
this.DrawEnumPopup(attr.InspectorPropertyLabel, fieldInfo.Name);
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType == typeof(string))
|
||||||
|
{
|
||||||
|
this.DrawTextArea(attr.InspectorPropertyLabel, fieldInfo.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 781273c2603144f799c7f88a8bc8e5ed
|
||||||
|
timeCreated: 1616120492
|
||||||
|
|
@ -0,0 +1,894 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditorInternal;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
|
||||||
|
[CustomEditor(typeof(JoyPacParams))]
|
||||||
|
[Serializable]
|
||||||
|
public class JoyPacInitParamsInspector : BaseParamsInspector<JoyPacParams>
|
||||||
|
{
|
||||||
|
|
||||||
|
//JPReleaseAreaType jPReleaseAreaType = JPReleaseAreaType.None;
|
||||||
|
// 面板渲染
|
||||||
|
protected override void DrawInspector()
|
||||||
|
{
|
||||||
|
var JoyPacParams = this.mTargetObject;
|
||||||
|
// 注册字段值改变的监听
|
||||||
|
this.FieldValueChangeListener = this.FieldValueChange;
|
||||||
|
|
||||||
|
DrawEditorUi(JoyPacParams);
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
|
||||||
|
// 绘制iosUi
|
||||||
|
this.DrawIosUi(JoyPacParams);
|
||||||
|
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
// 绘制Android参数UI
|
||||||
|
this.DrawAndroidUi(JoyPacParams);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Draw Editor
|
||||||
|
|
||||||
|
private void DrawEditorUi(JoyPacParams JoyPacParams)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawSwitchArea();
|
||||||
|
#if UNITY_IOS
|
||||||
|
this.DrawH1Title("Attention! \n The current platform is iOS");
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
this.DrawH1Title("Attention! \n The current platform is Android");
|
||||||
|
#endif
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void DrawSwitchArea()
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.iOS,
|
||||||
|
JPReleaseAreaType.Editor,
|
||||||
|
|
||||||
|
JPEditorComponentType.Core);
|
||||||
|
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.Android,
|
||||||
|
JPReleaseAreaType.Editor,
|
||||||
|
|
||||||
|
JPEditorComponentType.Core);
|
||||||
|
#elif UNITY_EDITOR
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.Editor,
|
||||||
|
JPReleaseAreaType.Editor, JPEditorComponentType.Core);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
|
||||||
|
string explain = "";
|
||||||
|
if (fieldInfo.FieldType == typeof(JPReleaseAreaType))
|
||||||
|
{
|
||||||
|
|
||||||
|
JPReleaseAreaType jPReleaseAreaType = (JPReleaseAreaType)fieldInfo.GetValue(AutomationManager.JoyPacParams);
|
||||||
|
|
||||||
|
switch (jPReleaseAreaType)
|
||||||
|
{
|
||||||
|
case JPReleaseAreaType.Editor:
|
||||||
|
explain = "请先选择当前要发布的地区 \n (Select the region you want to publish) \n CN --国内(China) OS--海外(no China)";
|
||||||
|
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.CN:
|
||||||
|
|
||||||
|
explain = "当前为国内地区(It is currently in China)";
|
||||||
|
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.OS:
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
explain = "当前为海外地区(It is currently in no China)";
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
explain = "当前为海外GP地区(It is currently in no China)";
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.DrawH2Title(explain);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
#region Draw iOS Platform Ui
|
||||||
|
|
||||||
|
// 绘制iosUi
|
||||||
|
private void DrawIosUi(JoyPacParams JoyPacParams)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
|
||||||
|
JPReleaseAreaType releaseAreaType = JoyPacParamsManager.GetJPReleaseAreaType();
|
||||||
|
if (JPPackageManager.HasComponent(JPComponenetType.Ga_Adjust))
|
||||||
|
{
|
||||||
|
// Ga_Adjust
|
||||||
|
this.DrawIosGa_AdjustParams(JoyPacParams, releaseAreaType);
|
||||||
|
switch (releaseAreaType)
|
||||||
|
{
|
||||||
|
case JPReleaseAreaType.CN:
|
||||||
|
if (JoyPacParams.iOSCN_IsHaveAdjustEvent)
|
||||||
|
this.DrawIosAdjustEventParams(JoyPacParams, releaseAreaType);
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.OS:
|
||||||
|
if (JoyPacParams.iOSOS_IsHaveAdjustEvent)
|
||||||
|
this.DrawIosAdjustEventParams(JoyPacParams, releaseAreaType);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.DrawIosJoyPacSetting(JoyPacParams, releaseAreaType);
|
||||||
|
if (JPPackageManager.HasComponent(JPComponenetType.Umeng))
|
||||||
|
{
|
||||||
|
StringKeyManger.Instance.isHaveUmeng = true;
|
||||||
|
this.DrawIosUmengParams(JoyPacParams, releaseAreaType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
StringKeyManger.Instance.isHaveUmeng = false;
|
||||||
|
|
||||||
|
if (JPPackageManager.HasComponent(JPComponenetType.JoyPacAd))
|
||||||
|
{
|
||||||
|
StringKeyManger.Instance.isHaveJoypacSDK = true;
|
||||||
|
this.DrawIosAdParams(JoyPacParams, releaseAreaType);
|
||||||
|
this.DrawIosCoreAdUi(JoyPacParams, releaseAreaType);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
StringKeyManger.Instance.isHaveJoypacSDK = false;
|
||||||
|
//att弹框仅在没有joypacSDK的时候可用
|
||||||
|
this.DrawIosAttParams(JoyPacParams, releaseAreaType);
|
||||||
|
}
|
||||||
|
DrawIosPopUp(JoyPacParams, releaseAreaType);
|
||||||
|
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region 绘制Ga_Adjust模块
|
||||||
|
private void DrawIosGa_AdjustParams(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("iOS GameAnalytics和Adjust组件参数配置 \n【GameAnalytics and Adjust component parameters configuration】");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.iOS,
|
||||||
|
type,
|
||||||
|
|
||||||
|
JPEditorComponentType.Ga_Adjust);
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
if (fieldInfo.FieldType == typeof(string))
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
if (fieldInfo.FieldType == typeof(bool))
|
||||||
|
{
|
||||||
|
if (JPPackageManager.HasComponent(JPComponenetType.JoyPacAd))
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawVerticalBox();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 绘制Adjust事件模块
|
||||||
|
private void DrawIosAdjustEventParams(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("iOS Adjust事件");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.iOS, type,
|
||||||
|
JPEditorComponentType.AdjustEvent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 绘制弹框模块
|
||||||
|
private void DrawIosPopUp(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("iOS 国内弹框参数");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.iOS, type,
|
||||||
|
JPEditorComponentType.Pop_Up);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 绘制att弹框模块
|
||||||
|
private void DrawIosAttParams(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("iOS att弹框,仅在无JP框架的时候使用");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.iOS, JPReleaseAreaType.Editor,
|
||||||
|
JPEditorComponentType.Att);
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region JoyPacSetting AppID
|
||||||
|
private void DrawIosJoyPacSetting(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
//this.BeginDrawVerticalBox();
|
||||||
|
//this.DrawH2Title("请选择是否有评价弹出功能,默认为false");
|
||||||
|
|
||||||
|
//var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
// JPEditorPlatformType.iOS,
|
||||||
|
// type,
|
||||||
|
// JPEditorComponentType.JoyPacSetting);
|
||||||
|
|
||||||
|
//foreach (var fieldInfo in fieldInfos)
|
||||||
|
//{
|
||||||
|
// switch (type)
|
||||||
|
// {
|
||||||
|
// case JPReleaseAreaType.CN:
|
||||||
|
// if (fieldInfo.Name == "iOSCN_APPLE_APP_ID")
|
||||||
|
// {
|
||||||
|
// if (JoyPacParams.iOSCN_IsHaveAppraise)
|
||||||
|
// this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case JPReleaseAreaType.OS:
|
||||||
|
// if (fieldInfo.Name == "iOSOS_APPLE_APP_ID")
|
||||||
|
// {
|
||||||
|
// if (JoyPacParams.iOSOS_IsHaveAppraise)
|
||||||
|
// this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
//EndDrawVerticalBox();
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 绘制友盟模块
|
||||||
|
private void DrawIosUmengParams(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("Umeng分析【Umeng analysis】");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.iOS, type,
|
||||||
|
JPEditorComponentType.Umeng);
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 绘制iOS-JoyPacSDK参数配置
|
||||||
|
private void DrawIosAdParams(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("JoyPacSDK参数配置【JoyPacSDK parameter configuration】");
|
||||||
|
|
||||||
|
var adnFieldInfo = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.iOS, type,
|
||||||
|
JPEditorComponentType.AdParams);
|
||||||
|
foreach (var fieldInfo in adnFieldInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 绘制iOS-Core-Ad-Net UI
|
||||||
|
/// <summary>
|
||||||
|
/// 测试阶段广告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="JoyPacParams"></param>
|
||||||
|
private void DrawIosCoreAdUi(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("JoyPacSDK AdN参数配置 \n 【JoyPacSDK AdN parameter configuration】");
|
||||||
|
|
||||||
|
// 绘制ADN类型
|
||||||
|
var adnFieldInfo = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.iOS, type,
|
||||||
|
JPEditorComponentType.AdNet);
|
||||||
|
foreach (var fieldInfo in adnFieldInfo)
|
||||||
|
{
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
#region Draw ANDROID Platform Ui
|
||||||
|
|
||||||
|
// 绘制iosUi
|
||||||
|
private void DrawAndroidUi(JoyPacParams JoyPacParams)
|
||||||
|
{
|
||||||
|
// 绘制android参数UI
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
|
||||||
|
JPReleaseAreaType releaseAreaType = JoyPacParamsManager.GetJPReleaseAreaType();
|
||||||
|
|
||||||
|
|
||||||
|
if (JPPackageManager.HasComponent(JPComponenetType.Ga_Adjust))
|
||||||
|
{
|
||||||
|
// 绘制Ga_Adjust模块参数
|
||||||
|
this.DrawAndroidGa_AdjustParams(JoyPacParams, releaseAreaType);
|
||||||
|
if (JoyPacParams.AndroidOS_IsHaveAdjustEvent)
|
||||||
|
this.DrawAndroidAdjustEventParams(JoyPacParams, releaseAreaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (releaseAreaType == JPReleaseAreaType.OS)
|
||||||
|
{
|
||||||
|
if (JPPackageManager.HasComponent(JPComponenetType.JoyPacAd_Android))
|
||||||
|
{
|
||||||
|
this.DrawAndroidUmengParams(JoyPacParams, releaseAreaType);
|
||||||
|
this.DrawAndroidAdParams(JoyPacParams, releaseAreaType);
|
||||||
|
this.DrawAdnParams(JoyPacParams, releaseAreaType);
|
||||||
|
this.DrawPropertiesParams(JoyPacParams, releaseAreaType);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.DrawAndroidAdParams(JoyPacParams, releaseAreaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 绘制Ga_Adjust模块
|
||||||
|
private void DrawAndroidGa_AdjustParams(JoyPacParams JoyPacParams, JPReleaseAreaType jPReleaseAreaType)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
|
||||||
|
|
||||||
|
this.DrawH2Title("Android GameAnalytics和Adjust组件参数配置 \n 【GameAnalytics and Adjust component parameters configuration】");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.Android,
|
||||||
|
jPReleaseAreaType,
|
||||||
|
|
||||||
|
JPEditorComponentType.Ga_Adjust);
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 绘制Adjust事件模块
|
||||||
|
private void DrawAndroidAdjustEventParams(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("Android Adjust事件【Android Adjust event】");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.Android, type,
|
||||||
|
JPEditorComponentType.AdjustEvent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 绘制友盟模块
|
||||||
|
private void DrawAndroidUmengParams(JoyPacParams JoyPacParams, JPReleaseAreaType type)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("Umeng分析【Umeng analysis】");
|
||||||
|
|
||||||
|
var fieldInfos = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.Android, type,
|
||||||
|
JPEditorComponentType.Umeng);
|
||||||
|
|
||||||
|
foreach (var fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
private void DrawAndroidAdParams(JoyPacParams JoyPacParams, JPReleaseAreaType jPReleaseAreaType)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("JoyPacSDK参数配置【JoyPacSDK parameter configuration】");
|
||||||
|
|
||||||
|
var adnFieldInfo = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.Android, jPReleaseAreaType,
|
||||||
|
JPEditorComponentType.AdParams);
|
||||||
|
foreach (var fieldInfo in adnFieldInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void DrawAdnParams(JoyPacParams JoyPacParams, JPReleaseAreaType jPReleaseAreaType)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("JoyPacSDK AdN参数配置 \n 【JoyPacSDK AdN parameter configuration】 ");
|
||||||
|
|
||||||
|
var adnFieldInfo = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.Android, jPReleaseAreaType,
|
||||||
|
JPEditorComponentType.AdNet);
|
||||||
|
foreach (var fieldInfo in adnFieldInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
|
||||||
|
this.DrawH1Title("UmengAppKey和\n Android_Admob_GADApplicationIdentifier \n更改后点击下方按钮更新AndroidManifest文件 ");
|
||||||
|
|
||||||
|
ButtonAndroidManifest();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAndroidManifest()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (GUILayout.Button("更新AndroidManifest文件(Update AndroidManifest file)", GUILayout.Width(500), GUILayout.Height(50)))
|
||||||
|
{
|
||||||
|
|
||||||
|
string message = "确认更新AndroidManifest文件 (Update AndroidManifest file)";
|
||||||
|
|
||||||
|
if (EditorUtility.DisplayDialog("提示", message, "Yes", "No")) //显示对话框
|
||||||
|
{
|
||||||
|
JoyPacParamsManager.WriteXmlKey("", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private void DrawPropertiesParams(JoyPacParams JoyPacParams, JPReleaseAreaType jPReleaseAreaType)
|
||||||
|
{
|
||||||
|
this.BeginDrawVerticalBox();
|
||||||
|
this.DrawH2Title("Properties文件另外所需参数,更改后需点击下方按钮进行更新 \n 【Properties file for additional parameters, \n click the button below to update after change】");
|
||||||
|
|
||||||
|
var adnFieldInfo = JoyPacParamsManager.GetInitParamsFieldInfoByComponentType(
|
||||||
|
JPEditorPlatformType.Android, jPReleaseAreaType,
|
||||||
|
JPEditorComponentType.Properties);
|
||||||
|
foreach (var fieldInfo in adnFieldInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.DrawComponentByFieldInfo(fieldInfo);
|
||||||
|
}
|
||||||
|
this.EndDrawVerticalBox();
|
||||||
|
ButtonProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ButtonProperties()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (GUILayout.Button("更新Properties文件 (Update Properties file)", GUILayout.Width(500), GUILayout.Height(50)))
|
||||||
|
{
|
||||||
|
|
||||||
|
string message = "确认更新Properties文件 (Update Properties file)";
|
||||||
|
|
||||||
|
if (EditorUtility.DisplayDialog("提示", message, "Yes", "No")) //显示对话框
|
||||||
|
{
|
||||||
|
JoyPacParamsManager.WriteProperties(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private void DrawIosPayUi()
|
||||||
|
{
|
||||||
|
//BeginDrawVerticalBox();
|
||||||
|
//DrawH2Title("iOS Pay 模块");
|
||||||
|
//DrawLabel("iOS_Pay_Key", JPiOSConfig.Config.Payment.PayKey,"用于生成支付签名");
|
||||||
|
//EndDrawVerticalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#endif
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制不同字段类型的控件.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fieldInfo">字段信息.</param>
|
||||||
|
/// <param name="isContinueDraw">是否继续绘制.</param>
|
||||||
|
private void DrawComponentByFieldInfo(FieldInfo fieldInfo, bool isContinueDraw = true)
|
||||||
|
{
|
||||||
|
var attr = JoyPacParamsManager.GetInitFieldAttr(fieldInfo);
|
||||||
|
|
||||||
|
// 不是控制开关并且外部条件不继续绘制则不尽兴绘制
|
||||||
|
if (!attr.IsControllerSwitch && !isContinueDraw)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(attr.Tip))
|
||||||
|
{
|
||||||
|
EditorGUILayout.HelpBox(attr.Tip, MessageType.Info);
|
||||||
|
}
|
||||||
|
if (fieldInfo.FieldType == typeof(bool))
|
||||||
|
{
|
||||||
|
this.DrawToggle(attr.InspectorPropertyLabel, fieldInfo.Name);
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType.BaseType == typeof(Enum))
|
||||||
|
{
|
||||||
|
this.DrawEnumPopup(attr.InspectorPropertyLabel, fieldInfo.Name);
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType == typeof(string))
|
||||||
|
{
|
||||||
|
this.DrawTextArea(attr.InspectorPropertyLabel, fieldInfo.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字段在面板中被修改监听.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fieldName">字段名.</param>
|
||||||
|
/// <param name="value">要修改的值.</param>
|
||||||
|
private void FieldValueChange(string fieldName, object value)
|
||||||
|
{
|
||||||
|
JoyPacParamsManager.FieldValueChange(fieldName, value);
|
||||||
|
var attr = JoyPacParamsManager.GetInitAttrByFieldName(fieldName);
|
||||||
|
// Adn选择处理
|
||||||
|
|
||||||
|
|
||||||
|
ComponentType_Core(attr, fieldName, value);
|
||||||
|
|
||||||
|
ComponentType_AdNet(attr, fieldName, value);
|
||||||
|
|
||||||
|
string val = value.ToString();
|
||||||
|
if (val == null || val == "")
|
||||||
|
return;
|
||||||
|
if (IsSpace(val.Substring(0, 1)))
|
||||||
|
JPPackageManager.ShowTips("Error", "value = " + val + " 第一个字符串为空格,请检查是否正确");
|
||||||
|
|
||||||
|
if (IsSpace(val.Substring(val.Length - 1, 1)))
|
||||||
|
JPPackageManager.ShowTips("Error", "value = " + val + " 最后一个字符串为空格,请检查是否正确");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool IsSpace(string name)
|
||||||
|
{
|
||||||
|
if (name.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region FieldValueChange
|
||||||
|
|
||||||
|
|
||||||
|
private void ComponentType_Core(InspectorGameParamsAttribute attr, string fieldName, object value)
|
||||||
|
{
|
||||||
|
if (attr.ComponentType == JPEditorComponentType.Core)
|
||||||
|
{
|
||||||
|
if (value.GetType() == typeof(JPReleaseAreaType))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
switch ((JPReleaseAreaType)value)
|
||||||
|
{
|
||||||
|
|
||||||
|
case JPReleaseAreaType.Editor:
|
||||||
|
JPPackageManager.ShowTips("Error", "只能请选择CN(国内)或者OS(非国内)【Please select CN(China) or OS(not China)】");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.CN:
|
||||||
|
#if UNITY_IOS
|
||||||
|
JPPackageManager.ShowTips("提示", "确认切换为国内地区(The local area has been switched to China");
|
||||||
|
|
||||||
|
JPPackageManager.iOS_Adn_Info(JPReleaseAreaType.CN);
|
||||||
|
|
||||||
|
string str = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android);
|
||||||
|
|
||||||
|
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
JPPackageManager.ShowTips("提示", "安卓CN仅支持内部使用,外部开发请选择OS(海外,GP)【Android CN only supports internal use, please select OS for external development】");
|
||||||
|
SwitchArea_Android(JPReleaseAreaType.CN);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
break;
|
||||||
|
case JPReleaseAreaType.OS:
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
JPPackageManager.ShowTips("提示", "确认切换为海外地区(The local area has been switched to no China");
|
||||||
|
|
||||||
|
JPPackageManager.iOS_Adn_Info(JPReleaseAreaType.OS);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
JPPackageManager.ShowTips("提示", "确认切换为海外GP地区(The local area has been switched to no China【GP】)");
|
||||||
|
SwitchArea_Android(JPReleaseAreaType.OS);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SwitchArea_Android(JPReleaseAreaType jPReleaseAreaType)
|
||||||
|
{
|
||||||
|
string Android_AD = Application.dataPath + "/" + "JoyPacSDK/JoyPacAd_Android";
|
||||||
|
string Android_FB = Application.dataPath + "/" + "FacebookSDK";
|
||||||
|
|
||||||
|
string Android_Manifest = Application.dataPath + "/" + "Plugins/Android/AndroidManifest.xml";
|
||||||
|
string Android_Raw = Application.dataPath + "/" + "Plugins/Android/res/raw";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string str = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android);
|
||||||
|
Debug.Log("old " + str);
|
||||||
|
str = str.Replace("ANDROID_GP", null);
|
||||||
|
if (jPReleaseAreaType == JPReleaseAreaType.CN)
|
||||||
|
{
|
||||||
|
|
||||||
|
JPChannel.HidePath(Android_AD);
|
||||||
|
JPChannel.HideFile(Android_Manifest);
|
||||||
|
JPChannel.HidePath(Android_Raw);
|
||||||
|
JPChannel.HidePath(Android_FB);
|
||||||
|
Debug.Log("切换CN");
|
||||||
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android,
|
||||||
|
str);
|
||||||
|
Debug.Log("new " + PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android));
|
||||||
|
}
|
||||||
|
else if (jPReleaseAreaType == JPReleaseAreaType.OS)
|
||||||
|
{
|
||||||
|
if (File.Exists(Android_Manifest))
|
||||||
|
File.Delete(Android_Manifest);
|
||||||
|
JPChannel.ShowPath(Android_AD);
|
||||||
|
JPChannel.showFile(Android_Manifest);
|
||||||
|
JPChannel.ShowPath(Android_Raw);
|
||||||
|
JPChannel.ShowPath(Android_FB);
|
||||||
|
|
||||||
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android,
|
||||||
|
"ANDROID_GP" + ";" + str);
|
||||||
|
Debug.Log("new " + PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android));
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Log("切换OS");
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ComponentType_AdNet(InspectorGameParamsAttribute attr, string fieldName, object value)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (attr.ComponentType == JPEditorComponentType.AdNet)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (value.GetType() == typeof(bool))
|
||||||
|
{
|
||||||
|
string jsonKey = fieldName.Remove(3, 2);
|
||||||
|
switch (jsonKey)
|
||||||
|
{
|
||||||
|
|
||||||
|
case "iOS_Admob":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.admob, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_IronSource":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.ironsource, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_GDT":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.gdt, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_UnityAd":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.unityads, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_Vungle":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.vungle, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_Mintegral":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.mintegral, (bool)value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// -------------------------------------------以下为测试阶段不需要------------------------------------------------------------------
|
||||||
|
case "iOS_KS":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.kuaishou, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_Pangle_China":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.pangle_China, (bool)value);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "iOS_Pangle_nonChina":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.pangle_nonChina, (bool)value);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "iOS_Applovin":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.applovin, (bool)value);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "iOS_KlevinSDK":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.KlevinSDK, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_Adcolony":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.adcolony, (bool)value);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "iOS_Maio":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.maio, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_Chartboost":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.chartboost, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_FaceBook":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.facebook, (bool)value);
|
||||||
|
break;
|
||||||
|
case "iOS_Fyber":
|
||||||
|
JPPackageManager.iOS_Adn_Handle(JPAdNType.fyber, (bool)value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 动态权限,可增删列表UI
|
||||||
|
private ReorderableList Android_Permission_ReorderableList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21c147f92b164edebf571ef9ad2e3573
|
||||||
|
timeCreated: 1615184248
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
using UnityEditor.Build;
|
||||||
|
using UnityEditor.Build.Reporting;
|
||||||
|
|
||||||
|
public class JPConfigManager : IPreprocessBuildWithReport
|
||||||
|
{
|
||||||
|
public int callbackOrder => 0;
|
||||||
|
public async void OnPreprocessBuild(BuildReport report)
|
||||||
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
|
// await JPiOSConfig.Download2();
|
||||||
|
#elif UNITY_ANDROID
|
||||||
|
// await JPAndroidConfig.Download2();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c6d14ccd642546f9aa583017d426f418
|
||||||
|
timeCreated: 1624531043
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
[InitializeOnLoad]
|
||||||
|
public class JoyPacSDKInitializeOnLoad
|
||||||
|
{
|
||||||
|
static JoyPacSDKInitializeOnLoad()
|
||||||
|
{
|
||||||
|
// 更新构建脚本.
|
||||||
|
BuildScriptManager.UpdateBuildScriptContent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21747c0a085e74a33ad2f908b217b38a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7cadbf2a29724854b4793a352675c238
|
||||||
|
timeCreated: 1615529856
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
|
||||||
|
public static class JPMenuName
|
||||||
|
{
|
||||||
|
// JoyPacSdk
|
||||||
|
private const string SDK = "JoyPacSDK/";
|
||||||
|
|
||||||
|
// 包管理菜单
|
||||||
|
private const string PackageManagerMenu = SDK + "一键输出SDK/";
|
||||||
|
|
||||||
|
// 最终包
|
||||||
|
public const string SdkFinalPackage = PackageManagerMenu + "打出最终完整SDK包(SDK研发使用)";
|
||||||
|
public const string SdkCPAPackage = PackageManagerMenu + "最小CPA测试SDK包(SDK研发使用)";
|
||||||
|
public const string SdkVersionTestPackage = PackageManagerMenu + "最小版本测试SDK包(SDK研发使用)";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 构建菜单
|
||||||
|
private const string BUILD = SDK + "一键打包(Rapid Packaging)/";
|
||||||
|
|
||||||
|
// 构建Apk
|
||||||
|
//public const string BUILD_DEBUG_APK = BUILD + "输出APK/Debug版本";
|
||||||
|
//public const string BUILD_RELEASE_APK = BUILD + "输出APK/Release版本";
|
||||||
|
|
||||||
|
// 构建ipa
|
||||||
|
//public const string BUILD_DEBUG_IPA = BUILD + "输出IPA/Debug版本";
|
||||||
|
//public const string BUILD_RELEASE_IPA = BUILD + "输出IPA/Release版本";
|
||||||
|
public const string BUILD_DEBUG_XCODE = BUILD + "导出(Export Xcode)/Debug版本";
|
||||||
|
public const string BUILD_RELEASE_XCODE = BUILD + "导出(Export Xcode)/Release版本";
|
||||||
|
|
||||||
|
|
||||||
|
// 参数面板
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private const string Params_Inspector = SDK + "参数配置(Parameter configuration)/";
|
||||||
|
|
||||||
|
public const string Open_Params_InspectorCN = Params_Inspector + "/" + "打开参数面板(Open Parameters)";
|
||||||
|
public const string Open_BuildParams_InspectorCN = Params_Inspector + "打开构建参数面板(Open build Parameters)";
|
||||||
|
|
||||||
|
public const string Switching_Platform = SDK + "切换 JoypacService-info文件(Switching JoypacService-info)";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 39c567825cc8d4e2a9edc413ad3aacf8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.SceneManagement;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
public static class JoyPacSDKMenu
|
||||||
|
{
|
||||||
|
[MenuItem(JPMenuName.Open_Params_InspectorCN)]
|
||||||
|
private static async Task OpenParamsInspectorScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
Selection.activeObject = JoyPacParams.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem(JPMenuName.Open_BuildParams_InspectorCN)]
|
||||||
|
private static void OpenBuildParamsInspectorScene()
|
||||||
|
{
|
||||||
|
Selection.activeObject = JoyPacBuildParams.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 23e03180aeaf41a6b98356d5f9d3c8c0
|
||||||
|
timeCreated: 1618469099
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
//using System.Collections;
|
||||||
|
//using System.Collections.Generic;
|
||||||
|
//using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//using System;
|
||||||
|
|
||||||
|
//using UnityEditor;
|
||||||
|
//using UnityEngine;
|
||||||
|
//using System.IO;
|
||||||
|
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Package导出
|
||||||
|
///// </summary>
|
||||||
|
//public class PackageExportManger
|
||||||
|
//{
|
||||||
|
|
||||||
|
|
||||||
|
// private static List<string> fileList = new List<string>();
|
||||||
|
|
||||||
|
// // private const string SdkNamePreFix = "JoyPac_SDK";
|
||||||
|
// private static string exportedFileName = "JoyPac_SDK";
|
||||||
|
// private static string assetsPath = "Assets";
|
||||||
|
// /// <summary>
|
||||||
|
// /// 获取路径下所有文件以及子文件夹中文件
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="path">全路径根目录</param>
|
||||||
|
// /// <param name="FileList">存放所有文件的全路径</param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// public static List<string> GetFile(string path, List<string> FileList)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// DirectoryInfo dir = new DirectoryInfo(path);
|
||||||
|
// FileInfo[] fil = dir.GetFiles();
|
||||||
|
// DirectoryInfo[] dii = dir.GetDirectories();
|
||||||
|
// foreach (FileInfo f in fil)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// long size = f.Length;
|
||||||
|
// FileList.Add(f.FullName);//添加文件路径到列表中
|
||||||
|
// }
|
||||||
|
// //获取子文件夹内的文件列表,递归遍历
|
||||||
|
// foreach (DirectoryInfo d in dii)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// if (d.FullName == assetsPath + "/JoyPacSDK/JoyPacAd")
|
||||||
|
// continue;
|
||||||
|
// if (d.FullName == assetsPath + "/JoyPacSDK/JoyPacAd_Android")
|
||||||
|
// continue;
|
||||||
|
// if (d.FullName == assetsPath + "/JoyPacSDK/Resources")
|
||||||
|
// continue;
|
||||||
|
// if (d.FullName == assetsPath + "/Resources/JoyPacJSON")
|
||||||
|
// continue;
|
||||||
|
// GetFile(d.FullName, FileList);
|
||||||
|
// }
|
||||||
|
// return FileList;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private static void GetShowFile(string rootPath)
|
||||||
|
// {
|
||||||
|
// if (string.IsNullOrEmpty(rootPath))
|
||||||
|
// return;
|
||||||
|
|
||||||
|
|
||||||
|
// var files = GetFile(rootPath, fileList);
|
||||||
|
|
||||||
|
// //for (int i = 0; i < files.Count; i++)
|
||||||
|
// //{
|
||||||
|
// // string info = new DirectoryInfo(files[i]).Name;
|
||||||
|
|
||||||
|
// // Debug.Log(info);
|
||||||
|
// // if (Path.GetExtension(info) == ".meta")
|
||||||
|
// // {
|
||||||
|
// // fileList.Remove(files[i]);
|
||||||
|
// // }
|
||||||
|
// //}
|
||||||
|
|
||||||
|
// //foreach (var item in fileList)
|
||||||
|
// //{
|
||||||
|
// // Debug.Log(item);
|
||||||
|
// //}
|
||||||
|
// }
|
||||||
|
// [MenuItem("JoyPacSDK/JoyPac/Export Unity Package")]
|
||||||
|
// public static void test()
|
||||||
|
// {
|
||||||
|
|
||||||
|
// string Examples = assetsPath + "/Examples";
|
||||||
|
// GetShowFile(Examples);
|
||||||
|
|
||||||
|
// string Joypac = assetsPath + "/Joypac";
|
||||||
|
// GetShowFile(Joypac);
|
||||||
|
|
||||||
|
// string I2 = assetsPath + "/I2";
|
||||||
|
// GetShowFile(I2);
|
||||||
|
|
||||||
|
// string JPChannel = assetsPath + "/JPChannel";
|
||||||
|
// GetShowFile(JPChannel);
|
||||||
|
|
||||||
|
// string Other = assetsPath + "/Other";
|
||||||
|
// GetShowFile(Other);
|
||||||
|
|
||||||
|
// string JoyPacSDK = assetsPath + "/JoyPacSDK";
|
||||||
|
// GetShowFile(JoyPacSDK);
|
||||||
|
// string Resources = assetsPath + "/Resources";
|
||||||
|
// GetShowFile(Resources);
|
||||||
|
|
||||||
|
// foreach (var item in fileList.ToArray())
|
||||||
|
// {
|
||||||
|
// Debug.Log(item);
|
||||||
|
// }
|
||||||
|
// AssetDatabase.ExportPackage(
|
||||||
|
// fileList.ToArray(),
|
||||||
|
// exportedFileName,
|
||||||
|
|
||||||
|
// ExportPackageOptions.IncludeDependencies | ExportPackageOptions.Interactive);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f3190ae7dd7a240c1bd689f4a133ad04
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b225c16ca63245bd9b2b71503051e933
|
||||||
|
timeCreated: 1625540328
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
|
||||||
|
public class JPEditorPrefsHelper
|
||||||
|
{
|
||||||
|
public static EditorSkinType CurrentSkinType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var userSkinInt = EditorPrefs.GetInt("UserSkin", 0);
|
||||||
|
return userSkinInt == 1 ? EditorSkinType.Dark : EditorSkinType.Light;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unity 编辑器当前设置的主题颜色
|
||||||
|
public enum EditorSkinType : int
|
||||||
|
{
|
||||||
|
// 白色主题
|
||||||
|
Light = 0,
|
||||||
|
|
||||||
|
// 黑色主题
|
||||||
|
Dark = 1,
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8084532a788d412ba58c9cd405b45bcd
|
||||||
|
timeCreated: 1625540386
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 85868a61a89e4d148a34a6e121fe547a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue