Commit 1fdd0589 authored by zhangzhe's avatar zhangzhe

iOS修改

parent 92b33759
...@@ -84,10 +84,25 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -84,10 +84,25 @@ public class CSJFeedUtil : MonoBehaviour
lastCallBack = callback; lastCallBack = callback;
Debug.Log("设备机型: " + SystemInfo.deviceModel);
#if UNITY_IOS
int ImageAcceptedWidth;
// Screen.width在iPhone8p上获取的不对
if (SystemInfo.deviceModel == "iPhone10,2" || SystemInfo.deviceModel == "iPhone10,5")
{
ImageAcceptedWidth = 1242;
}
else
{
ImageAcceptedWidth = Screen.width;
}
#endif
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetImageAcceptedSize(Screen.width, 0) .SetImageAcceptedSize(ImageAcceptedWidth, 0)
#else #else
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应 ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
...@@ -98,7 +113,7 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -98,7 +113,7 @@ public class CSJFeedUtil : MonoBehaviour
.SetOrientation(AdOrientation.Horizontal) .SetOrientation(AdOrientation.Horizontal)
.SetAdCount(1) //请求广告数量为1到3条 .SetAdCount(1) //请求广告数量为1到3条
.Build(); .Build();
this.AdNative.LoadNativeExpressAd(adSlot, new FeedAdListener(entity,callback)); this.AdNative.LoadNativeExpressAd(adSlot, new FeedAdListener(entity, callback));
} }
//FeedAd IOS 和 Android 相同 //FeedAd IOS 和 Android 相同
...@@ -116,7 +131,7 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -116,7 +131,7 @@ public class CSJFeedUtil : MonoBehaviour
/// 展示缓存的FeedAd /// 展示缓存的FeedAd
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
public void ShowCacheFeedAd(AdEntity entity,Action<bool> callback) public void ShowCacheFeedAd(AdEntity entity, Action<bool> callback)
{ {
#if UNITY_ANDROID #if UNITY_ANDROID
CloseFeedAd(); CloseFeedAd();
...@@ -125,8 +140,29 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -125,8 +140,29 @@ public class CSJFeedUtil : MonoBehaviour
{ {
feedAd = feedAdCacheList.Dequeue(); feedAd = feedAdCacheList.Dequeue();
#if UNITY_IOS #if UNITY_IOS
int width;
// Screen.width在iPhone8p上获取的不对
if (SystemInfo.deviceModel == "iPhone10,2" || SystemInfo.deviceModel == "iPhone10,5")
{
width = 1242;
}
else
{
width = Screen.width;
}
int height;
// Screen.height在iPhone8p上获取的不对
if (SystemInfo.deviceModel == "iPhone10,2" || SystemInfo.deviceModel == "iPhone10,5")
{
height = 2208;
}
else
{
height = Screen.height;
}
float x = 0; float x = 0;
float y = Screen.height - (Screen.width * 275.5f / 375) - (IsX ? 45 : 0); float y = height - (width * 275.5f / 375) - (IsX ? 45 : 0);
//if (y == 0) //if (y == 0)
//{ //{
// y = 100; // 防止Demo里刘海遮挡 // y = 100; // 防止Demo里刘海遮挡
...@@ -153,7 +189,7 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -153,7 +189,7 @@ public class CSJFeedUtil : MonoBehaviour
{ {
private AdEntity entity; private AdEntity entity;
private Action<bool> callback; private Action<bool> callback;
public FeedAdListener(AdEntity entity,Action<bool> callback) public FeedAdListener(AdEntity entity, Action<bool> callback)
{ {
this.entity = entity; this.entity = entity;
this.callback = callback; this.callback = callback;
...@@ -161,7 +197,7 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -161,7 +197,7 @@ public class CSJFeedUtil : MonoBehaviour
public void OnError(int code, string message) public void OnError(int code, string message)
{ {
EventUtils.onEventPullFail(entity,code.ToString(),message); EventUtils.onEventPullFail(entity, code.ToString(), message);
callback(false); callback(false);
} }
......
...@@ -42,6 +42,7 @@ public class GDTFeedAdUtil ...@@ -42,6 +42,7 @@ public class GDTFeedAdUtil
NativeExpressAd ad = new NativeExpressAd(entity.codeId, GetAdSize()); NativeExpressAd ad = new NativeExpressAd(entity.codeId, GetAdSize());
nativeExpressAd = ad; nativeExpressAd = ad;
ad.SetEnableDefaultAudioSessionSetting(false);
ad.SetListener(new FeedAdListener(entity,callback)); ad.SetListener(new FeedAdListener(entity,callback));
ad.LoadAd(1); ad.LoadAd(1);
} }
......
...@@ -39,6 +39,7 @@ public class GDTInterstitialAdUtil ...@@ -39,6 +39,7 @@ public class GDTInterstitialAdUtil
//string posId = Constants.intersititialNoVideoPosId;//不带视频的插屏广告测试Id //string posId = Constants.intersititialNoVideoPosId;//不带视频的插屏广告测试Id
UnifiedInterstitialAd ad = new UnifiedInterstitialAd(entity.codeId); UnifiedInterstitialAd ad = new UnifiedInterstitialAd(entity.codeId);
ad.SetEnableDefaultAudioSessionSetting(false);
ad.SetListener(new UnifiedInterstitialAdListener(entity,ad,null, callback)); ad.SetListener(new UnifiedInterstitialAdListener(entity,ad,null, callback));
ad.LoadAd(); ad.LoadAd();
} }
......
...@@ -678,6 +678,15 @@ namespace Tencent.GDT ...@@ -678,6 +678,15 @@ namespace Tencent.GDT
} }
}); });
} }
[DllImport("__Internal")]
private static extern void GDT_UnionPlatform_RewardVideoAd_SetEnableDefaultAudioSessionSetting(bool audioSessionSetting);
public void SetEnableDefaultAudioSessionSetting(bool audioSessionSetting)
{
GDT_UnionPlatform_RewardVideoAd_SetEnableDefaultAudioSessionSetting(audioSessionSetting);
}
} }
#endif #endif
} }
...@@ -543,6 +543,15 @@ namespace Tencent.GDT ...@@ -543,6 +543,15 @@ namespace Tencent.GDT
} }
}); });
} }
[DllImport("__Internal")]
private static extern void GDT_UnionPlatform_RewardVideoAd_SetEnableDefaultAudioSessionSetting(bool audioSessionSetting);
public void SetEnableDefaultAudioSessionSetting(bool audioSessionSetting)
{
GDT_UnionPlatform_RewardVideoAd_SetEnableDefaultAudioSessionSetting(audioSessionSetting);
}
} }
#endif #endif
} }
...@@ -382,8 +382,8 @@ MonoBehaviour: ...@@ -382,8 +382,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 788e2a3a769e26b459cd63d4a5de7d76, type: 3} m_Script: {fileID: 11500000, guid: 788e2a3a769e26b459cd63d4a5de7d76, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
isTest: 0 isTest: 1
isShowLog: 0 isShowLog: 1
XyDialog: {fileID: 0} XyDialog: {fileID: 0}
--- !u!1 &2010092450 --- !u!1 &2010092450
GameObject: GameObject:
...@@ -441,7 +441,7 @@ MonoBehaviour: ...@@ -441,7 +441,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 21300000, guid: e5d6b9eed3a874a0397c699b5154addb, type: 3} m_Sprite: {fileID: 21300000, guid: 5ea045535c25e4c96a220073f19049c1, type: 3}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
......
fileFormatVersion: 2
guid: feed25f3a4ce64a1596f99926c2d825e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5ea045535c25e4c96a220073f19049c1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
...@@ -118,6 +118,7 @@ public class Guide : MonoBehaviour ...@@ -118,6 +118,7 @@ public class Guide : MonoBehaviour
} }
PlayerDataControl.Instance.IsNewUser = isUser; PlayerDataControl.Instance.IsNewUser = isUser;
PlayerPrefs.SetInt("DidFinishedNewUserGuide", isUser ? 0 : 1);
isStartShow = true; isStartShow = true;
IsNewUser = isUser; IsNewUser = isUser;
DissmissGuide(false); DissmissGuide(false);
......
...@@ -511,15 +511,7 @@ public class DialogControl : MonoBehaviour ...@@ -511,15 +511,7 @@ public class DialogControl : MonoBehaviour
} }
private void moveDiamondDialog() private void moveDiamondDialog()
{ {
#if UNITY_IOS
diamondcontent.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0.5f);
diamondcontent.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.5f);
diamondcontent.GetComponent<RectTransform>().anchoredPosition = new Vector3(0, 100, 0);
diamondcontent.transform.parent.Find("CloseImage").gameObject.SetActive(false);
#else
diamondcontent.transform.localPosition += new Vector3(0, 340, 0); diamondcontent.transform.localPosition += new Vector3(0, 340, 0);
#endif
} }
//关闭获取钻石弹窗 //关闭获取钻石弹窗
public void closeDiamondDialog() public void closeDiamondDialog()
...@@ -620,15 +612,7 @@ public class DialogControl : MonoBehaviour ...@@ -620,15 +612,7 @@ public class DialogControl : MonoBehaviour
} }
private void moveAllSpeedDialog() private void moveAllSpeedDialog()
{ {
#if UNITY_IOS
allspeedcontent.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0.5f);
allspeedcontent.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.5f);
allspeedcontent.GetComponent<RectTransform>().anchoredPosition = new Vector3(0, 100, 0);
allspeedcontent.transform.parent.Find("CloseImage").gameObject.SetActive(false);
#else
allspeedcontent.transform.localPosition += new Vector3(0, 320, 0); allspeedcontent.transform.localPosition += new Vector3(0, 320, 0);
#endif
} }
private void showAd() private void showAd()
{ {
...@@ -1513,7 +1497,7 @@ public class DialogControl : MonoBehaviour ...@@ -1513,7 +1497,7 @@ public class DialogControl : MonoBehaviour
/// </summary> /// </summary>
private void moveHarvestHongBao() private void moveHarvestHongBao()
{ {
transform.Find("HarvestHongBao/BgImage").localPosition = new Vector3(0, 370, 0); transform.Find("HarvestHongBao/BgImage").localPosition = new Vector3(0, 320, 0);
} }
/// <summary> /// <summary>
......
...@@ -1513,7 +1513,7 @@ MonoBehaviour: ...@@ -1513,7 +1513,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 21300000, guid: e5d6b9eed3a874a0397c699b5154addb, type: 3} m_Sprite: {fileID: 21300000, guid: 5ea045535c25e4c96a220073f19049c1, type: 3}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
......
...@@ -90,7 +90,7 @@ public class Splash : MonoBehaviour ...@@ -90,7 +90,7 @@ public class Splash : MonoBehaviour
{ {
Constant.Instance.shubiao = false; Constant.Instance.shubiao = false;
} }
Constant.Instance.shubiao = true; //Constant.Instance.shubiao = true;
novelInfo(); novelInfo();
}), new Action<string, string>((code, errMsg) => }), new Action<string, string>((code, errMsg) =>
{ {
......
...@@ -34,7 +34,6 @@ GraphicsSettings: ...@@ -34,7 +34,6 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}
......
...@@ -17,7 +17,7 @@ MonoBehaviour: ...@@ -17,7 +17,7 @@ MonoBehaviour:
m_Registries: m_Registries:
- m_Id: main - m_Id: main
m_Name: m_Name:
m_Url: https://packages.unity.cn m_Url: https://packages.unity.com
m_Scopes: [] m_Scopes: []
m_IsDefault: 1 m_IsDefault: 1
m_UserSelectedRegistryName: m_UserSelectedRegistryName:
......
...@@ -270,7 +270,7 @@ PlayerSettings: ...@@ -270,7 +270,7 @@ PlayerSettings:
- m_BuildTarget: - m_BuildTarget:
m_Icons: m_Icons:
- serializedVersion: 2 - serializedVersion: 2
m_Icon: {fileID: 2800000, guid: 43004d061e5444c07a12e464fc3a7e20, type: 3} m_Icon: {fileID: 2800000, guid: 354f3646ee72b417eb1bbc40e7f70be3, type: 3}
m_Width: 128 m_Width: 128
m_Height: 128 m_Height: 128
m_Kind: 0 m_Kind: 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment