This commit is contained in:
2026-07-15 16:19:07 +08:00
parent 64bad7c077
commit 544f4b2d01
7963 changed files with 447731 additions and 972637 deletions
BIN
View File
Binary file not shown.
+210
View File
@@ -0,0 +1,210 @@
using System;
using System.Collections;
using System.Collections.Generic;
using ScrewsMaster;
using DG.Tweening;
using Roy.Datas;
using Roy.ObjectPool;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
using Random = UnityEngine.Random;
namespace SGame
{
public class BoxTypeLogic : ObjectPoolItem
{
public int boxType;
public Image boxCover;
public Transform holes;
public Image cashImg;
private bool _isCashBox;
private Image _image;
private int _curAvailableCount;
private Dictionary<int, Transform> _kongDic;
private Dictionary<int, bool> _kongStates;
private List<ScrewsLogic> _screwsLogics;
private Vector2 _boxCoverPos;
private bool _canUse;
private void Awake()
{
_image = GetComponent<Image>();
_kongDic = new Dictionary<int, Transform>(holes.childCount);
_kongStates = new Dictionary<int, bool>(holes.childCount);
for (int i = 0; i < holes.childCount; i++)
{
_kongDic.Add(i, holes.GetChild(i));
_kongStates.Add(i, true);
}
_curAvailableCount = _kongStates.Count;
_boxCoverPos = boxCover.transform.localPosition;
_screwsLogics = new List<ScrewsLogic>(3);
_canUse = false;
}
public void SetBoxType(int type)
{
_isCashBox = false;
cashImg.gameObject.SetActive(false);
boxType = type;
var sprite = Resources.Load<Sprite>("UI/box/box" + (boxType + 1));
_image.sprite = sprite;
sprite = Resources.Load<Sprite>("UI/box/boxCover" + (boxType + 1));
boxCover.sprite = sprite;
if (GameHelper.IsGiftSwitch())
{
var rewardRate = GameHelper.GetCommonModel().rewardrate;
var range = Random.Range(0, 101);
_isCashBox = range <= rewardRate;
cashImg.gameObject.SetActive(_isCashBox);
}
}
public bool IsCashBox()
{
return _isCashBox;
}
public void HideBoxCover()
{
boxCover.gameObject.SetActive(false);
}
public void PlayBoxFull(Action action = null)
{
boxCover.transform.localPosition = _boxCoverPos + Vector2.up * 500;
boxCover.gameObject.SetActive(true);
var sequence = DOTween.Sequence();
sequence.Append(boxCover.transform.DOLocalMove(_boxCoverPos, 0.2f));
sequence.AppendCallback(() =>
{
#if UNITY_ANDROID
AndroidVibration.Instance.CVibrate(10);
#elif UNITY_IOS
HapticManager.TriggerHapticFeedback(1f, 0.9f, 0.013f);
#endif
});
sequence.Append(transform.DOScaleY(0.8f, 0.1f));
sequence.Append(transform.DOScaleY(1.1f, 0.1f));
sequence.Append(transform.DOScaleY(1f, 0.05f));
sequence.Append(transform.DOLocalMoveY(500, 0.2f));
sequence.AppendCallback(() =>
{
PoolManager.Instance.ReturnObject(objectName, this);
// Destroy(gameObject);
if (_isCashBox)
{
var rewardValue = GameHelper.GetRewardValue(1);
var temp = new SettlementData{ cash_number = rewardValue[0], rate = rewardValue[1], is_h5_reward = false };
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GetTaskRewardUI_Open, temp);
}
action?.Invoke();
});
}
public Sequence ShowBoxAnim(Vector3 pos)
{
_canUse = false;
var sequence = DOTween.Sequence();
sequence.AppendCallback(()=>
{
transform.position = pos + (Vector3.up * 100f);
});
sequence.Append(transform.DOMove(pos, 0.4f));
sequence.Append(transform.DOScaleY(0.8f, 0.1f));
sequence.Append(transform.DOScaleY(1.1f, 0.1f));
sequence.Append(transform.DOScaleY(1f, 0.05f));
sequence.AppendCallback(() =>
{
_canUse = true;
});
return sequence;
}
public bool HasAvailableKong()
{
return _curAvailableCount > 0;
}
public Transform GetKong()
{
if (!HasAvailableKong()) return null;
for (int i = _kongStates.Count - _curAvailableCount; i < _kongStates.Count; i++)
{
_kongStates[i] = false;
_curAvailableCount--;
return _kongDic[i];
}
return null;
}
public bool CanUseKong(ScrewsLogic screwsLogic)
{
if (!_canUse) return false;
var kong = GetKong();
if (kong == null) return false;
screwsLogic.FlyToTarget(kong);
AddScrew(screwsLogic);
if (!HasAvailableKong())
{
ShowScrews.Instance.BoxIsFull(this);
}
return true;
}
private void AddScrew(ScrewsLogic screwsLogic)
{
_screwsLogics.Add(screwsLogic);
ShowScrews.Instance.RemoveScrewTypeRecord(boxType, 1);
}
public void MyReset()
{
for (int i = 0; i < _kongStates.Count; i++)
{
_kongStates[i] = true;
}
_curAvailableCount = _kongStates.Count;
}
public override void OnRecycle()
{
base.OnRecycle();
foreach (var screw in _screwsLogics)
{
PoolManager.Instance.ReturnObject(screw.objectName, screw);
}
_screwsLogics.Clear();
for (int i = 0; i < _kongStates.Count; i++)
{
_kongStates[i] = true;
}
_curAvailableCount = _kongStates.Count;
transform.localScale = Vector3.one;
_canUse = false;
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2adde2664e7d75747a419c9a04850267
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+43
View File
@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.InteropServices;
using UnityEditor;
public class BrigdeIOS
{
[DllImport("__Internal")]
public static extern void addH5Field(int field1, int field2, int field3, int field4, int field5, string field6, string field7, string dark_url, string light_url, bool is_gift, string web_through_str, string click_add_time);
// [DllImport("__Internal")]
// public static extern void SetTouchWebview(bool flag, bool force = false);
// [DllImport("__Internal")]
// public static extern void ScrollWebview(float dx, float dy);
[DllImport("__Internal")]
public static extern void SetPadding(float left, float top, float right, float bottom);
[DllImport("__Internal")]
public static extern void SetDarkThough(bool though);
[DllImport("__Internal")]
public static extern void SetBtn(int left, int top, int right, int bottom);
[DllImport("__Internal")]
public static extern void ShowH5View(bool flag);
[DllImport("__Internal")]
public static extern void SetIconProgress(float val);
[DllImport("__Internal")]
public static extern void ShowFlyBtn(bool flag);
[DllImport("__Internal")]
public static extern void setFlyBtnTag(bool flag);
[DllImport("__Internal")]
public static extern void setRewardBtnTag(bool flag);
[DllImport("__Internal")]
public static extern void copyText(string text);
[DllImport("__Internal")]
public static extern void OpenWv();
[DllImport("__Internal")]
public static extern void showGameA(bool flag);
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 08a3414d3ce94b6783b0079b4fbe8a6e
timeCreated: 1730193210
-3
View File
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7fb008dbf6acb0d41b42eb4b0083e089
timeCreated: 1692603665
+7
View File
@@ -0,0 +1,7 @@
public enum ItemEnum
{
AddHole,
MergeBox,
ClearHole,
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1fc994435276445e80176bff4f35614a
timeCreated: 1726127585
+140
View File
@@ -0,0 +1,140 @@
using System.Collections.Generic;
using FairyGUI;
using ScrewsMaster;
using UnityEngine;
public class FGUIClickDetection : MonoBehaviour
{
void Update()
{
if (Input.GetMouseButtonDown(0)) // 检测鼠标左键或手指点击
{
// 获取鼠标在 Unity 屏幕坐标系中的位置
Vector2 screenPos = Input.mousePosition;
// 处理坐标原点差异,将屏幕坐标的 Y 值翻转
screenPos.y = Screen.height - screenPos.y;
// 计算屏幕与 FairyGUI UI 的宽高比例
float scaleX = Screen.width / GRoot.inst.width;
float scaleY = Screen.height / GRoot.inst.height;
// 将屏幕坐标缩放到 FairyGUI 的 UI 坐标系
Vector2 fguiScreenPos = new Vector2(screenPos.x / scaleX, screenPos.y / scaleY);
// 最后将转换后的坐标传递给 FairyGUI 的本地坐标系
// Vector2 fguiPos = GRoot.inst.GlobalToLocal(fguiScreenPos);
// WebviewManager.Instance.HandleUIElements(fguiScreenPos);
// GetInteractiveObjectAtScreenPosition(screenPosition);
// 将屏幕坐标转换为FGUI坐标
// Vector2 localPos = GRoot.inst.GlobalToLocal(screenPosition);
// 使用HitTest获取点击位置下的GObject
// 如果检测到对象
// if (hitObject != null)
// {
// // 判断类型并触发相应操作
// if (hitObject is GButton button)
// {
// // 触发按钮点击事件
// button.onClick.Call();
// }
// else if (hitObject is GTextInput textInput)
// {
// // 触发文本输入框的焦点
// textInput.RequestFocus();
// }
// else if (hitObject is GSlider slider)
// {
// // 可以添加滑动条的响应逻辑
// Debug.Log("Slider detected!");
// }
// // 继续根据其他类型处理
// }
}
}
public GObject GetInteractiveObjectAtScreenPosition(Vector2 screenPosition)
{
// 转换屏幕坐标为FGUI坐标
Vector2 localPos = GRoot.inst.GlobalToLocal(screenPosition);
Debug.LogError($"开始检查 坐标 {localPos}");
// 创建一个列表以存储潜在的可交互对象
List<GObject> interactiveObjects = new List<GObject>();
// 遍历GRoot下的所有子对象
FindInteractiveObjects(GRoot.inst, localPos, interactiveObjects);
// 遍历找到的可交互对象,判断是否被遮挡
foreach (GObject obj in interactiveObjects)
{
Debug.LogError($"可交互对象 {obj.name}");
// 判断是否被其他对象遮挡
if (!IsObjectObstructed(obj, localPos))
{
Debug.LogError($"结果是:{obj.name}");
return obj; // 返回第一个没有被遮挡的对象
}
}
return null; // 没有找到可交互的对象
}
private void FindInteractiveObjects(GComponent parent, Vector2 position, List<GObject> interactiveObjects)
{
Debug.LogError($"当前父节点 {parent.name}");
// 遍历当前GObject的所有子对象
foreach (GObject child in parent.GetChildren())
{
if (child.visible && child.touchable)
{
// 检查坐标是否在子对象的边界内
Rect rect = new Rect(child.x, child.y, child.width, child.height);
if (rect.Contains(position))
{
interactiveObjects.Add(child);
}
}
// 递归查找子组件
if (child is GComponent component)
{
FindInteractiveObjects(component, position, interactiveObjects);
}
}
}
private bool IsObjectObstructed(GObject target, Vector2 position)
{
// 遍历所有子对象,检查目标对象是否被遮挡
foreach (GObject gObject in GRoot.inst.GetChildren())
{
// 排除当前目标对象
if (gObject != target && gObject.visible && gObject.touchable)
{
Rect rect = new Rect(gObject.x, gObject.y, gObject.width, gObject.height);
if (rect.Contains(position))
{
return true; // 被遮挡
}
}
// 递归检查子组件
if (gObject is GComponent component)
{
foreach (GObject child in component.GetChildren())
{
Rect rect = new Rect(child.x, child.y, child.width, child.height);
if (rect.Contains(position))
{
return true; // 被遮挡
}
}
}
}
return false; // 没有被遮挡
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28853f4e040a81b4ca3663e53bff0fd4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+25
View File
@@ -0,0 +1,25 @@
using System;
using System.Collections;
using System.Collections.Generic;
using ScrewsMaster;
using UnityEngine;
using UnityEngine.UI;
public class ItemNumShow : MonoBehaviour
{
public ItemEnum iEnum;
public Image plusIcon;
public Text numText;
private void Awake()
{
// GameDispatcher.Instance.AddListener(GameMsg.RefreshItemCount, RefreshItemCount);
}
private void RefreshItemCount(object obj)
{
var count = GameHelper.GetItemNumber(iEnum);
plusIcon.gameObject.SetActive(count <= 0);
numText.gameObject.SetActive(count > 0);
numText.text = count.ToString();
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a7dec1ec129468946bb32b2938b957ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+94
View File
@@ -0,0 +1,94 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Roy.ObjectPool;
using SGame;
using UnityEngine;
using UnityEngine.UI;
public class KongLogic : MonoBehaviour
{
public Image lockIcon;
private ScrewsLogic screwsLogic;
private void Awake()
{
lockIcon.gameObject.SetActive(false);
}
public bool IsUsed()
{
return screwsLogic != null;
}
public bool CanUse()
{
return !IsUsed() && !IsLock();
}
public bool IsSameType(int t)
{
if (IsUsed())
{
return screwsLogic.screwsType == t;
}
return false;
}
public void SetCurScrews(ScrewsLogic screws)
{
screwsLogic = screws;
}
private void CleanScrews()
{
screwsLogic = null;
}
public void MoveScrews(Transform target)
{
if (!IsUsed())
{
Debug.LogError("逻辑异常请检查!!");
return;
}
CleanScrews();
}
public ScrewsLogic PutScrew(bool isClean = false)
{
if (!IsUsed())
{
Debug.LogError("逻辑异常请检查!!");
return null;
}
var screw = screwsLogic;
if (isClean)
{
CleanScrews();
}
return screw;
}
public void RemoveScrews()
{
if (screwsLogic != null)
{
PoolManager.Instance.ReturnObject(screwsLogic.objectName, screwsLogic);
// Destroy(screwsLogic.gameObject);
CleanScrews();
}
}
public bool IsLock()
{
return lockIcon.gameObject.activeSelf;
}
public void SetLockState(bool state)
{
lockIcon.gameObject.SetActive(state);
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c16941abbfd05224a8184fe733426e88
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+534
View File
@@ -0,0 +1,534 @@
using UnityEngine;
using DG.Tweening;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Collections;
using UnityEngine.UI;
using System.Linq;
using System;
using ScrewsMaster;
public class MaxPayManager
{
public static readonly MaxPayManager Instance = new MaxPayManager();
public static bool isPay = false;
public static bool isIOSPay = true;
// public static Dictionary<string, int> statusDictionary = new();
MaxPayManager()
{
}
public const string buy_one = "com.twistturn.space.24.99";
public const string buy_gold_1 = "com.twistturn.shop.1.99";
public const string buy_gold_2 = "com.twistturn.shop.3.99";
public const string buy_gold_3 = "com.twistturn.shop.9.99";
public const string buy_gold_4 = "com.twistturn.shop.19.99";
public const string buy_gold_5 = "com.twistturn.shop.39.99";
public const string remove_ad = "com.twistturn.remove.2.99";
public const string battle_pass = "com.twistturn.pass.9.99";
public const string pack_reward = "com.twistturn.gift.1.99";
public const string fail_pack = "com.twistturn.fail.1.99";
public const string three_days_gift = "com.twistturn.threeday.3.99";
public void Buy(ApplePayClass _data)
{
Debug.Log("[barry] Purchase------sku:" + _data.sku);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
System.Random random = new();
int paymentMethod = random.Next(0, 100); // 生成0到100之间的随机整数,包括0-99
int PayRate = GameHelper.GetCommonModel().PayRate;
// if (false)//zhushi
if (!GameHelper.IsGiftSwitch() || paymentMethod < PayRate)
{
Debug.Log("barry ios pay");
// 调用官方支付逻辑
isIOSPay = true;
PurchasingManager.Instance.Purchase(_data);
}
else
{
// Debug.Log("barry max pay");
// 调用三方支付逻辑
StopPayCoroutine();
isIOSPay = false;
SaveData.GetSaveobject().max_pay_object = _data;
MaxPay(_data);
}
}
/// <summary>
/// 发起第三发支付
/// </summary>
public void MaxPay(ApplePayClass data_)
{
// Debug.Log($"[UNITY] Purchase;;;;;;{JsonConvert.SerializeObject(data_)}");
ApplePayClass paydata = data_;
SaveData.pay_time = Time.time;
// if (data_.sku == MaxPayManager.buy_one)
// {
// NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.buy_one_click, 1);
// }
// else
if (data_.sku == MaxPayManager.remove_ad)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.remove_ad_click, 1);
}
else if (data_.sku == MaxPayManager.pack_reward)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pack_click, 1);
}
else if (data_.shopName != null && data_.shopName.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = paydata.shopName[startIndex..]; // 截取 "gold" 后的所有字符
string eventClickName = $"gold_click_{suffix}";
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, eventClickName, 1);
}
else if (data_.sku == MaxPayManager.battle_pass)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_click, 1);
}
else if (data_.sku == MaxPayManager.fail_pack)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.fail_click, 1);
}
else if (data_.sku == MaxPayManager.three_days_gift)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.three_days_gift_click, 1);
}
PayerData test = new PayerData()
{
amount = data_.amount,
};
//max 支付订单创建
NetworkKit.PostWithHeader<orderData>("shop/maxPayIn", test, (isSuccess, obj) =>
{
if (isSuccess)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
Debug.Log($"max 支付订单创建:{JsonConvert.SerializeObject(obj)}");
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PixPayUI_Open, obj);
SaveData.GetSaveobject().max_pay_object.innerOrderId = obj.order_id;
paydata.status = 1;
SavePayData(obj.order_id, paydata);
isPay = true;
OpenBrowser.OpenURL(obj.pay_url);
}
});
}
public void SavePayData(string orderId, ApplePayClass payData)
{
// Debug.Log($"max 支付 SavePayData: orderId={orderId} status={payData}");
// 加载已保存的支付数据
var payDataJson = PlayerPrefs.GetString("three_pay_data", "{}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
// Debug.Log($"max 支付 statusDictionary {statusDictionary}");
// 判断是否已有相同的 orderId
if (statusDictionary.ContainsKey(orderId))
{
// Debug.Log($"max 支付 statusDictionary 已存在 orderId {orderId}");
// 更新现有条目的状态
statusDictionary[orderId] = payData;
}
else
{
// 添加新的条目
// Debug.Log($"max 支付 statusDictionary 不存在 orderId {orderId}");
statusDictionary.Add(orderId, payData);
}
// 保存更新后的数据
PlayerPrefs.SetString("three_pay_data", JsonConvert.SerializeObject(statusDictionary));
// Debug.Log($"max 支付 three_pay_data {JsonConvert.SerializeObject(statusDictionary)}");
}
public ApplePayClass GetPayData(string orderId)
{
var payDataJson = PlayerPrefs.GetString("three_pay_data", "{}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
if (statusDictionary.ContainsKey(orderId))
{
return statusDictionary[orderId];
}
return null;
}
public bool GetPayStatus()
{
bool isCheck = false;
var payDataJson = PlayerPrefs.GetString("three_pay_data", "{}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
if (statusDictionary == null) return false;
foreach (var entry in statusDictionary)
{
if (entry.Value.status == 1)
{
isCheck = true;
break;
}
}
return isCheck;
}
private int PayStatus = -1;
private Coroutine PayCoroutine;
public IEnumerator ProcessPayData()
{
var payDataJson = PlayerPrefs.GetString("three_pay_data", "{}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
foreach (var entry in statusDictionary.OrderByDescending(pair => pair.Key))
{
// Debug.Log($"max 支付 ProcessPayData0======{entry.Key} status:{entry.Value}");
if (entry.Value.status == 1)
{
bool keepRequesting = true;
while (keepRequesting)
{
// 发起请求
PaySuccess(entry.Key);
yield return new WaitForSeconds(5f);
// Debug.Log($"max 支付 ProcessPayData1======{entry.Key} status:{PayStatus}");
if (PayStatus == 1)
{
// 如果返回值为1,则等待5秒后再次请求
}
else
{
// 如果返回值不为1,则停止循环
PayStatus = -1;
keepRequesting = false;
}
yield return null; // 等待本次请求完成
}
}
}
}
public void StopPayCoroutine()
{
if (PayCoroutine != null)
{
CrazyAsyKit.StopCoroutine(PayCoroutine);
}
}
public void PaySuccess()
{
Debug.Log("max 支付 StartCoroutine------");
PayCoroutine = CrazyAsyKit.StartCoroutine(ProcessPayData());
}
public void PaySuccess(string orderId)
{
var test = new maxOrder();
test.order_id = orderId;
//max 支付订单查询
NetworkKit.PostWithHeader<orderState>("shop/maxPayOrderQuery", test, (isSuccess, obj) =>
{
Debug.Log($"max 支付订单查询: id= {orderId} is succ={isSuccess}");
if (isSuccess)
{
Debug.Log($"max 支付订单查询: 成功,statu====: {obj.status}");
// Debug.Log($"max 支付订单查询: {JsonConvert.SerializeObject(obj)}");
PayStatus = obj.status;
//1:支付中,需要定时查询
if (obj.status == 1)
{
var paydata = GetPayData(orderId);
if (paydata != null)
{
paydata.status = 1;
SavePayData(obj.order_id, paydata);
}
// reCreatPur();
}
//2:支付成功,发奖
else if (obj.status == 2)
{
var paydata = GetPayData(orderId);
if (paydata != null)
{
paydata.status = 2;
SavePayData(obj.order_id, paydata);
}
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
bool isOpen = false;
if (paydata.sku == MaxPayManager.buy_one)
{
isOpen = HandleSku(paydata.sku, UIConst.PropUI, BuriedPointEvent.buy_one_open, BuriedPointEvent.buy_one_success);
}
else
if (paydata.sku == MaxPayManager.remove_ad)
{
isOpen = HandleSku(paydata.sku, UIConst.PackrewardUI, BuriedPointEvent.remove_ad_open, BuriedPointEvent.remove_ad_success);
}
else if (paydata.sku == MaxPayManager.pack_reward)
{
isOpen = HandleSku(paydata.sku, UIConst.PackrewardUI, BuriedPointEvent.pack_open, BuriedPointEvent.pack_success);
}
else if (paydata.shopName != null && paydata.shopName.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = paydata.shopName[startIndex..]; // 截取 "gold" 后的所有字符
string eventOpenName = $"gold_open_{suffix}";
string eventSuccessName = $"gold_success_{suffix}";
isOpen = HandleSku(paydata.sku, UIConst.BuygoldUI, eventOpenName, eventSuccessName);
}
else if (paydata.sku == MaxPayManager.battle_pass)
{
isOpen = HandleSku(paydata.sku, UIConst.PassunlockUI, BuriedPointEvent.pass_open, BuriedPointEvent.pass_success);
}
else if (paydata.sku == MaxPayManager.fail_pack)
{
isOpen = HandleSku(paydata.sku, UIConst.ResurgenceUI, BuriedPointEvent.fail_open, BuriedPointEvent.fail_buy_success);
}
else if (paydata.sku == MaxPayManager.three_days_gift)
{
isOpen = HandleSku(paydata.sku, UIConst.ThreeDaysGiftUI, BuriedPointEvent.three_days_gift_open, BuriedPointEvent.three_days_gift_buy_success);
}
else
{
// 处理未知的 sku 值
Debug.LogError($"Unknown SKU: {paydata.sku}");
throw new ArgumentException("Unknown SKU");
}
// if (isOpen) {
string sku = paydata.sku.Contains("shop") ? paydata.shopName : paydata.sku;
GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, sku);
// }
// else {
// GetPayPrice(paydata);
// }
SaveingPotClass taskData = SaveData.GetSaveobject().saveingpot_history.Last();
Makeup_2 makeupVo = ConfigSystem.GetConfig<MakeupModel_2>().GetData(taskData.tableId);
SaveData.GetSaveobject().saveingpot_cash += ((float)paydata.amount) / 100 * makeupVo.PayIncrease; ;
if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1 && GameHelper.IsGiftSwitch())
{
if ((SaveData.GetSaveobject().saveingpot_cash > taskData.amount) && (!taskData.auto_show) && !UIManager.Instance.IsExistUI(UIConst.H5UI))
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SaveingPotUI_Open);
taskData.auto_show = true;
PlayerPrefs.SetInt("pot_day", DateTime.Now.Day);
}
}
GameDispatcher.Instance.Dispatch(GameMsg.RefreshSaveingPot);
DOVirtual.DelayedCall(1, () =>
{
SaveData.GetSaveobject().max_pay_object = null;
var paydata = GetPayData(orderId);
if (paydata != null)
{
paydata.status = 4;
SavePayData(obj.order_id, paydata);
}
});
}
//3:支付失败,已领奖或者支付失败,或者查询次数达到上限
else if (obj.status == 3)
{
var paydata = GetPayData(orderId);
if (paydata != null)
{
paydata.status = 3;
SavePayData(obj.order_id, paydata);
}
OnPayFailed(orderId);
}
//4:已发货,服务端记录已经发过奖,若客户端未发奖可发奖
else
{
DOVirtual.DelayedCall(1, () =>
{
var paydata = GetPayData(orderId);
if (paydata != null)
{
paydata.status = 4;
SavePayData(obj.order_id, paydata);
}
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
SaveData.GetSaveobject().max_pay_object = null;
GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, paydata.sku);
});
}
}
else
{
// Debug.Log("max 支付 验证订单失败");
// Debug.Log($"max 支付 验证订单失败: {JsonConvert.SerializeObject(obj)}");
//验证订单失败
// reCreatPur();
// status = -1;
PayStatus = -1;
}
});
}
bool HandleSku(string sku, string uiConst, string openEvent, string successEvent)
{
bool isOpen;
try
{
isOpen = CheckIsOpen(uiConst);
// NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, openEvent, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, successEvent, 1);
}
catch (Exception ex)
{
// 记录异常信息
Debug.LogError($"Error handling SKU {sku}: {ex.Message}");
// 可以选择重新抛出异常或进行其他处理
throw;
}
return isOpen;
}
public void reCreatPur()//重新验证订单
{
// Debug.Log($"max 支付 reCreatPur 重新验证订单: pay_object_data===: {JsonConvert.SerializeObject(SaveData.GetSaveobject().max_pay_object)}");
// if (SaveData.GetSaveobject().max_pay_object != null)
// {
// CrazyAsyKit.StartCoroutine(ProcessPayData());
// }
}
public void OnPayFailed(string orderId)
{
var paydata = GetPayData(orderId);
if (paydata == null)
{
return;
}
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
// Debug.LogWarning("OnPurchaseFailedproduct:" + product.transactionID + " failureReason:" + failureReason);
DOVirtual.DelayedCall(1, () =>
{
SaveData.GetSaveobject().max_pay_object = null;
});
}
private bool CheckIsOpen(string name)
{
var isOpen = UIManager.Instance.IsExistUI(name);
return isOpen;
}
//适用这个方法领奖,说明购买界面已经关闭
private static decimal GetGoldRewradNum(int index)
{
decimal rewardNum = 0;
var list = ConfigSystem.GetConfig<PaidcoinsModel>().dataList;
if (list.Count > 0 && list.Count > index)
{
rewardNum = list[index].Actual_coins;
}
return rewardNum;
}
private void GetPayReward(decimal goldNum)
{
if (goldNum == 0) return;
var start = new Vector2(540, 960);
var rewardData = new RewardData();
var rewardSingleData = new RewardSingleData(101, goldNum, RewardOrigin.AdTask)
{
startPosition = start,
};
rewardData.AddReward(rewardSingleData);
rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange;
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
}
}
public class maxOrder
{
public string order_id;
}
public class PayerData
{
public string name;
public string tel;
public string email;
public int amount;
}
public class ApplePayClass
{
public string innerOrderId;
public string transactionId;
public int amount;
public string sku;
public string currency = "USD";
public int status;
public string shopName;
}
public class checkData
{
public string signedPayload;
public string innerOrderId;
}
public class orderState
{
public string order_id;
public int status;
}
public class orderData
{
public string order_id;
public string pay_url;
public int code;
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 64251c3f770d44e4e835533a46f0e020
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+22
View File
@@ -0,0 +1,22 @@
using System.Runtime.InteropServices;
using UnityEngine;
public class OpenBrowser
{
[DllImport("__Internal")]
public static extern void _openURL(string url);
public static void OpenURL(string url)
{
// 调用iOS原生方法打开URL
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
_openURL(url);
}
else
{
// 在非iOS平台上,你可以使用Unity的Application.OpenURL方法
Application.OpenURL(url);
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ddb09b6f815b6496aa0783ebfeb17b5d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+18
View File
@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PanelHole : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 46245853b1b5eb742b020dac92fcb579
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+42
View File
@@ -0,0 +1,42 @@
using UnityEngine;
using UnityEngine.UI;
public class PanelImage : Image
{
// 覆盖 Raycast 方法
public override bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera)
{
// 获取当前Image的RectTransform
RectTransform rectTransform = this.rectTransform;
// 将屏幕坐标转换为Image的局部坐标
Vector2 localPoint;
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, screenPoint, eventCamera, out localPoint);
// 将局部坐标转换为贴图坐标
Vector2 normalizedPoint = new Vector2(
(localPoint.x - rectTransform.rect.x) / rectTransform.rect.width,
(localPoint.y - rectTransform.rect.y) / rectTransform.rect.height
);
// 确保坐标在0到1之间
if (normalizedPoint.x < 0 || normalizedPoint.x > 1 || normalizedPoint.y < 0 || normalizedPoint.y > 1)
{
return false;
}
// 获取当前图片的Sprite(确保图片是Sprite类型)
if (sprite == null || sprite.texture == null)
{
return true;
}
// 计算在纹理上的像素位置
int x = Mathf.FloorToInt(normalizedPoint.x * sprite.texture.width);
int y = Mathf.FloorToInt(normalizedPoint.y * sprite.texture.height);
// 检查该像素是否透明
Color pixelColor = sprite.texture.GetPixel(x, y);
return pixelColor.a > 0.1f; // 如果透明度小于0.1,视为透明区域
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 99f9dfa0de98e6e4d851c75f48d5c4b5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+320
View File
@@ -0,0 +1,320 @@
using DG.Tweening;
using System.Collections.Generic;
using System.Linq;
using Roy.ObjectPool;
using ScrewsMaster;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace SGame
{
public class PanelLogic : ObjectPoolItem
{
private List<Sprite> _availableScrews;
private int _minCount;
public Text layerText;
#region
private List<ScrewsLogic> _screwLogics;
private List<PanelHole> _holes;
private Image _backgroundImage;
public Image frameImage;
private Rigidbody2D _rigidbody2D;
private int _activeScrewCount;
public PolygonCollider2D polygonCollider2D;
private int _layer;
private bool _isLock;
private Color _curColor;
private int _curShowScrewCount;
private static readonly Color LockColor = new Color(0,0,0, 0.4f);
private static readonly Color LockFrameColor = new Color(1,1,1, 0f);
/// <summary>
/// 开始检查掉落
/// </summary>
private bool _startCheckDrop;
private void Awake()
{
_rigidbody2D = GetComponent<Rigidbody2D>();
_backgroundImage = GetComponent<Image>();
polygonCollider2D = GetComponent<PolygonCollider2D>();
// InitScrews();
InitHoles();
}
private void Update()
{
if (_startCheckDrop)
{
if (gameObject.transform.localPosition.y < -1200)
{
ShowScrews.Instance.RemovePanelLogic(this);
// 销毁游戏对象
// Destroy(gameObject);
PoolManager.Instance.ReturnObject(objectName, this);
}
}
}
/// <summary>
/// 隐藏所有螺丝孔
/// </summary>
public void HideAllHole()
{
foreach (var hole in _holes)
{
hole.gameObject.SetActive(false);
}
}
/// <summary>
/// 初始化孔位
/// </summary>
private void InitHoles()
{
_holes = gameObject.GetComponentsInChildren<PanelHole>().ToList();
// foreach (var hole in _holes)
// {
// hole.gameObject.SetActive(false);
// }
for (int i = 0; i < _holes.Count; i++)
{
_holes[i].gameObject.name = i.ToString();
_holes[i].gameObject.SetActive(false);
}
}
/// <summary>
/// 初始化螺丝数据
/// </summary>
private void InitScrews()
{
_screwLogics = gameObject.GetComponentsInChildren<ScrewsLogic>().ToList();
foreach (var screwsLogic in _screwLogics)
{
screwsLogic.transform.parent.gameObject.SetActive(false);
}
}
/// <summary>
/// 显示螺丝孔,并初始化螺丝
/// </summary>
/// <param name="types"></param>
// public void ShowHole(List<Sprite> sprites)
public void ShowHole(List<int> types)
{
// _curShowScrewCount = Mathf.Min(types.Count, _screwLogics.Count);
// for (int i = 0; i < _curShowScrewCount; i++)
// {
// _screwLogics[i].Init(types[i]);
// _screwLogics[i].transform.parent.gameObject.SetActive(true);
// }
_curShowScrewCount = Mathf.Min(types.Count, _holes.Count);
_screwLogics ??= new List<ScrewsLogic>();
for (int i = 0; i < _curShowScrewCount; i++)
{
_holes[i].gameObject.SetActive(true);
var screwsLogic = PoolManager.Instance.GetObject<ScrewsLogic>("Screw");
screwsLogic.transform.SetParent(_holes[i].transform);
screwsLogic.transform.localPosition = Vector3.zero;
screwsLogic.Init(types[i]);
_screwLogics.Add(screwsLogic);
}
_startCheckDrop = false;
_activeScrewCount = _curShowScrewCount;
RemoveActiveScrewCount(null);
}
public void RemoveActiveScrewCount(ScrewsLogic screwsLogic)
{
if (screwsLogic != null)
{
if (_screwLogics.Remove(screwsLogic))
{
_activeScrewCount--;
}
else
{
Debug.LogError("尝试删除了不属于该面板的螺丝");
}
}
if (_activeScrewCount == 1)
{
SetRigidbody2D();
}
if (_activeScrewCount <= 0)
{
_startCheckDrop = true;
}
}
/// <summary>
/// 获得螺丝孔数量
/// </summary>
/// <returns></returns>
public int GetHoleCount()
{
return _holes.Count;
}
/// <summary>
/// 将螺钉旋转对齐
/// </summary>
public void AlignScrewsToRotation()
{
foreach (var screwLogic in _screwLogics)
{
screwLogic.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, -transform.eulerAngles.z));
}
}
private void SetRigidbody2D()
{
_rigidbody2D.bodyType = RigidbodyType2D.Dynamic;
_rigidbody2D.angularDrag = 1.5f;
_rigidbody2D.mass = 5f;
}
public void SetLayerText(string layerName)
{
layerText.text = layerName;
layerText.gameObject.SetActive(true);
}
public void SetBackgroundColor(Color color)
{
_curColor = color;
_backgroundImage.color = _curColor;
}
public void UpdatePolygonCollider2D()
{
polygonCollider2D = GetComponent<PolygonCollider2D>();
}
public float GetRectMaxEdge()
{
var sizeDelta = _backgroundImage.rectTransform.sizeDelta;
return Mathf.Max(sizeDelta.x, sizeDelta.y);
}
public void SetLayer(int layer)
{
_layer = layer;
}
public int GetLayer()
{
return _layer;
}
public void SetLock(bool b, bool animateEffect = false)
{
_isLock = b;
void UpdatePhysicalEffect()
{
if (_isLock)
{
SetStaticRigidbody();
}
else
{
RemoveActiveScrewCount(null);
}
}
if (!animateEffect)
{
_backgroundImage.color = b ? LockColor : _curColor;
frameImage.color = b ? LockFrameColor : Color.white;
for (int i = 0; i < _curShowScrewCount; i++)
{
_holes[i].transform.parent.gameObject.SetActive(!b);
}
UpdatePhysicalEffect();
}
else
{
var sequence = DOTween.Sequence();
sequence.Append(_backgroundImage.DOColor(b ? LockColor : _curColor, 0.5f));
sequence.Append(frameImage.DOColor(b ? LockFrameColor : Color.white, 0.5f));
for (int i = 0; i < _curShowScrewCount; i++)
{
_holes[i].gameObject.SetActive(!b);
_screwLogics[i].SetAlpha(b ? 0 : 1);
if (_isLock) continue;
if (i == 0)
sequence.Append(_screwLogics[i].ShowAnim());
else
sequence.Join(_screwLogics[i].ShowAnim());
}
sequence.AppendCallback(UpdatePhysicalEffect);
}
if (!_isLock)
{
UpdateScrewRecord();
}
}
public bool IsLock()
{
return _isLock;
}
private void UpdateScrewRecord()
{
for (int i = 0; i < _curShowScrewCount; i++)
{
var screwsType = _screwLogics[i].screwsType;
ShowScrews.Instance.AddScrewTypeRecord(screwsType);
}
}
public void SetStaticRigidbody()
{
_rigidbody2D.bodyType = RigidbodyType2D.Static;
}
public override void OnRecycle()
{
base.OnRecycle();
foreach (var screwLogic in _screwLogics)
{
PoolManager.Instance.ReturnObject(screwLogic.objectName, screwLogic);
}
_screwLogics.Clear();
HideAllHole();
_startCheckDrop = false;
SetStaticRigidbody();
}
#endregion
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 76b109a6c3e75c94e9312cf6f39ef3e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+290
View File
@@ -0,0 +1,290 @@
using UnityEngine;
using System;
using DG.Tweening;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using ScrewsMaster;
public class PurchasingManager
{
public static readonly PurchasingManager Instance = new PurchasingManager();
//private static IGooglePlayStoreExtensions googleExtension;
private Action<string> failedCallback;
private ApplePayClass applePayData;
PurchasingManager()
{
}
/// <summary>
/// 初始化商品
/// 建议在游戏初始化完成的时候就去初始化商品
/// </summary>
public void InitProduct()
{
}
public const string buy_one = "com.twistturn.space.24.99";
public const string buy_gold_1 = "com.twistturn.shop.1.99";
public const string buy_gold_2 = "com.twistturn.shop.3.99";
public const string buy_gold_3 = "com.twistturn.shop.9.99";
public const string buy_gold_4 = "com.twistturn.shop.19.99";
public const string buy_gold_5 = "com.twistturn.shop.39.99";
public const string remove_ad = "com.twistturn.remove.2.99";
public const string battle_pass = "com.twistturn.pass.9.99";
public const string pack_reward = "com.twistturn.gift.1.99";
public const string fail_pack = "com.twistturn.fail.1.99";
public const string three_days_gift = "com.twistturn.threeday.3.99";
/// <summary>
/// 发起内购
/// </summary>
/// <param name="_productId">要购买的商品ID</param>
/// <param name="_successedCallback">购买成功回调</param>
/// <param name="_failedCallback">购买失败回调</param>/* */
public void Purchase(ApplePayClass data_)
{
string _productId = data_.sku;
Debug.Log($"[barry] Purchase;;;;;;;;;;;;;;;;;;;{_productId}\n data=== {JsonConvert.SerializeObject(data_)}");
if (Time.time - SaveData.pay_time < 5)
{
GameHelper.ShowTips("Clicks are too frequent");
return;
}
SaveData.pay_time = Time.time;
if (data_.sku == buy_one)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.buy_one_click, 1);
}
else if (data_.sku == remove_ad)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.remove_ad_click, 1);
}
else if (data_.sku == pack_reward)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pack_click, 1);
}
else if (data_.sku == fail_pack)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.fail_click, 1);
}
else if (data_.sku == three_days_gift)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.three_days_gift_click, 1);
}
else if (data_.shopName != null && data_.shopName.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = data_.shopName[startIndex..]; // 截取 "gold" 后的所有字符
string eventClickName = $"gold_click_{suffix}";
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, eventClickName, 1);
}
else if (data_.sku == battle_pass)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_click, 1);
}
ApplePay(data_);
Debug.Log("[barry] Purchase;;;;;;;;;;;;;;;;;;;");
// ApplePay(_productId, data_);
// GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, data_.sku);
}
private void ApplePay(ApplePayClass data_)
{
}
//private List<Product> product_list = new List<Product>();
/// <summary>
/// IOS恢复内购
/// 会在删除应用后,第一次安装是自动恢复
/// </summary>
/// <param name="restoreCallback">恢复回调</param>
public void IosRestore(Action<bool, string> restoreCallback)
{
}
//======================================分割线=========================================
public void SaveApplePayData(Dictionary<string, ApplePayClass> payData)
{
// 保存更新后的数据
PlayerPrefs.SetString("apple_pay_data", JsonConvert.SerializeObject(payData));
}
public void ApplePaySuccess(string transactionID)
{
Debug.Log("apple 支付 StartCoroutine------");
CrazyAsyKit.StartCoroutine(ProcessPayData(transactionID));
}
public void startPay()
{
var payDataJson = PlayerPrefs.GetString("apple_pay_data", "{}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
foreach (var entry in statusDictionary.OrderByDescending(pair => pair.Key))
{
DOVirtual.DelayedCall(1f, () =>
{
Debug.Log($"max 支付 ProcessPayData0======{entry.Key} status:{entry.Value}");
CrazyAsyKit.StartCoroutine(ProcessPayData(entry.Key));
});
}
}
public IEnumerator ProcessPayData(string orderId)
{
// 发起请求
ApplePayRequest(orderId);
yield return null; // 等待本次请求完成
}
public void ApplePayRequest(string transactionID)
{
var payDataJson = PlayerPrefs.GetString("apple_pay_data", "{}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
if (statusDictionary.ContainsKey(transactionID))
{
ApplePayClass data_ = statusDictionary[transactionID];
var test = new checkData();
test.signedPayload = Base64Kit.Encode(transactionID, true);
test.innerOrderId = data_.innerOrderId;
NetworkKit.PostWithHeader<orderData>("shop/applePayCheck", test, (isSuccess, obj) =>
{
Debug.Log("[barry] yanzhengchengleeeee");
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
if (isSuccess)
{
Debug.Log("barry] yanzhengchenggonggggg");
statusDictionary.Remove(transactionID);
// 保存更新后的数据
SaveApplePayData(statusDictionary);
SaveingPotClass taskData = SaveData.GetSaveobject().saveingpot_history.Last();
Makeup_2 makeupVo = ConfigSystem.GetConfig<MakeupModel_2>().GetData(taskData.tableId);
SaveData.GetSaveobject().saveingpot_cash += ((float)data_.amount) / 100 * makeupVo.PayIncrease;
GameDispatcher.Instance.Dispatch(GameMsg.RefreshSaveingPot);
if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1 && GameHelper.IsGiftSwitch())
{
if ((SaveData.GetSaveobject().saveingpot_cash > taskData.amount) && (!taskData.auto_show) && !UIManager.Instance.IsExistUI(UIConst.H5UI))
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SaveingPotUI_Open);
taskData.auto_show = true;
}
}
string sku = data_.sku.Contains("shop") ? data_.shopName : data_.sku;
GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, sku);
if (data_.sku == buy_one)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.buy_one_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.buy_one_success, 1);
}
else if (data_.sku == remove_ad)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.remove_ad_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.remove_ad_success, 1);
}
else if (data_.sku == pack_reward)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pack_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pack_success, 1);
}
else if (data_.shopName != null && data_.shopName.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = data_.shopName[startIndex..]; // 截取 "gold" 后的所有字符
string eventOpenName = $"gold_open_{suffix}";
string eventSuccessName = $"gold_success_{suffix}";
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, eventOpenName, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, eventSuccessName, 1);
}
else if (data_.sku == battle_pass)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_success, 1);
}
else if (data_.sku == fail_pack)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.fail_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.fail_buy_success, 1);
}
else if (data_.sku == three_days_gift)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.three_days_gift_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.three_days_gift_buy_success, 1);
}
}
else
{
//验证订单失败
// reCreatPur(2);
//根据code 判断是否需要重试
if (!new List<int>() { 1021, 1026, 1027, 1028 }.Contains(obj.code))
{
ApplePayRequest(transactionID);
}
else
{
statusDictionary.Remove(transactionID);
// 保存更新后的数据
SaveApplePayData(statusDictionary);
}
}
});
}
}
private void OnFailedCallback(string _reason)
{
Debug.Log("[barry 11]OnFailedCallback Reason:" + _reason);
if (failedCallback != null)
{
failedCallback(_reason);
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e5b9e9e1361eb489a911fb405caef47a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 59598b9347fc4732b1ed185ba57e387c
timeCreated: 1727234921
+41
View File
@@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using Roy;
using UnityEngine;
public class AndroidVibration : SingletonMonoBehaviour<AndroidVibration>
{
AndroidJavaClass VibratorTool = null;
AndroidJavaClass ToastTool = null;
void Awake()
{
VibratorTool = new AndroidJavaClass("com.tools.common.VibratorTool");
ToastTool = new AndroidJavaClass("com.tools.common.ToastTool");
ToastTool.CallStatic("SetShowToast", false);//关闭测试toast
//smsDialog.CallStatic<AndroidJavaObject>("getInstance").Call("init", getContext());
}
public void CVibrate(int milliseconds)
{
// Debug.LogError("---- 调用震动");
VibratorTool.CallStatic("CVibrate", milliseconds);
}
public void CVibrateShort()
{
// Debug.LogError("---- 调用震动 -- 短");
VibratorTool.CallStatic("CVibrateShort");
}
public void CVibrateLong()
{
// Debug.LogError("---- 调用震动 -- 长");
VibratorTool.CallStatic("CVibrateLong");
}
public void CCannelVibrate()
{
// Debug.LogError("---- 调用震动 -- 取消");
VibratorTool.CallStatic("CCancelVibrate");
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bf48492c834d5a145b3a992bcffb4bef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1425010c752246ffa6889c5e6b6b05ec
timeCreated: 1727339286
+20
View File
@@ -0,0 +1,20 @@
namespace Roy
{
/// <summary>
/// 管理类基类
/// </summary>
/// <typeparam name="T"></typeparam>
public class BaseManager<T> where T : new()
{
private static T _instance;
public static T GetInstance
{
get
{
_instance ??= new T();
return _instance;
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 91c3234e0b0b4940992129af43d62f99
timeCreated: 1727164456
@@ -0,0 +1,55 @@
using UnityEngine;
namespace Roy
{
public class SingletonMonoBehaviour<T> : MonoBehaviour where T : MonoBehaviour
{
private static T _instance;
public static T Instance
{
get
{
if (_instance == null)
{
// 尝试找到已存在的实例
_instance = FindObjectOfType<T>();
// 如果没有找到,则创建一个新的实例
if (_instance == null)
{
GameObject singletonObject = new GameObject(typeof(T).Name);
_instance = singletonObject.AddComponent<T>();
DontDestroyOnLoad(singletonObject); // 不在场景切换时销毁
}
}
return _instance;
}
}
// 确保在场景中只存在一个实例
protected virtual void Awake()
{
if (_instance == null)
{
_instance = this as T;
}
else if (_instance != this)
{
Debug.LogWarning($"An instance of {typeof(T)} already exists! Destroying this instance.");
Destroy(gameObject); // 如果有其他实例,销毁当前对象
}
}
protected virtual void OnDestroy()
{
if (_instance == this)
{
_instance = null; // 清除引用
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 54bf3c952fe4494dbae47a7a63806362
timeCreated: 1728986962
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: aa366da86c25451b99f84f4fa7fd8d4f
timeCreated: 1727318395
+8
View File
@@ -0,0 +1,8 @@
namespace Roy.Datas
{
public class PropViewData
{
public int type;
public int index;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ad8b86d6227e44b4bc9bdf88413402fb
timeCreated: 1727318419
@@ -0,0 +1,11 @@
namespace Roy.Datas
{
public class SettlementData
{
public bool is_success;
public float cash_number;
public float rate;
public bool is_level_success;
public bool is_h5_reward;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6e4551287fa849ba86b54304a2d9e71e
timeCreated: 1727318650
+25
View File
@@ -0,0 +1,25 @@
#if UNITY_IOS
using System.Runtime.InteropServices;
using UnityEngine;
public class HapticManager
{
[DllImport("__Internal")]
private static extern void TriggerCustomHaptic(float intensity, float sharpness, float duration);
public static void TriggerHapticFeedback(float intensity, float sharpness, float duration)
{
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
TriggerCustomHaptic(intensity, sharpness, duration);
}
else
{
Debug.Log("Haptic feedback is only available on iOS.");
}
}
}
#endif
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 108ec92fa01a4e42b4594ca3561d77bd
timeCreated: 1729504904
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 60448bf52bae4ca4bb0edaf413418b1c
timeCreated: 1727339306
@@ -0,0 +1,51 @@
using System.Collections.Generic;
using DG.Tweening;
namespace Roy
{
public class AnimationPipeline : BaseManager<AnimationPipeline>
{
private Queue<Tween> _tweenQueue = new Queue<Tween>(); // 动画队列
private Sequence _currentSequence; // 当前的动画Sequence
private bool _isPlaying = false; // 管线是否正在播放
// 向管线添加一个新的动画
public void AddToPipeline(Tween newTween)
{
_tweenQueue.Enqueue(newTween); // 将新的动画放入队列
if (!_isPlaying)
{
StartNextSequence(); // 如果没有播放中的动画,启动队列中的下一个动画
}
}
// 启动下一个动画序列
private void StartNextSequence()
{
if (_tweenQueue.Count == 0)
{
_isPlaying = false; // 队列为空,停止播放
return;
}
_isPlaying = true;
_currentSequence = DOTween.Sequence(); // 创建一个新的Sequence
while (_tweenQueue.Count > 0)
{
Tween nextTween = _tweenQueue.Dequeue();
_currentSequence.Append(nextTween); // 将每个Tween按顺序加入到Sequence
}
// 当Sequence完成时,检查队列中是否还有新的动画
_currentSequence.OnComplete(() =>
{
_isPlaying = false;
StartNextSequence(); // 如果还有新动画,继续播放
});
_currentSequence.Play(); // 播放当前Sequence
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a5e50fdce1d843d891c5bb1f55668145
timeCreated: 1728459955
@@ -0,0 +1,261 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ScrewsMaster;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace Roy
{
public class FileNetworkManager : BaseManager<FileNetworkManager>
{
private readonly string _copyFolderPath;
private readonly string _configFolderPath;
public const string FolderName = "Configs";
public const string FolderLabel = "config";
public FileNetworkManager()
{
_copyFolderPath = Path.Combine(Application.streamingAssetsPath, FolderName);
_configFolderPath = Path.Combine(Application.persistentDataPath, FolderName);
}
public string GetConfigFOlderPath()
{
return _configFolderPath;
}
// 示例解析文件列表方法(你可以根据实际需求实现)
List<string> ParseFileList(string data)
{
// 假设 data 是文件列表的文本,解析文件名
// 根据实际情况解析,例如通过换行符分割
return data.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
public void CopyStreamingAssetsToPersistentDataPath(Action<bool> onComplete = null)
{
// 如果目标文件夹不存在,创建它
if (!Directory.Exists(_configFolderPath))
{
Directory.CreateDirectory(_configFolderPath);
}
CrazyAsyKit.StartCoroutine(CopyFile(onComplete));
// // 获取StreamingAssets中的文件,排除后缀为.meta的文件
// var files = Directory.GetFiles(_copyFolderPath)
// .Where(file => !file.EndsWith(".meta")) // 过滤 .meta 文件
// .ToList(); // 转换为列表以方便使用
//
// if (files.Count == 0)
// {
// onComplete?.Invoke(true); // 如果没有文件,直接回调成功
// return;
// }
//
// // 使用计数器来跟踪完成的文件复制
// int completedCount = 0;
//
// foreach (var file in files)
// {
// string fileName = Path.GetFileName(file);
// string sourceFilePath = file; // 原始文件路径
// string destFilePath = Path.Combine(_configFolderPath, fileName);
//
// // 读取并写入文件
// CrazyAsyKit.StartCoroutine(CopyFile(sourceFilePath, destFilePath,
// (result) =>
// {
// completedCount++;
// // 如果所有文件都已复制完成,调用回调
// if (completedCount == files.Count)
// {
// onComplete?.Invoke(true);
// }
// }));
// }
}
private IEnumerator CopyFile(Action<bool> onComplete = null)
{
var handle = Addressables.LoadResourceLocationsAsync(FolderLabel);
yield return handle;
if (handle.Status == AsyncOperationStatus.Succeeded)
{
// 查找以 ".json" 结尾的文件
var jsonLocation = handle.Result.FirstOrDefault(loc => loc.PrimaryKey.EndsWith(".json"));
if (jsonLocation != null)
{
var jsonFileName = Path.GetFileName(jsonLocation.PrimaryKey);
// 加载 JSON 文件
var textAssetAsync = Addressables.LoadAssetAsync<TextAsset>(jsonLocation);
yield return textAssetAsync;
if (textAssetAsync.Status == AsyncOperationStatus.Succeeded)
{
TextAsset jsonFile = textAssetAsync.Result;
Debug.Log("Loaded JSON content: " + jsonFile.text);
string destFilePath = Path.Combine(_configFolderPath, jsonFileName);
File.WriteAllBytes(destFilePath, jsonFile.bytes);
onComplete?.Invoke(true);
}
else
{
Debug.LogError("Failed to load JSON file");
onComplete?.Invoke(false);
}
}
else
{
Debug.LogError("No JSON file found in folder");
onComplete?.Invoke(false);
}
}
else
{
Debug.LogError("Failed to load folder resources");
onComplete?.Invoke(false);
}
}
private IEnumerator CopyFile(string sourceFile, string destFile, Action<bool> onComplete = null)
{
string filePath = "file://" + sourceFile;
using (UnityWebRequest www = UnityWebRequest.Get(filePath))
{
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success)
{
File.WriteAllBytes(destFile, www.downloadHandler.data);
Debug.Log($"File copied to {destFile}");
onComplete?.Invoke(true);
}
else
{
Debug.LogError("Failed to copy file: " + www.error);
onComplete?.Invoke(false);
}
}
}
/// <summary>
/// 读取或下载
/// </summary>
/// <param name="path"></param>
/// <param name="callback"></param>
public void ReadData(string path, Action<string> callback)
{
CrazyAsyKit.StartCoroutine(ReadDataEnumerator(path, callback));
}
/// <summary>
/// 读取或下载
/// </summary>
/// <param name="path"></param>
/// <param name="callback"></param>
/// <returns></returns>
private IEnumerator ReadDataEnumerator(string path, Action<string> callback)
{
string fullPath;
// 判断是网络URL还是本地文件路径
if (path.StartsWith("http://") || path.StartsWith("https://"))
{
fullPath = path; // 网络URL
}
else
{
// 本地文件路径
fullPath = "file://" + path;
}
// 使用UnityWebRequest读取数据
using (UnityWebRequest webRequest = UnityWebRequest.Get(fullPath))
{
yield return webRequest.SendWebRequest();
if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
{
Debug.LogError($"Error while reading file: {webRequest.error} path: {fullPath}");
callback?.Invoke(null); // 返回null表示出错
}
else
{
string data = webRequest.downloadHandler.text;
Debug.Log($"Data read successfully: {data}");
callback?.Invoke(data); // 通过回调传出数据
}
}
}
/// <summary>
/// 将内容写入指定文件,并删除原有文件。
/// </summary>
/// <param name="folderName">文件夹名称</param>
/// <param name="fileName">文件名称</param>
/// <param name="content">要写入的内容</param>
public void WriteToPersistentData(string folderName, string fileName, string content)
{
// 获取持久化数据路径
string folderPath = Path.Combine(Application.persistentDataPath, folderName);
// 如果文件夹不存在,则创建它
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
// 删除原有文件
var existingFiles = Directory.GetFiles(folderPath);
foreach (var file in existingFiles)
{
File.Delete(file);
}
// 完整文件路径
string filePath = Path.Combine(folderPath, fileName);
// 写入新文件
File.WriteAllText(filePath, content);
Debug.Log($"File written to: {filePath}");
}
/// <summary>
/// 提取指定目录下所有文件文件名
/// </summary>
/// <param name="subdirectory"></param>
/// <returns></returns>
public string[] GetFileNamesFromPersistentDataPath(string subdirectory)
{
string directoryPath = Path.Combine(Application.persistentDataPath, subdirectory);
if (Directory.Exists(directoryPath))
{
// 获取目录中的所有文件名
return Directory.GetFiles(directoryPath)
.Select(Path.GetFileName) // 只提取文件名
.ToArray();
}
else
{
Debug.LogWarning($"Directory does not exist: {directoryPath}");
return new string[0]; // 返回空数组
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2d7ee718e2a1471fa1d948628a66d1aa
timeCreated: 1727164004
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8495bd5c9c964c9893df4d30e80f2649
timeCreated: 1727581465
@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;
namespace Roy.ObjectPool
{
public class ObjectPool<T> where T : ObjectPoolItem
{
private readonly Queue<T> _pool; // 存储可重用对象的队列
private readonly T _prefab; // 预制体
private readonly string _poolName; // 预制体
private readonly Transform _parent; // 对象的父级
// 构造函数
public ObjectPool(string objectName, T prefab, int initialSize, Transform parent = null)
{
_poolName = objectName;
_prefab = prefab;
_parent = parent;
_pool = new Queue<T>();
// 初始化对象池
for (int i = 0; i < initialSize; i++)
{
T obj = CreateInstance();
_pool.Enqueue(obj);
}
}
// 创建对象的实例
private T CreateInstance()
{
var gameObject = Object.Instantiate(_prefab.gameObject, _parent);
gameObject.SetActive(false); // 初始化时设置为不激活
var instance = gameObject.GetComponent<T>();
instance.objectName = _poolName;
return instance;
}
// 获取一个对象
public T Get()
{
if (_pool.Count > 0)
{
T obj = _pool.Dequeue();
obj.gameObject.SetActive(true); // 获取时激活对象
return obj;
}
else
{
// 如果没有可用对象,创建一个新的
var obj = CreateInstance();
obj.gameObject.SetActive(true);// 激活对象
return obj;
}
}
// 归还对象
public void ReturnToPool(T obj)
{
obj.OnRecycle();
obj.gameObject.SetActive(false); // 归还时设置为不激活
obj.transform.SetParent(_parent);
obj.transform.localPosition = Vector3.zero;
_pool.Enqueue(obj); // 将对象返回池中
}
// 清空对象池
public void ClearPool()
{
while (_pool.Count > 0)
{
T obj = _pool.Dequeue();
Object.Destroy(obj.gameObject); // 清除所有对象
}
Object.Destroy(_parent);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 43b0aa3ccb0740cdacd10e06164ecb74
timeCreated: 1728964545
@@ -0,0 +1,17 @@
using UnityEngine;
namespace Roy.ObjectPool
{
public class ObjectPoolItem : MonoBehaviour
{
public string objectName;
/// <summary>
/// 返回对象池,回收时执行
/// </summary>
public virtual void OnRecycle()
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 97032cf20b09454ca983b038b9ff147b
timeCreated: 1729045887
@@ -0,0 +1,117 @@
using System.Collections.Generic;
using ScrewsMaster;
using UnityEngine;
using UnityEngine.UI;
namespace Roy.ObjectPool
{
public class PoolManager : SingletonMonoBehaviour<PoolManager>
{
private GameObject _gameObjectParentNode;
private GameObject _uiPoolParentNode;
private readonly Dictionary<string, object> _pools = new Dictionary<string, object>();
protected override void Awake()
{
_gameObjectParentNode = new GameObject("GameObjectPool");
_gameObjectParentNode.transform.SetParent(transform); // 设置为对象池管理类的子节点
// 创建一个用于存放UI元素的节点
_uiPoolParentNode = new GameObject("UIPool");
_uiPoolParentNode.transform.SetParent(transform); // 设置为对象池管理类的子节点
// 添加必需的组件
var canvas = _uiPoolParentNode.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceCamera;
foreach (var c in Camera.allCameras)
{
if (!c.name.Equals("Camera")) continue;//TODO 当前是去找固定名称的摄像机 后续看看怎么优化调整
canvas.worldCamera = c;
break;
}
var canvasScaler = _uiPoolParentNode.AddComponent<CanvasScaler>(); // 添加适配组件
canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
canvasScaler.referenceResolution = new Vector2(Screen.width, Screen.height);
_uiPoolParentNode.AddComponent<GraphicRaycaster>(); // 添加事件处理组件
base.Awake();
}
// 创建对象池
public void CreatePool<T>(string poolName, T prefab, int initialSize, bool isUI = false) where T : ObjectPoolItem
{
if (!_pools.ContainsKey(poolName))
{
var poolGameObject = new GameObject(poolName);
if (isUI)
{
poolGameObject.AddComponent<RectTransform>();
poolGameObject.SetParent(_uiPoolParentNode);
}
else
{
poolGameObject.SetParent(_gameObjectParentNode);
}
ObjectPool<T> pool = new ObjectPool<T>(poolName, prefab, initialSize, poolGameObject.transform);
_pools.Add(poolName, pool);
}
else
{
Debug.LogError($"尝试创建已经存在的的对象池,请检查 !!!");
}
}
// 获取对象
public T GetObject<T>(string poolName) where T : ObjectPoolItem
{
if (_pools.TryGetValue(poolName, out var pool))
{
return ((ObjectPool<T>)pool).Get();
}
else
{
Debug.LogError($"尝试获取没有初始化的对象池,请检查!!!!");
return null;
}
}
// 判断是否存在名称为 poolName 的对象池
public bool HasPool(string poolName)
{
return _pools.ContainsKey(poolName);
}
// 归还对象
public void ReturnObject<T>(string poolName, T obj) where T : ObjectPoolItem
{
if (_pools.TryGetValue(poolName, out var pool))
{
((ObjectPool<T>)pool).ReturnToPool(obj);
}
else
{
Destroy(obj.gameObject);
Debug.LogError($"归还了不存在对象池 {poolName} 的对象");
}
}
// 清空指定池
public void ClearPool(string poolName)
{
if (_pools.TryGetValue(poolName, out var pool))
{
((ObjectPool<ObjectPoolItem>)pool).ClearPool();
_pools.Remove(poolName); // 清空后移除池
}
else
{
Debug.LogError($"尝试清空不存在的对象池,请检查!!!");
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bfc0527198b24e8983adfd0c2f9e2ef1
timeCreated: 1728964617
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 16df66f027fdbc2408c47c53e75d559f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,9 +1,6 @@
using System;
using System.IO;
using BingoBrain.Core;
using UnityEngine;
using BingoBrain.Asset;
using BingoBrain.HotFix;
using System.Collections.Generic;
using Newtonsoft.Json;
using BingoBrain;
@@ -13,6 +10,8 @@ using DontConfuse;
using UnityEngine.Networking;
using UnityEngine.Events;
using System.Collections;
using ScrewsMaster;
using FairyGUI;
namespace BingoBrain
{
public class ConfigSystem_sdk
@@ -31,7 +30,7 @@ namespace BingoBrain
private static Dictionary<Type, object> configData = new();
public void OnRequestGetConfig()
{
GameHelper.PostFunnelLogin("loadBegin");
var loginData = LoginModel_sdk.Instance;
var configFileName = "Json";
@@ -81,8 +80,7 @@ namespace BingoBrain
// Debug.Log($"[UNITY] Load config from datapath: {assetHotFixFilePath}");
ParseConfig(File.ReadAllText(assetHotFixFilePath));
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
AppDispatcher.Instance.Dispatch(CsjInfoC.LoginInit);
GameHelper.PostFunnelLogin("loadFinish");
// GameHelper.PostFunnelLogin("loadFinish");
}
//检查设备本地是否有配置文件
@@ -129,7 +127,7 @@ namespace BingoBrain
if (!json.StartsWith("{"))
{
json = Encoding.UTF8.GetString(Base64Kit_sdk.Decrypt(Encoding.UTF8.GetBytes(json),
"com.matchgame.captaindicedubloons"));
NetworkManager.packName));
}
Debug.Log("转化后的json" + json);
SetConfig(json);
@@ -138,22 +136,20 @@ namespace BingoBrain
Debug.Log(GetRegisteredCalendarDaysByUTC(LoginModel_sdk.Instance.reg_time));
SdkManager.Instance.OpenWv();
// int flyswitch = ConfigSystem.GetConfig<CommonModel>().flyswitch;
// int propswitch = ConfigSystem.GetConfig<CommonModel>().propswitch;
// float top_offset = 150;//fgui中的顶部信息的高度
// float buttom_offset = 0;
// if (Screen.safeArea.y != 0)
// {//刘海屏
// top_offset += Screen.safeArea.y;
// }
int flyswitch = ConfigSystem.GetConfig<CommonModel>().flyswitch;
int propswitch = ConfigSystem.GetConfig<CommonModel>().propswitch;
float top_offset = 150;//fgui中的顶部信息的高度
float buttom_offset = 0;
if (Screen.safeArea.y != 0)
{//刘海屏
top_offset += Screen.safeArea.y;
}
// SdkManager.Instance.setFlyBtnTag(flyswitch == 1);
// SdkManager.Instance.setRewardBtnTag(propswitch == 1);
// SdkManager.Instance.SetBtn(ConfigSystem.GetConfig<CommonModel>().propCoord[0], ConfigSystem.GetConfig<CommonModel>().propCoord[1], 60, 60);
// SdkManager.Instance.SetPadding(0, top_offset / GRoot.inst.height, 0, buttom_offset / GRoot.inst.height);
SdkManager.Instance.setFlyBtnTag(flyswitch == 1);
SdkManager.Instance.setRewardBtnTag(propswitch == 1);
SdkManager.Instance.SetBtn(ConfigSystem.GetConfig<CommonModel>().propCoord[0], ConfigSystem.GetConfig<CommonModel>().propCoord[1], 60, 60);
SdkManager.Instance.SetPadding(0, top_offset / GRoot.inst.height, 0, buttom_offset / GRoot.inst.height);
SdkManager.Instance.SetDarkThough(true);
SdkManager.Instance.RefreshUrl();
SdkManager.Instance.ShowH5View(false);
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c8538a57a3c527342a227adf0c5c9f20
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2d66722231daf944ba4c10b0af879c96
guid: e0aea1b60e9976e4293e8a33deb1c488
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -2,10 +2,10 @@
using UnityEngine;
using Newtonsoft.Json;
using BingoBrain.Core;
using BingoBrain;
using DG.Tweening;
using System;
using ScrewsMaster;
public class LoginSystem_sdk
{
@@ -30,7 +30,7 @@ public class LoginSystem_sdk
{
device_id = SystemInfo.deviceUniqueIdentifier,
// device_id ="E742FE8B-C32E-56A7-8F8A-6B3BC0F3169",
pack_name = "com.matchgame.captaindicedubloons",
pack_name = NetworkManager.packName,
app_version = Application.version,
// channel = BingoBea.Instance.attribution,
// sim = WebviewManager.haveSimCard
@@ -88,11 +88,7 @@ public class LoginSystem_sdk
// {
// RequestHeart();
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData);
NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig);
GameHelper.PostFunnelLogin("loginRecv", true);
// GameHelper.PostFunnelLogin("loginRecv", true);
ConfigSystem_sdk.Instance.OnRequestGetConfig();
// if (GameHelper.IsGiftSwitch())
// {
@@ -105,7 +101,6 @@ public class LoginSystem_sdk
Debug.Log(JsonConvert.SerializeObject(loginData));
//UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
Debug.Log("登陆请求失败");
GameHelper.PostFunnelLogin("loginRecv", false);
float times = loginCount == 0 ? 0 : 5f;
@@ -124,7 +119,6 @@ public class LoginSystem_sdk
{
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
};
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, _OnFail);
}
});
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f3a411886fa88a741b96f7124a48b681
guid: b0e15557430f65f449b5b9a4fa39bb1b
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -10,6 +10,8 @@ using System;
using DontConfuse;
using System.Linq;
using System.Security.Cryptography;
using FutureCore;
using ScrewsMaster;
@@ -32,9 +34,19 @@ public class NetworkKit_sdk
{
PlayerPrefs.SetString(JarvisToken_SDK, token);
}
public const string DomainDebugUrl = @"https://sdkapi.jsoncompare.online/api/";
public const string DomainDebugUrl = @"https://sdkapi.jsoncompare.online/";
public static string DomainRelease = "zoomatchsolo.top";
// 改为只读属性,实时获取(等调用时 DomainRelease 早就初始化好了)
public static string DomainReleaseUrl => $"https://{DomainRelease}/sdkapi/";
// 改为只读属性,实时获取
#if JarvisRelease
public static string CrazyUrl => DomainReleaseUrl;
#else
public static string CrazyUrl => DomainDebugUrl;
#endif
public static readonly string DomainReleaseUrl = $"https://bingotornado.top/api/";
private static IEnumerator PostInternal<T>(string url, object requestData, UnityAction<bool, T> onCompleted,
Dictionary<string, string> header = null)
@@ -42,13 +54,13 @@ public class NetworkKit_sdk
string requestJson = JsonConvert.SerializeObject(requestData);
string url2 = url;
#if BingoBrainRelease
#if JarvisRelease
url2 = Base64Kit_sdk.Encode(url);
requestJson = Base64Kit_sdk.Encode(requestJson);
#endif
byte[] bytes = Encoding.UTF8.GetBytes(requestJson);
string url1 = DomainDebugUrl + url2;
//Debug.Log($"Url: {url1}");
string url1 = CrazyUrl + url2;
Debug.Log($"Url: {url1}");
UnityWebRequest loginRequest = new UnityWebRequest(url1, UnityWebRequest.kHttpVerbPOST)
{
uploadHandler = new UploadHandlerRaw(bytes),
@@ -72,7 +84,7 @@ public class NetworkKit_sdk
else
{
string receiveContent = loginRequest.downloadHandler.text;
#if BingoBrainRelease
#if JarvisRelease
if (!receiveContent.IsNullOrWhiteSpace())
{
receiveContent = receiveContent.Substring(0, receiveContent.Length - 1);
@@ -335,73 +347,73 @@ public class NetworkKit_sdk
}
public class Base64Kit_sdk
{
// public static string Base64Encode(string source)
// {
// byte[] bytes = Encoding.UTF8.GetBytes(source);
// string encode = Convert.ToBase64String(bytes);
// return encode;
// }
// public static string Encode(string data, bool is_apple_pay = false)
// {
// var key = BingoBrain.Network.DomainRelease;
// //if (is_apple_pay) key = "com.leisuregames.crazygourmet";
public static string Base64Encode(string source)
{
byte[] bytes = Encoding.UTF8.GetBytes(source);
string encode = Convert.ToBase64String(bytes);
return encode;
}
public static string Encode(string data, bool is_apple_pay = false)
{
var key = NetworkKit_sdk.DomainRelease;
//if (is_apple_pay) key = "com.leisuregames.crazygourmet";
// var keyMD5 = MD5Kit.MD5String1(key);
// //UnityEngine.Debug.Log("Base64 Encode Key: " + keyMD5);
// var str = Base64EncodeUtil.Base64Encode(data + keyMD5);
var keyMD5 = MD5Kit.MD5String1(key);
//UnityEngine.Debug.Log("Base64 Encode Key: " + keyMD5);
var str = Base64EncodeUtil.Base64Encode(data + keyMD5);
// var bytes = Encoding.UTF8.GetBytes(str);
// for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
// {
// if (i % 2 == 0)
// {
// (bytes[i], bytes[j]) = (bytes[j], bytes[i]);
// }
// }
var bytes = Encoding.UTF8.GetBytes(str);
for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
{
if (i % 2 == 0)
{
(bytes[i], bytes[j]) = (bytes[j], bytes[i]);
}
}
// var loginData = Encoding.UTF8.GetString(bytes);
// return loginData;
// }
var loginData = Encoding.UTF8.GetString(bytes);
return loginData;
}
// public static string Decode(string data)
// {
// var bytes = Encoding.UTF8.GetBytes(data);
// for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
// {
// if (i % 2 == 0)
// {
// (bytes[i], bytes[j]) = (bytes[j], bytes[i]);
// }
// }
public static string Decode(string data)
{
var bytes = Encoding.UTF8.GetBytes(data);
for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
{
if (i % 2 == 0)
{
(bytes[i], bytes[j]) = (bytes[j], bytes[i]);
}
}
// var str = Encoding.UTF8.GetString(bytes);
// var str1 = Base64EncodeUtil.Base64Decode(str);
// var key = BingoBrain.Network.DomainRelease;
// var keyMD5 = MD5Kit.MD5String1(key);
// // Debug.Log("Base64 Decode Key: " + keyMD5);
// // Debug.Log("Base64 Decode str1: " + str1);
// var result = str1.Replace(keyMD5, string.Empty);
// return result;
// }
var str = Encoding.UTF8.GetString(bytes);
var str1 = Base64EncodeUtil.Base64Decode(str);
var key = NetworkKit_sdk.DomainRelease;
var keyMD5 = MD5Kit.MD5String1(key);
// Debug.Log("Base64 Decode Key: " + keyMD5);
// Debug.Log("Base64 Decode str1: " + str1);
var result = str1.Replace(keyMD5, string.Empty);
return result;
}
// public static string Decode(string data, string key)
// {
// var bytes = Encoding.UTF8.GetBytes(data);
// for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
// {
// if (i % 2 == 0)
// {
// (bytes[i], bytes[j]) = (bytes[j], bytes[i]);
// }
// }
public static string Decode(string data, string key)
{
var bytes = Encoding.UTF8.GetBytes(data);
for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
{
if (i % 2 == 0)
{
(bytes[i], bytes[j]) = (bytes[j], bytes[i]);
}
}
// var str = Encoding.UTF8.GetString(bytes);
// var str1 = Base64EncodeUtil.Base64Decode(str);
// // var key = NetworkManager.DomainRelease;
// var keyMD5 = MD5Kit.MD5String1(key);
// var result = str1.Replace(keyMD5, string.Empty);
// return result;
// }
var str = Encoding.UTF8.GetString(bytes);
var str1 = Base64EncodeUtil.Base64Decode(str);
// var key = NetworkManager.DomainRelease;
var keyMD5 = MD5Kit.MD5String1(key);
var result = str1.Replace(keyMD5, string.Empty);
return result;
}
private static byte[] GenerateKey(string secret)
{
using var sha256 = SHA256.Create();
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 14b39d653503e7f42b9992c6815b62a4
guid: 5bc692f6af350864d89381f7546552fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -9,12 +9,12 @@ using UnityEngine.EventSystems;
using BingoBrain;
using DG.Tweening;
using BingoBrain;
using BingoBrain.Core;
using BingoBrain.HotFix;
using Unity.VisualScripting.FullSerializer;
using Unity.VisualScripting;
using Newtonsoft.Json;
using System.Collections;
using ScrewsMaster;
namespace DontConfuse
@@ -71,7 +71,6 @@ namespace DontConfuse
}
public void SetDarkThough(bool though)
{
if (!GameHelper.IsGiftSwitch()) return;
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.SetDarkThough(though);
#endif
@@ -130,9 +129,9 @@ namespace DontConfuse
public void ObjC_TouchClick(string name)
{
// Debug.Log("Touch click: " + name);
GameDispatcher.Instance.Dispatch(BingoInfo.H5ViewClickBtn, name);
GameDispatcher.Instance.Dispatch(GameMsg.H5ViewClickBtn, name);
}
public void H5AutoRefresh(string string_xcode)
public void H5AutoRefresh(string string_xcode)
{
if (string_xcode.Contains("|h5"))
{
@@ -384,14 +383,14 @@ namespace DontConfuse
Debug.Log(light_str);
Debug.Log(layer_click_probability);
Debug.Log(add_time);
int reg_days = ConfigSystem_sdk.Instance.GetRegisteredCalendarDaysByUTC(LoginModel_sdk.Instance.reg_time);
int reg_days = ConfigSystem_sdk.Instance.GetRegisteredCalendarDaysByUTC(LoginModel_sdk.Instance.reg_time);
bool open_dark_wv = true;
if (ConfigSystem_sdk.Instance. SDKConfig.h6Conf.switchCondition != null)
if (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition != null)
{
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition.retentionConf.Count; i++)
{
if ((reg_days >= ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition.retentionConf[i].days.min) &&
(reg_days <=ConfigSystem_sdk.Instance. SDKConfig.h6Conf.switchCondition.retentionConf[i].days.max))
(reg_days <= ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition.retentionConf[i].days.max))
{
if (UnityEngine.Random.Range(0, 100) >= ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition.retentionConf[i].prob)
{
@@ -405,7 +404,7 @@ namespace DontConfuse
addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
UnityEngine.Random.Range(ConfigSystem_sdk.Instance.SDKConfig.h5Conf.f5Interval.min, ConfigSystem_sdk.Instance.SDKConfig.h5Conf.f5Interval.max + 1), -1, -1
, darkWVRefreshtime_str, "", dark_str, light_str,open_dark_wv , layer_click_probability, add_time);
, darkWVRefreshtime_str, "", dark_str, light_str, open_dark_wv, layer_click_probability, add_time);
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9e4a4fc2ee037174b95c916ef5475ee2
guid: f320161c7337dbf46989861b4ea8d8b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
+221
View File
@@ -0,0 +1,221 @@
using System;
using ScrewsMaster;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using Roy.ObjectPool;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using ColorUtility = UnityEngine.ColorUtility;
using Sequence = DG.Tweening.Sequence;
namespace SGame
{
public class ScrewsLogic : ObjectPoolItem
{
public PanelLogic panelLogic;
public PolygonCollider2D polygonCollider2D;
private HingeJoint2D _hingeJoint2D;
private Button _button;
public Text testText;
private CanvasGroup _canvasGroup;
private void Awake()
{
// panelLogic = GetComponentInParent<PanelLogic>();
polygonCollider2D = GetComponentInChildren<PolygonCollider2D>();
_hingeJoint2D = GetComponentInChildren<HingeJoint2D>(); ;
_button = GetComponentInChildren<Button>();
_canvasGroup = gameObject.AddComponent<CanvasGroup>();
// if (panelLogic != null)
// {
// _hingeJoint2D.connectedBody = panelLogic.GetComponent<Rigidbody2D>();
// _hingeJoint2D.enabled = true;//初始化时都启用一下物理组件,有的预制体里面没启用
// }
}
void Start()
{
_button.onClick.AddListener(OnClick);
}
#region
public int screwsType;
public Image head;
public Image thread;
public float threadHeightMax = 59f;
public float threadHeightMin = 30f;
// public Vector2 threadDefault = 32f;
public void Init(int t)
{
screwsType = t;
SetSprite(ShowScrews.Instance.GetScrewsSprite(screwsType));
thread.color = ColorUtility.TryParseHtmlString(ShowScrews.ScrewColors[screwsType], out Color _color)
? _color
: Color.white;
panelLogic = GetComponentInParent<PanelLogic>();
if (panelLogic != null)
{
_hingeJoint2D.connectedBody = panelLogic.GetComponent<Rigidbody2D>();
_hingeJoint2D.enabled = true;//初始化时都启用一下物理组件,有的预制体里面没启用
}
_button.enabled = true;
transform.localScale = Vector3.one;
}
#if !JarvisRelease
private void Update()
{
if (testText.gameObject.activeSelf)
{
var point = RectTransformUtility.WorldToScreenPoint(ShowScrews.Instance.myCamera, transform.position);
testText.text = point.ToString();
}
}
#endif
private void SetSprite(Sprite sprite)
{
head.sprite = sprite;
}
public void OnClick()
{
ShowScrews.Instance.is_resurgence = false;
if (ShowScrews.Instance.gameOver) return;//游戏结束
var panelLayerDic = ShowScrews.Instance.PanelLayerDic;
for (int i = panelLogic.GetLayer() + 1; i <= 100; i++)
{
if (panelLayerDic.TryGetValue(i, out var layer))
{
if (ShowScrews.Instance.CheckOverlapWithExistingObjects(polygonCollider2D,
layer))
{
return;
}
}
}
AudioManager.Instance.PlayDynamicEffect(AudioConst.UIButtonDefault);//播放音效
var boxTypeLogic = ShowScrews.Instance.GetBoxTypeLogic(screwsType);
if (boxTypeLogic != null)
{
if (boxTypeLogic.CanUseKong(this))
{
UnlinkFromPanel();
return;
}
}
var kongLogic = ShowScrews.Instance.GetKongLogic();
if (kongLogic != null)
{
kongLogic.SetCurScrews(this);
FlyToTarget(kongLogic.transform, () =>
{
if (ShowScrews.Instance.GetIdleHoleCount() <= 0)
{
ShowScrews.Instance.OnGameFailed();//游戏失败,等待飞螺丝动画后执行失败逻辑
}
});
if (ShowScrews.Instance.GetIdleHoleCount() <= 0)
{
ShowScrews.Instance.gameOver = true;//游戏结束,设置结束标记
}
UnlinkFromPanel();
return;
}
ShowScrews.Instance.OnGameFailed();//游戏失败
}
public Sequence FlyToTarget(Transform target, UnityAction action = null)
{
if (panelLogic != null)
{
panelLogic.RemoveActiveScrewCount(this);
panelLogic = null;
}
transform.rotation = Quaternion.Euler(Vector3.zero);
transform.SetParent(ShowScrews.Instance.flightControlLayer);
var sequence = DOTween.Sequence();
sequence.Append(head.rectTransform.DOLocalRotate(new Vector3(0, 0, 360), 0.25f, RotateMode.FastBeyond360));
sequence.Join(thread.rectTransform.DOSizeDelta(new Vector2(thread.rectTransform.sizeDelta.x, threadHeightMax), 0.25f));
// sequence.AppendCallback(() =>
// {
// transform.SetParent(target);
// });
// sequence.AppendInterval(0.05f);
// sequence.Append(transform.DOLocalMove(Vector3.zero, 0.5f).SetEase(Ease.OutBack));
sequence.Append(transform.DOMove(target.position, 0.3f).SetEase(Ease.OutBack));
sequence.AppendCallback(() =>
{
transform.SetParent(target);
transform.localPosition = Vector3.zero;
});
sequence.AppendInterval(0.05f);
sequence.AppendCallback(() => { AudioManager.Instance.PlayDynamicEffect(AudioConst.FlyToCacheKong); });
sequence.Append(head.rectTransform.DOLocalRotate(new Vector3(0, 0, -360), 0.25f, RotateMode.FastBeyond360));
sequence.Join(thread.rectTransform.DOSizeDelta(new Vector2(thread.rectTransform.sizeDelta.x, threadHeightMin), 0.25f));
sequence.AppendCallback(() =>
{
action?.Invoke();
});
return sequence;
}
/// <summary>
/// 禁用触控与物理组件
/// </summary>
private void UnlinkFromPanel()
{
_button.enabled = false;
_hingeJoint2D.enabled = false;
}
public TweenerCore<float, float, FloatOptions> ShowAnim()
{
return _canvasGroup.DOFade(1f, 0.5f);
}
public void SetAlpha(float alpha)
{
_canvasGroup.alpha = alpha;
}
public override void OnRecycle()
{
base.OnRecycle();
panelLogic = null;
}
#endregion
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be6e27c505386b14196ba7ae9920e81f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 312f593a69e67ca47ae66a4807e9e220
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+48
View File
@@ -0,0 +1,48 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
public class Toast : MonoBehaviour
{
public Text toastText;
private RectTransform _rectTransform;
private CanvasGroup _canvasGroup;
private Vector2 _startPosition;
private Sequence _sequence;
private void Awake()
{
_rectTransform = transform as RectTransform;
_canvasGroup = gameObject.AddComponent<CanvasGroup>();
if (_rectTransform != null) _startPosition = _rectTransform.anchoredPosition;
}
public void ShowToast(string str, float duration = 1.5f, float fadeOutDuration = 1.5f, float moveDistance = 250f)
{
toastText.text = str;
_sequence = DOTween.Sequence();
_sequence
.Append(_rectTransform.DOAnchorPosY(_startPosition.y + moveDistance, duration)) // 上升动画
.Join(_canvasGroup.DOFade(0f, fadeOutDuration)) // 淡出动画
.OnComplete(() => ToastPool.Instance.ReturnToPool(this)); // 动画结束后隐藏
}
public void Reset()
{
// 重置透明度
_canvasGroup.alpha = 1f;
// 重置位置
_rectTransform.anchoredPosition = _startPosition;
_rectTransform.gameObject.SetActive(false);
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad57788d39136a445867b63aec5db1fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+39
View File
@@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ToastPool : MonoBehaviour
{
public static ToastPool Instance;
[SerializeField] private Toast toastPrefab; // Toast预制体
[SerializeField] private Transform poolParent; // 对象池中的Toast存放位置
private Queue<Toast> pool = new Queue<Toast>();
private void Awake()
{
Instance = this;
}
// 获取一个Toast
public Toast GetFromPool()
{
if (pool.Count > 0)
{
Toast toast = pool.Dequeue();
toast.gameObject.SetActive(true);
return toast;
}
return Instantiate(toastPrefab, poolParent);
}
// 回收Toast到对象池
public void ReturnToPool(Toast toast)
{
toast.Reset(); // 重置Toast状态
pool.Enqueue(toast); // 回收进队列
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4334d1e1f055d3840b0d9d0c86267cf8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+70
View File
@@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using DontConfuse;
using ScrewsMaster;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace DontConfuse
{
public class TwistNode : MonoBehaviour
{
public GameObject bg;
public void TwistPos(string str = "")
{
// Vector3 v3 = new Vector3(0, 0, 0);
// if (str != "")
// {
// v3.x = float.Parse(str.Split("##")[0]) * Screen.width;
// v3.y = float.Parse(str.Split("##")[1]) * Screen.height;
// }
if (str != "")
{
string[] a = str.Split("##");
if (a.Length >= 2)
{
// WebviewManager.Instance.TouchClickPoint(a[0] + "|" + a[1]);
}
}
// PointerEventData pointerEventData = new PointerEventData(EventSystem.current);
// pointerEventData.position = new Vector2(v3.x, v3.y);
// Debug.Log("------------------------" + str);
// Debug.Log(v3.x + "------------------------" + v3.y);
// List<RaycastResult> results = new List<RaycastResult>();
// EventSystem.current.RaycastAll(pointerEventData, results);
// // Debug.Log("------------------------"+results.Count);
// if (results.Count > 0)
// {
// pointerEventData.pointerCurrentRaycast = results[0];
// ExecuteEvents.Execute(results[0].gameObject, pointerEventData, ExecuteEvents.pointerClickHandler);
// if (results[0].gameObject.GetComponent<InputField>() != null)
// {
// EventSystem.current.SetSelectedGameObject(results[0].gameObject.gameObject);
// results[0].gameObject.GetComponent<InputField>().OnPointerClick(new PointerEventData(EventSystem.current));
// }
// }
// EventSystem.current.SetSelectedGameObject(null);
// pointerEventData.pointerCurrentRaycast = new RaycastResult();
// results.Clear();
}
public void TwistBg(string alp)
{
#if JarvisRelease
int a = int.Parse(alp);
Color cl = bg.GetComponent<Image>().color;
cl.a = a;
//bg为游戏背景图片
bg.GetComponent<Image>().color = cl;
#endif
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f342bfdaac9ae4d729e7eb83b84641cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+95
View File
@@ -0,0 +1,95 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections.Generic;
using FairyGUI;
using Roy;
public class UIScreenTapTrigger : SingletonMonoBehaviour<UIScreenTapTrigger>
{
public Canvas canvas; // 目标 Canvas
private GraphicRaycaster raycaster;
private EventSystem eventSystem;
private RectTransform _canvasRect;
private float _scaleX, _scaleY;
private float _ignoreY;
private void Start()
{
// 获取 Canvas 上的 GraphicRaycaster 和 EventSystem
raycaster = canvas.GetComponent<GraphicRaycaster>();
eventSystem = EventSystem.current;
_canvasRect = canvas.GetComponent<RectTransform>();
// 分别计算 X 和 Y 方向的缩放因子
_scaleX = Screen.width / _canvasRect.sizeDelta.x;
_scaleY = Screen.height / _canvasRect.sizeDelta.y;
}
public void SetIgnoreY(float ignoreY)
{
_ignoreY = ignoreY;
}
// 将 iOS 的比例坐标转换为 Unity 坐标
private Vector2 ConvertToUnityPosition(Vector2 ratioPosition)
{
// Debug.LogError($"转换canvasRect size{_canvasRect.sizeDelta.x}, {_canvasRect.sizeDelta.y} ");
// Debug.LogError($"转换screen{Screen.width}x{Screen.height} 当前scale{_scaleX}x{_scaleY}" );
// 计算屏幕坐标并翻转 Y 轴
float x = ratioPosition.x * _canvasRect.sizeDelta.x * _scaleX;
float y = (1 - ratioPosition.y) * _canvasRect.sizeDelta.y * _scaleY;
return new Vector2(x, y);
}
// 检测特定屏幕坐标的 UI 按钮并触发
public bool TriggerButtonAtScreenPosition(Vector2 screenPosition)
{
// Debug.LogError($"转换前比例{screenPosition}");
screenPosition = ConvertToUnityPosition(screenPosition);
if (screenPosition.y < _ignoreY)
{
Debug.LogError($"TouchClickPoint 忽略当前高度{screenPosition.y} 限制范围Y{_ignoreY}");
return false;
}
// Debug.LogError($"转换后坐标{screenPosition}");
// 设置射线检测的事件数据
PointerEventData pointerEventData = new PointerEventData(eventSystem)
{
position = screenPosition
};
// 用于存储检测结果
List<RaycastResult> results = new List<RaycastResult>();
// 对屏幕坐标进行射线检测
raycaster.Raycast(pointerEventData, results);
// 遍历检测结果
foreach (RaycastResult result in results)
{
var target = result.gameObject.GetComponent<Button>();
if (target != null)
{
// 触发按钮点击事件
// button.onClick.Invoke();
// ExecuteEvents.Execute(result.gameObject, pointerEventData, ExecuteEvents.submitHandler);
ExecuteEvents.Execute(result.gameObject, pointerEventData, ExecuteEvents.pointerClickHandler);
Debug.Log("Button triggered: " + result.gameObject.name);
return true;
}
}
return false;
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c397f9da8994cf49aa030a19853a442
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+764
View File
@@ -0,0 +1,764 @@
// using System;
// using System.Collections.Generic;
// using System.Linq;
// using FairyGUI;
// using UnityEngine;
// namespace ScrewsMaster
// {
// public class WebviewManager : MonoBehaviour
// {
// // Vector2 startPos;
// // float lastTouchTime = 0f;
// // float touchInterval = 0.3f;
// // void Update()
// // {
// // #if UNITY_IOS && !UNITY_EDITOR
// // if(Input.touchCount > 0)
// // {
// // Touch touch_ = Input.GetTouch(0);
// //
// // if(touch_.phase == TouchPhase.Began)
// // {
// // startPos = touch_.position;
// // lastTouchTime = Time.time;
// // }
// // if(touch_.phase == TouchPhase.Ended)
// // {
// // if ((Time.time - lastTouchTime) < touchInterval){
// // // if (WebViewMgr.Instance.WebUIType == WebUIType.H5 && EventSystem.current.currentSelectedGameObject == null){
// // // BrigdeIOS.SetTouchWebview(true, true);
// // // }else{
// // // BrigdeIOS.SetTouchWebview(true);
// // // }
// // BrigdeIOS.SetClickView();
// // }
// // }
// // // if(touch_.phase == TouchPhase.Moved){
// // // Vector2 delta = touch_.position - startPos;
// // // // Debug.Log("delta Y: " + delta.y);
// // // BrigdeIOS.ScrollWebview(delta.x, delta.y);
// // // startPos = touch_.position;
// // // }
// // }
// // #endif
// // }
// public static WebviewManager Instance;
// public WebviewManager()
// {
// Instance = this;
// }
// public void OpenWebView(string url)
// {
// //Debug.Log("[WebviewManager] OpenWebView");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.OpenWebview(url);
// #endif
// }
// public void showDarkWebview()
// {
// //Debug.Log("[WebviewManager] OpenWebView");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.showDarkWebview();
// #endif
// }
// public void CloseWebview()
// {
// //Debug.Log("[WebviewManager] CloseWebview");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.CloseWebview();
// #endif
// }
// public void SetOffset(int offset_y, int offset_y1)
// {
// // Debug.Log($"barry [WebviewManager] SetOffset:{offset_y}, {offset_y1}");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.SetOffset(offset_y, offset_y1);
// #endif
// }
// public void SetPadding(float left, float top, float right, float bottom)
// {
// // Debug.Log("[WebviewManager] SetPadding");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.SetPadding(left, top, right, bottom);
// #endif
// }
// public void openWebview()
// {
// #if UNITY_IOS && !UNITY_EDITOR
// BrigdeIOS.openWebview();
// #endif
// }
// public void SetDarkThough(bool though)
// {
// if(!GameHelper.IsGiftSwitch()) return;
// // Debug.Log("[WebviewManager] SetPadding");
// #if UNITY_IOS && !UNITY_EDITOR
// BrigdeIOS.SetDarkThough(though);
// #endif
// }
// public void SetBtn(int left, int top, int right, int bottom)
// {
// // Debug.Log("[WebviewManager] SetBtn");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.SetBtn(left, top, right, bottom);
// #endif
// }
// public void SetCTEnable(bool flag)
// {
// // Debug.Log("[WebviewManager] SetCTEnable");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.SetCTEnable(flag);
// #endif
// }
// public void SetFullScreen()
// {
// // Debug.Log("[WebviewManager] SetFullScreen");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.SetFullScreen();
// #endif
// }
// public void addH5Field(int field1, int field2, int field3, int field4, int field5, string field6, string field7, string dark_url, string light_url, bool is_gift, string web_through_str, string click_add_time)
// {
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.addH5Field(field1,field2,field3,field4,field5,field6,field7,dark_url,light_url,is_gift,web_through_str,click_add_time);
// #endif
// }
// public void ShowH5View(bool flag)
// {
// // Debug.Log("[WebviewManager] SetCTEnable");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.ShowH5View(flag);
// #endif
// }
// public void SetIconProgress(float val)
// {
// // Debug.Log("[WebviewManager] SetCTEnable");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.SetIconProgress(val);
// #endif
// }
// public void setInH5View(bool flag)
// {
// // Debug.Log("[WebviewManager] SetCTEnable");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.setInH5View(flag);
// #endif
// }
// public void upDataH5times(string weblink, int times, bool is_dark)
// {
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.upDataH5times( weblink, times,is_dark);
// #endif
// }
// public void ShowFlyBtn(bool flag)
// {
// // Debug.Log("[WebviewManager] SetCTEnable");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.ShowFlyBtn(flag);
// #endif
// }
// public void setFlyBtnTag(bool flag)
// {
// Debug.Log($"[WebviewManager] setFlyBtnTag ---{flag}");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.setFlyBtnTag(flag);
// #endif
// }
// public void setRewardBtnTag(bool flag)
// {
// Debug.Log($"[WebviewManager] setRewardBtnTag--- {flag}");
// #if UNITY_IOS && !UNITY_EDITOR
// // BrigdeIOS.setRewardBtnTag(flag);
// #endif
// }
// public void ObjC_TouchClick(string name)
// {
// // Debug.Log("Touch click: " + name);
// GameDispatcher.Instance.Dispatch(GameMsg.H5ViewClickBtn, name);
// }
// public void H5AutoRefresh(string times)
// {
// if (times == "") return;
// DateTime newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
// newDate = newDate.AddSeconds(GameHelper.GetNowTime());
// var newDays = newDate.Day;
// if (times == "Dailyrefreshtimes")
// {
// var last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
// if (last_time == newDays)
// {
// var numbers = PlayerPrefs.GetInt("Dailyrefreshnum", 0);
// numbers++;
// PlayerPrefs.SetInt("Dailyrefreshnum", numbers);
// }
// else
// {
// PlayerPrefs.SetInt("Dailyrefreshnum", 1);
// PlayerPrefs.SetInt("Dayreftimes", newDays);
// string darkWVRefreshtime_str = "";
// string darkWVDailyrefreshtimes_str = "";
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime.Length; i++)
// {
// if (i != 0) darkWVRefreshtime_str += "|";
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime[i].ToString();
// }
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2.Length; i++)
// {
// darkWVRefreshtime_str += "|";
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2[i].ToString();
// }
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes.Length; i++)
// {
// if (i != 0) darkWVDailyrefreshtimes_str += "|";
// darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes[i].ToString();
// }
// WebviewManager.Instance.addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
// ConfigSystem.GetConfig<CommonModel>().H5Refreshtime, ConfigSystem.GetConfig<CommonModel>().Dailyrefreshtimes, ConfigSystem.GetConfig<CommonModel>().darkThoughProbability, darkWVRefreshtime_str,
// darkWVDailyrefreshtimes_str, "", "", GameHelper.IsGiftSwitch(), "", "");
// }
// }
// else if (times.Contains("dark_Dailyrefreshtimes"))
// {
// var last_time = PlayerPrefs.GetInt("dark_refreshDay", 0);
// if (last_time == newDays)
// {
// // var numbers = PlayerPrefs.GetInt("dark_Dayref", 0);
// // numbers++;
// // PlayerPrefs.SetInt("dark_Dayref", numbers);
// string[] temp_arr = times.Split("|");
// if (temp_arr.Length >= 2)
// {
// SaveData.GetSaveobject().dark_Dayref[Int32.Parse(temp_arr[1])]++;
// SaveData.saveDataFunc();
// }
// }
// else
// {
// // PlayerPrefs.SetInt("dark_Dayref", 1);
// string[] temp_arr = times.Split("|");
// if (temp_arr.Length >= 2)
// {
// SaveData.GetSaveobject().dark_Dayref[Int32.Parse(temp_arr[1])] = 1;
// SaveData.saveDataFunc();
// }
// PlayerPrefs.SetInt("dark_refreshDay", newDays);
// string darkWVRefreshtime_str = "";
// string darkWVDailyrefreshtimes_str = "";
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime.Length; i++)
// {
// if (i != 0) darkWVRefreshtime_str += "|";
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime[i].ToString();
// }
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2.Length; i++)
// {
// darkWVRefreshtime_str += "|";
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2[i].ToString();
// }
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes.Length; i++)
// {
// if (i != 0) darkWVDailyrefreshtimes_str += "|";
// darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes[i].ToString();
// }
// WebviewManager.Instance.addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
// ConfigSystem.GetConfig<CommonModel>().H5Refreshtime, ConfigSystem.GetConfig<CommonModel>().Dailyrefreshtimes, ConfigSystem.GetConfig<CommonModel>().darkThoughProbability, darkWVRefreshtime_str,
// darkWVDailyrefreshtimes_str, "", "", GameHelper.IsGiftSwitch(), "", "");
// }
// }
// else
// {
// string[] temp_array = times.Split("|");
// if (temp_array.Length >= 2 && temp_array[0] != null && temp_array[0] != "")
// {
// if (temp_array[1] == "h5")
// {
// H5sendClass info = new H5sendClass() { link = temp_array[0], type = "h5" };
// NetworkKit.PostWithHeader<H5refreshTimes>("event/h5Impressions", info, (isSuccess, obj) =>
// {
// if (isSuccess)
// {
// int numbers = 0;
// for (int i = 0; i < ConfigSystem.light_weblist.Count; i++)
// {
// if (ConfigSystem.light_weblist[i].webLink == temp_array[0])
// {
// Debug.Log("uuuuuuuuuuuuuuuuu明穿透" + temp_array[0] + "已经刷新了" + obj.times + "次" + "上限是" + ConfigSystem.light_weblist[i].refreshMax + "次");
// numbers = ConfigSystem.light_weblist[i].refreshMax - obj.times;
// break;
// }
// }
// if (numbers < 0) numbers = 0;
// upDataH5times(temp_array[0], numbers, false);
// }
// });
// }
// else
// {
// H5sendClass info = new H5sendClass() { link = temp_array[0], type = "h6" };
// NetworkKit.PostWithHeader<H5refreshTimes>("event/h5Impressions", info, (isSuccess, obj) =>
// {
// if (isSuccess)
// {
// int numbers = 0;
// for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
// {
// if (ConfigSystem.dark_weblist[i].webLink == temp_array[0])
// {
// Debug.Log("uuuuuuuuuuuuuuuuu暗穿透" + temp_array[0] + "已经刷新了" + obj.times + "次" + "上限是" + ConfigSystem.dark_weblist[i].refreshMax + "次");
// numbers = ConfigSystem.dark_weblist[i].refreshMax - obj.times;
// break;
// }
// }
// if (numbers < 0) numbers = 0;
// upDataH5times(temp_array[0], numbers, true);
// }
// });
// }
// }
// }
// }
// private GList select_glist;
// private float select_glist_y;
// // public void TouchClickPoint(string name)
// // {
// // Debug.Log("TouchClickPoint" + name);
// // if (string.IsNullOrEmpty(name)) return;
// // if (name == "flyBtn")
// // {
// // NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.fly_ct_number, 1);
// // //NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.fly_ct_people,1);
// //
// // }
// //
// // if (name == "rewardBtn")
// // {
// // NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_ct_number, 1);
// // //NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.annular_ct_people,1);
// // }
// //
// // if (name == "finish")
// // {
// // NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_finish_number, 1);
// // }
// // else
// // {
// //
// // string[] a = name.Split("|");
// // if (a.Length < 2) return;
// // Vector2 fguiScreenPos;
// // // Debug.Log("mmmmmmmmmmmmmmmmmm" + a[0]);
// // // Debug.Log("mmmmmmmmmmmmmmmmmm" + a[1]);
// // // if (AppConst.DeviceLangue == "pt")
// // // {
// // // fguiScreenPos = new Vector2((float.Parse(a[0]) * GRoot.inst.width) / 1000000.0f,
// // // float.Parse(a[1]) * GRoot.inst.height / 1000000.0f);
// // // }
// // // else
// // // {
// // fguiScreenPos = new Vector2(float.Parse(a[0]) * GRoot.inst.width,
// // float.Parse(a[1]) * GRoot.inst.height);
// // //}
// //
// // GButton objUnderPoint = null;
// //
// // var child_array = GRoot.inst.GetChildren().Reverse();
// // bool click_card = true;
// // foreach (GComponent child in child_array) //normal
// // {
// // if (child.GetChildren().Length > 0)
// // {
// // var com_array = child.GetChildren().Reverse();
// // foreach (GComponent com_child in com_array) //com_层面
// // {
// // if (child.name == "Popup" || child.name == "Highest")
// // {
// // click_card = false;/* */
// // }
// // var btn_array = com_child.GetChildren();
// // for (int i = btn_array.Length - 1; i >= 0; i--) //btn_层面
// // {
// // // if (btn_array[i] .name=="btn_collect")
// // // {
// // // Debug.Log(btn_array[i].x);
// // // Debug.Log(btn_array[i].y);
// // // Debug.Log(fguiScreenPos.x);
// // // Debug.Log(fguiScreenPos.y);
// // // Debug.Log(btn_array[i].position.x <= fguiScreenPos.x &&
// // // fguiScreenPos.x <= btn_array[i].position.x + btn_array[i].width);
// // // Debug.Log( btn_array[i].position.y <= fguiScreenPos.y &&
// // // fguiScreenPos.y <= btn_array[i].position.y + btn_array[i].height);
// // // }
// //
// // if (btn_array[i] is GButton)
// // {
// // GButton temp = btn_array[i] as GButton;
// //
// // if (temp.onStage && temp.visible && temp.position.x <= fguiScreenPos.x &&
// // fguiScreenPos.x <= temp.position.x + temp.width &&
// // temp.position.y <= fguiScreenPos.y &&
// // fguiScreenPos.y <= temp.position.y + temp.height)
// // {
// // objUnderPoint = btn_array[i] as GButton;
// // if (objUnderPoint.enabled)
// // {
// // objUnderPoint.FireClick(true, true);
// // }
// // else objUnderPoint.FireClick(true, false);
// // goto EndLoop;
// // }
// // }
// //
// // else if (btn_array[i] is GTextInput)
// // {
// //
// // GTextInput temp = btn_array[i] as GTextInput;
// // if (temp.onStage && temp.visible && temp.position.x <= fguiScreenPos.x &&
// // fguiScreenPos.x <= temp.position.x + temp.width &&
// // temp.position.y <= fguiScreenPos.y &&
// // fguiScreenPos.y <= temp.position.y + temp.height)
// // {
// //
// // temp.RequestFocus();
// // goto EndLoop;
// // }
// //
// // }
// // else if (btn_array[i] is GList)
// // {
// //
// // GList temp = btn_array[i] as GList;
// // if (temp.onStage && temp.visible && temp.position.x <= fguiScreenPos.x &&
// // fguiScreenPos.x <= temp.position.x + temp.width &&
// // temp.position.y <= fguiScreenPos.y &&
// // fguiScreenPos.y <= temp.position.y + temp.height)
// // {
// // if (select_glist == null)
// // {
// // select_glist_y = fguiScreenPos.y;
// // select_glist = btn_array[i] as GList;
// // }
// // else
// // {
// // select_glist.scrollPane.posY -= (fguiScreenPos.y - select_glist_y);
// // select_glist_y = fguiScreenPos.y;
// // }
// //
// // goto EndLoop;
// // }
// //
// // }
// // else if (btn_array[i] is GComponent)
// // {
// // var child_btn_array = btn_array[i].asCom.GetChildren(); //嵌套的com
// //
// // for (int j = child_btn_array.Length - 1; j >= 0; j--)
// // {
// // if (child_btn_array[j] is GButton)
// // {
// // Vector2 local_pos = new Vector2(btn_array[i].x + child_btn_array[j].x,
// // btn_array[i].y + child_btn_array[j].y);
// // if (child_btn_array[j].visible && child_btn_array[j].onStage && child_btn_array[j].visible && local_pos.x <= fguiScreenPos.x &&
// // fguiScreenPos.x <= local_pos.x + child_btn_array[j].width &&
// // local_pos.y <= fguiScreenPos.y && fguiScreenPos.y <=
// // local_pos.y + child_btn_array[j].height)
// // {
// // objUnderPoint = child_btn_array[j] as GButton;
// // if (objUnderPoint.enabled) objUnderPoint.FireClick(true, true);
// // else objUnderPoint.FireClick(true, false);
// // goto EndLoop;
// //
// // }
// // }
// // }
// //
// // }
// //
// // }
// // }
// // if (child.name == "Popup" || child.name == "Highest")
// // {
// // goto EndLoop;
// // }
// // }
// // }
// //
// // EndLoop: Debug.Log("");
// // if (click_card)
// // {
// // if (orthoCamera == null) orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
// // Ray ray = orthoCamera.ScreenPointToRay(new Vector2(float.Parse(a[0]) * Screen.width, (1 - float.Parse(a[1])) * Screen.height));
// // RaycastHit hit;
// // int layerMask = 1 << 6;
// //
// // if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
// // {
// // GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name);
// // }
// // }
// // }
// // }
// public void TouchClickPoint(string message)
// {
// Debug.Log("TouchClickPoint " + message);
// if (string.IsNullOrEmpty(message)) return;
// // 埋点处理
// HandleBuriedPoints(message);
// // 解析坐标信息
// var a = message.Split('|');
// if (a.Length < 2) return;
// var fairyGuiScreenPos = new Vector2(float.Parse(a[0]) * GRoot.inst.width, float.Parse(a[1]) * GRoot.inst.height);
// var clickType = HandleUIElements(fairyGuiScreenPos);
// if (clickType == ClickType.FairyGUI) return;
// HandleOtherClick(a);
// HandleCardClick(a);
// }
// private void HandleBuriedPoints(string message)
// {
// switch (message)
// {
// case "flyBtn":
// NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.fly_ct_number, 1);
// break;
// case "rewardBtn":
// NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_ct_number, 1);
// break;
// case "finish":
// NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_finish_number, 1);
// break;
// }
// }
// public ClickType HandleUIElements(Vector2 fguiScreenPos)
// {
// var childArray = GRoot.inst.GetChildren()?.Reverse();
// if (childArray == null)
// {
// return ClickType.UGUI;
// }
// foreach (GComponent child in childArray)
// {
// if (child.GetChildren() != null && child.GetChildren().Length > 0)
// {
// var comArray = child.GetChildren().Reverse();
// foreach (GComponent comChild in comArray)
// {
// var btnArray = comChild.GetChildren();
// for (int i = btnArray.Length - 1; i >= 0; i--)
// {
// var item = btnArray[i];
// if (IsInside(item, fguiScreenPos) && item.touchable && item.onStage && item.visible)
// {
// switch (item)
// {
// case GButton button:
// HandleButtonClick(button);
// break;
// case GTextInput textInput:
// HandleTextInputClick(textInput);
// break;
// case GList list:
// HandleListClick(list);
// break;
// case GComponent component:
// HandleNestedComponents(component);
// break;
// }
// return ClickType.FairyGUI;
// }
// }
// }
// }
// }
// return ClickType.UGUI;
// }
// private bool HandleButtonClick(GComponent component)
// {
// if (component is GButton button)
// {
// button.FireClick(button.enabled, true);
// return true;
// }
// return false;
// }
// private bool HandleTextInputClick(GTextInput textInput)
// {
// if (textInput != null)
// {
// textInput.RequestFocus();
// return true;
// }
// return false;
// }
// private bool HandleListClick(GList list)
// {
// if (list != null)
// {
// // 处理列表点击逻辑
// return true;
// }
// return false;
// }
// private bool HandleNestedComponents(GComponent component)
// {
// var children = component.GetChildren();
// for (int j = children.Length - 1; j >= 0; j--)
// {
// if (children[j] is GButton button && HandleButtonClick(button)) return true;
// }
// return false;
// }
// private bool IsInside(GObject gObject, Vector2 fguiScreenPos)
// {
// // 获取GObject的位置和尺寸
// float width = gObject.width;
// float height = gObject.height;
// // 计算左、右、上、下范围
// float left, right, top, bottom;
// // 如果锚点已设置,按锚点计算位置,否则按pivot计算
// if (gObject.pivotAsAnchor)
// {
// left = gObject.x - (gObject.pivot.x * width);
// right = left + width;
// bottom = gObject.y - (gObject.pivot.y * height);
// top = bottom + height;
// }
// else
// {
// left = gObject.position.x;
// right = left + width;
// bottom = gObject.position.y;
// top = bottom + height;
// // // 没有设置锚点的情况
// // return gObject.position.x <= fguiScreenPos.x &&
// // fguiScreenPos.x <= gObject.position.x + gObject.width &&
// // gObject.position.y <= fguiScreenPos.y &&
// // fguiScreenPos.y <= gObject.position.y + gObject.height;
// }
// return fguiScreenPos.x >= left && fguiScreenPos.x <= right &&
// fguiScreenPos.y <= top && fguiScreenPos.y >= bottom;
// }
// private void HandleCardClick(string[] a)
// {
// if (orthoCamera == null)
// {
// orthoCamera = GameObject.Find("Stage Camera")?.GetComponent<Camera>();
// // orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
// }
// if (orthoCamera != null)
// {
// Ray ray = orthoCamera.ScreenPointToRay(new Vector2(float.Parse(a[0]) * Screen.width, (1 - float.Parse(a[1])) * Screen.height));
// RaycastHit hit;
// int layerMask = 1 << 6;
// if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
// {
// GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name);
// }
// }
// }
// private void HandleOtherClick(string[] a)
// {
// UIScreenTapTrigger.Instance.TriggerButtonAtScreenPosition(new Vector2(float.Parse(a[0]), float.Parse(a[1])));
// }
// public Camera orthoCamera;
// public static Dictionary<string, string> adCallbackInfo = new Dictionary<string, string>();
// public void SendH5Event(string numbers)
// {
// // adCallbackInfo.Clear();
// // adCallbackInfo.Add("h5_revenue",ConfigSystem.GetConfig<CommonModel>().h5_refreshRevenue.ToString());
// // //Debug.Log("sssssssssssssssssss"+JsonConvert.SerializeObject(adCallbackInfo));
// // AppsFlyer.sendEvent("Growing_Total_01_002",adCallbackInfo);
// }
// public void ClickAdEvent(string ad_msg)
// {
// string[] temp_array = ad_msg.Split("|");
// if (temp_array.Length >= 2 && temp_array[0] != null && temp_array[0] != "")
// {
// H5sendClass info = new H5sendClass() { link = temp_array[0], type = temp_array[1] };
// NetworkKit.PostWithHeader<object>("/event/h5Clicks", info, (isSuccess, obj) =>
// {
// // if (isSuccess)
// // {
// // Debug.Log("dadianchenggong" + temp_array[0]);
// // }
// });
// }
// }
// public void haveSimCard(string have)
// {
// if (have == "TRUE") NetworkManager.haveSimCard = true;
// }
// }
// public class H5refreshTimes
// {
// public string link;
// public int times;
// }
// public class H5sendClass
// {
// public string link;
// public string type;
// }
// public enum ClickType
// {
// FairyGUI,
// Scene,
// UGUI
// }
// }
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1eb2bc549fe045758bca6f69676b6bf4
timeCreated: 1730192119
+32
View File
@@ -0,0 +1,32 @@
#if !UNITY_EDITOR
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Scripting;
[Preserve]
public class SkipUnityLogo
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
private static void BeforeSplashScreen()
{
#if UNITY_WEBGL
Application.focusChanged += Application_focusChanged;
#else
System.Threading.Tasks.Task.Run(AsyncSkip);
#endif
}
#if UNITY_WEBGL
private static void Application_focusChanged(bool obj)
{
Application.focusChanged -= Application_focusChanged;
SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
}
#else
private static void AsyncSkip()
{
SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
}
#endif
}
#endif
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d81ffd80664954a9f8393d7f282c2210
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: