Commit cda73a19 authored by zhangzhe's avatar zhangzhe

修改bug

parent 3f18019d
...@@ -77,12 +77,14 @@ public class CSJBannerUtil ...@@ -77,12 +77,14 @@ public class CSJBannerUtil
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(Screen.width, 70f)
#else #else
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(Screen.width, 70f)
////期望模板广告view的size,单位dp,//高度按照实际rit对应宽高传入 ////期望模板广告view的size,单位dp,//高度按照实际rit对应宽高传入
#endif #endif
//.SetExpressViewAcceptedSize(Screen.width, float.Parse(Screen.width.ToString()) / 600 * 90) //.SetExpressViewAcceptedSize(Screen.width, float.Parse(Screen.width.ToString()) / 600 * 90)
.SetExpressViewAcceptedSize(Screen.width, 70f) //.SetExpressViewAcceptedSize(Screen.width, 70f)
.SetSupportDeepLink(true) .SetSupportDeepLink(true)
.SetImageAcceptedSize(1080, 1920) .SetImageAcceptedSize(1080, 1920)
.SetAdCount(1) .SetAdCount(1)
......
...@@ -69,6 +69,7 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -69,6 +69,7 @@ public class CSJFeedUtil : MonoBehaviour
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(Screen.width, 0)
#else #else
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应 ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
......
...@@ -51,6 +51,7 @@ public class CSJFullScreenUtil : MonoBehaviour ...@@ -51,6 +51,7 @@ public class CSJFullScreenUtil : MonoBehaviour
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId(iosSlotID) .SetCodeId(iosSlotID)
.SetExpressViewAcceptedSize(Screen.width, 0)
#else #else
.SetCodeId(AndroidSlotID) .SetCodeId(AndroidSlotID)
#endif #endif
......
...@@ -62,7 +62,7 @@ public class CSJInterstitialUtil ...@@ -62,7 +62,7 @@ public class CSJInterstitialUtil
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(200, 300) .SetExpressViewAcceptedSize(800, 1200)
#else #else
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(350, 0) .SetExpressViewAcceptedSize(350, 0)
......
...@@ -24,6 +24,10 @@ public class AppConfig ...@@ -24,6 +24,10 @@ public class AppConfig
/// <param name="IsShowLog">是否显示Log</param> /// <param name="IsShowLog">是否显示Log</param>
public void InitProgect(bool isTest, bool IsShowLog, string appls) public void InitProgect(bool isTest, bool IsShowLog, string appls)
{ {
#if !UNITY_EDITOR && UNITY_IOS
iOSHander.Instance.Handler();
#endif
Constant.Instance.IsTestNet = isTest; Constant.Instance.IsTestNet = isTest;
//log日志 //log日志
Debug.unityLogger.logEnabled = IsShowLog; Debug.unityLogger.logEnabled = IsShowLog;
......
...@@ -21,14 +21,19 @@ public class Constant ...@@ -21,14 +21,19 @@ public class Constant
//微信key //微信key
public string WX_APP_ID= "wx10f8dcecdcf26ab7"; public string WX_APP_ID= "wx10f8dcecdcf26ab7";
public string WX_APP_Key= "bfa522c1b6be52727795b726b788181a"; public string WX_APP_Key= "bfa522c1b6be52727795b726b788181a";
public string universalLink = "https://feedapi.zhangxineducation.com/iosdiandiancy/"; public string universalLink = "https://feedapi.zhangxineducation.com/simulator/";
// 友盟key ios // 友盟key ios
public string UM_ID public string UM_ID
{ {
get get
{ {
#if UNITY_IOS
return "609a589b53b6726499f8543d"; return "609a589b53b6726499f8543d";
#else
return "608669265844f15425eb7953";
#endif
} }
} }
public string Token { get; set; } public string Token { get; set; }
...@@ -39,7 +44,11 @@ public class Constant ...@@ -39,7 +44,11 @@ public class Constant
{ {
get get
{ {
#if UNITY_IOS
return "399d87a2b8c8d900";
#else
return "892467fd69100919"; return "892467fd69100919";
#endif
} }
} }
......
...@@ -178,12 +178,12 @@ public class UnityPhoneUtils ...@@ -178,12 +178,12 @@ public class UnityPhoneUtils
string vc = ""; string vc = "";
#if UNITY_EDITOR #if UNITY_EDITOR
vc = "1"; vc = "5";
#elif UNITY_ANDROID #elif UNITY_ANDROID
vc = GetPhoneUtil().Call<int>("getAppVersionCode", GetActivity())+""; vc = GetPhoneUtil().Call<int>("getAppVersionCode", GetActivity())+"";
#elif UNITY_IOS #elif UNITY_IOS
vc = "1"; vc = "5";
#endif #endif
Debug.unityLogger.Log("GetVC " + vc); Debug.unityLogger.Log("GetVC " + vc);
return vc; return vc;
...@@ -215,7 +215,7 @@ public class UnityPhoneUtils ...@@ -215,7 +215,7 @@ public class UnityPhoneUtils
#elif UNITY_ANDROID #elif UNITY_ANDROID
aid = GetPhoneUtil().Call<string>("getAndroidID", GetActivity()); aid = GetPhoneUtil().Call<string>("getAndroidID", GetActivity());
#elif UNITY_IOS #elif UNITY_IOS
aid = Constant.Instance.device;
#endif #endif
PlayerPrefs.SetString("app_aid", aid); PlayerPrefs.SetString("app_aid", aid);
} }
...@@ -263,7 +263,7 @@ public class UnityPhoneUtils ...@@ -263,7 +263,7 @@ public class UnityPhoneUtils
device = GetPhoneUtil().Call<string>("getDeviceId", GetActivity()); device = GetPhoneUtil().Call<string>("getDeviceId", GetActivity());
#elif UNITY_IOS #elif UNITY_IOS
device = device_iOS; device = Constant.Instance.device;
#endif #endif
...@@ -321,7 +321,7 @@ public class UnityPhoneUtils ...@@ -321,7 +321,7 @@ public class UnityPhoneUtils
#elif UNITY_ANDROID #elif UNITY_ANDROID
idfaStr =""; idfaStr ="";
#elif UNITY_IOS #elif UNITY_IOS
idfaStr = idfa_iOS; idfaStr = Constant.Instance.idfa;
#endif #endif
Debug.unityLogger.Log("GetIDFA " + idfaStr); Debug.unityLogger.Log("GetIDFA " + idfaStr);
......
...@@ -53,6 +53,7 @@ public class WxLoginUtil : MonoBehaviour ...@@ -53,6 +53,7 @@ public class WxLoginUtil : MonoBehaviour
} }
EventUtils.OnEvent("wx_page_login_suc"); EventUtils.OnEvent("wx_page_login_suc");
Debug.unityLogger.Log("微信登录成功"); Debug.unityLogger.Log("微信登录成功");
PlayerPrefs.SetInt("didWxLogin", 1);
} }
/// <summary> /// <summary>
/// 微信绑定失败 /// 微信绑定失败
...@@ -90,6 +91,33 @@ public class WxLoginUtil : MonoBehaviour ...@@ -90,6 +91,33 @@ public class WxLoginUtil : MonoBehaviour
})); }));
} }
/// <summary>
/// 设备登录
/// </summary>
public void DeviceLogin(Action<bool> loginCallBack)
{
HttpTool.Instance._Post("app/v1/auth/tourist-login", null, new Action<LoginUserInfoBean>((bean) =>
{
AppConfig.Instance.setTokenAndUid(bean.token, bean.uid.ToString());
if (wxCallBack != null)
{
wxCallBack(true);
}
loginCallBack = wxCallBack;
}), new Action<string, string>((code, errMsg) =>
{
if (wxCallBack != null)
{
wxCallBack(false);
}
loginCallBack = wxCallBack;
}));
}
/// <summary> /// <summary>
/// 通过微信的接口 获取token /// 通过微信的接口 获取token
......
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using AOT;
using UnityEngine;
public class iOSHander
{
private iOSHander() { }
private static readonly iOSHander singleInstance = new iOSHander();
public static iOSHander Instance
{
get
{
return singleInstance;
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ResultHandler(string device, string IDFA);
[MonoPInvokeCallback(typeof(ResultHandler))]
static void resultHandler(string deviceStr, string IDFAStr)
{
Debug.Log("resultHandler : deviceStr = " + deviceStr + "IDFAStr = " + IDFAStr);
Constant.Instance.device = deviceStr;
Constant.Instance.idfa = IDFAStr;
Constant.Instance.aid = deviceStr;
}
[DllImport("__Internal")]
static extern void BridageDeviceAndIDFA(IntPtr resultHandler);
public void Handler()
{
ResultHandler handler = new ResultHandler(resultHandler);
IntPtr fp = Marshal.GetFunctionPointerForDelegate(handler);
BridageDeviceAndIDFA(fp);
}
}
fileFormatVersion: 2 fileFormatVersion: 2
guid: d14f2a2eb002b4069ae29bda900b8d08 guid: 52667d5fbb1ad4ceab750981b8a52854
timeCreated: 1586268596
licenseType: Store
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: 542241069a90544baa3754ff79c4b1aa guid: 4d11659e57c6a42e180c74b91e5a5af7
folderAsset: yes folderAsset: yes
timeCreated: 1568822248
licenseType: Store
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
......
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEngine;
public class ConfigXcode
{
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuiltProject)
{
// 只处理IOS工程, pathToBuildProject会传入导出的ios工程的根目录
        if (buildTarget != BuildTarget.iOS)
return;
// ----------------------------- 创建工程设置对象 -----------------------------
var projectPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject project = new PBXProject();
Debug.Log(projectPath);
project.ReadFromFile(projectPath);
string mainTargetGuid = project.GetUnityMainTargetGuid();
string frameworkTargetGuid = project.GetUnityFrameworkTargetGuid();
// ----------------------------- 修改BITCODE设置的例子 -----------------------------
project.SetBuildProperty(mainTargetGuid, "ENABLE_BITCODE", "NO");
// ----------------------------- 添加framework -----------------------------
project.AddFrameworkToProject(frameworkTargetGuid, "AppTrackingTransparency.framework", false);
project.AddFrameworkToProject(frameworkTargetGuid, "libz.dylib", false);
project.AddFrameworkToProject(frameworkTargetGuid, "libsqlite3.tbd", false);
project.AddFrameworkToProject(frameworkTargetGuid, "CoreTelephony.framework", false);
project.AddFrameworkToProject(frameworkTargetGuid, "WebKit.framework", false);
// ----------------------------- 添加universal link -----------------------------
string fileName = "my.entitlements"; // 这个名字任意
string filePath = Path.Combine(pathToBuiltProject, fileName);
//Debug.Log ("filePath: " + filePath);
string fileContent = @"<?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>com.apple.developer.associated-domains</key>
<array>
<string>applinks:feedapi.zhangxineducation.com</string>
</array>
</dict>
</plist>";
File.WriteAllText(filePath, fileContent);
project.AddFile(filePath, fileName);
project.SetBuildProperty(mainTargetGuid, "CODE_SIGN_ENTITLEMENTS", fileName);
// ----------------------------- 修改后的内容写回到配置文件 -----------------------------
File.WriteAllText(projectPath, project.WriteToString());
// ----------------------------- 修改Info.plist的示例 -----------------------------
var plistPath = Path.Combine(pathToBuiltProject, "Info.plist");
var plist = new PlistDocument();
plist.ReadFromFile(plistPath);
// ----------------------------- 添加权限 -----------------------------
plist.root.SetString("NSUserTrackingUsageDescription", "菜市场模拟器需要获取设备信息用以精准推送您喜欢的内容");
// ----------------------------- 设置微信白名单 -----------------------------
PlistElementArray loginChannelsArr;
loginChannelsArr = plist.root.CreateArray("LSApplicationQueriesSchemes");
loginChannelsArr.AddString("weixin");
loginChannelsArr.AddString("weChat");
loginChannelsArr.AddString("weixinULAPI");
// ----------------------------- 配置urlSchemes -----------------------------
PlistElementArray urlTypes = plist.root.CreateArray("CFBundleURLTypes");
PlistElementDict itemDict;
itemDict = urlTypes.AddDict();
itemDict.SetString("CFBundleTypeRole", "Editor");
itemDict.SetString("CFBundleURLName", "weixin");
PlistElementArray schemesArray1 = itemDict.CreateArray("CFBundleURLSchemes");
schemesArray1.AddString("wx10f8dcecdcf26ab7");
File.WriteAllText(plistPath, plist.WriteToString());
// ----------------------------- 修改后的内容写回到文件Info.plist -----------------------------
plist.WriteToFile(plistPath);
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: ba1d7058d9b25448d8de87d0c136b895
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: feed25f3a4ce64a1596f99926c2d825e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5adc50d8dba6d489fb252faa618e1073 guid: 354f3646ee72b417eb1bbc40e7f70be3
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}
......
...@@ -3331,7 +3331,7 @@ GameObject: ...@@ -3331,7 +3331,7 @@ GameObject:
- component: {fileID: 119479674} - component: {fileID: 119479674}
- component: {fileID: 119479673} - component: {fileID: 119479673}
m_Layer: 5 m_Layer: 5
m_Name: Image m_Name: CloseImage
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
...@@ -3577,7 +3577,7 @@ RectTransform: ...@@ -3577,7 +3577,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 16, y: 0.00004386902} m_AnchoredPosition: {x: 16, y: 310.35764}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1} m_Pivot: {x: 0, y: 1}
--- !u!114 &133138106 --- !u!114 &133138106
...@@ -13747,7 +13747,7 @@ GameObject: ...@@ -13747,7 +13747,7 @@ GameObject:
- component: {fileID: 438306672} - component: {fileID: 438306672}
- component: {fileID: 438306674} - component: {fileID: 438306674}
m_Layer: 5 m_Layer: 5
m_Name: Image m_Name: CloseImage
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
...@@ -15109,8 +15109,8 @@ MonoBehaviour: ...@@ -15109,8 +15109,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1531958713} m_TargetGraphic: {fileID: 1531958713}
m_HandleRect: {fileID: 1531958712} m_HandleRect: {fileID: 1531958712}
m_Direction: 2 m_Direction: 2
m_Value: 1.0000033 m_Value: 0.9999997
m_Size: 0.93547666 m_Size: 0.6616987
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
...@@ -26836,7 +26836,7 @@ GameObject: ...@@ -26836,7 +26836,7 @@ GameObject:
- component: {fileID: 904852951} - component: {fileID: 904852951}
- component: {fileID: 904852953} - component: {fileID: 904852953}
m_Layer: 5 m_Layer: 5
m_Name: Image m_Name: CloseImage
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
...@@ -33293,7 +33293,7 @@ MonoBehaviour: ...@@ -33293,7 +33293,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1920204264} m_TargetGraphic: {fileID: 1920204264}
m_HandleRect: {fileID: 1920204263} m_HandleRect: {fileID: 1920204263}
m_Direction: 2 m_Direction: 2
m_Value: 0 m_Value: 1
m_Size: 1 m_Size: 1
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
...@@ -45184,7 +45184,7 @@ MonoBehaviour: ...@@ -45184,7 +45184,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 949134090} m_HandleRect: {fileID: 949134090}
m_Direction: 2 m_Direction: 2
m_Value: 0 m_Value: 0
m_Size: 1 m_Size: 0.6989742
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
...@@ -382,7 +382,7 @@ MonoBehaviour: ...@@ -382,7 +382,7 @@ 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: 1 isTest: 0
isShowLog: 1 isShowLog: 1
XyDialog: {fileID: 0} XyDialog: {fileID: 0}
--- !u!1 &2010092450 --- !u!1 &2010092450
......
...@@ -21,7 +21,7 @@ public class HarvestItem : MonoBehaviour ...@@ -21,7 +21,7 @@ public class HarvestItem : MonoBehaviour
tv_title.text = bean.title; tv_title.text = bean.title;
tv_process.text = bean.current + "/" + bean.target; tv_process.text = bean.current + "/" + bean.target;
//tv_reward.text = bean.yuan+"元"; //tv_reward.text = bean.yuan+"元";
tv_reward.text = bean.yuan + (Constant.Instance.shubiao ? "币" : "元"); tv_reward.text = bean.yuan + (!Constant.Instance.shubiao ? "币" : "元");
img_process.fillAmount= (float)bean.current / bean.target; img_process.fillAmount= (float)bean.current / bean.target;
setImageIcon(bean.woodId); setImageIcon(bean.woodId);
......
...@@ -12,7 +12,7 @@ public class HomeItem : MonoBehaviour ...@@ -12,7 +12,7 @@ public class HomeItem : MonoBehaviour
{ {
//tvdesc.text = bean.wdlcWdData.shortConditionContent; //tvdesc.text = bean.wdlcWdData.shortConditionContent;
//tv_cash.text = + bean.yuan + "元"; //tv_cash.text = + bean.yuan + "元";
tv_cash.text = +bean.yuan + (Constant.Instance.shubiao? "币" : "元"); tv_cash.text = +bean.yuan + (!Constant.Instance.shubiao? "币" : "元");
tv_process.text = bean.current + "/" + bean.targetNum; tv_process.text = bean.current + "/" + bean.targetNum;
img_procress.fillAmount = (float)bean.current / bean.targetNum; img_procress.fillAmount = (float)bean.current / bean.targetNum;
......
...@@ -21,7 +21,7 @@ public class PlantTreeItem : MonoBehaviour ...@@ -21,7 +21,7 @@ public class PlantTreeItem : MonoBehaviour
{ {
mData = data; mData = data;
//CrasNumTv.text = "<size=42>" + data.yuan + "</size><size=26>元</size>"; //CrasNumTv.text = "<size=42>" + data.yuan + "</size><size=26>元</size>";
CrasNumTv.text = "<size=42>" + data.yuan + "</size><size=26>" + (Constant.Instance.shubiao ? "币" : "元") + "</size>"; CrasNumTv.text = "<size=42>" + data.yuan + "</size><size=26>" + (!Constant.Instance.shubiao ? "币" : "元") + "</size>";
tv_process.text = data.current + "/" + data.targetNum; tv_process.text = data.current + "/" + data.targetNum;
img_process.fillAmount = (float)data.current / data.targetNum; img_process.fillAmount = (float)data.current / data.targetNum;
......
...@@ -39,7 +39,7 @@ public class SignItem : MonoBehaviour ...@@ -39,7 +39,7 @@ public class SignItem : MonoBehaviour
//status//1 已经签到 2 今天要签到 3 未签到 错过的签到 0 未来要签到的 //status//1 已经签到 2 今天要签到 3 未签到 错过的签到 0 未来要签到的
tv_days.text = signData.id.ToString(); tv_days.text = signData.id.ToString();
//tv_cash.text = signData.maxCashStr+"元"; //tv_cash.text = signData.maxCashStr+"元";
tv_cash.text = signData.maxCashStr + (Constant.Instance.shubiao? "币" : "元"); tv_cash.text = signData.maxCashStr + (!Constant.Instance.shubiao? "币" : "元");
if (signData.status == 0) if (signData.status == 0)
{ {
......
...@@ -68,7 +68,7 @@ public class AdUtils ...@@ -68,7 +68,7 @@ public class AdUtils
public void onAdClose(AdEntity entity) public void onAdClose(AdEntity entity)
{ {
Debug.Log("音乐是否开关的值"+ PlayerPrefs.GetInt("IS_OPEN_MUSIC", 0)); Debug.Log("音乐是否开关的值"+ PlayerPrefs.GetInt("IS_OPEN_MUSIC", 0));
if(PlayerPrefs.GetInt("IS_OPEN_MUSIC", 0) == 1) if(PlayerPrefs.GetInt("IS_OPEN_MUSIC", 0) == 0)
{ {
Debug.Log("如果开的重新开"); Debug.Log("如果开的重新开");
AudioUtils.ins.music.Play(); AudioUtils.ins.music.Play();
......
...@@ -59,7 +59,7 @@ public class Guide : MonoBehaviour ...@@ -59,7 +59,7 @@ public class Guide : MonoBehaviour
return; return;
} }
if (Constant.Instance.shubiao) if (!Constant.Instance.shubiao)
{ {
isUser = false; isUser = false;
} }
......
...@@ -75,14 +75,14 @@ public class JumpUtils : MonoBehaviour ...@@ -75,14 +75,14 @@ public class JumpUtils : MonoBehaviour
/// </summary> /// </summary>
public void JumpWithDraw() public void JumpWithDraw()
{ {
EventUtils.OnEvent("cash_click", "点击提现"); //EventUtils.OnEvent("cash_click", "点击提现");
AudioUtils.ins.PlayBtnAudio(); //AudioUtils.ins.PlayBtnAudio();
WithDrawCamera.depth = 1; //WithDrawCamera.depth = 1;
SettingCamera.depth = 0; //SettingCamera.depth = 0;
HomeCamera.depth = 0; //HomeCamera.depth = 0;
WithDrawRecordCamera.depth = 0; //WithDrawRecordCamera.depth = 0;
WithDrawEveryDayCamera.depth = 0; //WithDrawEveryDayCamera.depth = 0;
EventUtils.OnEvent("cashout_show"); //EventUtils.OnEvent("cashout_show");
} }
/// <summary> /// <summary>
/// 显示提现记录页 /// 显示提现记录页
......
...@@ -106,7 +106,7 @@ public class CarUIControl : MonoBehaviour ...@@ -106,7 +106,7 @@ public class CarUIControl : MonoBehaviour
private void flyRedPack(int arg) private void flyRedPack(int arg)
{ {
if (Constant.Instance.shubiao) if (!Constant.Instance.shubiao)
{ {
return; return;
} }
...@@ -201,7 +201,7 @@ public class CarUIControl : MonoBehaviour ...@@ -201,7 +201,7 @@ public class CarUIControl : MonoBehaviour
pickName.text = land.landPlantData.plantName; pickName.text = land.landPlantData.plantName;
speedName.text = land.landPlantData.plantName; speedName.text = land.landPlantData.plantName;
//tv_get_price.text = "<size=48>" + land.landPlantData.plantPrice + "</size><size=26>元</size>"; //tv_get_price.text = "<size=48>" + land.landPlantData.plantPrice + "</size><size=26>元</size>";
tv_get_price.text =Constant.Instance.shubiao ? "币" : "¥" + land.landPlantData.plantPrice; tv_get_price.text = !Constant.Instance.shubiao ? (land.landPlantData.plantPrice + "币") : ("¥" + land.landPlantData.plantPrice);
} }
tv_speed_diamond.text = PlayerDataControl.Instance.acceleratorConsumeDiamond.ToString(); tv_speed_diamond.text = PlayerDataControl.Instance.acceleratorConsumeDiamond.ToString();
......
...@@ -240,7 +240,7 @@ public class DialogControl : MonoBehaviour ...@@ -240,7 +240,7 @@ public class DialogControl : MonoBehaviour
// 外星礼物背景 // 外星礼物背景
Image FlyBoxRewardBg = transform.Find("FlyBoxReward/Image").GetComponent<Image>(); Image FlyBoxRewardBg = transform.Find("FlyBoxReward/Image").GetComponent<Image>();
if (Constant.Instance.shubiao) if (!Constant.Instance.shubiao)
{ {
EncounterpestsDialogBg.sprite = Resources.Load<Sprite>("shubiaoBg0"); EncounterpestsDialogBg.sprite = Resources.Load<Sprite>("shubiaoBg0");
FlyBoxRewardBg.sprite = Resources.Load<Sprite>("shubiaoBg0"); FlyBoxRewardBg.sprite = Resources.Load<Sprite>("shubiaoBg0");
...@@ -251,6 +251,7 @@ public class DialogControl : MonoBehaviour ...@@ -251,6 +251,7 @@ public class DialogControl : MonoBehaviour
FlyBoxRewardBg.sprite = Resources.Load<Sprite>("shubiaoBg1"); FlyBoxRewardBg.sprite = Resources.Load<Sprite>("shubiaoBg1");
} }
#endif #endif
} }
/// <summary> /// <summary>
...@@ -410,7 +411,7 @@ public class DialogControl : MonoBehaviour ...@@ -410,7 +411,7 @@ public class DialogControl : MonoBehaviour
public void showPigBankDialog() public void showPigBankDialog()
{ {
#if UNITY_IOS #if UNITY_IOS
if (Constant.Instance.shubiao) if (!Constant.Instance.shubiao)
{ {
return; return;
} }
...@@ -420,7 +421,7 @@ public class DialogControl : MonoBehaviour ...@@ -420,7 +421,7 @@ public class DialogControl : MonoBehaviour
pigbankDialog.SetActive(true); pigbankDialog.SetActive(true);
AdUtils.showBanner("cqg"); AdUtils.showBanner("cqg");
//tv_pig_cash.text = PlayerDataControl.Instance.pigNum+"元"; //tv_pig_cash.text = PlayerDataControl.Instance.pigNum+"元";
tv_pig_cash.text = PlayerDataControl.Instance.pigNum + (Constant.Instance.shubiao ? "币" : "元"); tv_pig_cash.text = PlayerDataControl.Instance.pigNum + (!Constant.Instance.shubiao ? "币" : "元");
if (PlayerDataControl.Instance.pigStatus == 1) if (PlayerDataControl.Instance.pigStatus == 1)
{ {
...@@ -457,7 +458,7 @@ public class DialogControl : MonoBehaviour ...@@ -457,7 +458,7 @@ public class DialogControl : MonoBehaviour
{ {
closePigBankDialog(); closePigBankDialog();
//showHappyGetDialog(PlayerDataControl.Instance.pigNum + "元"); //showHappyGetDialog(PlayerDataControl.Instance.pigNum + "元");
showHappyGetDialog(PlayerDataControl.Instance.pigNum + (Constant.Instance.shubiao ? "币" : "元")); showHappyGetDialog(PlayerDataControl.Instance.pigNum + (!Constant.Instance.shubiao ? "币" : "元"));
// EventCenter.Broadcast(MyEventType.UPDATE_CAR_LIST_DATA); // EventCenter.Broadcast(MyEventType.UPDATE_CAR_LIST_DATA);
}), new Action<string, string>((code, errMsg) => }), new Action<string, string>((code, errMsg) =>
...@@ -477,8 +478,13 @@ public class DialogControl : MonoBehaviour ...@@ -477,8 +478,13 @@ public class DialogControl : MonoBehaviour
//EventUtils.OnEvent("addDiamond_click", "点击钻石加号"); //EventUtils.OnEvent("addDiamond_click", "点击钻石加号");
AudioUtils.ins.PlayBtnAudio(); AudioUtils.ins.PlayBtnAudio();
DiamondDialog.SetActive(true); DiamondDialog.SetActive(true);
#if UNITY_IOS
moveDiamondDialog();
#else
Invoke("showAd",0.5f); Invoke("showAd",0.5f);
Invoke("moveDiamondDialog", 1f); Invoke("moveDiamondDialog", 1f);
#endif
HttpTool.Instance._Get("app/v1/wdlc/reward/diamond_by_video_status", parm, new Action<DiamondStatusBean>((bean) => HttpTool.Instance._Get("app/v1/wdlc/reward/diamond_by_video_status", parm, new Action<DiamondStatusBean>((bean) =>
{ {
DiamondplayNum = bean.playNum; DiamondplayNum = bean.playNum;
...@@ -494,7 +500,15 @@ public class DialogControl : MonoBehaviour ...@@ -494,7 +500,15 @@ 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()
...@@ -573,8 +587,13 @@ public class DialogControl : MonoBehaviour ...@@ -573,8 +587,13 @@ public class DialogControl : MonoBehaviour
AllSpeedDialog.SetActive(true); AllSpeedDialog.SetActive(true);
allSpeedDesc.text = "所有作物成熟速度加" + bean.reduceMinute + "分钟"; allSpeedDesc.text = "所有作物成熟速度加" + bean.reduceMinute + "分钟";
useAllSpeedByVideoNumTv.text = "每天0点重置视频次数(剩余" + bean.todayVideoRemainingNum + "次)"; useAllSpeedByVideoNumTv.text = "每天0点重置视频次数(剩余" + bean.todayVideoRemainingNum + "次)";
#if UNITY_IOS
moveAllSpeedDialog();
#else
Invoke("showAd", 0.5f); Invoke("showAd", 0.5f);
Invoke("moveAllSpeedDialog", 1f); Invoke("moveAllSpeedDialog", 1f);
#endif
//HttpTool.Instance._Get("app/v1/game/reward_video/status", parm, new Action<VideoStatusBean>((bean) => //HttpTool.Instance._Get("app/v1/game/reward_video/status", parm, new Action<VideoStatusBean>((bean) =>
//{ //{
// if (bean.status == 1) // if (bean.status == 1)
...@@ -601,7 +620,15 @@ public class DialogControl : MonoBehaviour ...@@ -601,7 +620,15 @@ 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()
{ {
...@@ -797,6 +824,12 @@ public class DialogControl : MonoBehaviour ...@@ -797,6 +824,12 @@ public class DialogControl : MonoBehaviour
{ {
happygetDialog.SetActive(true); happygetDialog.SetActive(true);
tv_cash.text = cash; tv_cash.text = cash;
Text TitleText = happygetDialog.transform.Find("Image/Text").GetComponent<Text>();
TitleText.text = Constant.Instance.shubiao ? "恭喜获得 现金奖励" : "恭喜获得 金币奖励";
GameObject Text = happygetDialog.transform.Find("Image/Text (1)").gameObject;
Text.SetActive(Constant.Instance.shubiao);
} }
//关闭开心收下弹窗 //关闭开心收下弹窗
public void closeHappyGetDialog() public void closeHappyGetDialog()
...@@ -833,7 +866,7 @@ public class DialogControl : MonoBehaviour ...@@ -833,7 +866,7 @@ public class DialogControl : MonoBehaviour
signcashstr = cashstr; signcashstr = cashstr;
signid = id; signid = id;
//sign_cashtr.text = cashstr+"元"; //sign_cashtr.text = cashstr+"元";
sign_cashtr.text = cashstr + (Constant.Instance.shubiao ? "币" : "元"); sign_cashtr.text = cashstr + (!Constant.Instance.shubiao ? "币" : "元");
} }
//关闭签到奖励 //关闭签到奖励
...@@ -893,7 +926,7 @@ public class DialogControl : MonoBehaviour ...@@ -893,7 +926,7 @@ public class DialogControl : MonoBehaviour
//flybottom.SetActive(true); //flybottom.SetActive(true);
// EventCenter.Broadcast(MyEventType.FlyPigBank); // EventCenter.Broadcast(MyEventType.FlyPigBank);
//showHappyGetDialog(result.cash+"元"); //showHappyGetDialog(result.cash+"元");
showHappyGetDialog(result.cash + (Constant.Instance.shubiao ? "币" : "元")); showHappyGetDialog(result.cash + (!Constant.Instance.shubiao ? "币" : "元"));
EventCenter.Broadcast(MyEventType.RefreshSignList); EventCenter.Broadcast(MyEventType.RefreshSignList);
// EventCenter.Broadcast(MyEventType.RefreshHomeData); // EventCenter.Broadcast(MyEventType.RefreshHomeData);
......
...@@ -71,16 +71,25 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -71,16 +71,25 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
#if UNITY_IOS #if UNITY_IOS
private void CheckShubiao() private void CheckShubiao()
{ {
// 点击金币事件
Destroy(transform.Find("Title/bg").GetComponent<Button>()); Destroy(transform.Find("Title/bg").GetComponent<Button>());
// 幸运转盘
GameObject luckyzhuanpan = transform.Find("Title/luckyzhuanpan").gameObject;
luckyzhuanpan.SetActive(Constant.Instance.shubiao);
// 我的礼包
GameObject shiwujiangli = transform.Find("Title/shiwujiangli").gameObject;
shiwujiangli.SetActive(Constant.Instance.shubiao);
// 立即领取
GameObject receive_red_oack = transform.Find("Title/receive_red_oack").gameObject;
receive_red_oack.SetActive(Constant.Instance.shubiao);
// 顶部钱旁的提现按钮 // 顶部钱旁的提现按钮
GameObject withdraw = transform.Find("Title/bg/withdraw").gameObject; GameObject withdraw = transform.Find("Title/bg/withdraw").gameObject;
withdraw.SetActive(Constant.Instance.shubiao); withdraw.SetActive(Constant.Instance.shubiao);
// 每日提现
GameObject meirijiangli = transform.Find("Title/meirijiangli").gameObject;
meirijiangli.SetActive(Constant.Instance.shubiao);
// 明日存钱罐 // 明日存钱罐
GameObject pigbank = transform.Find("Title/pigbank").gameObject; GameObject pigbank = transform.Find("Title/pigbank").gameObject;
pigbank.SetActive(Constant.Instance.shubiao); pigbank.SetActive(Constant.Instance.shubiao);
...@@ -89,25 +98,33 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -89,25 +98,33 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
GameObject Harvestreward = transform.Find("BottomFun/Harvestreward").gameObject; GameObject Harvestreward = transform.Find("BottomFun/Harvestreward").gameObject;
Harvestreward.SetActive(Constant.Instance.shubiao); Harvestreward.SetActive(Constant.Instance.shubiao);
// 幸运转盘
//GameObject GameObject = transform.Find("BottomFun/GameObject").gameObject;
//GameObject.SetActive(Constant.Instance.shubiao);
// 天天提现 // 天天提现
GameObject EveryDayWithdraw = transform.Find("BottomFun/EveryDayWithdraw").gameObject; GameObject EveryDayWithdraw = transform.Find("BottomFun/EveryDayWithdraw").gameObject;
EveryDayWithdraw.SetActive(Constant.Instance.shubiao); EveryDayWithdraw.SetActive(Constant.Instance.shubiao);
// 种植
GameObject Plant = transform.Find("BottomFun/plant").gameObject;
Plant.SetActive(Constant.Instance.shubiao);
// 漂浮红包 // 漂浮红包
GameObject Coin1 = transform.Find("Car_list_bg/FloatCoin/Coin1").gameObject; GameObject Coin1 = transform.Find("Car_list_bg/FloatCoin/Coin1").gameObject;
Coin1.SetActive(Constant.Instance.shubiao); Coin1.SetActive(Constant.Instance.shubiao);
// 下面的红包 // 卖菜赚钱
GameObject receive_red_oack = transform.Find("Car_list_bg/Park/receive_red_oack").gameObject; GameObject SellingVegetables = transform.Find("BottomFun/SellingVegetables").gameObject;
receive_red_oack.SetActive(Constant.Instance.shubiao); SellingVegetables.SetActive(Constant.Instance.shubiao);
// 一箱草莓
GameObject Strawberries = transform.Find("BottomFun/Strawberries").gameObject;
Strawberries.SetActive(Constant.Instance.shubiao);
// 手速红包
GameObject HandSpeedRedPacketItem = transform.Find("BottomFun/HandSpeedRedPacketItem").gameObject;
HandSpeedRedPacketItem.SetActive(Constant.Instance.shubiao);
// 百元红包
GameObject baiyuanenvelope = transform.Find("BottomFun/100yuanenvelope").gameObject;
baiyuanenvelope.SetActive(Constant.Instance.shubiao);
// 飞行道具
GameObject flyBox = transform.Find("FlyBox/box").gameObject;
flyBox.SetActive(Constant.Instance.shubiao);
} }
// 判断是否是刘海屏 // 判断是否是刘海屏
...@@ -129,7 +146,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -129,7 +146,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
transform.Find("Title").GetComponent<RectTransform>().anchoredPosition = new Vector2(titlePosition.x, titlePosition.y - 45); transform.Find("Title").GetComponent<RectTransform>().anchoredPosition = new Vector2(titlePosition.x, titlePosition.y - 45);
} }
if (Constant.Instance.shubiao) if (!Constant.Instance.shubiao)
{ {
transform.Find("BottomFun/Dailytasks").GetComponent<RectTransform>().anchoredPosition = new Vector2(285, 1170); transform.Find("BottomFun/Dailytasks").GetComponent<RectTransform>().anchoredPosition = new Vector2(285, 1170);
} }
...@@ -179,6 +196,10 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -179,6 +196,10 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
private void flyhongbao() private void flyhongbao()
{ {
if (!Constant.Instance.shubiao)
{
return;
}
redpack.SetActive(true); redpack.SetActive(true);
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
...@@ -202,7 +223,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -202,7 +223,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
{ {
img_add_cash_trips.SetActive(true); img_add_cash_trips.SetActive(true);
//tv_trips_cash.text = "+" + arg + "元"; //tv_trips_cash.text = "+" + arg + "元";
tv_trips_cash.text = "+" + arg + (Constant.Instance.shubiao ? "币" : "元"); tv_trips_cash.text = "+" + arg + (!Constant.Instance.shubiao ? "币" : "元");
StartCoroutine(dissmiss()); StartCoroutine(dissmiss());
} }
...@@ -301,8 +322,8 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -301,8 +322,8 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
{ {
//CashTv.text = homeInfo.avaYuan.ToString()+"元"; //CashTv.text = homeInfo.avaYuan.ToString()+"元";
//tv_passRewardToday.text = homeInfo.wdRewardToday2.ToString() + "元"; //tv_passRewardToday.text = homeInfo.wdRewardToday2.ToString() + "元";
CashTv.text = homeInfo.avaYuan.ToString() + (Constant.Instance.shubiao ? "币" : "元"); CashTv.text = homeInfo.avaYuan.ToString() + (!Constant.Instance.shubiao ? "币" : "元");
tv_passRewardToday.text = homeInfo.wdRewardToday2.ToString() + (Constant.Instance.shubiao ? "币" : "元"); tv_passRewardToday.text = homeInfo.wdRewardToday2.ToString() + (!Constant.Instance.shubiao ? "币" : "元");
DiamondTv.text = homeInfo.avaDiamond.ToString(); DiamondTv.text = homeInfo.avaDiamond.ToString();
StartCoroutine(LoadHeadImg(homeInfo.headImg)); StartCoroutine(LoadHeadImg(homeInfo.headImg));
...@@ -382,7 +403,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -382,7 +403,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
{ {
img_pig_cash_trips.SetActive(true); img_pig_cash_trips.SetActive(true);
//tv_pig_tomorrow_cash.text = "<size=35>" + PlayerDataControl.Instance.pigNum + "</size><size=20>元</size>"; //tv_pig_tomorrow_cash.text = "<size=35>" + PlayerDataControl.Instance.pigNum + "</size><size=20>元</size>";
tv_pig_tomorrow_cash.text = "<size=35>" + PlayerDataControl.Instance.pigNum + "</size><size=20>" + (Constant.Instance.shubiao ? "币" : "元") + "</size>"; tv_pig_tomorrow_cash.text = "<size=35>" + PlayerDataControl.Instance.pigNum + "</size><size=20>" + (!Constant.Instance.shubiao ? "币" : "元") + "</size>";
yield return new WaitForSecondsRealtime(time); yield return new WaitForSecondsRealtime(time);
img_pig_cash_trips.SetActive(false); img_pig_cash_trips.SetActive(false);
......
...@@ -117,26 +117,22 @@ public class SettingControl : MonoBehaviour ...@@ -117,26 +117,22 @@ public class SettingControl : MonoBehaviour
{ {
AudioUtils.ins.PlayBtnAudio(); AudioUtils.ins.PlayBtnAudio();
Debug.unityLogger.Log("用户协议"); Debug.unityLogger.Log("用户协议");
#if UNITY_IOS
ShowIOSWebView(Constant.Instance.UserAgreement, "用户协议");
#elif UNITY_ANDROID
CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.UserAgreement, "用户协议"); CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.UserAgreement, "用户协议");
//CallLocalFunUtil.Instance.OpenWebPage(PlayerDataControl.Instance.UserAgreementUrl, "用户协议"); #endif
//#if UNITY_IOS
// ShowIOSWebView(PlayerDataControl.Instance.UserAgreementUrl, "用户协议");
//#elif UNITY_ANDROID
// CallLocalFunUtil.Instance.OpenWebPage(PlayerDataControl.Instance.UserAgreementUrl, "用户协议");
//#endif
} }
public void OnClickPrivacyPolicy() public void OnClickPrivacyPolicy()
{ {
AudioUtils.ins.PlayBtnAudio(); AudioUtils.ins.PlayBtnAudio();
Debug.unityLogger.Log("隐私协议"); Debug.unityLogger.Log("隐私政策");
CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.PrivacyPolicy, "隐私政策"); #if UNITY_IOS
//CallLocalFunUtil.Instance.OpenWebPage(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私协议"); ShowIOSWebView(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私政策");
//#if UNITY_IOS #elif UNITY_ANDROID
// ShowIOSWebView(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私协议"); CallLocalFunUtil.Instance.OpenWebPage(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私政策");
//#elif UNITY_ANDROID #endif
// CallLocalFunUtil.Instance.OpenWebPage(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私协议");
//#endif
} }
public void OnClicAboutUs() public void OnClicAboutUs()
{ {
......
...@@ -33,13 +33,26 @@ public class StickDialog : MonoBehaviour ...@@ -33,13 +33,26 @@ public class StickDialog : MonoBehaviour
cancelStickId = arg; cancelStickId = arg;
Debug.unityLogger.Log("显示害虫弹窗"+arg); Debug.unityLogger.Log("显示害虫弹窗"+arg);
StickDialogObj.SetActive(true); StickDialogObj.SetActive(true);
#if UNITY_IOS
moveDialog();
#else
AdUtils.showFeedAd("stick"); AdUtils.showFeedAd("stick");
Invoke("moveDialog", 1f); Invoke("moveDialog", 1f);
#endif
} }
private void moveDialog() private void moveDialog()
{ {
#if UNITY_IOS
stickContent.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0.5f);
stickContent.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.5f);
stickContent.GetComponent<RectTransform>().anchoredPosition = new Vector3(0, 100, 0);
stickContent.transform.parent.Find("CloseImage").gameObject.SetActive(false);
#else
stickContent.transform.localPosition += new Vector3(0, 300, 0); stickContent.transform.localPosition += new Vector3(0, 300, 0);
#endif
} }
private static Dictionary<string, object> parm = new Dictionary<string, object>(); private static Dictionary<string, object> parm = new Dictionary<string, object>();
...@@ -65,7 +78,7 @@ public class StickDialog : MonoBehaviour ...@@ -65,7 +78,7 @@ public class StickDialog : MonoBehaviour
else else
{ {
//GameObject.Find("Dialog").GetComponent<DialogControl>().showHappyGetDialog(bean.rewardContent.cash.ToString() + "元"); //GameObject.Find("Dialog").GetComponent<DialogControl>().showHappyGetDialog(bean.rewardContent.cash.ToString() + "元");
GameObject.Find("Dialog").GetComponent<DialogControl>().showHappyGetDialog(bean.rewardContent.cash.ToString() + (Constant.Instance.shubiao ? "币" : "元")); GameObject.Find("Dialog").GetComponent<DialogControl>().showHappyGetDialog(bean.rewardContent.cash.ToString() + (!Constant.Instance.shubiao ? "币" : "元"));
} }
......
...@@ -69,7 +69,7 @@ public class TaskDiamandControl : MonoBehaviour ...@@ -69,7 +69,7 @@ public class TaskDiamandControl : MonoBehaviour
#if UNITY_IOS #if UNITY_IOS
int[] sidArray = new int[] { 2594, 2590, 2596, 2591 }; int[] sidArray = new int[] { 2594, 2590, 2596, 2591 };
List<int> sidList = new List<int>(sidArray); List<int> sidList = new List<int>(sidArray);
if (Constant.Instance.shubiao && sidList.Contains(bean.taskList[i].sid)) if (!Constant.Instance.shubiao && sidList.Contains(bean.taskList[i].sid))
{ {
continue; continue;
} }
......
...@@ -20,18 +20,6 @@ public class TitleControl : MonoBehaviour ...@@ -20,18 +20,6 @@ public class TitleControl : MonoBehaviour
private void Start() private void Start()
{ {
getWdFirstInfo(); getWdFirstInfo();
#if UNITY_IOS
if (Constant.Instance.shubiao)
{
transform.Find("withdraw").gameObject.SetActive(false);
}
else
{
transform.Find("withdraw").gameObject.SetActive(true);
}
#endif
} }
private void Awake() private void Awake()
{ {
......
...@@ -97,7 +97,7 @@ public class WithDrawControl : MonoBehaviour ...@@ -97,7 +97,7 @@ public class WithDrawControl : MonoBehaviour
{ {
// coinNumTv.text = "<size=56>" + bean.avaCoin + "</size> <size=32>金币</size>"; // coinNumTv.text = "<size=56>" + bean.avaCoin + "</size> <size=32>金币</size>";
//cashtv.text = bean.avaYuan + "元"; //cashtv.text = bean.avaYuan + "元";
cashtv.text = bean.avaYuan + (Constant.Instance.shubiao? "币" : "元"); cashtv.text = bean.avaYuan + (!Constant.Instance.shubiao? "币" : "元");
withdrawDesc.text = bean.wdDesc; withdrawDesc.text = bean.wdDesc;
nickName.text = PlayerDataControl.Instance.NickName; nickName.text = PlayerDataControl.Instance.NickName;
......
...@@ -36,7 +36,7 @@ public class WithDrawItem : MonoBehaviour ...@@ -36,7 +36,7 @@ public class WithDrawItem : MonoBehaviour
bgImg.sprite = borders[0]; bgImg.sprite = borders[0];
//CrasNumTv.text = "<color=#FFFFFF>" + mData.yuan + "元</color>"; //CrasNumTv.text = "<color=#FFFFFF>" + mData.yuan + "元</color>";
CrasNumTv.text = "<color=#FFFFFF>" + mData.yuan + (Constant.Instance.shubiao ? "币" : "元") + "</color>"; CrasNumTv.text = "<color=#FFFFFF>" + mData.yuan + (!Constant.Instance.shubiao ? "币" : "元") + "</color>";
} }
else else
...@@ -49,7 +49,7 @@ public class WithDrawItem : MonoBehaviour ...@@ -49,7 +49,7 @@ public class WithDrawItem : MonoBehaviour
{ {
bgImg.sprite = borders[2]; bgImg.sprite = borders[2];
//CrasNumTv.text = "<color=#FFFFFF>" + mData.yuan + "元</color>"; //CrasNumTv.text = "<color=#FFFFFF>" + mData.yuan + "元</color>";
CrasNumTv.text = "<color=#FFFFFF>" + mData.yuan + (Constant.Instance.shubiao ? "币" : "元") + "</color>"; CrasNumTv.text = "<color=#FFFFFF>" + mData.yuan + (!Constant.Instance.shubiao ? "币" : "元") + "</color>";
// CrasNumTv.color = new Color(255, 255, 255, 255); // CrasNumTv.color = new Color(255, 255, 255, 255);
} }
...@@ -57,7 +57,7 @@ public class WithDrawItem : MonoBehaviour ...@@ -57,7 +57,7 @@ public class WithDrawItem : MonoBehaviour
{ {
bgImg.sprite = borders[1]; bgImg.sprite = borders[1];
//CrasNumTv.text = "<color=#97CC7E>" + mData.yuan + "元</color>"; //CrasNumTv.text = "<color=#97CC7E>" + mData.yuan + "元</color>";
CrasNumTv.text = "<color=#97CC7E>" + mData.yuan + (Constant.Instance.shubiao ? "币" : "元") + "</color>"; CrasNumTv.text = "<color=#97CC7E>" + mData.yuan + (!Constant.Instance.shubiao ? "币" : "元") + "</color>";
// CrasNumTv.color = new Color(151, 204, 126, 255); // CrasNumTv.color = new Color(151, 204, 126, 255);
} }
...@@ -84,7 +84,7 @@ public class WithDrawItem : MonoBehaviour ...@@ -84,7 +84,7 @@ public class WithDrawItem : MonoBehaviour
bgImg.sprite = borders[2]; bgImg.sprite = borders[2];
// CrasNumTv.color = new Color(255, 255, 255, 255); // CrasNumTv.color = new Color(255, 255, 255, 255);
//CrasNumTv.text = "<color=#FFFFFF>" + data.yuan + "元</color>"; //CrasNumTv.text = "<color=#FFFFFF>" + data.yuan + "元</color>";
CrasNumTv.text = "<color=#FFFFFF>" + data.yuan + (Constant.Instance.shubiao ? "币" : "元") + "</color>"; CrasNumTv.text = "<color=#FFFFFF>" + data.yuan + (!Constant.Instance.shubiao ? "币" : "元") + "</color>";
} }
else else
...@@ -92,7 +92,7 @@ public class WithDrawItem : MonoBehaviour ...@@ -92,7 +92,7 @@ public class WithDrawItem : MonoBehaviour
bgImg.sprite = borders[1]; bgImg.sprite = borders[1];
//CrasNumTv.color = new Color(151, 204, 126, 255); //CrasNumTv.color = new Color(151, 204, 126, 255);
//CrasNumTv.text = "<color=#97CC7E>" + data.yuan + "元</color>"; //CrasNumTv.text = "<color=#97CC7E>" + data.yuan + "元</color>";
CrasNumTv.text = "<color=#97CC7E>" + data.yuan + (Constant.Instance.shubiao ? "币" : "元") + "</color>"; CrasNumTv.text = "<color=#97CC7E>" + data.yuan + (!Constant.Instance.shubiao ? "币" : "元") + "</color>";
} }
......
...@@ -11,7 +11,7 @@ public class WithDrawRecordItem : MonoBehaviour ...@@ -11,7 +11,7 @@ public class WithDrawRecordItem : MonoBehaviour
title.text = data.title; title.text = data.title;
time.text = data.time; time.text = data.time;
//desc.text = data.wdAmount + "元"; //desc.text = data.wdAmount + "元";
desc.text = data.wdAmount + (Constant.Instance.shubiao ? "币" : "元"); desc.text = data.wdAmount + (!Constant.Instance.shubiao ? "币" : "元");
if (data.status == 1) if (data.status == 1)
{ {
......
...@@ -38,6 +38,10 @@ public class WithdrawalEveryDayControl : MonoBehaviour ...@@ -38,6 +38,10 @@ public class WithdrawalEveryDayControl : MonoBehaviour
private void Awake() private void Awake()
{ {
EventCenter.AddListener(MyEventType.WithDrewarlEveryDay, getHeartList); EventCenter.AddListener(MyEventType.WithDrewarlEveryDay, getHeartList);
#if UNITY_IOS
fitFrame();
#endif
} }
private void OnDestroy() private void OnDestroy()
...@@ -175,7 +179,7 @@ public class WithdrawalEveryDayControl : MonoBehaviour ...@@ -175,7 +179,7 @@ public class WithdrawalEveryDayControl : MonoBehaviour
topNomalObj.SetActive(true); topNomalObj.SetActive(true);
topComplateObj.SetActive(false); topComplateObj.SetActive(false);
//topNomalMoneyTv.text = wd.rewardValue +"元"; //topNomalMoneyTv.text = wd.rewardValue +"元";
topNomalMoneyTv.text = wd.rewardValue + (Constant.Instance.shubiao ? "币" : "元"); topNomalMoneyTv.text = wd.rewardValue + (!Constant.Instance.shubiao ? "币" : "元");
topNomalProgress.fillAmount = (float) mHeartDate.hearts / wd.max; topNomalProgress.fillAmount = (float) mHeartDate.hearts / wd.max;
topNomalProgressTv.text = ""+ mHeartDate.hearts+"/" +wd.max; topNomalProgressTv.text = ""+ mHeartDate.hearts+"/" +wd.max;
...@@ -339,5 +343,28 @@ public class WithdrawalEveryDayControl : MonoBehaviour ...@@ -339,5 +343,28 @@ public class WithdrawalEveryDayControl : MonoBehaviour
playerObj.SetActive(isShow); playerObj.SetActive(isShow);
} }
#if UNITY_IOS
// 判断是否是刘海屏
private static bool isX;
public static bool IsX
{
get => isX = !(Screen.width == 750 && Screen.height == 1334) && !(Screen.width == 1242 && Screen.height == 2208) && !(Screen.width == 640 && Screen.height == 1136) && !(Screen.width == 1080 && Screen.height == 1920);
set => isX = value;
}
/// <summary>
/// 适配位置
/// </summary>
private void fitFrame()
{
if (IsX)
{
transform.Find("WithdawalEveryDay").DOLocalMoveY(-45, 0);
transform.Find("Scroll View").localPosition = new Vector2(transform.Find("Scroll View").localPosition.x, transform.Find("Scroll View").localPosition.y - 45);
}
}
#endif
} }
...@@ -95,7 +95,7 @@ public class EveryRewardControl : MonoBehaviour ...@@ -95,7 +95,7 @@ public class EveryRewardControl : MonoBehaviour
if (null != result) if (null != result)
{ {
//bottomPassText.text = result.cash + "元"; //bottomPassText.text = result.cash + "元";
bottomPassText.text = result.cash + (Constant.Instance.shubiao ? "币" : "元"); bottomPassText.text = result.cash + (!Constant.Instance.shubiao ? "币" : "元");
bottomPassPbLevel.text = result.now + "棵"; bottomPassPbLevel.text = result.now + "棵";
bottomPassPb.fillAmount = (float)Math.Round(((decimal)result.now / result.max), 2); bottomPassPb.fillAmount = (float)Math.Round(((decimal)result.now / result.max), 2);
......
...@@ -14,7 +14,7 @@ public class EverydayRewardItemControl : MonoBehaviour ...@@ -14,7 +14,7 @@ public class EverydayRewardItemControl : MonoBehaviour
public void updateData(EverydayRewardData.Reward data) public void updateData(EverydayRewardData.Reward data)
{ {
//everydayRewardNumber.text = Math.Round(((decimal)data.cash / 100), 2) + "元"; //everydayRewardNumber.text = Math.Round(((decimal)data.cash / 100), 2) + "元";
everydayRewardNumber.text = Math.Round(((decimal)data.cash / 100), 2) + (Constant.Instance.shubiao ? "币" : "元"); everydayRewardNumber.text = Math.Round(((decimal)data.cash / 100), 2) + (!Constant.Instance.shubiao ? "币" : "元");
everydayRewardContentText.text = data.title; everydayRewardContentText.text = data.title;
everydayRewardPbText.text = Math.Round(((decimal)data.now / data.max), 3) * 100 + "%"; everydayRewardPbText.text = Math.Round(((decimal)data.now / data.max), 3) * 100 + "%";
......
...@@ -223,7 +223,7 @@ public class LottlyControl : MonoBehaviour ...@@ -223,7 +223,7 @@ public class LottlyControl : MonoBehaviour
else else
{ {
//GameObject.Find("Dialog").GetComponent<DialogControl>().showHappyGetDialog(awardNum.ToString()+"元"); //GameObject.Find("Dialog").GetComponent<DialogControl>().showHappyGetDialog(awardNum.ToString()+"元");
GameObject.Find("Dialog").GetComponent<DialogControl>().showHappyGetDialog(awardNum.ToString() + (Constant.Instance.shubiao ? "币" : "元")); GameObject.Find("Dialog").GetComponent<DialogControl>().showHappyGetDialog(awardNum.ToString() + (!Constant.Instance.shubiao ? "币" : "元"));
} }
// GameObject.FindWithTag("MainCamera").SendMessage("turanRedPack", turn); // GameObject.FindWithTag("MainCamera").SendMessage("turanRedPack", turn);
......
...@@ -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: 5adc50d8dba6d489fb252faa618e1073, type: 3} m_Sprite: {fileID: 21300000, guid: 354f3646ee72b417eb1bbc40e7f70be3, type: 3}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
...@@ -3297,18 +3297,9 @@ MonoBehaviour: ...@@ -3297,18 +3297,9 @@ MonoBehaviour:
m_GameObject: {fileID: 6886931801841547695} m_GameObject: {fileID: 6886931801841547695}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d14f2a2eb002b4069ae29bda900b8d08, type: 3} m_Script: {fileID: 11500000, guid: 16e7b7746fe994186af56db1475c0fae, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
onLogin:
m_PersistentCalls:
m_Calls: []
onCredentialState:
m_PersistentCalls:
m_Calls: []
onError:
m_PersistentCalls:
m_Calls: []
--- !u!222 &6886931802155640432 --- !u!222 &6886931802155640432
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -3542,8 +3533,8 @@ MonoBehaviour: ...@@ -3542,8 +3533,8 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 0} - m_Target: {fileID: 6886931801841547696}
m_MethodName: OnClickPrivacyPolicy m_MethodName: DidSelectedYSZCButton
m_Mode: 1 m_Mode: 1
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}
...@@ -3637,8 +3628,8 @@ MonoBehaviour: ...@@ -3637,8 +3628,8 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 0} - m_Target: {fileID: 6886931801841547696}
m_MethodName: OnClickUserAgreement m_MethodName: DidSelectedYHXYButton
m_Mode: 1 m_Mode: 1
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}
......
...@@ -86,7 +86,7 @@ char* MakeStringCopy(const char* string){ ...@@ -86,7 +86,7 @@ char* MakeStringCopy(const char* string){
//信息提示 //信息提示
void OnShowMessage(const char* msg) void OnShowMessage(const char* msg)
{ {
UnitySendMessage("LoginView", "LoginCallBack", MakeStringCopy(msg)); UnitySendMessage("WxLogin", "LoginCallBack", MakeStringCopy(msg));
} }
void OnShareShowMessage(const char* msg) void OnShareShowMessage(const char* msg)
{ {
......
#import <Foundation/Foundation.h>
#import <AuthenticationServices/AuthenticationServices.h>
#if TARGET_OS_TV || TARGET_OS_IOS
#import "UnityAppController.h"
#endif
struct UserInfo
{
const char * userId;
const char * email;
const char * displayName;
const char * idToken;
const char * error;
ASUserDetectionStatus userDetectionStatus;
};
typedef void (*SignInWithAppleCallback)(int result, struct UserInfo s1);
typedef void (*CredentialStateCallback)(ASAuthorizationAppleIDProviderCredentialState state);
@interface UnitySignInWithApple : NSObject<ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding>
@property (nonatomic) SignInWithAppleCallback loginCallback;
@property (nonatomic) CredentialStateCallback credentialStateCallback;
@end
static UnitySignInWithApple* _unitySignInWithAppleInstance;
@implementation UnitySignInWithApple
{
ASAuthorizationAppleIDRequest* request;
}
+(UnitySignInWithApple*)instance
{
if (_unitySignInWithAppleInstance == nil)
_unitySignInWithAppleInstance = [[UnitySignInWithApple alloc] init];
return _unitySignInWithAppleInstance;
}
-(void)startRequest
{
if (@available(iOS 13.0, tvOS 13.0, macOS 10.15, *)) {
ASAuthorizationAppleIDProvider* provider = [[ASAuthorizationAppleIDProvider alloc] init];
request = [provider createRequest];
[request setRequestedScopes: @[ASAuthorizationScopeEmail, ASAuthorizationScopeFullName]];
ASAuthorizationController* controller = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]];
controller.delegate = self;
controller.presentationContextProvider = self;
[controller performRequests];
} else {
// Fallback on earlier versions
}
}
- (void)getCredentialState:(NSString *)userID
{
ASAuthorizationAppleIDProvider* provider = [[ASAuthorizationAppleIDProvider alloc] init];
[provider getCredentialStateForUserID:userID
completion:^(ASAuthorizationAppleIDProviderCredentialState credentialState, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
self.credentialStateCallback(credentialState);
});
}];
}
-(ASPresentationAnchor)presentationAnchorForAuthorizationController:(ASAuthorizationController *)controller
{
#if TARGET_OS_TV || TARGET_OS_IOS
return _UnityAppController.window;
#else
return [[NSApplication sharedApplication] mainWindow];
#endif
}
-(void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization
{
if (self.loginCallback)
{
struct UserInfo data;
if (@available(iOS 13.0, tvOS 13.0, macOS 10.15, *)) {
ASAuthorizationAppleIDCredential* credential = (ASAuthorizationAppleIDCredential*)authorization.credential;
NSString* idToken = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding];
NSPersonNameComponents* name = credential.fullName;
data.idToken = [idToken UTF8String];
data.displayName = [[NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:name
style:NSPersonNameComponentsFormatterStyleDefault
options:0] UTF8String];
// Email gets treated a little differently. Rather than an empty string it will return nil for no value.
data.email = credential.email == nil ? "" : [credential.email UTF8String];
data.userId = [credential.user UTF8String];
data.userDetectionStatus = credential.realUserStatus;
data.error = "";
self.loginCallback(1, data);
} else {
// Fallback on earlier versions
}
}
}
-(void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error
{
if (self.loginCallback)
{
// All members need to be set to a non-null value.
struct UserInfo data;
data.idToken = "";
data.displayName = "";
data.email = "";
data.userId = "";
data.userDetectionStatus = 1;
data.error = [error.localizedDescription UTF8String];
self.loginCallback(0, data);
}
}
@end
void UnitySignInWithApple_Login(SignInWithAppleCallback callback)
{
if (@available(iOS 13.0, tvOS 13.0, macOS 10.15, *)) {
UnitySignInWithApple* login = [UnitySignInWithApple instance];
login.loginCallback = callback;
[login startRequest];
} else {
// Fallback on earlier versions
}
}
void UnitySignInWithApple_GetCredentialState(const char *userID, CredentialStateCallback callback)
{
if (@available(iOS 13.0, tvOS 13.0, macOS 10.15, *)) {
UnitySignInWithApple* login = [UnitySignInWithApple instance];
login.credentialStateCallback = callback;
[login getCredentialState: [NSString stringWithUTF8String: userID]];
} else {
// Fallback on earlier versions
}
}
fileFormatVersion: 2
guid: 81f60b393d9a64277b6f8db14ce0c4b5
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
...@@ -33,7 +33,7 @@ public class InitProject : MonoBehaviour ...@@ -33,7 +33,7 @@ public class InitProject : MonoBehaviour
#if !UNITY_EDITOR && UNITY_IOS #if !UNITY_EDITOR && UNITY_IOS
// 初始化友盟sdk // 初始化友盟sdk
InitUMSDK("60a370fb53b6726499028a50"); InitUMSDK(Constant.Instance.UM_ID);
#endif #endif
} }
...@@ -69,19 +69,37 @@ public class InitProject : MonoBehaviour ...@@ -69,19 +69,37 @@ public class InitProject : MonoBehaviour
//} //}
} }
#if UNITY_IOS
/// <summary>
/// 显示iOS网页方法
/// </summary>
/// <param name="urlStr"></param>
/// <param name="titleStr"></param>
[DllImport("__Internal")]
private static extern void ShowIOSWebView(string urlStr, string titleStr);
#endif
/// <summary> /// <summary>
/// 隐私政策 /// 隐私政策
/// </summary> /// </summary>
public void OnClickYsxy() public void OnClickYsxy()
{ {
CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.PrivacyPolicy, "隐私政策"); #if UNITY_IOS
ShowIOSWebView(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私政策");
#elif UNITY_ANDROID
CallLocalFunUtil.Instance.OpenWebPage(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私政策");
#endif
} }
/// <summary> /// <summary>
/// 用户协议 /// 用户协议
/// </summary> /// </summary>
public void OnClickUser() public void OnClickUser()
{ {
#if UNITY_IOS
ShowIOSWebView(Constant.Instance.UserAgreement, "用户协议");
#elif UNITY_ANDROID
CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.UserAgreement, "用户协议"); CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.UserAgreement, "用户协议");
#endif
} }
/// <summary> /// <summary>
......
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using AOT;
using UnityEngine.Events;
namespace UnityEngine.SignInWithApple
{
public enum UserDetectionStatus
{
LikelyReal,
Unknown,
Unsupported
}
public enum UserCredentialState
{
Revoked,
Authorized,
NotFound
}
public struct UserInfo
{
public string userId;
public string email;
public string displayName;
public string idToken;
public string error;
public UserDetectionStatus userDetectionStatus;
}
[Serializable]
public class SignInWithAppleEvent : UnityEvent<SignInWithApple.CallbackArgs>
{
}
public class SignInWithApple : MonoBehaviour
{
private static Callback s_LoginCompletedCallback;
private static Callback s_CredentialStateCallback;
private static readonly Queue<Action> s_EventQueue = new Queue<Action>();
public static SignInWithApple Instance;
private void Awake()
{
Instance = this;
}
public struct CallbackArgs
{
/// <summary>
/// The state of the user's authorization.
/// </summary>
public UserCredentialState credentialState;
/// <summary>
/// The logged in user info after the call is done.
/// </summary>
public UserInfo userInfo;
/// <summary>
/// Whether the call ends up with an error.
/// </summary>
public string error;
}
public delegate void Callback(CallbackArgs args);
private delegate void LoginCompleted(int result, UserInfo info);
[MonoPInvokeCallback(typeof(LoginCompleted))]
private static void LoginCompletedCallback(int result, [MarshalAs(UnmanagedType.Struct)]UserInfo info)
{
var args = new CallbackArgs();
if (result != 0)
{
args.userInfo = new UserInfo
{
idToken = info.idToken,
displayName = info.displayName,
email = info.email,
userId = info.userId,
userDetectionStatus = info.userDetectionStatus
};
}
else
{
args.error = info.error;
}
s_LoginCompletedCallback(args);
s_LoginCompletedCallback = null;
}
private delegate void GetCredentialStateCompleted(UserCredentialState state);
[MonoPInvokeCallback(typeof(GetCredentialStateCompleted))]
private static void GetCredentialStateCallback([MarshalAs(UnmanagedType.SysInt)]UserCredentialState state)
{
var args = new CallbackArgs
{
credentialState = state
};
s_CredentialStateCallback(args);
s_CredentialStateCallback = null;
}
#region events
[Header("Event fired when login is complete.")]
public SignInWithAppleEvent onLogin;
[Header("Event fired when the users credential state has been retrieved.")]
public SignInWithAppleEvent onCredentialState;
[Header("Event fired when there is an error.")]
public SignInWithAppleEvent onError;
#endregion
/// <summary>
/// Get credential state and trigger onCredentialState or onError event when action is completed.
/// </summary>
/// <param name="userID">The user id to query the credential state on.</param>
public void GetCredentialState(string userID)
{
GetCredentialState(userID, TriggerCredentialStateEvent);
}
/// <summary>
/// Invoke login and provide a custom callback when action is completed.
/// When a custom trigger is used, the onCredentialState or onError unity event won't trigger.
/// </summary>
/// <param name="userID">The user id to query the credential state on.</param>
/// <param name="callback">The custom callback to trigger when action is completed.</param>
public void GetCredentialState(string userID, Callback callback)
{
if (userID == null)
throw new InvalidOperationException("Credential state fetch called without a user id.");
if (s_CredentialStateCallback != null)
throw new InvalidOperationException("Credential state fetch called while another request is in progress");
s_CredentialStateCallback = callback;
GetCredentialStateInternal(userID);
}
private void GetCredentialStateInternal(string userID)
{
#if (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) && !UNITY_EDITOR
IntPtr cback = IntPtr.Zero;
GetCredentialStateCompleted d = GetCredentialStateCallback;
cback = Marshal.GetFunctionPointerForDelegate(d);
UnitySignInWithApple_GetCredentialState(userID, cback);
#endif
}
/// <summary>
/// Invoke login and trigger onLogin or onError event when login is completed.
/// </summary>
public void Login()
{
Login(TriggerOnLoginEvent);
}
/// <summary>
/// Invoke login and provide a custom callback when login is completed.
/// When a custom trigger is used, the onLogin or onError unity event won't trigger.
/// </summary>
/// <param name="callback">The custom callback to trigger when login is completed.</param>
public void Login(Callback callback)
{
if (s_LoginCompletedCallback != null)
throw new InvalidOperationException("Login called while another login is in progress");
s_LoginCompletedCallback = callback;
LoginInternal();
}
private void LoginInternal()
{
#if (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) && !UNITY_EDITOR
IntPtr cback = IntPtr.Zero;
LoginCompleted d = LoginCompletedCallback;
cback = Marshal.GetFunctionPointerForDelegate(d);
UnitySignInWithApple_Login(cback);
#endif
}
private void TriggerOnLoginEvent(CallbackArgs args)
{
if (args.error != null)
{
TriggerOnErrorEvent(args);
return;
}
s_EventQueue.Enqueue(delegate
{
if (onLogin != null)
onLogin.Invoke(args);
});
}
private void TriggerCredentialStateEvent(CallbackArgs args)
{
if (args.error != null)
{
TriggerOnErrorEvent(args);
return;
}
s_EventQueue.Enqueue(delegate
{
if (onCredentialState != null)
onCredentialState.Invoke(args);
});
}
private void TriggerOnErrorEvent(CallbackArgs args)
{
s_EventQueue.Enqueue(delegate
{
if (onError != null)
onError.Invoke(args);
});
}
public void Update()
{
while (s_EventQueue.Count > 0)
{
s_EventQueue.Dequeue().Invoke();
}
}
#region Native Hooks
#if (UNITY_IOS || UNITY_TVOS) && !UNITY_EDITOR
[DllImport("__Internal")]
private static extern void UnitySignInWithApple_Login(IntPtr callback);
[DllImport("__Internal")]
private static extern void UnitySignInWithApple_GetCredentialState(string userID, IntPtr callback);
#elif UNITY_STANDALONE_OSX && !UNITY_EDITOR
[DllImport("UnitySignInWithApple")]
private static extern void UnitySignInWithApple_Login(IntPtr callback);
[DllImport("UnitySignInWithApple")]
private static extern void UnitySignInWithApple_GetCredentialState(string userID, IntPtr callback);
#endif
#endregion
}
}
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
/// <summary>
/// 登录页面
/// </summary>
public class LoginView : MonoBehaviour
{
//public GameObject Apple;
private void OnEnable()
{
//#if UNITY_IOS
// Apple.SetActive(!Constant.Instance.shubiao);
//#endif
}
#if UNITY_IOS
/// <summary>
/// 显示iOS网页方法
/// </summary>
/// <param name="urlStr"></param>
/// <param name="titleStr"></param>
[DllImport("__Internal")]
private static extern void ShowIOSWebView(string urlStr, string titleStr);
#endif
/// <summary>
/// 隐私政策按钮点击事件
/// </summary>
public void DidSelectedYSZCButton()
{
#if UNITY_IOS
ShowIOSWebView(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私政策");
#elif UNITY_ANDROID
CallLocalFunUtil.Instance.OpenWebPage(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私政策");
#endif
}
/// <summary>
/// 用户协议按钮点击事件
/// </summary>
public void DidSelectedYHXYButton()
{
#if UNITY_IOS
ShowIOSWebView(Constant.Instance.UserAgreement, "用户协议");
#elif UNITY_ANDROID
CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.UserAgreement, "用户协议");
#endif
}
/// <summary>
/// iOS微信登录回调
/// </summary>
/// <param name="msg"></param>
public void LoginCallBack(string msg)
{
Debug.Log("微信登录的回调在这里: " + msg);
// 051AdH000dJnkL1KyK300KeBye2AdH0d
WxLoginUtil.Instance.BingWxLogin(msg);
}
}
fileFormatVersion: 2
guid: 16e7b7746fe994186af56db1475c0fae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -26,11 +26,6 @@ public class Splash : MonoBehaviour ...@@ -26,11 +26,6 @@ public class Splash : MonoBehaviour
/// </summary> /// </summary>
// public GameObject LoginView; // public GameObject LoginView;
#if !UNITY_EDITOR && UNITY_IOS
[DllImport("__Internal")]
public static extern void ReSendIDFA(); // ios 发送idfa
#endif
/// <summary> /// <summary>
/// 请求权限 /// 请求权限
/// </summary> /// </summary>
...@@ -52,7 +47,11 @@ public class Splash : MonoBehaviour ...@@ -52,7 +47,11 @@ public class Splash : MonoBehaviour
private void OnEnable() private void OnEnable()
{ {
#if !UNITY_EDITOR && UNITY_IOS #if !UNITY_EDITOR && UNITY_IOS
ReSendIDFA(); if (Constant.Instance.idfa == null)
{
Debug.Log("重新获取idfa");
iOSHander.Instance.Handler();
}
#endif #endif
} }
...@@ -86,7 +85,7 @@ public class Splash : MonoBehaviour ...@@ -86,7 +85,7 @@ public class Splash : MonoBehaviour
{ {
Constant.Instance.shubiao = false; Constant.Instance.shubiao = false;
} }
//UserInfoManager.Instance().shubiao = 1; //Constant.Instance.shubiao = true;
novelInfo(); novelInfo();
}), new Action<string, string>((code, errMsg) => }), new Action<string, string>((code, errMsg) =>
{ {
...@@ -227,6 +226,44 @@ public class Splash : MonoBehaviour ...@@ -227,6 +226,44 @@ public class Splash : MonoBehaviour
{ {
yield return null; yield return null;
#if UNITY_IOS
if (AppConfig.Instance.getToken().Equals(""))
{
if (!Constant.Instance.shubiao)
{
DeviceLogin();
}
else
{
EventUtils.OnEvent("wx_page_show");
//显示微信登录页面
WeChatLoginBtn.SetActive(true);
}
}
else
{
if (!Constant.Instance.shubiao)
{
IsJump = true;
}
else
{
if (PlayerPrefs.GetInt("didWxLogin") == 1)
{
IsJump = true;
}
else
{
EventUtils.OnEvent("wx_page_show");
//显示微信登录页面
WeChatLoginBtn.SetActive(true);
}
}
}
#else
if (AppConfig.Instance.getToken().Equals("")) if (AppConfig.Instance.getToken().Equals(""))
{ {
//显示微信登录页面 //显示微信登录页面
...@@ -240,6 +277,8 @@ public class Splash : MonoBehaviour ...@@ -240,6 +277,8 @@ public class Splash : MonoBehaviour
{ {
IsJump = true; IsJump = true;
} }
#endif
} }
////点击微信登录 ////点击微信登录
...@@ -268,6 +307,24 @@ public class Splash : MonoBehaviour ...@@ -268,6 +307,24 @@ public class Splash : MonoBehaviour
})); }));
} }
public void DeviceLogin()
{
WxLoginUtil.Instance.DeviceLogin(new Action<bool>((loginResult) =>
{
// 登录成功
if (loginResult)
{
IsJump = true;
}
// 登录失败
else
{
ToastPlugin.ToastHelper.ShowToast("登录失败");
}
}));
}
private static bool IsJump = false; private static bool IsJump = false;
private AsyncOperation async = null; private AsyncOperation async = null;
...@@ -298,19 +355,32 @@ public class Splash : MonoBehaviour ...@@ -298,19 +355,32 @@ public class Splash : MonoBehaviour
} }
} }
#if UNITY_IOS
[DllImport("__Internal")]
private static extern void ShowIOSWebView(string urlStr, string titleStr);
#endif
/// <summary> /// <summary>
/// 隐私政策 /// 隐私政策
/// </summary> /// </summary>
public void OnClickYsxy() public void OnClickYsxy()
{ {
CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.PrivacyPolicy, "隐私政策"); #if UNITY_IOS
ShowIOSWebView(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私政策");
#elif UNITY_ANDROID
CallLocalFunUtil.Instance.OpenWebPage(PlayerDataControl.Instance.PrivacyPolicyUrl, "隐私政策");
#endif
} }
/// <summary> /// <summary>
/// 用户协议 /// 用户协议
/// </summary> /// </summary>
public void OnClickUser() public void OnClickUser()
{ {
#if UNITY_IOS
ShowIOSWebView(Constant.Instance.UserAgreement, "用户协议");
#elif UNITY_ANDROID
CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.UserAgreement, "用户协议"); CallingNativeMethods.Instance.OpenWebPage(Constant.Instance.UserAgreement, "用户协议");
#endif
} }
} }
\ No newline at end of file
...@@ -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}
......
...@@ -41,12 +41,6 @@ PlayerSettings: ...@@ -41,12 +41,6 @@ PlayerSettings:
height: 1 height: 1
m_SplashScreenLogos: [] m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0} m_VirtualRealitySplashScreen: {fileID: 0}
m_ShowUnitySplashAds: 0
m_AdsAndroidGameId:
m_AdsIosGameId:
m_ShowSplashAdsSlogan: 0
m_SloganImage: {fileID: 0}
m_SloganHeight: 150
m_HolographicTrackingLossScreen: {fileID: 0} m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1024 defaultScreenWidth: 1024
defaultScreenHeight: 768 defaultScreenHeight: 768
...@@ -124,7 +118,6 @@ PlayerSettings: ...@@ -124,7 +118,6 @@ PlayerSettings:
vulkanNumSwapchainBuffers: 3 vulkanNumSwapchainBuffers: 3
vulkanEnableSetSRGBWrite: 0 vulkanEnableSetSRGBWrite: 0
vulkanEnableLateAcquireNextImage: 0 vulkanEnableLateAcquireNextImage: 0
useSecurityBuild: 0
m_SupportedAspectRatios: m_SupportedAspectRatios:
4:3: 1 4:3: 1
5:4: 1 5:4: 1
...@@ -277,7 +270,7 @@ PlayerSettings: ...@@ -277,7 +270,7 @@ PlayerSettings:
- m_BuildTarget: - m_BuildTarget:
m_Icons: m_Icons:
- serializedVersion: 2 - serializedVersion: 2
m_Icon: {fileID: 2800000, guid: 5adc50d8dba6d489fb252faa618e1073, 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
...@@ -472,7 +465,6 @@ PlayerSettings: ...@@ -472,7 +465,6 @@ PlayerSettings:
m_Kind: 4 m_Kind: 4
m_SubKind: App Store m_SubKind: App Store
m_BuildTargetBatching: [] m_BuildTargetBatching: []
m_BuildTargetEncrypting: []
m_BuildTargetGraphicsJobs: m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport - m_BuildTarget: MacStandaloneSupport
m_GraphicsJobs: 0 m_GraphicsJobs: 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