提交项目

This commit is contained in:
2026-06-12 10:11:36 +08:00
commit 65acce7dde
5920 changed files with 629434 additions and 0 deletions
+439
View File
@@ -0,0 +1,439 @@
using System;
using System.Collections.Generic;
using LoveLegend;
using DG.Tweening;
using FGUI.ZM_Common_01;
using UnityEngine;
using Newtonsoft.Json;
using SGModule.Common.Helper;
using SGModule.NetKit;
using System.Linq;
public class AdExchangeManager
{
public static readonly AdExchangeManager Instance = new AdExchangeManager();
AdExchangeManager()
{
}
// public const string buy_one = "com.rainforestworld.space.24.99";
// // public const string buy_gold_1 = "com.rainforestworld.shop.1.99";
// // public const string buy_gold_2 = "com.rainforestworld.shop.3.99";
// // public const string buy_gold_3 = "com.rainforestworld.shop.19.99";
// // public const string buy_gold_4 = "com.rainforestworld.shop.39.99";
// public const string remove_ad = "com.rainforestworld.remove.2.99";
// public const string battle_pass = "com.rainforestworld.pass.9.99";
// public const string pack_reward = "com.rainforestworld.reward.1.99";
// public const string fail_pack = "com.rainforestworld.fail.1.99";
// public const string three_days_gift = "com.rainforestworld.three.1.99";
// public const string secret_albnums = "com.rainforestworld.secret_albnums.3.99";
// private static readonly Dictionary<string, EventTrackMapping> _trackMappings = new()
// {
// [pack_reward] = new EventTrackMapping
// {
// EventKey = ADEventTrack.Event,
// ClickProperty = _ => ADEventTrack.Property.lucky_gift_click,
// SuccessProperty = _ => ADEventTrack.Property.lucky_gift_receive
// },
// [remove_ad] = new EventTrackMapping
// {
// EventKey = ADEventTrack.Event,
// ClickProperty = _ => ADEventTrack.Property.remove_ad_click,
// SuccessProperty = _ => ADEventTrack.Property.remove_ad_receive
// },
// [battle_pass] = new EventTrackMapping
// {
// EventKey = ADEventTrack.Event,
// ClickProperty = _ => ADEventTrack.Property.master_pass_click,
// SuccessProperty = _ => ADEventTrack.Property.master_pass_receive
// },
// [buy_one] = new EventTrackMapping
// {
// EventKey = ADEventTrack.Event,
// ClickProperty = _ => ADEventTrack.Property.buy_one_click,
// SuccessProperty = _ => ADEventTrack.Property.buy_one_success
// },
// ["buy_gold"] = new EventTrackMapping
// {
// EventKey = ADEventTrack.Event,
// ClickProperty = suffix => ADEventTrack.Property.gold_click_ + suffix,
// SuccessProperty = suffix => ADEventTrack.Property.shop_receive_ + suffix
// }
// };
public void Exchange(AdExchangeData _data)
{
if (Time.time - SaveData.rm_time < 5)
{
GameHelper.ShowTips("click_too_frequent", true);
return;
}
SaveData.rm_time = Time.time;
int myAdNum = GetLookRewardADNum();
if (myAdNum >= _data.ad_count)
{
SetLookRewardADNum(myAdNum - _data.ad_count);
SendEventClickByName(_data.type, "success");
DOVirtual.DelayedCall(0.1f, () =>
{
GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, _data.type);
});
}
else
{
GameHelper.ShowTips("no_ad_count", true);
}
}
public void ShowVideoAd(string adName, Action _action)
{
GameHelper.ShowVideoAd(adName, isSuccess =>
{
if (isSuccess)
{
_action?.Invoke();
}
});
}
// private btn_watchAd btn_WatchAd = null;
private Dictionary<string, btn_watchAd> btn_WatchAd = new Dictionary<string, btn_watchAd>();
private Dictionary<string, Action> ActionSetText = new Dictionary<string, Action>(); //广告数量的显示
public void SetWatchAd(string key, btn_watchAd _btn, Action action)
{
if (!btn_WatchAd.ContainsKey(key))
{
btn_WatchAd.Add(key, _btn);
}
else
{
btn_WatchAd[key] = _btn;
}
if (!ActionSetText.ContainsKey(key))
{
ActionSetText.Add(key, action);
}
else
{
ActionSetText[key] = action;
}
}
private void removeWatchAd()
{
btn_WatchAd.Clear();
}
private int ad_cool_down = ConfigSystem.GetCommonConf().exchangeCD;
private void updateWatchCD()
{
var lastTimes = SaveData.GetSaveObject()._watch_ad_cd;
foreach (var item in btn_WatchAd)
{
bool is_get = item.Key == PurchasingManager.GetPaySku(PayType.pack_reward) && SaveData.GetSaveObject().is_get_packreward;
bool is_get1 = item.Key == PurchasingManager.GetPaySku(PayType.remove_ad) && SaveData.GetSaveObject().is_get_removead;
if (is_get || is_get1)
{
item.Value.enabled = false;
}
else if (GameHelper.GetNowTime() < lastTimes && !checkIsCanReceive(item.Key))
{
item.Value.enabled = false;
item.Value.can_buy.selectedIndex = btn_watchAd.Can_buy_cd;
item.Value.btn_text.text = CommonHelper.TimeFormat(lastTimes - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour);
}
else
{
// stopAction();
item.Value.enabled = true;
item.Value.can_buy.selectedIndex = btn_watchAd.Can_buy_can;
checkBtnState(item.Value, item.Key);
}
}
}
private CommonModel config = ConfigSystem.GetCommonConf();
private List<Paidgift> packdata = ConfigSystem.GetConfig<Paidgift>();
private List<Multigift> threeDayData = ConfigSystem.GetConfig<Multigift>();
public int GetCeilingNeedAds(string name)
{
int needAds = -1;
if (name == PurchasingManager.GetPaySku(PayType.buy_one))
{
double addspace = config.addspace;
needAds = (int)Math.Ceiling(addspace);
}
// else if (name == PurchasingManager.GetPaySku(PayType.buy_one_off))
// {
// double addspace1 = config.AddDiscount;
// needAds = (int)Math.Ceiling(addspace1);
// }
else if (name == PurchasingManager.GetPaySku(PayType.battle_pass))
{
double Passportgift = config.Passportgift;
needAds = (int)Math.Ceiling(Passportgift);
}
else if (name == PurchasingManager.GetPaySku(PayType.pack_reward))
{
double Paid_price = packdata[0].Paid_price;
needAds = (int)Math.Ceiling(Paid_price);
}
else if (name == PurchasingManager.GetPaySku(PayType.remove_ad))
{
double move_price = packdata[1].Paid_price;
needAds = (int)Math.Ceiling(move_price);
}
else if (name == PurchasingManager.GetPaySku(PayType.three_days_gift))
{
double move_price = threeDayData[2].Paid_price;
needAds = (int)Math.Ceiling(move_price);
}
else if (name == PurchasingManager.GetPaySku(PayType.buy_gold_1))
{
needAds = (int)Math.Ceiling(getCoinNeedAds(name));
}
else if (name == PurchasingManager.GetPaySku(PayType.buy_gold_2))
{
needAds = (int)Math.Ceiling(getCoinNeedAds(name));
}
else if (name == PurchasingManager.GetPaySku(PayType.buy_gold_3))
{
needAds = (int)Math.Ceiling(getCoinNeedAds(name));
}
else if (name == PurchasingManager.GetPaySku(PayType.buy_gold_4))
{
needAds = (int)Math.Ceiling(getCoinNeedAds(name));
}
else if (name == PurchasingManager.GetPaySku(PayType.buy_gold_5))
{
needAds = (int)Math.Ceiling(getCoinNeedAds(name));
}
return needAds;
}
private List<Paidcoins> coinList = ConfigSystem.GetConfig<Paidcoins>();
private double getCoinNeedAds(string sku)
{
Paidcoins result = coinList.FirstOrDefault(c => c.SKU == sku);
if (result != null)
{
return result.Payment_amount;
}
return 0;
}
private bool checkIsCanReceive(string name)
{
int myAd = GetLookRewardADNum();
return myAd >= GetCeilingNeedAds(name);
}
private void checkBtnState(btn_watchAd item, string key)
{
// stopAction();
// foreach (var item in btn_WatchAd)
// {
item.SetClick(() => { });
if (checkIsCanReceive(key))
{
item.buy_state.selectedIndex = btn_watchAd.Buy_state_buy;
item.SetClick(() =>
{
item.enabled = false;
AdExchangeData adExchangeData = new AdExchangeData()
{
type = key,
ad_count = GetCeilingNeedAds(key)
};
Exchange(adExchangeData);
});
}
else
{
item.buy_state.selectedIndex = btn_watchAd.Buy_state_ad;
bool is_get = key == PurchasingManager.GetPaySku(PayType.pack_reward) && SaveData.GetSaveObject().is_get_packreward;
bool is_get1 = key == PurchasingManager.GetPaySku(PayType.remove_ad) && SaveData.GetSaveObject().is_get_removead;
if (is_get || is_get1)
{
item.enabled = false;
item.SetClick(() => { });
}
else
{
item.SetClick(() =>
{
SendEventClickByName(key, "click");
ShowVideoAd("buy_add_one", () =>
{
RunAllAction();
item.enabled = false;
TimerHelper.mEasy.AddTimer(0.1f, () =>
{
var ad_times = Convert.ToInt32(GameHelper.GetNowTime());
SaveData.GetSaveObject()._watch_ad_cd = ad_times + ad_cool_down;
startAction();
});
});
});
}
// }
}
}
private void RunAllAction()
{
foreach (var item in ActionSetText)
{
item.Value?.Invoke();
}
}
private void startAction()
{
stopAction();
HallManager.Instance.UpdateSecondEvent += updateWatchCD;
}
private void stopAction()
{
HallManager.Instance.UpdateSecondEvent -= updateWatchCD;
}
public int GetLookRewardADNum()
{
return DataMgr.AdWatchCount.Value;
}
public void SetLookRewardADNum(int nums)
{
DataMgr.AdWatchCount.Value = nums;
}
public void Start()
{
startAction();
updateWatchCD();
}
public void Destroy()
{
stopAction();
removeWatchAd();
ActionSetText.Clear();
}
public void SendEventClickByName(string name, string type)
{
string eventClickName = "";
string eventSuccName = "";
if (name == PurchasingManager.GetPaySku(PayType.pack_reward))
{
eventClickName = ADEventTrack.Property.lucky_gift_click;
eventSuccName = ADEventTrack.Property.lucky_gift_receive;
}
else if (name == PurchasingManager.GetPaySku(PayType.remove_ad))
{
eventClickName = ADEventTrack.Property.remove_ad_click;
eventSuccName = ADEventTrack.Property.remove_ad_receive;
}
else if (name == PurchasingManager.GetPaySku(PayType.battle_pass))
{
eventClickName = ADEventTrack.Property.master_pass_click;
eventSuccName = ADEventTrack.Property.master_pass_receive;
}
else if (name == PurchasingManager.GetPaySku(PayType.buy_one))
{
eventClickName = ADEventTrack.Property.buy_one_click;
eventSuccName = ADEventTrack.Property.buy_one_success;
}
// else if (name == PurchasingManager.GetPaySku(PayType.buy_one_off))
// {
// eventClickName = ADEventTrack.Property.BuyOneOffClick;
// eventSuccName = ADEventTrack.Property.BuyOneOffSuccess;
// }
else if (name == PurchasingManager.GetPaySku(PayType.three_days_gift))
{
eventClickName = ADEventTrack.Property.three_days_gift_click;
eventSuccName = ADEventTrack.Property.three_days_gift_buy_success;
}
else if (name.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = name[startIndex..]; // 截取 "gold" 后的所有字符
eventClickName = ADEventTrack.Property.gold_click_ + suffix;
eventSuccName = ADEventTrack.Property.shop_receive_ + suffix;
}
if (type == "success" && eventSuccName != "")
{
TrackKit.SendEvent(ADEventTrack.Event, eventSuccName);
}
else if (type == "click" && eventClickName != "")
{
TrackKit.SendEvent(ADEventTrack.Event, eventClickName);
}
}
}
public class EventTrackMapping
{
public string EventKey
{
get;
set;
}
public Func<string, string> ClickProperty
{
get;
set;
}
public Func<string, string> SuccessProperty
{
get;
set;
}
}
public class AdExchangeData
{
[JsonProperty("type")]
public string type;
[JsonProperty("ad_count")]
public int ad_count;
[JsonProperty("shopName")]
public string shopName;
}
public class orderState
{
[JsonProperty("order_id")]
public string order_id;
[JsonProperty("status")]
public int status;
}
public class orderData
{
[JsonProperty("order_id")]
public string order_id;
[JsonProperty("pay_url")]
public string pay_url;
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 33ed44012dd51724bbb822265db9b931
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+32
View File
@@ -0,0 +1,32 @@
namespace LoveLegend
{
public static class App
{
private static SApplication _sCurrSApplication = null;
public static void InitApplication(SApplication sApplication)
{
_sCurrSApplication = sApplication;
_sCurrSApplication.Init();
_sCurrSApplication.Enable();
}
private static float LoadingProgressDelayTime = 0f;
public static void DisplayLoadingUI()
{
AppDispatcher.Instance.Dispatch(AppMsg.UI_DisplayLoadingUI);
}
public static void HideLoadingUI(bool isDelay = false)
{
if (!isDelay)
{
AppDispatcher.Instance.Dispatch(AppMsg.UI_HideLoadingUI);
return;
}
TimerHelper.mEasy.AddTimer(0.5f, () => { AppDispatcher.Instance.Dispatch(AppMsg.UI_HideLoadingUI); });
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 670d339b2f75a144e8ba207f951e51bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+51
View File
@@ -0,0 +1,51 @@
using System.Collections.Generic;
using SGModule.ApplePay;
using SGModule.ConfigLoader;
namespace LoveLegend
{
[ConfigKey("applePay")]
public class ApplePay
{
public int id;
public string payKey;
public string sku;
}
[ConfigKey("applePay2")]
public class ApplePay2
{
public string name;
public string sku;
public float price;
public string type;
}
}
// namespace LoveLegend
// {
// public class ApplePayModel: ConfigModel<ApplePayModel, ApplePay>
// {
// public ApplePayModel(string key) : base(key)
// {
// }
// }
// public class ApplePay
// {
// public int id;
// public string payKey;
// public string sku;
// }
// public class ApplePayModel2: ConfigModel<ApplePayModel2, ProductConfig>
// {
// public ApplePayModel2(string key) : base(key)
// {
// }
// }
// }
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a1fc4bc6ac4c74207bc26610e90056b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+153
View File
@@ -0,0 +1,153 @@
using System;
using System.Collections;
using System.Collections.Generic;
using AppsFlyerSDK;
using LoveLegend;
using DG.Tweening;
using SGModule.Common.Helper;
using SGModule.Net;
using SGModule.NetKit;
using Unity.Advertisement.IosSupport;
using UnityEngine;
namespace IgnoreOPS {
internal class AppsFlyerObjectScript1 : MonoBehaviour, IAppsFlyerConversionData {
public string appID;
public bool is_init;
public Coroutine m_Coroutine;
void Start() {
DontDestroyOnLoad(gameObject);
AddListener();
AppsFlyer.setIsDebug(true);
#if UNITY_IOS && !UNITY_EDITOR
appID = "6749253378";
m_Coroutine = CrazyAsyKit.StartCoroutine(loopWaitInitAf());
#endif
#if UNITY_EDITOR
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
#endif
}
private void AddListener() {
NetworkDispatcher.Instance.AddListener(NetworkMsg.NotNetwork, RequestLogin);
}
private void RemoveListener() {
NetworkDispatcher.Instance.RemoveListener(NetworkMsg.NotNetwork, RequestLogin);
}
void OnDestroy() {
RemoveListener();
}
void RequestLogin(object obj = null) {
if (GameHelper.IsConnect()) {
GameDispatcher.Instance.Dispatch(GameMsg.Network_reconnection);
}
CrazyAsyKit.StopCoroutine(m_Coroutine);
m_Coroutine = CrazyAsyKit.StartCoroutine(loopWaitInitAf());
}
private IEnumerator loopWaitInitAf() {
var isConnect = GameHelper.IsConnect();
if (!isConnect)
{
float retryTime = 0f;
const float maxRetryTime = 3f;
while (!GameHelper.IsConnect() && retryTime < maxRetryTime)
{
yield return new WaitForSeconds(0.2f);
retryTime += 0.2f;
}
// 再次确认网络状态
isConnect = GameHelper.IsConnect();
Log.Info("AF",$"[AF] loopWaitInitAf------1-- {isConnect}");
if (!isConnect)
{
// 超时且仍未连接,触发无网络提示
Action action = () => {
TimerHelper.mEasy.AddTimer(0.5f, () => {
NetworkDispatcher.Instance.Dispatch(NetworkMsg.NotNetwork);
});
};
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, action);
}
}
Log.Info("AF",$"[AF] loopWaitInitAf------2-- {isConnect}");
if (isConnect)
{
TrackKit.TrackLoginFunnel(LoginFunnelEventType.AfSend);
float a = 0;
if (ATTrackingStatusBinding.GetAuthorizationTrackingStatus() ==
ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED)
{
ATTrackingStatusBinding.RequestAuthorizationTracking();
}
while ((ATTrackingStatusBinding.GetAuthorizationTrackingStatus() ==
ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED) && (a < 5.0f))
{
a += 0.5f;
yield return new WaitForSeconds(0.5f);
}
AppsFlyer.initSDK("3e36AQrQTJWsVebUrLpexJ", appID, this);
AppsFlyer.startSDK();
AppsFlyer.AFLog("8888888888888888888",
ATTrackingStatusBinding.GetAuthorizationTrackingStatus().ToString());
}
}
public void onConversionDataSuccess(string conversionData) {
Log.Info("AF",$"[AF] onConversionDataSuccess-------- {is_init}");
if (is_init) return;
is_init = true;
AppsFlyer.AFLog("onConversionDataSuccess", conversionData);
var conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);
var json = SerializeUtil.ToJsonIndented(conversionDataDictionary);
SuperApplication.Instance.attribution =
conversionDataDictionary.TryGetValue("af_status", out var afStatus)
? afStatus.ToString().ToLower()
: "organic";
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
TrackKit.TrackLoginFunnel(LoginFunnelEventType.AfRecv, "success");
}
public void onConversionDataFail(string error) {
Log.Info("AF",$"[AF] onConversionDataFail-------- {is_init}");
if (is_init) return;
is_init = true;
AppsFlyer.AFLog("onConversionDataFail", error);
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
TrackKit.TrackLoginFunnel(LoginFunnelEventType.AfRecv, "fail");
}
public void onAppOpenAttribution(string attributionData) {
AppsFlyer.AFLog("onAppOpenAttribution", attributionData);
Dictionary<string, object> attributionDataDictionary =
AppsFlyer.CallbackStringToDictionary(attributionData);
}
public void onAppOpenAttributionFailure(string error) {
AppsFlyer.AFLog("onAppOpenAttributionFailure", error);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8d13b62194dfc4aa881356f7e410b7ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cc47593d8a04d3147a05e47aa376b7b8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+52
View File
@@ -0,0 +1,52 @@
namespace LoveLegend
{
public class AsyncDealData
{
public delegate void DealMethod();
private float _currentTime;
public float DelayTime = 1f;
public DealMethod dealMethod;
public int RepeatCount = 1;
public bool IsComplete => RepeatCount == 0;
public void PassTime(float time)
{
_currentTime += time;
if (!(_currentTime >= DelayTime))
{
return;
}
_currentTime -= DelayTime;
Run();
}
private void Run()
{
if (RepeatCount == -1)
{
dealMethod?.Invoke();
}
else
{
if (RepeatCount > 0)
{
dealMethod?.Invoke();
RepeatCount--;
}
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4e51ff91679a44d1b1efe3438d508e74
timeCreated: 1682577036
@@ -0,0 +1,92 @@
namespace LoveLegend
{
using System;
using UnityEngine;
using System.Collections.Generic;
internal class AsyncKitUnityBehaviour : SingletonUnity<AsyncKitUnityBehaviour>
{
private readonly Dictionary<string, AsyncDealData> _asyncDataDict = new Dictionary<string, AsyncDealData>();
private readonly Dictionary<string, AsyncDealData> _updateActionDict = new Dictionary<string, AsyncDealData>();
private readonly List<string> _keyClean = new List<string>();
private void Update()
{
foreach (var temp in _asyncDataDict.Values)
{
temp.PassTime(Time.deltaTime);
}
try
{
foreach (var temp in _updateActionDict.Values)
{
temp?.dealMethod?.Invoke();
}
}
catch (Exception)
{
}
ClearFinished();
ClearUpdateActionFinished();
}
private void ClearFinished()
{
_keyClean.Clear();
foreach (var dealData in _asyncDataDict)
{
if (dealData.Value.IsComplete)
{
_keyClean.Add(dealData.Key);
}
}
foreach (var key in _keyClean)
{
_asyncDataDict.Remove(key);
}
}
public void AddAsyncData(string key, AsyncDealData asyncDealData)
{
RemoveAsyncData(key);
_asyncDataDict.Add(key, asyncDealData);
}
public void RemoveAsyncData(string key)
{
if (_asyncDataDict.ContainsKey(key))
{
_asyncDataDict.Remove(key);
}
}
public void ClearUpdateActionFinished()
{
_keyClean.Clear();
foreach (var dealData in _updateActionDict)
{
if (dealData.Value.IsComplete)
{
_keyClean.Add(dealData.Key);
}
}
foreach (var key in _keyClean)
{
_updateActionDict.Remove(key);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 984d18c5a4974e729d72276896426930
timeCreated: 1682577036
+63
View File
@@ -0,0 +1,63 @@
namespace LoveLegend
{
using UnityEngine;
using System.Collections;
public static class CrazyAsyKit
{
private static AsyncKitUnityBehaviour sAsyncKitUnityBehaviour;
private static readonly object SynClock = new object();
private static AsyncKitUnityBehaviour mAsyncKitUnityBehaviour
{
get
{
if (sAsyncKitUnityBehaviour != null)
{
return sAsyncKitUnityBehaviour;
}
lock (SynClock)
{
if (sAsyncKitUnityBehaviour != null)
{
return sAsyncKitUnityBehaviour;
}
sAsyncKitUnityBehaviour = AsyncKitUnityBehaviour.Instance;
if (sAsyncKitUnityBehaviour != null)
{
sAsyncKitUnityBehaviour.name = "[ CrazyAsyKit ]";
}
}
return sAsyncKitUnityBehaviour;
}
}
public static Coroutine StartCoroutine(IEnumerator enumerator)
{
return mAsyncKitUnityBehaviour.StartCoroutine(enumerator);
}
public static void StopCoroutine(Coroutine enumerator)
{
mAsyncKitUnityBehaviour.StopCoroutine(enumerator);
}
public static void StartAction(string key, AsyncDealData.DealMethod method, float delayTime, int repeat = 1)
{
var temp = new AsyncDealData { dealMethod = method, DelayTime = delayTime, RepeatCount = repeat };
mAsyncKitUnityBehaviour.AddAsyncData(key, temp);
}
public static void StopAction(string key)
{
mAsyncKitUnityBehaviour.RemoveAsyncData(key);
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 93122ca4429e463aba586a345558ed8e
timeCreated: 1682577036
+159
View File
@@ -0,0 +1,159 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;
using UnityEngine;
namespace LoveLegend
{
public class BIManager : MonoBehaviour
{
private static BIManager _instance;
public static BIManager Instance
{
get
{
if (_instance == null)
{
var go = new GameObject("BIManager");
DontDestroyOnLoad(go);
_instance = go.AddComponent<BIManager>();
}
return _instance;
}
}
// ================= 通用埋点 =================
public void TrackEvent(string eventName, Dictionary<string, object> properties = null)
{
if (properties == null)
properties = new Dictionary<string, object>();
// DataEyeAnalyticsAPI.Track(eventName, properties);
// DataEyeAnalyticsAPI.Flush();
#if UNITY_IOS&&!UNITY_EDITOR
BrigdeIOS.TrackProduct(eventName, JsonConvert.SerializeObject(properties));
#endif
Debug.Log($"[BI] 事件上报: {eventName}, 属性={JsonConvert.SerializeObject(properties)}");
}
// ================= 预制事件封装 =================
/// <summary>
/// 上报广告事件
/// </summary>
/// <param name="eventName"></param>
/// <param name="adType">NativeRewardedVideoBannerInterstitialSplash</param>
/// <param name="placementId">聚合广告位id</param>
/// <param name="networkFirmId">广告网络ID</param>
public void TrackAdEvent(string eventName, string adType, string placementId = null,
string networkFirmId = null, double revenue = 0, string scene = null, string currency = "USD")
{
var props = new Dictionary<string, object>
{
{ "ad_type", adType }
};
if (!string.IsNullOrEmpty(placementId))
props["PlacementId"] = placementId;
if (!string.IsNullOrEmpty(networkFirmId))
props["NetworkFirmId"] = networkFirmId;
if (revenue > 0)
{
props["Revenue"] = revenue;
props["Ecpm"] = revenue * 1000;
}
if (!string.IsNullOrEmpty(scene))
props["scene"] = scene;
if (!string.IsNullOrEmpty(currency))
props["Currency"] = currency;
TrackEvent(eventName, props);
}
/// <summary>
/// 上报内购事件
/// </summary>
/// <param name="revenue">收入</param>
/// <param name="currency">币种</param>
/// <param name="payType">支付方式 0=商店支付,1=三方支付</param>
/// <param name="itemId">sku</param>
/// <param name="status">order:下单 paid:付费成功 paid_err:扣款失败</param>
/// <param name="itemName">商品名称</param>
/// <param name="msg">如果遇到异常或相关情况,将err_msg进行上报</param>
public void TrackPurchase(double revenue, string currency, string payType, string itemId,
string status, string itemName = null, string msg = null)
{
var props = new Dictionary<string, object>
{
{ "Revenue", revenue },
{ "Currency", currency },
{ "type", payType },
{ "item_id", itemId },
{ "purchase_status", status }
};
if (!string.IsNullOrEmpty(itemName))
props["item_name"] = itemName;
if (!string.IsNullOrEmpty(msg))
props["msg"] = msg;
TrackEvent(BIEvent.PURCHASE, props);
}
/// <summary>
/// 上报页面浏览
/// </summary>
public void TrackPageView(string pageName)
{
var props = new Dictionary<string, object>
{
{ "page_name", pageName } // 例如 "loading"、"game"
};
TrackEvent(BIEvent.PAGE_VIEW, props);
}
/// <summary>
/// AB 分组埋点
/// </summary>
public void TrackABConfig(int responseTime)
{
var props = new Dictionary<string, object>
{
{ "response_time", responseTime }
};
TrackEvent(BIEvent.AB_CONFIG, props);
}
}
}
public static class BIEvent
{
// 自动采集(SDK 开启自动采集即可,不需要手动埋点)
public const string APP_INSTALL = "app_install";
public const string APP_START = "app_start";
public const string APP_END = "app_end";
public const string APP_VIEW = "app_view";
public const string APP_CRASH = "app_crash";
// 内部预制事件
public const string AD_REQUEST = "ad_request"; // 广告请求
public const string AD_INVENTORY = "ad_inventory"; // 广告填充的时候
public const string AD_IMP = "ad_imp"; // 广告展示
public const string AD_CLICK = "ad_click"; // 广告点击
public const string PURCHASE = "purchase"; // 内购
// 页面相关
public const string PAGE_VIEW = "page_view_customize";
// 其他业务事件(AB 测试等)
public const string AB_CONFIG = "config"; // AB
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ca019e8aa557c43ad990801d4ccc6d0d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+29
View File
@@ -0,0 +1,29 @@
namespace LoveLegend
{
public abstract class BaseScene
{
public abstract int SceneIdx { get; }
public void Enter()
{
App.DisplayLoadingUI();
OnEnter();
}
public void Leave()
{
OnLeave();
}
public void SwitchSceneComplete(object param)
{
OnSwitchSceneComplete(param);
}
protected abstract void OnEnter();
protected abstract void OnLeave();
protected abstract void OnSwitchSceneComplete(object param);
public abstract void Dispose();
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b8bdd23fc1e10e744a00b9cd6e28eae3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+29
View File
@@ -0,0 +1,29 @@
namespace LoveLegend
{
public abstract class BaseSystem
{
public virtual void Init()
{
}
public virtual void InitLate()
{
}
public virtual void Dispose()
{
}
public virtual void Update()
{
}
public virtual void LateUpdate()
{
}
public virtual void FixedUpdate()
{
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d09f140354146564aa23e2896d940db2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+18
View File
@@ -0,0 +1,18 @@
using System.Runtime.InteropServices;
public class BrigdeIOS
{
[DllImport("__Internal")]
public static extern void DakaiACT();
[DllImport("__Internal")]
public static extern void ShezhiACT(bool though);
[DllImport("__Internal")]
public static extern void copyText(string text);
[DllImport("__Internal")]
public static extern void SaveVideoWithCustomDate(string videoPath);
[DllImport("__Internal")]
public static extern void SaveImageWithCustomDate(string imagePath);
[DllImport("__Internal")]
public static extern void TrackProduct(string eventName, string dictionaryJson);
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4fc20097e76a7465ab018001e2158c84
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+328
View File
@@ -0,0 +1,328 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using Newtonsoft.Json;
using SGModule.Common.Helper;
using SGModule.NetKit;
using LoveLegend;
using UnityEngine;
public class ChatSendClass
{
[JsonProperty("role")] public string role;
[JsonProperty("content")] public string content;
[JsonProperty("style")] public string style;
}
public class ChatetClass
{
[JsonProperty("role")] public string role;
[JsonProperty("style")] public string style;
}
public class ChatHelper : MonoBehaviour
{
public static void SendMessage(int type, string text)
{
ChatSendClass respData = new ChatSendClass
{
role = ChatType.GetType(type),
content = text,
style = ChatType.GetStyle(type)
};
NetKit.Instance.Post<object>("chat/sendAiMsg", respData, response =>
{
if (response.IsSuccess)
{
Debug.Log(JsonConvert.SerializeObject(response.Data));
}
});
}
public static void GetMessage(int type)
{
ChatetClass respData = new ChatetClass
{
role = ChatType.GetType(type),
style = ChatType.GetStyle(type),
};
NetKit.Instance.Post<object>("chat/initiateAi", respData, response =>
{
if (response.IsSuccess)
{
Debug.Log(JsonConvert.SerializeObject(response.Data));
}
});
}
public static void ResetMessage(int type)
{
var respData = new
{
role = ChatType.GetType(type),
};
NetKit.Instance.Post<object>("chat/resetAiChat", respData, response =>
{
if (response.IsSuccess)
{
Debug.Log(JsonConvert.SerializeObject(response.Data));
}
});
}
public static void CheckReply()
{
if (DataMgr.ChatData.Value == null)
{
DataMgr.ChatData.Value = new List<ChatItem>();
}
if (pollingCoroutine == null) pollingCoroutine = CrazyAsyKit.StartCoroutine(CheckReplyLoop());
// NetKit.Instance.Post<List<ReplyItem>>("chat/checkAiReply", null, response =>
// {
// if (response.IsSuccess)
// {
// Debug.Log(response.Data);
// Debug.Log(JsonConvert.SerializeObject(response.Data));
// Debug.Log(JsonConvert.SerializeObject(response.Data[0]));
// Debug.Log(JsonConvert.SerializeObject(response.Data[0].list));
// Debug.Log(response.Data[0].list == null);
// Debug.Log(response.Data[0].list.Count);
// for (int i = 0; i < response.Data.Count; i++)
// {
// if (response.Data[i].list.Count > 0)
// {
// for (int j = 0; j < response.Data[i].list.Count; j++)
// {
// Debug.Log(response.Data[i].list[j].content);
// ChatItem item = DataMgr.ChatData.Value.FirstOrDefault(c => c.role == response.Data[i].role);
// Debug.Log(JsonConvert.SerializeObject(item));
// if (item == null)
// {
// item = new ChatItem()
// {
// role = response.Data[i].role,
// content_list = new List<ChatText>(),
// chat_time = GameHelper.GetNowTime(),
// };
// DataMgr.ChatData.Value.Add(item);
// }
// item.content_list.Add(new ChatText()
// {
// type = 1,
// text_content = response.Data[i].list[j].content
// });
// }
// }
// }
// Debug.Log(JsonConvert.SerializeObject(DataMgr.ChatData.Value));
// DataMgr.ChatData.Save();
// }
// });
}
// public static List<ChatItem> Chat_Object;
// public static List<ChatItem> GetChatObject()
// {
// if (DataMgr.ChatData.Value == null)
// {
// DataMgr.ChatData.Value = new List<ChatItem>();
// }
// return DataMgr.ChatData.Value;
// }
private static Coroutine pollingCoroutine;
private static IEnumerator CheckReplyLoop()
{
while (true)
{
bool shouldStop = true;
NetKit.Instance.Post<List<ReplyItem>>("chat/checkAiReply", null, response =>
{
if (response.IsSuccess)
{
//Debug.Log(response.Data);
Debug.Log(JsonConvert.SerializeObject(response.Data));
// Debug.Log(JsonConvert.SerializeObject(response.Data[0]));
// Debug.Log(JsonConvert.SerializeObject(response.Data[0].list));
// Debug.Log(response.Data[0].list == null);
// Debug.Log(response.Data[0].list.Count);
for (int i = 0; i < response.Data.Count; i++)
{
if (response.Data[i].list.Count > 0)
{
for (int j = 0; j < response.Data[i].list.Count; j++)
{
string content = response.Data[i].list[j].content;
string role = response.Data[i].role;
ChatItem item = DataMgr.ChatData.Value.FirstOrDefault(c => c.role == role);
if (item == null)
{
item = new ChatItem()
{
role = role,
content_list = new List<ChatText>(),
};
DataMgr.ChatData.Value.Add(item); // ⚠️ 注意:要在这里添加,否则闭包中可能重复添加
}
unshow_message[ChatType.GetIndex(role)]++;
int delay_time = j * 2; // 每条消息延迟2秒
DOVirtual.DelayedCall(delay_time, () =>
{
item.content_list.Add(new ChatText()
{
type = 1,
text_content = content,
chat_time = GameHelper.GetNowTime(),
});
chat_red_list[ChatType.GetIndex(role)] = true;
unshow_message[ChatType.GetIndex(role)]--;
GameDispatcher.Instance.Dispatch(GameMsg.RefreshRedDot);
GameDispatcher.Instance.Dispatch(GameMsg.LiveChange);
});
}
}
if (response.Data[i].status == "pending") shouldStop = false;
}
// Debug.Log(JsonConvert.SerializeObject(DataMgr.ChatData.Value));
DataMgr.ChatData.Save();
}
});
if (UIManager.Instance.IsExistUI(UIConst.ChatUI)) yield return new WaitForSeconds(3f);
else yield return new WaitForSeconds(10f);
// 等待回调完成 + 间隔一秒
if (shouldStop)
{
Debug.Log("检测到 status 为 done,停止轮询");
// StopCoroutine("CheckReplyLoop");
// pollingCoroutine = null;
pollingCoroutine = null;
yield break;
}
}
}
public static List<int> unshow_message = new List<int> { 0, 0, 0 };
public static List<bool> chat_red_list = new List<bool> { false, false, false };
public static bool GetChatRed(int index = -1)
{
if (index >= 0)
{
return chat_red_list[index];
}
else
{
for (int i = 0; i < chat_red_list.Count; i++)
{
if (chat_red_list[i]) return true;
}
return false;
}
}
}
public class ChatItem
{
[JsonProperty("role")] public string role;
[JsonProperty("content_list")] public List<ChatText> content_list;
}
public class ChatText
{
[JsonProperty("type")] public int type;
[JsonProperty("text_content")] public string text_content;
[JsonProperty("chat_time")] public long chat_time;
}
public class ReplyItem
{
[JsonProperty("role")] public string role { get; set; }
[JsonProperty("list")] public List<ReplyContent> list { get; set; }
[JsonProperty("status")] public string status { get; set; }
}
public class ReplyContent
{
[JsonProperty("type")] public int type { get; set; }
[JsonProperty("content")] public string content { get; set; }
}
public static class ChatType
{
public const string Ainsley = "Ainsley";
public const string Lacey = "Lacey";
public const string Beatrice = "Beatrice";
public const string Taffy = "Taffy";
public const string Quinn = "Quinn";
public static string GetType(int type)
{
switch (type)
{
case 0:
return Ainsley;
case 1:
return Lacey;
case 2:
return Beatrice;
case 3:
return Taffy;
case 4:
return Quinn;
}
return Ainsley;
}
public static string GetStyle(int type)
{
switch (type)
{
case 0:
return "playful";
case 1:
return "nurturing";
case 2:
return "confident";
case 3:
return "affectionate";
case 4:
return "reserved";
}
return "playful";
}
public static int GetIndex(string type)
{
switch (type)
{
case Ainsley:
return 0;
case Lacey:
return 1;
case Beatrice:
return 2;
case Taffy:
return 3;
case Quinn:
return 4;
}
return 0;
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ff3b145e4056947d69838d9c469acb58
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+278
View File
@@ -0,0 +1,278 @@
using System;
using System.Collections.Generic;
using System.Linq;
using IgnoreOPS;
using Spine.Unity;
using LoveLegend;
using UnityEngine;
public class CreatAnimalCard : MonoBehaviour
{
private GameObject card_item;
public static CreatAnimalCard instance;
private List<Sprite> img_list;
public Camera orthoCamera; // 这个变量应该被设置为您想要调整大小的正交相机
private void Awake()
{
instance = this;
card_item = Resources.Load<GameObject>("card/card_item/card_");
img_list = new List<Sprite>();
// img_list = Resources.LoadAll<Sprite>("card/card_sprite").ToList();
// img_list.Sort((x, y) => String.Compare(x.name, y.name));
for (int i = 0; i < 16; i++)
{
img_list.Add(Resources.Load<Sprite>("card/card_sprite/" + i));
}
orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
float size = (float)Math.Round(28.125f / ((float)Screen.width / Screen.height), 4);
string type = SystemInfo.deviceModel.ToLower().Trim();
// Debug.Log($"type==========={type}");
if (type.Substring(0, 3) == "ipa")
{//iPad机型
size = 49.9f;
}
orthoCamera.orthographicSize = size;
}
public void SetCameraVisible(bool visible)
{
orthoCamera.SetActive(visible);
GameHelper.ShowSheepPlayUI(visible);
}
// Start is called before the first frame update
public List<List<Card_item>> card_item_list = new List<List<Card_item>>();
public List<List<Card_item>> CreatCardNew(int all_card_numbers, int card_type_max, int card_layer, int extra_max, List<List<Vector2>> map_list, List<Vector2> left_extra_list,
List<Vector2> right_extra_list)
{
//all_card_numbers *= 3;
int money_rate = ConfigSystem.GetCommonConf().rewardrate;
List<int> type_list = new List<int>();
List<int> this_timetype_list = new List<int>();
// Debug.Log(card_layer);
card_item_list.Clear();
// ---------- 新增:先从0~15中挑选 card_type_max 个不同的类型 ----------
List<int> allTypes = Enumerable.Range(0, 15).ToList(); // [0,1,2,...,15]
List<int> chosenTypes = new List<int>();
for (int i = 0; i < card_type_max; i++)
{
int idx = UnityEngine.Random.Range(0, allTypes.Count);
chosenTypes.Add(allTypes[idx]);
allTypes.RemoveAt(idx); // 确保不重复
}
// ---------------------------------------------------------------
// 打印选出来的类型池
Debug.Log($"[CreatCardNew] 随机选出的 {card_type_max} 个类型: {string.Join(",", chosenTypes)}");
for (int i = 0; i < all_card_numbers; i++)
{
int type = 0;
var randomNum = UnityEngine.Random.Range(0, 100);
// Debug.Log($"[creat] money_rate------------ {randomNum}==={money_rate}");
if (GameHelper.IsGiftSwitch() && randomNum < money_rate)
{
type = 15; // 金币
}
else
{
// 在挑选好的类型池里再随机
type = chosenTypes[UnityEngine.Random.Range(0, chosenTypes.Count)];
}
// if (GameHelper.IsGiftSwitch() && type == 15)
// {
// type = UnityEngine.Random.Range(0, card_type_max - 1);
// }
#if UNITY_EDITOR
// type = 1;
#endif
type_list.Add(type);
type_list.Add(type);
type_list.Add(type);
if (!this_timetype_list.Contains(type)) this_timetype_list.Add(type);
}
SaveData.GetSaveObject().this_time_cardtype = this_timetype_list.Count;
for (int i = 0; i < card_layer; i++)
{
card_item_list.Add(new List<Card_item>());
}
if (left_extra_list.Count > 0 || right_extra_list.Count > 0)
{
for (int i = 0; i < left_extra_list.Count; i++)
{
Card_item _tempObject = new()
{
pos_x = left_extra_list[i].x,
pos_y = left_extra_list[i].y,
_layer = i
};
card_item_list[i].Add(_tempObject);
}
for (int i = 0; i < right_extra_list.Count; i++)
{
Card_item _tempObject1 = new()
{
pos_x = right_extra_list[i].x,
pos_y = right_extra_list[i].y,
_layer = i
};
card_item_list[i].Add(_tempObject1);
}
}
var nums = 0;
for (int i = 0; i < map_list.Count; i++)
{
nums += map_list[i].Count;
}
for (int i = 0; i < nums; i++)
{
Card_item _tempObject = new();
int layer = getMaplayer(map_list);//确定层数
int pos = UnityEngine.Random.Range(0, map_list[layer].Count);
_tempObject.pos_x = map_list[layer][pos].x;
_tempObject.pos_y = map_list[layer][pos].y;
_tempObject._layer = layer;
card_item_list[layer].Add(_tempObject);
map_list[layer].RemoveAt(pos);
}
for (int i = 0; i < card_item_list.Count; i++)
{
card_item_list[i].Sort((x, y) => y.pos_y.CompareTo(x.pos_y));
}
int index = 0;
for (int i = 0; i < card_item_list.Count; i++)
{
float z_offset = 0;//用来微调每层之间的z值,让下层盖住上层
float last_posy = 0;
for (int j = 0; j < card_item_list[i].Count; j++)
{
if (last_posy != card_item_list[i][j].pos_y)
{
z_offset += 0.05f;
last_posy = card_item_list[i][j].pos_y;
}
GameObject temp = Instantiate(card_item, new Vector3(card_item_list[i][j].pos_x, card_item_list[i][j].pos_y, 400 - card_item_list[i][j]._layer - z_offset), Quaternion.identity, gameObject.transform);
index = UnityEngine.Random.Range(0, type_list.Count);
temp.GetComponent<SpriteRenderer>().sprite = img_list[type_list[index]];
card_item_list[i][j].sheep_card = temp;
card_item_list[i][j].card_type = type_list[index];
temp.gameObject.name = i + "-" + j;
type_list.RemoveAt(index);
}
}
return card_item_list;
}
public void creatSaveCard(List<List<Card_item>> card_item_list)
{
this.card_item_list = card_item_list;
for (int i = 0; i < card_item_list.Count; i++)
{
for (int j = 0; j < card_item_list[i].Count; j++)
{
GameObject temp;
// if (card_item_list[i][j].is_out)
// {
// temp = Instantiate(card_item, new Vector3(card_item_list[i][j].pos_x, card_item_list[i][j].pos_y, 400 - card_item_list[i][j].out_layer), Quaternion.identity, gameObject.transform);
// }
// else
temp = Instantiate(card_item, new Vector3(card_item_list[i][j].pos_x, card_item_list[i][j].pos_y, 400 - card_item_list[i][j]._layer), Quaternion.identity, gameObject.transform);
temp.GetComponent<SpriteRenderer>().sprite = img_list[card_item_list[i][j].card_type];
card_item_list[i][j].sheep_card = temp;
if (card_item_list[i][j].in_slot || card_item_list[i][j].is_out) temp.transform.localScale = new Vector3(4.628f, 4.628f, 1);
temp.gameObject.name = i + "-" + j;
}
}
}
private GameObject Popup;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (Popup == null) Popup = GameObject.Find("Popup");
if (Popup.transform.childCount != 0) return;
Ray ray = orthoCamera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
int layerMask = 1 << 6; // 只与第8层的碰撞器碰撞
// 如果射线与layerMask指定层的碰撞器发生碰撞
if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
{
// Debug.Log("Hit " + hit.collider.gameObject.name);
GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name);
// 在此处添加点击物体后的逻辑
}
else
{
// Debug.Log("No hit");
}
}
}
private GameObject disappear01;
private GameObject disappear02;
public void creatSpine(int type, Vector3 vec3)
{
if (disappear01 == null) disappear01 = Resources.Load<GameObject>("card/bg_img/fx_disaappear_1");
if (disappear02 == null) disappear02 = Resources.Load<GameObject>("card/bg_img/fx_disaappear_2");
if (type == 1)
{
SkeletonAnimation temp = Instantiate(disappear01, new Vector3(vec3.x, vec3.y, 110), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
temp.AnimationState.SetAnimation(0, "disappear01", true);
temp.AnimationState.Complete += (trackEntry) =>
{
Destroy(temp.gameObject);
};
}
if (type == 2)
{
SkeletonAnimation temp = Instantiate(disappear02, new Vector3(vec3.x, vec3.y, 110), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
temp.AnimationState.SetAnimation(0, "disappear02", true);
temp.AnimationState.Complete += (trackEntry) =>
{
Destroy(temp.gameObject);
};
}
// temp.GetComponent<SpriteRenderer>().sprite = img_list[card_item_list[i][j].card_type];
}
int getMaplayer(List<List<Vector2>> map_list)
{
int layer = UnityEngine.Random.Range(0, map_list.Count);//确定层数
if (map_list[layer].Count == 0)
{
layer = getMaplayer(map_list);
}
return layer;
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9fb9475b4182b354b84f97ae3ed0a002
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 461f4ab1eea545959e3ea8ea1a1b841b
timeCreated: 1750658885
+28
View File
@@ -0,0 +1,28 @@
using SGModule.Common.Helper;
using SGModule.NetKit;
namespace LoveLegend {
public class CloudDataSaver {
public static void UpdateData(string json, long version, bool onQuit) {
Log.Info("CloudDataSaver", $"最新数据版本: {version}, onQuit: {onQuit} ,数据: {json}");
if (json == null) {
return;
}
// 应用直接退出或者退到后台, 直接保存数据到服务器, 不启用协程发送
if (onQuit) {
NetApi.UploadPlayerDataUpdate(version, json);
return;
}
NetApi.UploadPlayerDataUpdate(version, json, result => {
if (result) {
Log.Info("CloudDataSaver", $"最新数据版本: {version} ,更新成功");
}
else {
Log.Warning("CloudDataSaver", $"最新数据版本: {version} ,更新失败");
}
});
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e430f51fc26d4125843615d8de9e7f6c
timeCreated: 1750659159
+68
View File
@@ -0,0 +1,68 @@
public static class DataKeys
{
public const string UserID = "UserID";
public const string FirstLogin = "FirstLogin";
public const string coin = "coin";
public const string ticket = "ticket";
public const string maxCoin = "maxCoin";
public const string nextOpenWheelStampTime = "nextOpenWheelStampTime";
public const string thisDayWatchSlyderVideoNum = "thisDayWatchSlyderVideoNum";
public const string playerName = "playerName";
public const string playerAvatarId = "playerAvatarId";
public const string signState = "signState";
public const string gameOfCount = "gameOfCount";
public const string gameLevel = "gameLevel";
public const string exchangeAccount = "exchangeAccount";
public const string exchangeName = "exchangeName";
public const string isShowRewardFly101 = "isShowRewardFly101";
public const string isShowRewardFly102 = "isShowRewardFly102";
public const string playReawrd111 = "playReawrd111";
public const string isShowRewardFly111 = "isShowRewardFly111";
public const string isShowOpenReward = "isShowOpenReward";
public const string isLastH5Tab = "isLastH5Tab";
public const string adChFlyShowTime = "adChFlyShowTime";
public const string h5StayTime = "h5StayTime";
public const string videoWatchCount = "videoWatchCount";
public const string makeupTaskHistory = "makeupTaskHistory";
public const string makeupTaskH5Time = "makeupTaskH5Time";
public const string gameStartCount = "gameStartCount";
public const string loginGameTodayTimes = "loginGameTodayTimes";
public const string date = "date";
public const string ch_level = "ch_level";
public const string SaveObject = "SaveObject";
public const string LevelData = "LevelData";
public const string AdWatchCount = "AdWatchCount"; // 看广告次数
public const string AvailableDiceRolls = "AvailableDiceRolls"; // 可摇骰子次数
public const string propBackNum = "propBackNum"; // 返回道具数量
public const string propRefreshNum = "propRefreshNum"; // 刷新道具数量
public const string propRemoveNum = "propRemoveNum"; // 移除道具数量
public const string resurrectionState = "resurrectionState"; //复活状态:4种,数字3为可以用广告和金币复活,2为只能用广告,1为只能用金币。0为不能复活
public const string gameExperience = "gameExperience";
public const string getFirstReaward = "getFirstReaward"; // 是否已领取新手奖励
public const string noviceGuide = "noviceGuide"; // 是否新手引导
public const string gameTime = "gameTime"; // 游戏时长
public const string gameDay = "gameDay";
public const string SecretUnlockList = "SecretUnlockList"; // 秘密相册解锁列表
public const string SecretUnlockCd = "SecretUnlockCd"; // 秘密相册看广告的剩余时间
public const string SecretUnlockADs = "SecretUnlockADs"; // 秘密相册看广告数(每一个图集的广告数不通用)
public const string IsUnlockSecret = "IsUnlockSecret"; // 秘密相册是否解锁(-1:未解锁 0:刚解锁 1:已打开秘密相册)
public const string VipLevel = "VipLevel"; // vip等级(1:7天 2:30天 3:365天)
public const string VipExpirationTime = "VipExpirationTime"; // vip失效时间(默认为0
public const string LiveDataList = "LiveDataList";
public const string IsUnlockLive = "IsUnlockLive"; // live是否解锁(-1:未解锁 0:刚解锁 1:已打开live)
public const string ApplePayTransactionID = "ApplePayTransactionID"; //ios购买后的非消耗性订单id
public const string LiveDataDic = "LiveDataDic";
public const string LevelUnlockList = "LevelUnlockList"; // 图鉴已解锁的index列表
public const string IsUnlockChat = "IsUnlockChat";
public const string ChatData = "ChatData";
public const string ChatNumber = "ChatNumber";
public const string ChatRecoverDays = "ChatRecoverDays";
public const string ChatFreeNumber = "ChatFreeNumber";
public const string curResVersion = "curResVersion";
public const string LevelUnlockListFree = "LevelUnlockListFree";
public const string LevelUnlockListAD = "LevelUnlockListAD";
public const string LevelUnlockListSpecial = "LevelUnlockListSpecial";
public const string LevelUnlockListVIP = "LevelUnlockListVIP";
public const string LevelUnlockListNew = "LevelUnlockListNew";
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bc5eccf1420ec3a489eb815e618824c8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+110
View File
@@ -0,0 +1,110 @@
using System.Collections.Generic;
using SGModule.DataStorage;
using LoveLegend;
public static partial class DataMgr
{
public static string long_name;
public static string short_name;
private static DataStorage<T> BindDataStorage<T>(string key, string messageKey = null, T @default = default)
{
return new DataStorage<T>(key, @default, (oldValue, newValue) =>
{
// 构造 ChangeValue 对象
var changeValue = new ChangeValue<T>
{
oldValue = oldValue,
newValue = newValue
};
if (messageKey.IsNullOrWhiteSpace())
{
return;
}
// 调用特定类型的分发器
PreferencesDispatcher<T>.Instance.Dispatch(messageKey, changeValue);
// 调用全局数据分发器(如果需要)
DataDispatcher.Instance.Dispatch(messageKey);
});
}
#region ValueType
public static DataStorage<bool> FirstLogin = new(DataKeys.FirstLogin, true);
public static DataStorage<long> UserID = BindDataStorage(DataKeys.UserID, @default: -1L);
public static DataStorage<long> NextOpenWheelStampTime = BindDataStorage<long>(DataKeys.nextOpenWheelStampTime);
public static DataStorage<int> ThisDayWatchSlyderVideoNum = BindDataStorage<int>(DataKeys.thisDayWatchSlyderVideoNum);
public static DataStorage<int> Coin = BindDataStorage<int>(DataKeys.coin, DataMsg.currency101);
public static DataStorage<decimal> Ticket = BindDataStorage<decimal>(DataKeys.ticket, DataMsg.currency102);
public static DataStorage<int> MaxCurrency101 = BindDataStorage<int>(DataKeys.maxCoin);
public static DataStorage<string> PlayerName = BindDataStorage<string>(DataKeys.playerName, DataMsg.playerName);
public static DataStorage<int> PlayerAvatarId = BindDataStorage<int>(DataKeys.playerAvatarId, DataMsg.playerAvatarId);
public static DataStorage<int> GameOfCount = BindDataStorage<int>(DataKeys.gameOfCount);
public static DataStorage<int> GameLevel = BindDataStorage(DataKeys.gameLevel, @default: 1);
public static DataStorage<string> ExchangeAccount = BindDataStorage<string>(DataKeys.exchangeAccount);
public static DataStorage<string> ExchangeName = BindDataStorage<string>(DataKeys.exchangeName);
public static DataStorage<bool> IsShowRewardFly101 = BindDataStorage<bool>(DataKeys.isShowRewardFly101, DataMsg.isShowRewardFly101);
public static DataStorage<bool> IsShowRewardFly102 = BindDataStorage<bool>(DataKeys.isShowRewardFly102);
public static DataStorage<decimal> PlayReawrd111 = BindDataStorage<decimal>(DataKeys.playReawrd111, DataMsg.playReawrd111);
public static DataStorage<bool> IsShowRewardFly111 = BindDataStorage<bool>(DataKeys.isShowRewardFly111, DataMsg.isShowRewardFly111);
public static DataStorage<bool> IsShowOpenReward = BindDataStorage<bool>(DataKeys.isShowOpenReward);
public static DataStorage<bool> IsLastH5Tab = BindDataStorage<bool>(DataKeys.isLastH5Tab);
public static DataStorage<long> AdChFlyShowTime = BindDataStorage<long>(DataKeys.adChFlyShowTime);
public static DataStorage<int> H5StayTime = BindDataStorage<int>(DataKeys.h5StayTime);
public static DataStorage<int> VideoWatchCount = BindDataStorage<int>(DataKeys.videoWatchCount);
public static DataStorage<decimal> MakeupTaskH5Time = BindDataStorage<decimal>(DataKeys.makeupTaskH5Time);
public static DataStorage<int> GameStartCount = BindDataStorage<int>(DataKeys.gameStartCount);
public static DataStorage<int> LoginGameTodayTimes = BindDataStorage<int>(DataKeys.loginGameTodayTimes);
public static DataStorage<string> Date = BindDataStorage<string>(DataKeys.date);
public static DataStorage<int> ChLevel = BindDataStorage<int>(DataKeys.ch_level);
public static DataStorage<string> LevelData = new(DataKeys.LevelData, cloudSave: false);
public static DataStorage<int> AdWatchCount = BindDataStorage<int>(DataKeys.AdWatchCount);
public static DataStorage<int> AvailableDiceRolls = BindDataStorage<int>(DataKeys.AvailableDiceRolls);
public static DataStorage<int> PropBackNum = BindDataStorage<int>(DataKeys.propBackNum);
public static DataStorage<int> PropRefreshNum = BindDataStorage<int>(DataKeys.propRefreshNum);
public static DataStorage<int> PropRemoveNum = BindDataStorage<int>(DataKeys.propRemoveNum);
public static DataStorage<int> ResurrectionState = BindDataStorage<int>(DataKeys.resurrectionState, null, 3);
public static DataStorage<int> GameExperience = BindDataStorage<int>(DataKeys.gameExperience);
public static DataStorage<bool> GetFirstReaward = BindDataStorage<bool>(DataKeys.getFirstReaward);
public static DataStorage<bool> NoviceGuide = BindDataStorage<bool>(DataKeys.noviceGuide);
public static DataStorage<int> GameTime = BindDataStorage<int>(DataKeys.gameTime);
public static DataStorage<int> GameDay = BindDataStorage<int>(DataKeys.gameDay);
public static DataStorage<int> IsUnlockSecret = BindDataStorage<int>(DataKeys.IsUnlockSecret, null, -1);
public static DataStorage<int> VipLevel = BindDataStorage<int>(DataKeys.VipLevel, null, -1);
public static DataStorage<long> VipExpirationTime = BindDataStorage<long>(DataKeys.VipExpirationTime);
public static DataStorage<int> IsUnlockLive = BindDataStorage<int>(DataKeys.IsUnlockLive, null, -1);
public static DataStorage<string> curResVersion = new(DataKeys.curResVersion, cloudSave: false);
#endregion
#region RefType
public static DataStorage<List<long>> SignState = BindDataStorage(DataKeys.signState, @default: new List<long>());
public static DataStorage<List<MakeupTaskData>> MakeupTaskHistory = BindDataStorage(DataKeys.makeupTaskHistory, @default: new List<MakeupTaskData>());
public static DataStorage<Saveobject> SaveObject = BindDataStorage(DataKeys.SaveObject, @default: new Saveobject());
public static DataStorage<List<int>> SecretUnlockList = BindDataStorage(DataKeys.SecretUnlockList, @default: new List<int>());
public static DataStorage<Dictionary<int, int>> SecretUnlockCd = new(DataKeys.SecretUnlockCd, defaultValue: new Dictionary<int, int>(), cloudSave: false);
public static DataStorage<Dictionary<int, int>> SecretUnlockADs = new(DataKeys.SecretUnlockADs, defaultValue: new Dictionary<int, int>());
public static DataStorage<List<LiveData>> LiveDataList = new(DataKeys.LiveDataList, defaultValue: new List<LiveData>());
public static DataStorage<List<string>> ApplePayTransactionID = BindDataStorage(DataKeys.ApplePayTransactionID, @default: new List<string>());
public static DataStorage<Dictionary<int, LiveData>> LiveDataDic = new(DataKeys.LiveDataDic, defaultValue: new Dictionary<int, LiveData>());
public static DataStorage<List<int>> LevelUnlockList = new(DataKeys.LevelUnlockList, defaultValue: new List<int>());
public static DataStorage<int> IsUnlockChat = BindDataStorage<int>(DataKeys.IsUnlockChat, null, -1);
public static DataStorage<List<ChatItem>> ChatData = new(DataKeys.ChatData, cloudSave: false);
public static DataStorage<int> ChatNumber = BindDataStorage<int>(DataKeys.ChatNumber, null, 0);
public static DataStorage<int> ChatFreeNumber = BindDataStorage<int>(DataKeys.ChatFreeNumber, null, 0);
public static DataStorage<int> ChatRecoverDays = BindDataStorage<int>(DataKeys.ChatRecoverDays, null, -1);
public static DataStorage<int> LevelUnlockFree = new(DataKeys.LevelUnlockListFree, defaultValue: -1);
public static DataStorage<int> LevelUnlockAD = new(DataKeys.LevelUnlockListAD, defaultValue: -1);
public static DataStorage<int> LevelUnlockSpecial = new(DataKeys.LevelUnlockListSpecial, defaultValue: -1);
public static DataStorage<int> LevelUnlockVIP = new(DataKeys.LevelUnlockListVIP, defaultValue: -1);
public static DataStorage<List<Levelunlock>> LevelUnlockListNew = new(DataKeys.LevelUnlockListNew, defaultValue: new List<Levelunlock>());
#endregion
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 935e480d49b8ffa4381022530d2f6acc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+9
View File
@@ -0,0 +1,9 @@
public static class DataMsg {
public const string currency101 = "Preferences_currency101";
public const string currency102 = "Preferences_currency102";
public const string playerName = "Preferences_playerName";
public const string playerAvatarId = "Preferences_playerAvatarId";
public const string isShowRewardFly101 = "Preferences_isShowRewardFly101";
public const string playReawrd111 = "Preferences_playReawrd111";
public const string isShowRewardFly111 = "Preferences_isShowRewardFly111";
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d352f19554a6f98469bd971e95579515
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
using System.Collections.Generic;
using SGModule.NetKit;
namespace LoveLegend {
public class PreferencesDataReadyCtrl : BaseCtrl {
private readonly List<uint> msgList = new();
public void PreferenceDataReady(object objs = null) {
InspectionNewDay();
DataMgr.GameStartCount.Value++;
}
public void InspectionNewDay() {
var login_time = LoginKit.Instance.LoginModel.LoginTime;
var data = DateTimeManager.Instance.GetDateTime(login_time);
var dateStr = DateTimeManager.Instance.DateTimeToYYYYMMDD(data);
if (!DataMgr.Date.Value.Equals(dateStr)) {
DataMgr.Date.Value = dateStr;
msgList.Add(CtrlMsg.NewDays);
DataMgr.LoginGameTodayTimes.Value = 1;
}
else {
DataMgr.LoginGameTodayTimes.Value++;
}
}
public void SendCtrlMsg(object args = null) {
for (var i = 0; i < msgList.Count; i++) {
ctrlDispatcher.Dispatch(msgList[i]);
}
msgList.Clear();
}
#region
protected override void OnInit() {
}
protected override void OnDispose() {
}
#endregion
#region
protected override void AddListener() {
ctrlDispatcher.AddListener(CtrlMsg.Preferences_InitComplete, PreferenceDataReady);
ctrlDispatcher.AddListener(CtrlMsg.Game_StartBefore, SendCtrlMsg);
}
protected override void RemoveListener() {
ctrlDispatcher.RemoveListener(CtrlMsg.Preferences_InitComplete, PreferenceDataReady);
ctrlDispatcher.RemoveListener(CtrlMsg.Game_StartBefore, SendCtrlMsg);
}
#endregion
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b456e1e40be344dd99c817ba250c2a0e
timeCreated: 1692007381
+31
View File
@@ -0,0 +1,31 @@
namespace LoveLegend
{
using System;
using UnityEngine;
public class Throttle
{
private float _lastTime;
private readonly float _interval;
public Throttle(float intervalSeconds)
{
_interval = intervalSeconds;
_lastTime = -intervalSeconds; // 确保一开始就能执行
}
/// <summary>
/// 节流调用:在时间窗口内只执行一次
/// </summary>
public void Execute(Action action)
{
if (Time.time - _lastTime >= _interval)
{
_lastTime = Time.time;
action?.Invoke();
}
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a38aa4bb7436148318f6c3577b8758f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: be8781ff9378e5345a9f6188e990a359
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e7146600e94b62843b388e234c8ce824
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
namespace LoveLegend
{
public static class AnimConst
{
public const float AnimFrameRate = 30;
public const float SecondRateUnit = 1 / AnimFrameRate;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: db177b3a2887ce0498712919fed1ee4f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
using UnityEngine;
using System.Collections.Generic;
using SGModule.Common;
namespace LoveLegend
{
public static class AppConst
{
#region Field
public static bool IsEnabledEngineLog = ConfigManager.GameConfig.enabledLog;
public const LogType EnabledFilterLogType =
LogType.Log | LogType.Warning | LogType.Error | LogType.Assert |
LogType.Exception;
public const bool IsRunInBG = true;
public const int SleepTimeoutMode = SleepTimeout.NeverSleep;
public const int AntiAliasing = 0;
public const int HighFrameRate = 60;
public const int LowFrameRate = 45;
public const float HDHighViewScale = 1f;
public const float HDLowViewScale = 0.9f;
public const float PixelsPerUnit = 100f;
public static Vector2Int StandardResolution = new Vector2Int(1080, 1920);
public static Vector2Int UIResolution = new Vector2Int(1080, 1920);
public static bool UseInternalSetting = true;
public static bool IsMultiLangue = true;
public static string CurrMultiLangue = "en";
public static string DefaultLangue = "en";
public static string InternalLangue = "en";
public static string DeviceLangue = "en";
public static List<string> CtrlDisableList = new List<string>();
#endregion
public static bool isPt()
{
if (CurrMultiLangue == "pt") return true;
return false;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5e2daa6b68221ec4f8e0b643de38afd1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,38 @@
using UnityEngine;
namespace LoveLegend
{
public static class AppObjConst
{
public const string FrameGoName = "[ Jarvis ]";
public static GameObject FrameGo;
public const string LauncherGoName = "[Launcher]";
public const string EngineEventSystemGoName = "[EngineEventSystem]";
public static GameObject EngineEventSystemGo;
public const string ApplicationGoName = "[ Application ]";
public static GameObject ApplicationGo;
public const string EngineSingletonGoName = "[EngineSingleton]";
public static GameObject EngineSingletonGo;
public const string MonoManagerGoName = "[MonoManager]";
public static GameObject MonoManagerGo;
public const string DispatcherGoName = "[Dispatcher]";
public static GameObject DispatcherGo;
public const string LoaderGoName = "[Loader]";
public static GameObject LoaderGo;
public const string CameraGoName = "[Camera]";
public static GameObject CameraGo;
public const string UIGoName = "[UI]";
public static GameObject UIGo;
public const string UICacheGoName = "[UICache]";
public static GameObject UICacheGo;
public const string DOTweenGoName = "[DOTween]";
public const string SuperInvokeGoName = "[SuperInvoke]";
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ce9826ccd786f9e46a1fb245b9fe4a04
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
namespace LoveLegend
{
public static class AudioConst
{
public const string UIButtonDefault = "ui_ButtonDefault";
public const string DailyBonusCollect = "dailyBonus_collect";
public const string CoinFly = "coinfly";
public const string MainBg = "hall_bgm";
public const string GameBg = "game_bgm";
public const string dissolve = "dissolve";
public const string fail = "fail";
public const string Victoriously = "Victoriously";
public const string MakeupDone = "makupdone";
public const string wheel_spin = "wheel_spin";
public const string game_open = "game_open";
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dbb65f81bcb66ff48abc55f1c1150765
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,17 @@
using UnityEngine;
namespace LoveLegend
{
public static class CameraConst
{
public const int MainDepth = 0;
public const int UICameraDepth = 10;
public const int MainCameraPosValue = 100;
public const int MainCameraZPos = 0;
public const int UICameraPosValue = 10000;
public static Vector3 MainCameraPos = new Vector3(MainCameraPosValue, MainCameraPosValue, MainCameraZPos);
public static Vector3 UICameraPos = new Vector3(UICameraPosValue, UICameraPosValue, MainCameraZPos);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e2555d38a702f494ca13aaf957846be9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,14 @@
namespace LoveLegend
{
public static class FolderNames
{
public const string SecretName = "SecretAlbums";
public const string AlbumName = "LevelAlbums";
public const string BackgroundName = "Background";
public const string VideoName = "LiveVideos";
public const string VideoCoversName = "LiveVideoCovers";
public const string GameCache = "GameCache";
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e4da890320dd03c4f837d9dc3c8c31c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,13 @@
using UnityEngine;
namespace LoveLegend
{
public static class LayerMaskConst
{
public const string Default_Name = "Default";
public const string UI_Name = "UI";
public readonly static int Default = LayerMask.NameToLayer(Default_Name);
public readonly static int UI = LayerMask.NameToLayer(UI_Name);
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8f53446f031c27d4eae9f0ff7d3e4565
timeCreated: 1530670154
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
namespace LoveLegend
{
public static class PrefsConst
{
public const bool BoolDefault = false;
public const int IntDefault = 0;
public const int IntTrue = 1;
public const int IntFalse = 2;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6cb940cabfde0ad4c8a849ca893d686c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
namespace LoveLegend
{
public static class PrefsKeyConst
{
public const string Application_isHDMode = "Application_isHDMode";
public const string Application_isHFRMode = "Application_isHFRMode";
public const string UIMgr_switchLanguage = "UIMgr_switchLanguage";
public const string AudioMgr_isOpenBGM = "AudioMgr_isOpenBGM";
public const string AudioMgr_isOpenEffect = "AudioMgr_isOpenEffect";
public const string App_isNewInstall = "App_isNewInstall";
public const string JarvisToken = "JarvisToken";
public const string C_ThroughMaxToday = "C_ThroughMaxToday";
public const string C_ThroughPop = "C_ThroughPop";
public const string C_ThroughOnline = "C_ThroughOnline";
public const string C_ThroughHide = "C_ThroughHide";
public const string C_ThroughFly = "C_ThroughFly";
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bec1a938462feda4eba6b162b9a387e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using UnityEngine;
namespace LoveLegend
{
public static class ScreenConst
{
public static Vector2 StandardResolution = new(AppConst.StandardResolution.x, AppConst.StandardResolution.y);
public static float StandardWidth => AppConst.StandardResolution.x;
public static float StandardHeight => AppConst.StandardResolution.y;
public static Vector2 RawResolution = new(Screen.width, Screen.height);
public static Vector2 CurrResolution = new(Screen.width, Screen.height);
public static float OrthographicSize_1280H = StandardHeight / 2 / AppConst.PixelsPerUnit;
public static float StandardAspectRatio = StandardHeight / StandardWidth;
public static float CurrAspectRatio = (float)Screen.height / Screen.width;
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 76e7d3de03bd12a44b19e935ea71697a
timeCreated: 1534935298
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,41 @@
namespace LoveLegend
{
public static class UILayerConst
{
public const string Background = "Background";
public const string Bottom = "Bottom";
public const string Normal = "Normal";
public const string Top = "Top";
public const string FullScreen = "FullScreen";
public const string Popup = "Popup";
public const string Highest = "Highest";
public const string Animation = "Animation";
public const string Tips = "Tips";
public const string Loading = "Loading";
public const string System = "System";
public const string NetworkError = "NetworkError";
public static readonly string[] AllUILayer = {
Background,
Bottom,
Normal,
Top,
FullScreen,
Popup,
Highest,
Animation,
Tips,
Loading,
System,
NetworkError
};
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a1cfef99d74aac943a6872498ec8fb4f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using UnityEngine;
namespace LoveLegend
{
public static class VectorConst
{
public static Vector3 One = Vector3.one;
public static Vector3 PPUOne = One * AppConst.PixelsPerUnit;
public static Vector3 Half = new(0.5f, 0.5f, 0.5f);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ae89e346ddf1a584382a1deb4b78193a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,13 @@
using UnityEngine;
namespace LoveLegend
{
public static class YieldConst
{
public const float Time10ms = 0.01f;
public const float Time100ms = 0.1f;
public static WaitForEndOfFrame WaitForEndOfFrame = new WaitForEndOfFrame();
public static WaitForSeconds WaitFor100ms = new WaitForSeconds(Time100ms);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6248774d8e1b69d46a89ad1ea46081ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f14f42c47ff29474bb4170a49c3bc8c1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
namespace LoveLegend
{
public static partial class CtrlMsg
{
public const string NAME = "CtrlMsg";
public const uint BASE = 0;
private static uint Cursor_BASE = BASE;
public static readonly uint Login_Succeed = ++Cursor_BASE;
public static readonly uint Game_StartReady = ++Cursor_BASE;
public static readonly uint Game_Start = ++Cursor_BASE;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 19bfc133c0819ad4486cceca51c8a2e3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
namespace LoveLegend
{
public static partial class GameMsg
{
public const string NAME = "GameMsg";
public const uint BASE = 0;
private static uint Cursor_BASE = BASE;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d7b577419d940f468e1a95a9afb1dd9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
namespace LoveLegend
{
public static partial class UICtrlMsg
{
public const string NAME = "UICtrlMsg";
public const uint BASE = 0;
private static uint Cursor_BASE = BASE;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fb50862938136744db6a10a950ab4a27
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 05068ae3f93705047a7ad62030047667
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
namespace LoveLegend
{
public class ChangeValue<T>
{
public T oldValue;
public T newValue;
public ChangeValue()
{
}
public ChangeValue(T oldValue, T newValue)
{
this.oldValue = oldValue;
this.newValue = newValue;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c53b34a8fdfa77143b24d0660057d5a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f185af0ac6ec3f548bed55863e2f65e8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 10e424129050f3a4ab3fdc991bf91318
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,132 @@
using System;
using UnityEngine;
using System.Collections.Generic;
namespace LoveLegend
{
public abstract class BaseDispatcher<T, Msg, Param> : IDisposable where T : class, new() where Param : class
{
private static T m_instance;
public static T Instance
{
get
{
if (m_instance == null)
{
m_instance = new T();
}
return m_instance;
}
}
private Dictionary<Msg, List<Action<Param>>> m_msgPriorityDict = new();
private Dictionary<Msg, List<Action<Param>>> m_msgDict = new();
private Dictionary<Msg, List<Action<Param>>> m_msgFinallyDict = new();
private Dictionary<Msg, List<Action<Param>>> m_msgOnceDict = new();
public void AddListener(Msg msgId, Action<Param> listener)
{
if (m_msgDict.TryGetValue(msgId, out var value))
{
value.Add(listener);
}
else
{
var list = ListPool<Action<Param>>.Get();
list.Add(listener);
m_msgDict.Add(msgId, list);
}
}
public void AddOnceListener(Msg msgId, Action<Param> listener)
{
if (m_msgOnceDict.TryGetValue(msgId, out var value))
{
value.Add(listener);
}
else
{
var list = ListPool<Action<Param>>.Get();
list.Add(listener);
m_msgOnceDict.Add(msgId, list);
}
}
public void RemoveListener(Msg msgId, Action<Param> listener)
{
if (m_msgDict.TryGetValue(msgId, out var list))
{
if (list.Contains(listener))
{
list.Remove(listener);
if (list.Count == 0)
{
ListPool<Action<Param>>.Release(list);
m_msgDict.Remove(msgId);
}
}
}
}
public void Dispatch(Msg msgId, Param param = null)
{
InvokeMethods(m_msgPriorityDict, msgId, param);
InvokeMethods(m_msgDict, msgId, param);
InvokeMethods(m_msgFinallyDict, msgId, param);
InvokeMethods(m_msgOnceDict, msgId, param);
if (m_msgOnceDict.ContainsKey(msgId))
{
ListPool<Action<Param>>.Release(m_msgOnceDict[msgId]);
m_msgOnceDict.Remove(msgId);
}
}
private void InvokeMethods(Dictionary<Msg, List<Action<Param>>> msgDict, Msg msgId, Param param)
{
if (!msgDict.ContainsKey(msgId)) return;
var rawList = msgDict[msgId];
int funcCount = rawList.Count;
if (funcCount == 1)
{
Action<Param> onEvent = rawList[0];
onEvent(param);
return;
}
var invokeFuncs = ListPool<Action<Param>>.Get();
invokeFuncs.AddRange(rawList);
for (var i = 0; i < funcCount; i++)
{
try
{
var onEvent = invokeFuncs[i];
onEvent(param);
}
catch (Exception e)
{
Debug.LogError(e);
}
}
ListPool<Action<Param>>.Release(invokeFuncs);
}
public void Dispose()
{
m_instance = null;
m_msgPriorityDict.Clear();
m_msgDict.Clear();
m_msgFinallyDict.Clear();
m_msgOnceDict.Clear();
m_msgPriorityDict = null;
m_msgDict = null;
m_msgFinallyDict = null;
m_msgOnceDict = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c4b55125cefc9754888cccfc76bee4c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace LoveLegend
{
public class BaseMainThreadDispatcher<T, Msg, Param> : SingletonUnity<T>
where T : SingletonUnity<T>
where Param : class
{
private class MainThreadMsgClass
{
public Msg currMsgId;
public Param currParam;
}
private Queue<MainThreadMsgClass> m_msgQueue = new Queue<MainThreadMsgClass>();
private Dictionary<Msg, List<Action<Param>>> m_msgPriorityDict = new Dictionary<Msg, List<Action<Param>>>();
private Dictionary<Msg, List<Action<Param>>> m_msgDict = new Dictionary<Msg, List<Action<Param>>>();
private Dictionary<Msg, List<Action<Param>>> m_msgOnceDict = new Dictionary<Msg, List<Action<Param>>>();
private object m_queueLock = new object();
private void Update()
{
if (m_msgQueue.Count <= 0) return;
while (m_msgQueue.Count > 0)
{
MainThreadMsgClass msg;
lock (m_queueLock)
{
msg = m_msgQueue.Dequeue();
}
AutoDispatch(msg.currMsgId, msg.currParam);
}
}
public void Dispatch(Msg msgId, Param param = null)
{
if (!m_msgPriorityDict.ContainsKey(msgId)
&& !m_msgDict.ContainsKey(msgId)
&& !m_msgOnceDict.ContainsKey(msgId))
return;
MainThreadMsgClass msg = new MainThreadMsgClass
{
currMsgId = msgId,
currParam = param,
};
lock (m_queueLock)
{
m_msgQueue.Enqueue(msg);
}
}
private void AutoDispatch(Msg msgId, Param param)
{
InvokeMethods(m_msgPriorityDict, msgId, param);
InvokeMethods(m_msgDict, msgId, param);
InvokeMethods(m_msgOnceDict, msgId, param);
if (m_msgOnceDict.ContainsKey(msgId))
{
ListPool<Action<Param>>.Release(m_msgOnceDict[msgId]);
m_msgOnceDict.Remove(msgId);
}
}
private void InvokeMethods(Dictionary<Msg, List<Action<Param>>> msgDict, Msg msgId, Param param)
{
if (!msgDict.ContainsKey(msgId)) return;
List<Action<Param>> rawList = msgDict[msgId];
int funcCount = rawList.Count;
if (funcCount == 1)
{
Action<Param> onEvent = rawList[0];
onEvent(param);
return;
}
List<Action<Param>> invokeFuncs = ListPool<Action<Param>>.Get();
invokeFuncs.AddRange(rawList);
for (int i = 0; i < funcCount; i++)
{
try
{
Action<Param> onEvent = invokeFuncs[i];
onEvent(param);
}
catch (Exception e)
{
Debug.LogError(e);
}
}
ListPool<Action<Param>>.Release(invokeFuncs);
}
protected override string ParentRootName
{
get { return AppObjConst.DispatcherGoName; }
}
protected override void OnDestroy()
{
base.OnDestroy();
m_msgPriorityDict.Clear();
m_msgDict.Clear();
m_msgOnceDict.Clear();
m_msgPriorityDict = null;
m_msgDict = null;
m_msgOnceDict = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e02321e1c5d556b4484a914fec6eafbd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7926ab78fe6049f3bff905262b9b4695
timeCreated: 1682307945
@@ -0,0 +1,4 @@
namespace LoveLegend
{
public class AppDispatcher : BaseDispatcher<AppDispatcher, uint, object> { }
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 38ec268add4ac6743a27b7167bdcb36a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
namespace LoveLegend
{
public class CtrlDispatcher : BaseDispatcher<CtrlDispatcher, uint, object>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f627301519ad9ac43ba05e525564d3a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
namespace LoveLegend
{
public class DataDispatcher : BaseDispatcher<DataDispatcher, string, object>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 080dce14c0be15a448f7a6f1d316700f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
namespace LoveLegend
{
public class GameDispatcher : BaseDispatcher<GameDispatcher, uint, object>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab8a1624eafed174385147056385f287
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
namespace LoveLegend
{
public class MainThreadDispatcher : BaseMainThreadDispatcher<MainThreadDispatcher, uint, object>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cc759fa7eaebc574da1d3990ca6acfa5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
namespace LoveLegend
{
public class ModelDispatcher : BaseDispatcher<ModelDispatcher, uint, object>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 730ba6382f4f49444a8219f08543f431
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
namespace LoveLegend
{
public class NetworkDispatcher : BaseDispatcher<NetworkDispatcher, uint, object>
{
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 81a02ff4d9ca458aa70fe26ab514bb99
timeCreated: 1681977441
@@ -0,0 +1,12 @@
namespace LoveLegend
{
public class PreferencesDispatcher<T> : BaseDispatcher<PreferencesDispatcher<T>, string, ChangeValue<T>>
{
public ChangeValue<T> changeValue;
public PreferencesDispatcher()
{
changeValue = new ChangeValue<T>();
}
}
}

Some files were not shown because too many files have changed in this diff Show More