fix:1、修复bug。2、添加跳转亚马逊。

This commit is contained in:
2026-07-08 15:36:17 +08:00
parent 3fd1e034c9
commit 8277a8e614
61 changed files with 77331 additions and 39566 deletions
+124 -124
View File
@@ -1,124 +1,124 @@
// using Gree.UnityWebView;
// using UnityEngine;
//
// public class FreeWebViewManager : MonoBehaviour
// {
// public static FreeWebViewManager Instance;
// private GameObject _webObj;
// private WebViewObject1 _webView;
//
// private void Awake()
// {
// if (Instance != null) Destroy(gameObject);
// else
// {
// Instance = this;
// DontDestroyOnLoad(gameObject);
// }
// }
//
// private void Start()
// {
// initView();
// }
//
// public void initView()
// {
// if (_webObj != null) return;
//
// // 创建WebView对象
// _webObj = new GameObject("WebViewObject1");
// _webView = _webObj.AddComponent<WebViewObject1>();
//
// // 关键:开启WKWebView,规避苹果审核拒绝
// _webView.Init(
// enableWKWebView: true,
// cb: OnWebMessage // JS调用Unity回调
// );
//
// float top_offset = 0;//fgui中的顶部信息的高度
// float buttom_offset = 155;
// if (Screen.safeArea.y != 0)
// {//刘海屏
// top_offset += Screen.safeArea.y;
// }
//
// // 铺满屏幕,适配刘海安全区
// _webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
// // 禁止下拉回弹(可选)
// _webView.SetScrollBounceEnabled(false);
//
// _webView.LoadURL("about:blank");
// _webView.SetVisibility(false);
//
// }
//
// /// <summary>
// /// 打开网页
// /// </summary>
// public void OpenWeb(string url)
// {
// // if (_webObj != null) return;
// //
// // // 创建WebView对象
// // _webObj = new GameObject("WebViewObject1");
// // _webView = _webObj.AddComponent<WebViewObject1>();
// //
// // // 关键:开启WKWebView,规避苹果审核拒绝
// // _webView.Init(
// // enableWKWebView: true,
// // cb: OnWebMessage // JS调用Unity回调
// // );
// //
// // float top_offset = 0;//fgui中的顶部信息的高度
// // float buttom_offset = 155;
// // if (Screen.safeArea.y != 0)
// // {//刘海屏
// // top_offset += Screen.safeArea.y;
// // }
// //
// // // 铺满屏幕,适配刘海安全区
// // _webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
// // // 禁止下拉回弹(可选)
// // _webView.SetScrollBounceEnabled(false);
// //
// // 加载网页并显示
// _webView.LoadURL(url);
// _webView.SetVisibility(true);
// }
//
// // JS向Unity发消息:window.unity.call("func","参数")
// void OnWebMessage(string msg)
// {
// Debug.Log("收到网页消息:" + msg);
// }
//
// // C#调用网页JS
// public void CallJs(string jsCode)
// {
// if (_webView != null)
// _webView.EvaluateJS(jsCode);
// }
//
// /// <summary>
// /// 关闭网页(必调用,释放原生资源)
// /// </summary>
// public void CloseWeb()
// {
// if (_webObj != null)
// {
// _webView.SetVisibility(false);
// }
// }
//
// private void OnDestroy()
// {
// if (_webObj != null)
// {
// _webView.SetVisibility(false);
// Destroy(_webObj);
// _webObj = null;
// _webView = null;
// }
// }
// }
using Gree.UnityWebView;
using UnityEngine;
public class FreeWebViewManager : MonoBehaviour
{
public static FreeWebViewManager Instance;
private GameObject _webObj;
private WebViewObject1 _webView;
private void Awake()
{
if (Instance != null) Destroy(gameObject);
else
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
}
private void Start()
{
initView();
}
public void initView()
{
if (_webObj != null) return;
// 创建WebView对象
_webObj = new GameObject("WebViewObject1");
_webView = _webObj.AddComponent<WebViewObject1>();
// 关键:开启WKWebView,规避苹果审核拒绝
_webView.Init(
enableWKWebView: true,
cb: OnWebMessage // JS调用Unity回调
);
float top_offset = 0;//fgui中的顶部信息的高度
float buttom_offset = 155;
if (Screen.safeArea.y != 0)
{//刘海屏
top_offset += Screen.safeArea.y;
}
// 铺满屏幕,适配刘海安全区
_webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
// 禁止下拉回弹(可选)
_webView.SetScrollBounceEnabled(false);
_webView.LoadURL("about:blank");
_webView.SetVisibility(false);
}
/// <summary>
/// 打开网页
/// </summary>
public void OpenWeb(string url)
{
// if (_webObj != null) return;
//
// // 创建WebView对象
// _webObj = new GameObject("WebViewObject1");
// _webView = _webObj.AddComponent<WebViewObject1>();
//
// // 关键:开启WKWebView,规避苹果审核拒绝
// _webView.Init(
// enableWKWebView: true,
// cb: OnWebMessage // JS调用Unity回调
// );
//
// float top_offset = 0;//fgui中的顶部信息的高度
// float buttom_offset = 155;
// if (Screen.safeArea.y != 0)
// {//刘海屏
// top_offset += Screen.safeArea.y;
// }
//
// // 铺满屏幕,适配刘海安全区
// _webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
// // 禁止下拉回弹(可选)
// _webView.SetScrollBounceEnabled(false);
//
// 加载网页并显示
_webView.LoadURL(url);
_webView.SetVisibility(true);
}
// JS向Unity发消息:window.unity.call("func","参数")
void OnWebMessage(string msg)
{
Debug.Log("收到网页消息:" + msg);
}
// C#调用网页JS
public void CallJs(string jsCode)
{
if (_webView != null)
_webView.EvaluateJS(jsCode);
}
/// <summary>
/// 关闭网页(必调用,释放原生资源)
/// </summary>
public void CloseWeb()
{
if (_webObj != null)
{
_webView.SetVisibility(false);
}
}
private void OnDestroy()
{
if (_webObj != null)
{
_webView.SetVisibility(false);
Destroy(_webObj);
_webObj = null;
_webView = null;
}
}
}
@@ -410,6 +410,7 @@ namespace ChillConnect
{
decimal coin = DataMgr.Ticket.Value;
coin *= (decimal)GameHelper.GetExchangeRateVo().Multi;
if (ui.com_money is com_money comMoney) comMoney.text_gold.text = coin.ToString("0.00");
}
@@ -600,7 +601,8 @@ namespace ChillConnect
{
if (ui.com_money is com_money btnMoney)
{
btnMoney.text_gold.text = DataMgr.Ticket.Value.ToString("0.00");
// btnMoney.text_gold.text = DataMgr.Ticket.Value.ToString("0.00");
Set102();
btnMoney.SetClick(PopMakeup);
}
}
@@ -233,7 +233,7 @@ namespace ChillConnect
}
}
ui.btn_gold.GetChild("text_gold").text = $"{DataMgr.Coin.Value:N0}";
ui.top_money.GetChild("text_gold").text = DataMgr.Ticket.Value.ToString();
ui.top_money.GetChild("text_gold").text = GameHelper.Get102Str(DataMgr.Ticket.Value);
ui.btn_mult.SetClick(() =>
{
if (!GameHelper.GetCloseResult())
@@ -309,7 +309,7 @@ namespace ChillConnect
{
curr_type = 102;
end_ = GameHelper.GetUICenterPosition(ui.top_money, true);
awardNum *= GameHelper.GetExchangeRateVo().Multi;
}
var rewardSingleData = new RewardSingleData(curr_type, (decimal)awardNum, RewardOrigin.Play)
{
+10
View File
@@ -39,6 +39,8 @@ namespace ChillConnect
protected override void OnClose()
{
FreeWebViewManager.Instance.CloseWeb();
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
GameDispatcher.Instance.Dispatch(GameMsg.showBroadCast);
@@ -55,9 +57,17 @@ namespace ChillConnect
private SDKOpenConfig _config;
protected override void OnOpenBefore(object args)
{
if (args is not SDKOpenConfig openConfig) return;
_config = openConfig;
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
// Debug.Log($"H5UI OpenBefore url: {_config.url} normal: {_config.normal}");
DOVirtual.DelayedCall(0.1f, () =>
{
FreeWebViewManager.Instance.OpenWeb(_config.url);
});
GameDispatcher.Instance.Dispatch(GameMsg.hideBroadCast);
@@ -1061,13 +1061,13 @@ namespace ChillConnect
ui.btn_contact_us.SetClick(() =>
{
// GameHelper.OpenEmail();
// SDKOpenConfig openConfig = new SDKOpenConfig
// {
// normal = false,
// url = vo.T_ShopURL
// };
//
// CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
SDKOpenConfig openConfig = new SDKOpenConfig
{
normal = false,
url = vo.T_ShopURL
};
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
CtrlCloseUI();
});
@@ -256,12 +256,12 @@ namespace ChillConnect
var pettyAmount = SaveData.GetSaveObject().PettyAmount;
if (pettyAmount != 0)
{
ui.com_detail.text_amount.SetVar("num", GameHelper.Get102Str(pettyAmount)).FlushVars();
ui.com_detail.text_amount.SetVar("num", $" {GameHelper.GetExchangeRateVo().Payicon}{GameHelper.Get102Str(pettyAmount)}").FlushVars();
}
else
{
var num = GameHelper.GetCommonModel().SmallReward;
ui.com_detail.text_amount.SetVar("num", GameHelper.Get102Str(num)).FlushVars();
ui.com_detail.text_amount.SetVar("num", $" {GameHelper.GetExchangeRateVo().Payicon}{GameHelper.Get102Str(num)}").FlushVars();
SaveData.GetSaveObject().PettyAmount = num;
}
@@ -64,7 +64,7 @@ namespace ChillConnect
var strings = ConfigSystem.GetConfig<CommonModel>().X_Redeemcode;
ui.lab_code.text = strings;
ui.text_rate.text = GameHelper.GetExchangeRateVo().Payicon + " 1";
ui.btn_copy.SetClick(() =>
{
GameHelper.CopyText(ui.lab_code.text);
@@ -72,13 +72,13 @@ namespace ChillConnect
ui.btn_contact_us.SetClick(() =>
{
// SDKOpenConfig openConfig = new SDKOpenConfig
// {
// normal = false,
// url = ConfigSystem.GetConfig<CommonModel>().X_ShopURL
// };
//
// CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb, openConfig);
SDKOpenConfig openConfig = new SDKOpenConfig
{
normal = false,
url = ConfigSystem.GetConfig<CommonModel>().X_ShopURL
};
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb, openConfig);
CtrlCloseUI();
});
@@ -158,13 +158,14 @@ namespace ChillConnect
private void InitView()
{
Makeup_2 makeupVo = ConfigSystem.GetConfig<MakeupModel_2>().GetData(makeupTaskData.tableId);
ui.text_ad.text = string.Format(GameHelper.getDesByKey("saving_pot_5"), makeupVo.ADIncrease * GameHelper.GetExchangeRateVo().Multi);
ui.text_ad.text = string.Format(GameHelper.getDesByKey("saving_pot_5"),
SaveingPotHelper.getChNumber(makeupVo.ADIncrease * GameHelper.GetExchangeRateVo().Multi));
string str = string.Format(GameHelper.getDesByKey("saving_pot_2"), makeupVo.PayIncrease);
ui.text_pay.text = str;
initTop();
ske_pot.SetActive(false);
string val = $"{SaveData.GetSaveObject().saveingpot_ch:N}";
string val = $"{SaveingPotHelper.getChNumber(SaveData.GetSaveObject().saveingpot_ch):N}";
ui.text_lose.SetVar("num", val).FlushVars();
// ui.text_lose.text = string.Format(ui.text_lose.text, SaveingPotHelper.getChString(SaveData.GetSaveObject().saveingpot_ch));
if (makeupTaskData.needShowAni)
@@ -194,6 +195,7 @@ namespace ChillConnect
btnWatchad.can_buy.selectedIndex = 1;
btnWatchad.btn_text.text = CommonHelper.TimeFormat(SaveData.GetSaveObject()._watch_ad_cd - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour);
InitView();
HallManager.Instance.UpdateSecondEvent += upLvWatchAdsBtn;
}
});
});
@@ -203,6 +205,7 @@ namespace ChillConnect
btn_watchAd btnWatchad = ui.btn_ch as btn_watchAd;
btnWatchad.enabled = true;
btnWatchad.buy_state.selectedIndex = 1;
btnWatchad.can_buy.selectedIndex = 0;
btnWatchad.title = Language.GetContentParams("get_card");
btnWatchad.SetClick(() => { });
btnWatchad.SetClick(() =>
@@ -211,6 +214,9 @@ namespace ChillConnect
SaveData.saveDataFunc();
InitView();
});
HallManager.Instance.UpdateSecondEvent -= upLvWatchAdsBtn;
DOVirtual.DelayedCall(0.1f, InitView);
}
if (SaveData.GetSaveObject().saveingpot_ch > SaveData.GetSaveObject().last_saveingpot_ch)
{
@@ -323,11 +329,11 @@ namespace ChillConnect
btn_watchAd btn_watchad = ui.btn_ch as btn_watchAd;
btn_watchad.img_saveingpot.visible = false;
if (SaveData.GetSaveObject().saveingpot_ch >= makeupTaskData.amount)
{
InitView();
return;
}
// if (SaveData.GetSaveObject().saveingpot_ch >= makeupTaskData.amount)
// {
// InitView();
// return;
// }
if (GameHelper.GetNowTime() < lastAdTimes)
{
@@ -337,9 +343,11 @@ namespace ChillConnect
}
else
{
HallManager.Instance.UpdateSecondEvent -= upLvWatchAdsBtn;
btn_watchad.enabled = true;
btn_watchad.can_buy.selectedIndex = 0;
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) btn_watchad.img_saveingpot.visible = true;
InitView();
}
}
@@ -615,14 +623,14 @@ namespace ChillConnect
{
// GameHelper.OpenEmail();
// SDKOpenConfig openConfig = new SDKOpenConfig
// {
// normal = false,
// url = vo.C_ShopURL
// };
//
//
// CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
SDKOpenConfig openConfig = new SDKOpenConfig
{
normal = false,
url = vo.C_ShopURL
};
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
CtrlCloseUI();
});
@@ -735,11 +743,11 @@ namespace ChillConnect
}
ui.type.selectedIndex = 4;
ui.com_task.text_task.text = Language.GetContentParams("get_card");
ui.com_task.text_payer.text = Language.GetContentParams("saveingpot_claimed","amt=$0.5");
ui.com_task.text_payer.text = Language.GetContentParams("saveingpot_claimed",makeupTaskData.GetAmountStr());
ui.com_task.text_orderid.text = makeupTaskData.orderID;
ui.com_task.text_task_title.SetVar("ad", vo.ad_need.ToString()).FlushVars();
ui.com_task.text_ads.text = $"{makeupTaskData.videoCount}/{vo.ad_need}";
ui.com_task.text_payer.SetVar("amt", makeupTaskData.GetAmountStr()).FlushVars();
// ui.com_task.text_payer.text = makeupTaskData.GetAmountStr();
if (makeupTaskData.videoCount >= vo.ad_need)
{
@@ -924,7 +932,7 @@ namespace ChillConnect
for (int i = 0; i < btn_list.Count; i++)
{
btn_list[i].text_ch.text = makeup_list[i].item_need + "";
btn_list[i].text_ch.text = makeup_list[i].item_need * GameHelper.GetExchangeRateVo().Multi + "";
btn_list[i].index.selectedIndex = i;
if (i >= saveingpot_history.Count)
{
@@ -998,11 +1006,11 @@ namespace ChillConnect
{
if (GameHelper.isRDExchangeMode())
{
text_list[i].text = "congratulations,[color=#ad4800][size=36] " + broad_list[i][0] + " [/size][/color]Successful exchange[color=#ad4800]<img src='ui://o9974uc5t9w7c3'/>" + broad_list[i][1] + "[/color]";
text_list[i].text = $"{Language.GetContent("congratulations")},[color=#ad4800][size=36] " + broad_list[i][0] + $" [/size][/color]{Language.GetContent("exchange_success")}[color=#ad4800]<img src='ui://o9974uc5t9w7c3'/>" + broad_list[i][1] + "[/color]";
}
else
{
text_list[i].text = "congratulations,[color=#ad4800][size=36] " + broad_list[i][0] + " [/size][/color]Successful exchange[color=#ad4800]$" + broad_list[i][1] + "[/color]";
text_list[i].text = $"{Language.GetContent("congratulations")},[color=#ad4800][size=36] " + broad_list[i][0] + $" [/size][/color]{Language.GetContent("exchange_success")}[color=#ad4800]$" + broad_list[i][1] + "[/color]";
}
}
});
@@ -1026,11 +1034,11 @@ namespace ChillConnect
broad_list.Add(new string[2] { config_name_list[name_index], config_money_list[money_index] });
if (GameHelper.isRDExchangeMode())
{
text_list[i].text = "congratulations,[color=#ad4800][size=36] " + broad_list[i][0] + " [/size][/color]Successful exchange[color=#ad4800]<img src='ui://o9974uc5t9w7c3'/>" + broad_list[i][1] + "[/color]";
text_list[i].text = $"{Language.GetContent("congratulations")},[color=#ad4800][size=36] " + broad_list[i][0] + $" [/size][/color]{Language.GetContent("exchange_success")} [color=#ad4800]<img src='ui://o9974uc5t9w7c3'/>" + broad_list[i][1] + "[/color]";
}
else
{
text_list[i].text = "congratulations,[color=#ad4800][size=36] " + broad_list[i][0] + " [/size][/color]Successful exchange[color=#ad4800]$" + broad_list[i][1] + "[/color]";
text_list[i].text = $"{Language.GetContent("congratulations")},[color=#ad4800][size=36] " + broad_list[i][0] + $" [/size][/color]{Language.GetContent("exchange_success")}[color=#ad4800]$" + broad_list[i][1] + "[/color]";
}
}
}
@@ -219,6 +219,7 @@ namespace ChillConnect
{
points = ui.point1;
typeId = vo.item1[i];
rewardNum *= (decimal)GameHelper.GetExchangeRateVo().Multi;
}
else
{
+3 -1
View File
@@ -63,7 +63,9 @@ public class SaveingPotClass
// }
// else
// {
return $"{amount:N}";
var exchangeRateVo = GameHelper.GetExchangeRateVo();
var cash = exchangeRateVo.Multi * amount;
return $"{cash:N}";
//}
}
+1 -1
View File
@@ -134,7 +134,7 @@ namespace ChillConnect
{
onVideoAdCompleted = onCompleted;
_placement = placement;
#if UNITY_EDITOR || GAME_RELEASE1
#if UNITY_EDITOR
onVideoAdCompleted?.Invoke(true);
#else
TrackKit.SendEvent(Property.adEvent,Property.watch_ad_people);