Browse Source

修改支付界面

liuqilin 7 years ago
parent
commit
3eca0fd7e9

+ 1 - 1
Assets/PayTest.cs

@@ -11,7 +11,7 @@ public class PayTest : MonoBehaviour
 
     public void Test()
     {
-        GetAlipayProductID("com.dashgame.garden.packfresh", (pid) =>
+        GetAlipayProductID("com.dashgame.garden.test01", (pid) =>
         {
             Debug.Log(pid);
             AliplayManager.Instance.Init();

+ 4 - 4
Assets/Resource/Prefab/PrefabUI/Canvas.prefab

@@ -20060,12 +20060,12 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   m_Padding:
-    m_Left: 0
+    m_Left: 22
     m_Right: 0
     m_Top: 0
     m_Bottom: 0
   m_ChildAlignment: 4
-  m_Spacing: 30
+  m_Spacing: 50
   m_ChildForceExpandWidth: 0
   m_ChildForceExpandHeight: 0
   m_ChildControlWidth: 0
@@ -81335,7 +81335,7 @@ RectTransform:
   m_PrefabInternal: {fileID: 100100000}
   m_GameObject: {fileID: 1256794080428206}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: 13.249908, y: -101.7, z: 0}
+  m_LocalPosition: {x: 13.249908, y: -74.3, z: 0}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 224941351126121354}
@@ -81343,7 +81343,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
   m_AnchorMax: {x: 0.5, y: 0.5}
-  m_AnchoredPosition: {x: 13.24991, y: -101.7}
+  m_AnchoredPosition: {x: 13.24991, y: -74.3}
   m_SizeDelta: {x: 195, y: 36}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!224 &224582533626079780

+ 1 - 1
Assets/Resource/Shader/GrayMat.mat

@@ -8,7 +8,7 @@ Material:
   m_PrefabInternal: {fileID: 0}
   m_Name: GrayMat
   m_Shader: {fileID: 4800000, guid: ac390d8200b91bd419e2d7b9e580d07d, type: 3}
-  m_ShaderKeywords: _EMISSION
+  m_ShaderKeywords: UNITY_UI_CLIP_RECT _EMISSION
   m_LightmapFlags: 1
   m_EnableInstancingVariants: 0
   m_DoubleSidedGI: 0

+ 1 - 1
Assets/Resource/XML/PlayerConfig.xml

@@ -1,5 +1,5 @@
 <PlayerConfig>
-  <Version value="34" />
+  <Version value="35" />
   <ReplayVersion value="1" />
   
   <ID value="Default" />

+ 20 - 0
Assets/Script/Manage/ConfigManager.cs

@@ -1526,6 +1526,13 @@ public class ConfigManager : Regist
             ToVersion34(nativeDoc, defaultDoc);
         }
 
+        if (nativeVersion < 35)
+        {
+            Debug.LogWarning("UpdateArchive to 35");
+
+            ToVersion35(nativeDoc, defaultDoc);
+        }
+
         return nativeDoc;
     }
 
@@ -2022,4 +2029,17 @@ public class ConfigManager : Regist
 
         return nativeDoc;
     }
+
+    public static XmlDocument ToVersion35(XmlDocument nativeDoc, XmlDocument defaultDoc)
+    {
+        nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 35.ToString();
+
+        string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
+        if (Directory.Exists(persistentFolderPath))
+        {
+            Directory.Delete(persistentFolderPath, true);
+        }
+
+        return nativeDoc;
+    }
 }

+ 2 - 4
Assets/Script/Manage/IAPManager.cs

@@ -306,8 +306,7 @@ public class IAPManager : MonoBehaviour, IStoreListener
         {
             HttpManager.GetAlipayProductID
             (
-                //ProductIdDictionary[str],
-                "com.dashgame.garden.test01",
+                ProductIdDictionary[str],
                 data =>
                 {
                     AliplayManager.Instance.Pay(data, str);
@@ -318,8 +317,7 @@ public class IAPManager : MonoBehaviour, IStoreListener
         {
             HttpManager.GetWXPayProductID
             (
-                //ProductIdDictionary[str],
-                "com.dashgame.garden.test01",
+                ProductIdDictionary[str],
                 data =>
                 {
                     WXPayManager.Pay(data, str);

+ 44 - 30
Assets/Script/ThirdParty/Alipay/AlipayManager.cs

@@ -1,3 +1,4 @@
+using System;
 using UnityEngine;
 
 using System.IO;
@@ -17,7 +18,8 @@ public class AliplayManager : UnitySingleton<AliplayManager>
 	//private static extern void aliPay(string orderInfo, string gameObjectName);  
 #endif
 
-    private Dictionary<string, string> PackNameDic = new Dictionary<string, string>();
+    private string packName;
+    //private Dictionary<string, string> PackNameDic = new Dictionary<string, string>();
 
 	public void Init()
 	{
@@ -38,7 +40,8 @@ public class AliplayManager : UnitySingleton<AliplayManager>
 
         id = id.Substring(index);
 
-        PackNameDic.Add(Regex.Match(WWW.UnEscapeURL(id), "out_trade_no.*total_amount").Value, packName);
+	    this.packName = packName;
+        //PackNameDic.Add(Regex.Match(WWW.UnEscapeURL(id), "out_trade_no.*total_amount").Value, packName);
 
 #if UNITY_ANDROID
 		
@@ -54,41 +57,52 @@ public class AliplayManager : UnitySingleton<AliplayManager>
 
     public void OnPayResult(string result)
 	{
-		//if result=9000 means pay success;
-
-        if (int.Parse(result.Split('|')[0]) == 9000)
+        if (result.Split('|')[0] =="9000")
+        {
+            IAPManager.BuyProductCallbackDictionary[packName].Invoke();
+            PayCard.Hide();
+        }
+        else
         {
-            Bubble.Show(null, Language.GetStr(LanguageLabel.IAP__PurchaseSuccess));
+            Bubble.Show(null, Language.GetStr(LanguageLabel.IAP__PurchaseFail));
+            ResourceManager.Get<CanvasGroup>(CanvasLabel.AK_PayCard).interactable = true;
+        }
 
-            JsonData jsonData = JsonMapper.ToObject(result.Split('|')[1]);
+        //if result=9000 means pay success;
 
-            string out_trade_no = jsonData["alipay_trade_app_pay_response"]["out_trade_no"].ToString();
+        //if (int.Parse(result.Split('|')[0]) == 9000)
+        //{
+        //    Bubble.Show(null, Language.GetStr(LanguageLabel.IAP__PurchaseSuccess));
 
-            string key = "";
+        //    JsonData jsonData = JsonMapper.ToObject(result.Split('|')[1]);
 
-            string packName = "";
+        //    string out_trade_no = jsonData["alipay_trade_app_pay_response"]["out_trade_no"].ToString();
 
-            foreach (var kv in PackNameDic)
-            {
-                if (kv.Key.Contains(out_trade_no))
-                {
-                    key = kv.Key;
-                    packName = kv.Value;
-                }
-            }
+        //    string key = "";
 
-            if (!string.IsNullOrEmpty(packName))
-            {
-                PackNameDic.Remove(key);
+        //    string packName = "";
 
-                IAPManager.BuyProductCallbackDictionary[packName].Invoke();
-                PayCard.Hide();
-            }
-        }
-        else
-        {
-            Bubble.Show(null, Language.GetStr(LanguageLabel.IAP__PurchaseFail));
-            ResourceManager.Get<CanvasGroup>(CanvasLabel.AK_PayCard).interactable = true;
-        }
+        //    foreach (var kv in PackNameDic)
+        //    {
+        //        if (kv.Key.Contains(out_trade_no))
+        //        {
+        //            key = kv.Key;
+        //            packName = kv.Value;
+        //        }
+        //    }
+
+        //    if (!string.IsNullOrEmpty(packName))
+        //    {
+        //        PackNameDic.Remove(key);
+
+        //        IAPManager.BuyProductCallbackDictionary[packName].Invoke();
+        //        PayCard.Hide();
+        //    }
+        //}
+        //else
+        //{
+        //    Bubble.Show(null, Language.GetStr(LanguageLabel.IAP__PurchaseFail));
+        //    ResourceManager.Get<CanvasGroup>(CanvasLabel.AK_PayCard).interactable = true;
+        //}
     }
 }