123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace LoyalSoftSDK
- {
- public class SoftSDKInstance
- {
- private static SoftSDKInstance instance;
- public static SoftSDKInstance GetInstance()
- {
- if(instance==null)
- {
- instance = new SoftSDKInstance();
- }
- return instance;
- }
- public delegate void SoftCallBackHandler(string datat);
- public SoftCallBackHandler OnCallBackHandler;
- public const int PayPlugCode = 2;
- // public const string payWx = "http://120.26.46.141/official/pay/wxpay/pay.php";
- // public const string payZfb = "http://120.26.46.141/official/pay/alipay/pay.php";
- // public const string payWx = "115.159.121.129/TTTTTT/Gameserver/Amfphp/service_call/pay/official/wxpay/pay.php";
- // public const string payZfb = "115.159.121.129/TTTTTT/Gameserver/Amfphp/service_call/pay/official/alipay/pay.php";
- /// <summary>
- /// 是否外网, true:外网地址, false:内网地址(192.168.10.xx).
- /// </summary>
- public readonly static eNetType netType = eNetType.Online_dev;
- public readonly static string payWx = netType switch
- {
- eNetType.Online => "https://ylsjtt.game7000.com/ylsj2019/Gameserver/Amfphp/service_call/pay/official/wxpay/pay.php",
- _=> "https://ylsjtt.game7000.com/ylsj2019_dev/Gameserver/Amfphp/service_call/pay/official/wxpay/pay.php",
- };
- public readonly static string payZfb = netType switch
- {
- eNetType.Online => "https://ylsjtt.game7000.com/ylsj2019/Gameserver/Amfphp/service_call/pay/official/alipay/pay.php",
- _ => "https://ylsjtt.game7000.com/ylsj2019_dev/Gameserver/Amfphp/service_call/pay/official/alipay/pay.php"
- };
- // public readonly static string payWx =GlobalConfig.netType == eNetType.
- // }// = "";// "https://ylsjtt.game7000.com/ylsj2019/Gameserver/Amfphp/service_call/pay/official/wxpay/pay.php";//"115.159.121.129/TTTTTT/Gameserver/Amfphp/service_call/pay/official/wxpay/pay.php";
- // public const string payZfb = "";//"https://ylsjtt.game7000.com/ylsj2019/Gameserver/Amfphp/service_call/pay/official/alipay/pay.php";//"115.159.121.129/TTTTTT/Gameserver/Amfphp/service_call/pay/official/alipay/pay.php";
-
- // public const string payWxdev = "https://ylsjtt.game7000.com/ylsj2019_dev/Gameserver/Amfphp/service_call/pay/official/wxpay/pay.php";//"115.159.121.129/TTTTTT/Gameserver/Amfphp/service_call/pay/official/wxpay/pay.php";
-
- //public const string payZfbdev = "https://ylsjtt.game7000.com/ylsj2019_dev/Gameserver/Amfphp/service_call/pay/official/alipay/pay.php";//"115.159.121.129/TTTTTT/Gameserver/Amfphp/service_call/pay/official/alipay/pay.php";
- public void InitSDK(string appId)
- {
-
- if (appId.Equals("test"))
- {
- UIFormManager.GetInstance().InitCanvas();
- Dictionary<string, string> data = new Dictionary<string, string>();
- data.Add("action", "Init");
- data.Add("title", "初始化");
- //UIFormManager.GetInstance().ShowUIForm("TestPanel", null, data);
- }
- else
- {
- Dictionary<string, object> backData = new Dictionary<string, object>();
- if (UIFormManager.GetInstance().InitCanvas())
- {
- backData.Add("action", "initSuccees");
- backData.Add("data", "loyal");
- backData.Add("msg", "初始化成功");
- }
- else
- {
- backData.Add("action", "initFail");
- backData.Add("data", "loyal");
- backData.Add("msg", "初始化失败");
- }
- SendCallBackMsg(MiniJSON.Json.Serialize(backData));
- }
-
- }
- public void LoginSDK(bool autoLogin)
- {
- Dictionary<string, string> data = new Dictionary<string, string>();
- data.Add("action", "star");
- data.Add("autoLogin", autoLogin.ToString());
- UIFormManager.GetInstance().ShowUIForm("LoginPanel",null, data);
- }
- public void LogOutSDK()
- {
- if (UserManager.GetInstance().GetCurUser() == null) return;
- UserManager.GetInstance().SetSaveUserData(UserManager.GetInstance().GetCurUser().Account,"", UserManager.GetInstance().GetSaveUser().lastLoginTime);
- UserManager.GetInstance().ClearCurUser();
- UIFormManager.GetInstance().CloseUIForm("FloatPanel");
- Dictionary<string, object> backData = new Dictionary<string, object>();
- backData.Add("action", "logoutSuccees");
- backData.Add("data", "");
- backData.Add("msg", "登出成功");
- SendCallBackMsg(MiniJSON.Json.Serialize(backData));
- }
- public void ExitGame()
- {
- UIFormManager.GetInstance().OnEscape();
- // UIFormManager.GetInstance().ShowUIForm("ExitGamePanel", null, null);
- }
- public void SubmitData()
- {
- }
- public void Pay(string product_id, string product_name,string product_count,string product_price, string party_id, string party_name,
- string amount,string zoneid,string callbackInfo,string ageRange )
- {
- Debug.Log("install pay");
- Dictionary<string, string> data = new Dictionary<string, string>();
- data.Add("action", "pay");
- data.Add("product_id", product_id);
- data.Add("product_name", product_name);
- data.Add("product_count", product_count);
- data.Add("product_price", product_price);
- data.Add("party_id", party_id);
- data.Add("party_name", party_name);
- data.Add("ageRange ", ageRange);
- data.Add("amount", amount);
- data.Add("zoneid", zoneid);
- data.Add("callbackInfo", callbackInfo);
- if (!GlobalConfig.is_SandBox)
- {
- UIFormManager.GetInstance().ShowUIForm("PayPanel", null, data);
- }
- else
- {
- List<KeyValuePair<string, string>> listdata=new List<KeyValuePair<string, string>> ();
- //listdata.Add(new KeyValuePair<string, string>("action", "pay"));
- //listdata.Add(new KeyValuePair<string, string>("product_id", product_id));
- //listdata.Add(new KeyValuePair<string, string>("product_name", product_name));
- //listdata.Add(new KeyValuePair<string, string>("product_count", product_count));
- //listdata.Add(new KeyValuePair<string, string>("product_price", product_price));
- //listdata.Add(new KeyValuePair<string, string>("party_id", party_id));
- //listdata.Add(new KeyValuePair<string, string>("party_name", party_name));
- //listdata.Add(new KeyValuePair<string, string>("ageRange ", ageRange));
- //listdata.Add(new KeyValuePair<string, string>("amount", amount));
- //listdata.Add(new KeyValuePair<string, string>("zoneid", zoneid));
- //listdata.Add(new KeyValuePair<string, string>("callbackInfo", callbackInfo));
- //listdata.Add(new KeyValuePair<string, string>("accountId", UserProxy.Instance.player.uid));
- //listdata.Add(new KeyValuePair<string, string>("channel","soft"));
- listdata.Add(new KeyValuePair<string, string>("accountId", UserProxy.Instance.player.uid));
- listdata.Add(new KeyValuePair<string, string>("amount", amount));
- listdata.Add(new KeyValuePair<string, string>("channel", "soft"));
- listdata.Add(new KeyValuePair<string, string>("callbackInfo", callbackInfo));
- listdata.Add(new KeyValuePair<string, string>("zoneid", zoneid));
- listdata.Add(new KeyValuePair<string, string>("product_id", product_id));
- listdata.Add(new KeyValuePair<string, string>("product_name", product_name));
- listdata.Add(new KeyValuePair<string, string>("product_count", product_count));
- listdata.Add(new KeyValuePair<string, string>("product_price", product_price));
- listdata.Add(new KeyValuePair<string, string>("party_id", party_id));
- listdata.Add(new KeyValuePair<string, string>("party_name", party_name));
- listdata.Add(new KeyValuePair<string, string>("ageRange", "18"));
- FakePay(listdata);
-
- }
- }
- public void SetCallBack(SoftCallBackHandler callback)
- {
- OnCallBackHandler = callback;
- }
- public void SendCallBackMsg(string datat)
- {
- if(OnCallBackHandler!=null)
- {
- OnCallBackHandler.Invoke(datat);
- }
- }
- public void GetSoftPayBack(string jsonData)
- {
- Dictionary<string, string> data = new Dictionary<string, string>();
- data.Add("action", "paySult");
- UIFormManager.GetInstance().ShowUIForm("PayPanel", null, data);
- }
- public void SendtoPayPanl(string jsonData)
- {
- if(UIFormManager.GetInstance().paypanl==null)
- {
- Debug.LogError("确认打开过支付界面吗?");
- return;
- }
- UIFormManager.GetInstance().paypanl.GetPayResults(jsonData);
- }
- public void FakePay(List<KeyValuePair<string, string>> data)
- {
- ///测试待修改.这里要加.
- ///测试待修改.这里要加.
- ShopProxy.Instance.ImitateBuy(data, (s) =>
- {
- PayProxy.Instance.PayDeliverGoods(long.Parse(s.cpOrderId), (lst) =>
- {
- if (lst.Count > 0)
- {
- PanelHelper.Instance.ShowPanel("UI_ShopPrizesPanel", (panel) =>
- {
- PanelHelper.Instance.ClosePanel("UI_WaitingForPaySuccessWindow");
- UI_ShopPrizesPanel shopPrize = panel.GetComponent<UI_ShopPrizesPanel>();
- shopPrize.Init();
- shopPrize.Show(lst);
- });
- }
- else
- {
- PanelHelper.Instance.ClosePanel("UI_WaitingForPaySuccessWindow");
- UI_CueDialog.Instance().Open("交易完成");
- }
- Debug.Log("交易完成");
- });
- });
-
- }
- }
- }
|