fix:1、修复bug。 2、1.0.8版本提审

This commit is contained in:
2026-05-15 11:09:47 +08:00
parent ee55c03120
commit 978797b678
121 changed files with 67129 additions and 66253 deletions
-15
View File
@@ -1,15 +0,0 @@
<linker>
<assembly fullname="Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" preserve="all">
<type fullname="UnityEngine.AddressableAssets.Addressables" preserve="all" />
</assembly>
<assembly fullname="Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" preserve="all">
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.SceneProvider" preserve="all" />
</assembly>
<assembly fullname="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<type fullname="UnityEngine.TextAsset" preserve="all" />
</assembly>
</linker>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b10c0e7d9a6ff7744bddfca54513995e
guid: 6323111b679d2804096d3c79f5f68fc2
TextScriptImporter:
externalObjects: {}
userData:
@@ -1,71 +1,72 @@
using SGModule.ConfigLoader;
namespace IgnoreOPS
{
[ConfigKey("Common", false)]
public class CommonModel
{
public int InitialNum;
public int[] inlineLoginDown;
public int inlineMin;
public int Purchaseprops;
public int rewardrate;
public int RevivalCoins;
public int[] wheelTimes;
public float Passportgift;
public float Passportgift2;
public int addspace;
public float addspace2;
public int AddDiscount;
public float AddDiscount2;
public int playtimes;
public int interstitialtype;
public int lobbyrewrdtime;
public int roomrewardrate;
public int Activetimes;
public int adrate;
public int roomrate;
public float afSendLimit;
public float afSendNum;
public int rewardinsertion;
public int exchangeCD = 120;
public int PayRate;
public int AddDiscountLevel;
public int AddDiscountCD;
public int AddSpaceLevel;
public int RemoveADsPackDuration;
public int RemoveADsPackPopup;
public string contactUs;
public int[] UnlockSecret;
public int[] UnlockLive;
public int Live;
public int Secret;
public int Assitant;
public int LivePreview;
public int SecretPreview;
public int HomeGuideRate;
public int roomGuideRate;
public int VIPGuide;
public int VIPGuideRate;
public int HomeInterstitialAd;
public int FreeClaims;
public int TurnOffPackRate;
public int TurnOffRewardsRate;
public int TurnOffRewardsCD;
public int TurnOffRewardslimit;
public int FailedGiftProgress;
public int BonusInside;
public int UnlockAIAssistant;
public int FreeMessages;
public int[] CoinsAccess;
public int AdAccess;
public int ClearRAM;
public int CoinsDownload;
public string ResVersion;
public int MultiModal;
}
using SGModule.ConfigLoader;
namespace IgnoreOPS
{
[ConfigKey("Common", false)]
public class CommonModel
{
public int InitialNum;
public int[] inlineLoginDown;
public int inlineMin;
public int Purchaseprops;
public int rewardrate;
public int RevivalCoins;
public int[] wheelTimes;
public float Passportgift;
public float Passportgift2;
public int addspace;
public float addspace2;
public int AddDiscount;
public float AddDiscount2;
public int playtimes;
public int interstitialtype;
public int lobbyrewrdtime;
public int roomrewardrate;
public int Activetimes;
public int adrate;
public int roomrate;
public float afSendLimit;
public float afSendNum;
public int rewardinsertion;
public int exchangeCD = 120;
public int PayRate;
public int AddDiscountLevel;
public int AddDiscountCD;
public int AddSpaceLevel;
public int RemoveADsPackDuration;
public int RemoveADsPackPopup;
public string contactUs;
public int[] UnlockSecret;
public int[] UnlockLive;
public int Live;
public int Secret;
public int Assitant;
public int LivePreview;
public int SecretPreview;
public int HomeGuideRate;
public int roomGuideRate;
public int VIPGuide;
public int VIPGuideRate;
public int HomeInterstitialAd;
public int FreeClaims;
public int TurnOffPackRate;
public int TurnOffRewardsRate;
public int TurnOffRewardsCD;
public int TurnOffRewardslimit;
public int FailedGiftProgress;
public int BonusInside;
public int UnlockAIAssistant;
public int FreeMessages;
public int[] CoinsAccess;
public int AdAccess;
public int ClearRAM;
public int CoinsDownload;
public string ResVersion;
public int MultiModal;
public int WVswitch;
}
}
@@ -7,7 +7,6 @@ namespace FGUI.LG_Common
{
public partial class btn_albums : GButton
{
public GGraph anim;
public GGroup panel;
public Transition t0;
public const string URL = "ui://c9mmg3dxccp2cc";
@@ -21,7 +20,6 @@ namespace FGUI.LG_Common
{
base.ConstructFromXML(xml);
anim = (GGraph)GetChildAt(0);
panel = (GGroup)GetChildAt(4);
t0 = GetTransitionAt(0);
}
@@ -7,7 +7,7 @@ namespace FGUI.LG_Common
{
public partial class btn_vip : GButton
{
public GGraph anim;
public Transition t0;
public const string URL = "ui://c9mmg3dxpjnncg";
public static btn_vip CreateInstance()
@@ -19,7 +19,7 @@ namespace FGUI.LG_Common
{
base.ConstructFromXML(xml);
anim = (GGraph)GetChildAt(0);
t0 = GetTransitionAt(0);
}
}
}
+10 -10
View File
@@ -15,7 +15,6 @@ namespace FGUI.LG_End
public GTextField tetx_level;
public GButton btn_setting;
public GGraph congra_parent;
public GButton btn_continue;
public GTextField text_levelType;
public GGraph bg_parent;
public GGraph bg_parent_title;
@@ -24,6 +23,7 @@ namespace FGUI.LG_End
public GTextField text_award;
public GButton btn_gold;
public GComponent com_loader;
public GButton btn_continue;
public GButton btn_download;
public GButton btn_restart;
public GComponent wheel;
@@ -52,15 +52,15 @@ namespace FGUI.LG_End
tetx_level = (GTextField)GetChildAt(4);
btn_setting = (GButton)GetChildAt(5);
congra_parent = (GGraph)GetChildAt(11);
btn_continue = (GButton)GetChildAt(12);
text_levelType = (GTextField)GetChildAt(13);
bg_parent = (GGraph)GetChildAt(14);
bg_parent_title = (GGraph)GetChildAt(19);
coin_parent = (GGraph)GetChildAt(20);
btn_mult = (GButton)GetChildAt(21);
text_award = (GTextField)GetChildAt(23);
btn_gold = (GButton)GetChildAt(24);
com_loader = (GComponent)GetChildAt(27);
text_levelType = (GTextField)GetChildAt(12);
bg_parent = (GGraph)GetChildAt(13);
bg_parent_title = (GGraph)GetChildAt(18);
coin_parent = (GGraph)GetChildAt(19);
btn_mult = (GButton)GetChildAt(20);
text_award = (GTextField)GetChildAt(22);
btn_gold = (GButton)GetChildAt(23);
com_loader = (GComponent)GetChildAt(26);
btn_continue = (GButton)GetChildAt(27);
btn_download = (GButton)GetChildAt(29);
btn_restart = (GButton)GetChildAt(30);
wheel = (GComponent)GetChildAt(31);
@@ -27,13 +27,13 @@ namespace FGUI.LG_Unlock
base.ConstructFromXML(xml);
type = GetControllerAt(0);
title1 = (GTextField)GetChildAt(1);
btn_subscribe = (GButton)GetChildAt(3);
text_coin = (GTextField)GetChildAt(4);
btn_gold = (GButton)GetChildAt(5);
text_level = (GTextField)GetChildAt(6);
btn_play = (GButton)GetChildAt(8);
btn_close = (GButton)GetChildAt(12);
title1 = (GTextField)GetChildAt(2);
btn_subscribe = (GButton)GetChildAt(4);
text_coin = (GTextField)GetChildAt(5);
btn_gold = (GButton)GetChildAt(6);
text_level = (GTextField)GetChildAt(7);
btn_play = (GButton)GetChildAt(9);
btn_close = (GButton)GetChildAt(13);
}
}
}
@@ -7,6 +7,7 @@ namespace FGUI.LG_Vip
{
public partial class com_vip : GComponent
{
public Controller viplevel;
public GLoader bg_loader;
public GList list;
public btn_vipType btn_week;
@@ -29,6 +30,7 @@ namespace FGUI.LG_Vip
{
base.ConstructFromXML(xml);
viplevel = GetControllerAt(0);
bg_loader = (GLoader)GetChildAt(2);
list = (GList)GetChildAt(7);
btn_week = (btn_vipType)GetChildAt(8);
@@ -22,8 +22,8 @@ namespace FGUI.LG_Vip
base.ConstructFromXML(xml);
have = GetControllerAt(0);
title = (GTextField)GetChildAt(0);
img_check = (GImage)GetChildAt(2);
title = (GTextField)GetChildAt(1);
img_check = (GImage)GetChildAt(3);
}
}
}
@@ -28,14 +28,14 @@ namespace FGUI.ZM_AddCell_12
base.ConstructFromXML(xml);
pay_type = GetControllerAt(0);
title = (GTextField)GetChildAt(1);
com_tips = (com_title)GetChildAt(3);
btn_watch = (GButton)GetChildAt(4);
ads = (GTextField)GetChildAt(5);
tips = (GTextField)GetChildAt(6);
broad = (GComponent)GetChildAt(7);
btn_max_pay = (GButton)GetChildAt(8);
btn_close = (GButton)GetChildAt(9);
title = (GTextField)GetChildAt(3);
com_tips = (com_title)GetChildAt(5);
btn_watch = (GButton)GetChildAt(6);
ads = (GTextField)GetChildAt(7);
tips = (GTextField)GetChildAt(8);
broad = (GComponent)GetChildAt(9);
btn_max_pay = (GButton)GetChildAt(10);
btn_close = (GButton)GetChildAt(11);
}
}
}
@@ -22,10 +22,10 @@ namespace FGUI.ZM_AddCell_12
{
base.ConstructFromXML(xml);
btn_close = (GButton)GetChildAt(1);
text_goldnum = (GTextField)GetChildAt(2);
btn_receive = (GButton)GetChildAt(3);
end_point = (GTextField)GetChildAt(4);
btn_close = (GButton)GetChildAt(2);
text_goldnum = (GTextField)GetChildAt(3);
btn_receive = (GButton)GetChildAt(4);
end_point = (GTextField)GetChildAt(5);
}
}
}
@@ -7,6 +7,7 @@ namespace FGUI.ZM_Common_01
{
public partial class btn_head : GButton
{
public Controller vip;
public head head;
public const string URL = "ui://o9974uc5emjh5e";
@@ -19,6 +20,7 @@ namespace FGUI.ZM_Common_01
{
base.ConstructFromXML(xml);
vip = GetControllerAt(0);
head = (head)GetChildAt(0);
}
}
@@ -18,6 +18,7 @@ namespace FGUI.ZM_Lobby_03
UIObjectFactory.SetPackageItemExtension(com_hall.URL, typeof(com_hall));
UIObjectFactory.SetPackageItemExtension(com_payloading.URL, typeof(com_payloading));
UIObjectFactory.SetPackageItemExtension(btn_play.URL, typeof(btn_play));
UIObjectFactory.SetPackageItemExtension(btn_sign.URL, typeof(btn_sign));
}
}
}
@@ -0,0 +1,25 @@
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
using FairyGUI;
using FairyGUI.Utils;
namespace FGUI.ZM_Lobby_03
{
public partial class btn_sign : GButton
{
public GImage red;
public const string URL = "ui://gytj501cwgo41d";
public static btn_sign CreateInstance()
{
return (btn_sign)UIPackage.CreateObject("ZM_Lobby_03", "btn_sign");
}
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
red = (GImage)GetChildAt(1);
}
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 39c8d648f664d534b85655b5c4317090
guid: 1dbbeec11949a5047b958e65a13068b1
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -33,6 +33,7 @@ namespace FGUI.ZM_Lobby_03
public btn_level_play btn_play10;
public GGroup play_node;
public GButton btn_task_times;
public btn_sign btn_sign;
public GButton btn_wv;
public GButton btn_noads;
public GButton btn_restore;
@@ -50,7 +51,7 @@ namespace FGUI.ZM_Lobby_03
base.ConstructFromXML(xml);
state = GetControllerAt(0);
bg_loader = (GLoader)GetChildAt(1);
bg_loader = (GLoader)GetChildAt(2);
btn_play = (btn_play)GetChildAt(4);
btn_album = (GButton)GetChildAt(5);
btn_vip = (GButton)GetChildAt(6);
@@ -75,11 +76,12 @@ namespace FGUI.ZM_Lobby_03
btn_play10 = (btn_level_play)GetChildAt(25);
play_node = (GGroup)GetChildAt(26);
btn_task_times = (GButton)GetChildAt(27);
btn_wv = (GButton)GetChildAt(28);
btn_noads = (GButton)GetChildAt(29);
btn_restore = (GButton)GetChildAt(30);
btn_secret = (GButton)GetChildAt(31);
btn_chat = (GButton)GetChildAt(32);
btn_sign = (btn_sign)GetChildAt(28);
btn_wv = (GButton)GetChildAt(29);
btn_noads = (GButton)GetChildAt(30);
btn_restore = (GButton)GetChildAt(31);
btn_secret = (GButton)GetChildAt(32);
btn_chat = (GButton)GetChildAt(33);
}
}
}
@@ -12,6 +12,7 @@ namespace FGUI.ZM_Setting_07
public btn_menu btn_terms;
public btn_menu btn_language;
public btn_menu btn_official;
public btn_menu btn_email;
public GTextField text_uid;
public GTextField text_version;
public btn_music btn_music;
@@ -33,11 +34,12 @@ namespace FGUI.ZM_Setting_07
btn_terms = (btn_menu)GetChildAt(6);
btn_language = (btn_menu)GetChildAt(7);
btn_official = (btn_menu)GetChildAt(8);
text_uid = (GTextField)GetChildAt(9);
text_version = (GTextField)GetChildAt(10);
btn_music = (btn_music)GetChildAt(11);
btn_sound = (btn_sound)GetChildAt(12);
btn_restore = (btn_menu)GetChildAt(13);
btn_email = (btn_menu)GetChildAt(9);
text_uid = (GTextField)GetChildAt(10);
text_version = (GTextField)GetChildAt(11);
btn_music = (btn_music)GetChildAt(12);
btn_sound = (btn_sound)GetChildAt(13);
btn_restore = (btn_menu)GetChildAt(14);
}
}
}
@@ -25,7 +25,7 @@ namespace FGUI.ZM_Sign_06
status = GetControllerAt(0);
fx_parent = (GGraph)GetChildAt(2);
reward_num = (GTextField)GetChildAt(3);
line = (GImage)GetChildAt(6);
line = (GImage)GetChildAt(7);
}
}
}
@@ -27,12 +27,12 @@ namespace FGUI.ZM_Tasks_13
base.ConstructFromXML(xml);
bg_parent = (GGraph)GetChildAt(2);
btn_mult = (GButton)GetChildAt(5);
fx_place = (GGraph)GetChildAt(6);
text_award = (GTextField)GetChildAt(7);
btn_claim = (GButton)GetChildAt(8);
title1 = (GTextField)GetChildAt(9);
wheel = (GComponent)GetChildAt(10);
btn_mult = (GButton)GetChildAt(4);
fx_place = (GGraph)GetChildAt(5);
text_award = (GTextField)GetChildAt(6);
btn_claim = (GButton)GetChildAt(7);
title1 = (GTextField)GetChildAt(8);
wheel = (GComponent)GetChildAt(9);
t0 = GetTransitionAt(0);
}
}
+3 -2
View File
@@ -365,8 +365,8 @@ namespace BallKingdomCrush
// return false;
return true;
bool b = GetLoginModel().IsMagic;
// return true;
// bool b = GetLoginModel().IsMagic;
return GetLoginModel().IsMagic;
}
@@ -582,6 +582,7 @@ namespace BallKingdomCrush
var currentIndex = GetValueIndex(currentRmLevel);
Debug.Log($"GetRewardValue type:{type} currentIndex:{currentIndex}");
if (currentIndex != -1)
{
if (type == 0)
File diff suppressed because it is too large Load Diff
+3 -5
View File
@@ -74,11 +74,9 @@ namespace BallKingdomCrush
// lang = "en";
// }
// UIManager.Instance.SetSwitchLanguage(lang);
DataMgr.Coin.Value = 100000;
DataMgr.GameLevel.Value = 20;
// UIManager.Instance.SetSwitchLanguage(lang);
//更新map中的value,与配置表的id对应
PurchasingManager.SetShopMapValue();
//初始化商品(谷歌支付和ios支付)
// PurchasingManager.InitProduct();
+354 -354
View File
@@ -1,355 +1,355 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using UnityEngine;
namespace BallKingdomCrush
{
public static class PreDownloadManager
{
#region Live
public static void InitializeLiveData()
{
List<Live> liveConfigList = ConfigSystem.GetConfig<Live>();
Debug.Log($"[预下载视频 数据初始化]-0-----{DataMgr.LiveDataDic.Value.Count}");
var newData = new Dictionary<int, LiveData>();
for (var i = 0; i < liveConfigList.Count; i++)
{
var oldData = GetLiveDataByIndex(liveConfigList[i], i);
if (oldData.progress > 0) newData[i] = oldData;
}
Debug.Log($"[预下载视频 数据初始化]--1----- {newData.Count}");
DataMgr.LiveDataDic.Value = newData;
}
public static LiveData GetLiveDataByIndex(Live liveConfig, int i)
{
DataMgr.LiveDataDic.Value.TryGetValue(i, out var oldData);
oldData ??= new LiveData
{
progress = liveConfig.Progress,
AD_num = 0,
Singleprogress = (100 - liveConfig.Progress) / liveConfig.AD
};
if (oldData.progress < liveConfig.Progress) oldData.progress = liveConfig.Progress;
return oldData;
}
// 最大同时下载数量
private const int MaxConcurrentDownloads = 1;
public static void StartDownload()
{
CrazyAsyKit.StartCoroutine(DownloadVideosCoroutine());
}
private static IEnumerator DownloadVideosCoroutine()
{
List<Live> liveConfigList = ConfigSystem.GetConfig<Live>();
var liveDic = DataMgr.LiveDataDic.Value;
var downloadNameList = new List<string>();
// 先加入已有进度的视频
foreach (var kvp in liveDic)
{
var index = kvp.Key;
var data = kvp.Value;
if (data.progress > 0 && index < liveConfigList.Count) downloadNameList.Add(liveConfigList[index].Name);
}
Debug.Log($"[init down video]---1---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// 添加不在downloadNameList中的项,最多添加6个
var addedCount = 0;
for (var i = 0; i < liveConfigList.Count && addedCount < 6; i++)
if (!downloadNameList.Contains(liveConfigList[i].Name))
{
downloadNameList.Add(liveConfigList[i].Name);
addedCount++;
}
Debug.Log($"[init down video]---2---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// 当前正在下载的协程数量
var runningCount = 0;
var currentIndex = 0;
if (downloadNameList.Count > 0)
{
var name = downloadNameList[currentIndex];
var localPath = Path.Combine(TextureHelper.getResPath(), FolderNames.VideoName, name + ".enc");
Debug.Log($"[预下载 视频 路径]-------localPath===={localPath}");
if (!File.Exists(localPath))
{
Debug.Log("[开始预下载 视频 ]---------------");
runningCount++;
CrazyAsyKit.StartCoroutine(DownloadSingleVideoCoroutine(name, () => { runningCount--; }));
}
}
// 等待下一帧再检查
yield return null;
Debug.Log("[init down video]---All downloads finished---");
}
private static IEnumerator DownloadSingleVideoCoroutine(string name, Action onComplete)
{
var isDone = false;
LiveVideoManager.Instance.GetVideoLocalPath(name, tex =>
{
Debug.Log($"[init down video]----------------{name}");
isDone = true;
}, false);
// 等待下载完成
while (!isDone) yield return null;
onComplete?.Invoke();
}
#endregion
#region Picture
public static void StartDownloadSecretPicture()
{
var liveConfigList = ConfigSystem.GetConfig<SecretAlbums>();
var liveList = DataMgr.SecretUnlockList.Value;
var downloadNameList = new List<string>();
// 先加入所有可用的图片
for (var i = 0; i < liveList.Count; i++)
if (liveConfigList[i] != null && !downloadNameList.Contains(liveConfigList[i].Name))
downloadNameList.Add(liveConfigList[i].Name);
Debug.Log(
$"[init down picture Secret]---1---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// 添加不在downloadNameList中的项,最多添加6个
var addedCount = 0;
for (var i = 0; i < liveConfigList.Count && addedCount < 6; i++)
if (!downloadNameList.Contains(liveConfigList[i].Name))
{
downloadNameList.Add(liveConfigList[i].Name);
addedCount++;
}
Debug.Log(
$"[init down picture Secret]---2---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
foreach (var name in downloadNameList)
{
var localPath = Path.Combine(TextureHelper.getResPath(), FolderNames.SecretName, name + ".jpg");
Debug.Log($"[预下载 Secret 路径]-------localPath===={localPath}");
if (!File.Exists(localPath))
{
Debug.Log("[开始预下载 Secret ]---------------");
TextureHelper.SetImgLoader(null, name,
s =>
{
Debug.Log($"[init down Secret picture]----------------{name}");
}, "SecretAlbums/", FolderNames.SecretName, false);
}
}
}
public static void StartDownloadAlbumsPicture()
{
int Free_Alubum_0 = PlayerPrefs.GetInt("Free_Alubum_0", -1);
int Free_Alubum_1 = PlayerPrefs.GetInt("Free_Alubum_1", -1);
int AD_Alubum = PlayerPrefs.GetInt("AD_Alubum", -1);
int Spec_Alubum = PlayerPrefs.GetInt("Spec_Alubum", -1);
int Vip_Alubum = PlayerPrefs.GetInt("Vip_Alubum", -1);
if (Free_Alubum_0 >= 0) return;
var FreeImageLibrary_ = ConfigSystem.GetConfig<FreeImageLibrary>();
var ADImageLibrary_ = ConfigSystem.GetConfig<ADImageLibrary>();
var SpecialImageLibrary_ = ConfigSystem.GetConfig<SpecialImageLibrary>();
var VIPImageLibrary_ = ConfigSystem.GetConfig<VIPImageLibrary>();
List<int> free_level_list = new List<int>();
List<int> ad_level_list = new List<int>();
List<int> special_level_list = new List<int>();
List<int> vip_level_list = new List<int>();
for (int i = 0; i < DataMgr.LevelUnlockListNew.Value.Count; i++)
{
if (DataMgr.LevelUnlockListNew.Value[i].type == 0) free_level_list.Add(DataMgr.LevelUnlockListNew.Value[i].config_index);
else if (DataMgr.LevelUnlockListNew.Value[i].type == 1) ad_level_list.Add(DataMgr.LevelUnlockListNew.Value[i].config_index);
else if (DataMgr.LevelUnlockListNew.Value[i].type == 2) special_level_list.Add(DataMgr.LevelUnlockListNew.Value[i].config_index);
else if (DataMgr.LevelUnlockListNew.Value[i].type == 3) vip_level_list.Add(DataMgr.LevelUnlockListNew.Value[i].config_index);
}
if (Free_Alubum_0 < 0)
{
HashSet<int> levelIds = new HashSet<int>(free_level_list);
List<FreeImageLibrary> filtered = ConfigSystem.GetConfig<FreeImageLibrary>().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
Free_Alubum_0 = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
Free_Alubum_0 = ConfigSystem.GetConfig<FreeImageLibrary>()[UnityEngine.Random.Range(0, ConfigSystem.GetConfig<FreeImageLibrary>().Count)].id;
}
free_level_list.Add(Free_Alubum_0);
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
if (Free_Alubum_1 < 0)
{
HashSet<int> levelIds = new HashSet<int>(free_level_list);
List<FreeImageLibrary> filtered = ConfigSystem.GetConfig<FreeImageLibrary>().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
Free_Alubum_1 = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
Free_Alubum_1 = ConfigSystem.GetConfig<FreeImageLibrary>()[UnityEngine.Random.Range(0, ConfigSystem.GetConfig<FreeImageLibrary>().Count)].id;
}
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
if (AD_Alubum < 0)
{
HashSet<int> levelIds = new HashSet<int>(ad_level_list);
List<ADImageLibrary> filtered = ConfigSystem.GetConfig<ADImageLibrary>().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
AD_Alubum = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
AD_Alubum = ConfigSystem.GetConfig<ADImageLibrary>()[UnityEngine.Random.Range(0, ConfigSystem.GetConfig<ADImageLibrary>().Count)].id;
}
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
if (Spec_Alubum < 0)
{
HashSet<int> levelIds = new HashSet<int>(special_level_list);
List<SpecialImageLibrary> filtered = ConfigSystem.GetConfig<SpecialImageLibrary>().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
Spec_Alubum = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
Spec_Alubum = ConfigSystem.GetConfig<SpecialImageLibrary>()[UnityEngine.Random.Range(0, ConfigSystem.GetConfig<SpecialImageLibrary>().Count)].id;
}
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
if (Vip_Alubum < 0)
{
HashSet<int> levelIds = new HashSet<int>(vip_level_list);
List<VIPImageLibrary> filtered = ConfigSystem.GetConfig<VIPImageLibrary>().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
Vip_Alubum = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
Vip_Alubum = ConfigSystem.GetConfig<VIPImageLibrary>()[UnityEngine.Random.Range(0, ConfigSystem.GetConfig<VIPImageLibrary>().Count)].id;
}
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
PlayerPrefs.SetInt("Free_Alubum_0", Free_Alubum_0);
PlayerPrefs.SetInt("Free_Alubum_1", Free_Alubum_1);
PlayerPrefs.SetInt("AD_Alubum", AD_Alubum);
PlayerPrefs.SetInt("Spec_Alubum", Spec_Alubum);
PlayerPrefs.SetInt("Vip_Alubum", Vip_Alubum);
List<string> downloadNameList = new List<string>
{
FreeImageLibrary_[Free_Alubum_0].Name,
FreeImageLibrary_[Free_Alubum_1].Name,
ADImageLibrary_[AD_Alubum].Name,
SpecialImageLibrary_[Spec_Alubum].Name,
VIPImageLibrary_[Vip_Alubum].Name
};
for (int i = 0; i < GameHelper.GetCommonModel().MultiModal - 1; i++)
{
downloadNameList.Insert(i, ConfigSystem.GetConfig<LevelUnlock>()[i].Name);
}
Debug.Log(
$"[init down picture Album]---1---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// 添加不在downloadNameList中的项,最多添加12个
// var addedCount = 0;
// for (var i = 0; i < liveConfigList.Count && addedCount < 6; i++)
// if (!downloadNameList.Contains(liveConfigList[i].Name))
// {
// downloadNameList.Add(liveConfigList[i].Name);
// addedCount++;
// }
Debug.Log(
$"[init down picture Album]---2---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// int centerIndex = GameHelper.GetLevel();
// int totalCount = downloadNameList.Count;
// // 计算起始索引和实际要取的数量
// int rangeStart = Math.Max(0, centerIndex - 5);
// int rangeEnd = Math.Min(totalCount, centerIndex + 5);
// int rangeCount = rangeEnd - rangeStart;
// // 获取范围内元素并反转
// var segment = downloadNameList.GetRange(rangeStart, rangeCount);
// segment.Reverse();
// // 移除原始位置的元素
// downloadNameList.RemoveRange(rangeStart, rangeCount);
// // 插入反转后的元素到最前面
// downloadNameList.InsertRange(0, segment);
Debug.Log(
$"[init down picture Album]---3---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
foreach (var name in downloadNameList)
{
var localPath = Path.Combine(TextureHelper.getResPath(), FolderNames.AlbumName, name + ".jpg");
Debug.Log($"[预下载 Albums 路径]-------localPath===={localPath}");
if (!File.Exists(localPath))
{
Debug.Log($"[开始预下载 Albums ]--------------name-{name}");
TextureHelper.SetImgLoader(null, name,
s =>
{
Debug.Log($"[init down Album picture]----------------{name}");
}, "LevelAlbums/", FolderNames.AlbumName, false);
}
}
}
#endregion
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using UnityEngine;
namespace BallKingdomCrush
{
public static class PreDownloadManager
{
#region Live
public static void InitializeLiveData()
{
List<Live> liveConfigList = ConfigSystem.GetLiveConfig();
Debug.Log($"[预下载视频 数据初始化]-0-----{DataMgr.LiveDataDic.Value.Count}");
var newData = new Dictionary<int, LiveData>();
for (var i = 0; i < liveConfigList.Count; i++)
{
var oldData = GetLiveDataByIndex(liveConfigList[i], i);
if (oldData.progress > 0) newData[i] = oldData;
}
Debug.Log($"[预下载视频 数据初始化]--1----- {newData.Count}");
DataMgr.LiveDataDic.Value = newData;
}
public static LiveData GetLiveDataByIndex(Live liveConfig, int i)
{
DataMgr.LiveDataDic.Value.TryGetValue(i, out var oldData);
oldData ??= new LiveData
{
progress = liveConfig.Progress,
AD_num = 0,
Singleprogress = (100 - liveConfig.Progress) / liveConfig.AD
};
if (oldData.progress < liveConfig.Progress) oldData.progress = liveConfig.Progress;
return oldData;
}
// 最大同时下载数量
private const int MaxConcurrentDownloads = 1;
public static void StartDownload()
{
CrazyAsyKit.StartCoroutine(DownloadVideosCoroutine());
}
private static IEnumerator DownloadVideosCoroutine()
{
List<Live> liveConfigList = ConfigSystem.GetLiveConfig();
var liveDic = DataMgr.LiveDataDic.Value;
var downloadNameList = new List<string>();
// 先加入已有进度的视频
foreach (var kvp in liveDic)
{
var index = kvp.Key;
var data = kvp.Value;
if (data.progress > 0 && index < liveConfigList.Count) downloadNameList.Add(liveConfigList[index].Name);
}
Debug.Log($"[init down video]---1---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// 添加不在downloadNameList中的项,最多添加6个
var addedCount = 0;
for (var i = 0; i < liveConfigList.Count && addedCount < 6; i++)
if (!downloadNameList.Contains(liveConfigList[i].Name))
{
downloadNameList.Add(liveConfigList[i].Name);
addedCount++;
}
Debug.Log($"[init down video]---2---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// 当前正在下载的协程数量
var runningCount = 0;
var currentIndex = 0;
if (downloadNameList.Count > 0)
{
var name = downloadNameList[currentIndex];
var localPath = Path.Combine(TextureHelper.getResPath(), FolderNames.VideoName, name + ".enc");
Debug.Log($"[预下载 视频 路径]-------localPath===={localPath}");
if (!File.Exists(localPath))
{
Debug.Log("[开始预下载 视频 ]---------------");
runningCount++;
CrazyAsyKit.StartCoroutine(DownloadSingleVideoCoroutine(name, () => { runningCount--; }));
}
}
// 等待下一帧再检查
yield return null;
Debug.Log("[init down video]---All downloads finished---");
}
private static IEnumerator DownloadSingleVideoCoroutine(string name, Action onComplete)
{
var isDone = false;
LiveVideoManager.Instance.GetVideoLocalPath(name, tex =>
{
Debug.Log($"[init down video]----------------{name}");
isDone = true;
}, false);
// 等待下载完成
while (!isDone) yield return null;
onComplete?.Invoke();
}
#endregion
#region Picture
public static void StartDownloadSecretPicture()
{
var liveConfigList = ConfigSystem.GetSecretAlbumsConfig();
var liveList = DataMgr.SecretUnlockList.Value;
var downloadNameList = new List<string>();
// 先加入所有可用的图片
for (var i = 0; i < liveList.Count; i++)
if (liveConfigList[i] != null && !downloadNameList.Contains(liveConfigList[i].Name))
downloadNameList.Add(liveConfigList[i].Name);
Debug.Log(
$"[init down picture Secret]---1---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// 添加不在downloadNameList中的项,最多添加6个
var addedCount = 0;
for (var i = 0; i < liveConfigList.Count && addedCount < 6; i++)
if (!downloadNameList.Contains(liveConfigList[i].Name))
{
downloadNameList.Add(liveConfigList[i].Name);
addedCount++;
}
Debug.Log(
$"[init down picture Secret]---2---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
foreach (var name in downloadNameList)
{
var localPath = Path.Combine(TextureHelper.getResPath(), FolderNames.SecretName, name + ".jpg");
Debug.Log($"[预下载 Secret 路径]-------localPath===={localPath}");
if (!File.Exists(localPath))
{
Debug.Log("[开始预下载 Secret ]---------------");
TextureHelper.SetImgLoader(null, name,
s =>
{
Debug.Log($"[init down Secret picture]----------------{name}");
}, "SecretAlbums/", FolderNames.SecretName, false);
}
}
}
public static void StartDownloadAlbumsPicture()
{
int Free_Alubum_0 = PlayerPrefs.GetInt("Free_Alubum_0", -1);
int Free_Alubum_1 = PlayerPrefs.GetInt("Free_Alubum_1", -1);
int AD_Alubum = PlayerPrefs.GetInt("AD_Alubum", -1);
int Spec_Alubum = PlayerPrefs.GetInt("Spec_Alubum", -1);
int Vip_Alubum = PlayerPrefs.GetInt("Vip_Alubum", -1);
if (Free_Alubum_0 >= 0) return;
var FreeImageLibrary_ = ConfigSystem.GetFreeImageConfig();
var ADImageLibrary_ = ConfigSystem.GetADImageConfig();
var SpecialImageLibrary_ = ConfigSystem.GetSpecialImageConfig();
var VIPImageLibrary_ = ConfigSystem.GetVIPImageConfig();
List<int> free_level_list = new List<int>();
List<int> ad_level_list = new List<int>();
List<int> special_level_list = new List<int>();
List<int> vip_level_list = new List<int>();
for (int i = 0; i < DataMgr.LevelUnlockListNew.Value.Count; i++)
{
if (DataMgr.LevelUnlockListNew.Value[i].type == 0) free_level_list.Add(DataMgr.LevelUnlockListNew.Value[i].config_index);
else if (DataMgr.LevelUnlockListNew.Value[i].type == 1) ad_level_list.Add(DataMgr.LevelUnlockListNew.Value[i].config_index);
else if (DataMgr.LevelUnlockListNew.Value[i].type == 2) special_level_list.Add(DataMgr.LevelUnlockListNew.Value[i].config_index);
else if (DataMgr.LevelUnlockListNew.Value[i].type == 3) vip_level_list.Add(DataMgr.LevelUnlockListNew.Value[i].config_index);
}
if (Free_Alubum_0 < 0)
{
HashSet<int> levelIds = new HashSet<int>(free_level_list);
List<FreeImageLibrary> filtered = ConfigSystem.GetFreeImageConfig().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
Free_Alubum_0 = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
Free_Alubum_0 = ConfigSystem.GetFreeImageConfig()[UnityEngine.Random.Range(0, ConfigSystem.GetFreeImageConfig().Count)].id;
}
free_level_list.Add(Free_Alubum_0);
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
if (Free_Alubum_1 < 0)
{
HashSet<int> levelIds = new HashSet<int>(free_level_list);
List<FreeImageLibrary> filtered = ConfigSystem.GetFreeImageConfig().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
Free_Alubum_1 = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
Free_Alubum_1 = ConfigSystem.GetFreeImageConfig()[UnityEngine.Random.Range(0, ConfigSystem.GetFreeImageConfig().Count)].id;
}
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
if (AD_Alubum < 0)
{
HashSet<int> levelIds = new HashSet<int>(ad_level_list);
List<ADImageLibrary> filtered = ConfigSystem.GetADImageConfig().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
AD_Alubum = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
AD_Alubum = ConfigSystem.GetADImageConfig()[UnityEngine.Random.Range(0, ConfigSystem.GetADImageConfig().Count)].id;
}
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
if (Spec_Alubum < 0)
{
HashSet<int> levelIds = new HashSet<int>(special_level_list);
List<SpecialImageLibrary> filtered = ConfigSystem.GetSpecialImageConfig().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
Spec_Alubum = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
Spec_Alubum = ConfigSystem.GetSpecialImageConfig()[UnityEngine.Random.Range(0, ConfigSystem.GetSpecialImageConfig().Count)].id;
}
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
if (Vip_Alubum < 0)
{
HashSet<int> levelIds = new HashSet<int>(vip_level_list);
List<VIPImageLibrary> filtered = ConfigSystem.GetVIPImageConfig().Where(x => !levelIds.Contains(x.id)).ToList();
if (filtered.Count > 0)
{
Vip_Alubum = filtered[UnityEngine.Random.Range(0, filtered.Count)].id;
}
else
{
Vip_Alubum = ConfigSystem.GetVIPImageConfig()[UnityEngine.Random.Range(0, ConfigSystem.GetVIPImageConfig().Count)].id;
}
Debug.Log(JsonConvert.SerializeObject(filtered) + ",,,,,,,,,,,,,,,,,,,,");
}
PlayerPrefs.SetInt("Free_Alubum_0", Free_Alubum_0);
PlayerPrefs.SetInt("Free_Alubum_1", Free_Alubum_1);
PlayerPrefs.SetInt("AD_Alubum", AD_Alubum);
PlayerPrefs.SetInt("Spec_Alubum", Spec_Alubum);
PlayerPrefs.SetInt("Vip_Alubum", Vip_Alubum);
List<string> downloadNameList = new List<string>
{
FreeImageLibrary_[Free_Alubum_0].Name,
FreeImageLibrary_[Free_Alubum_1].Name,
ADImageLibrary_[AD_Alubum].Name,
SpecialImageLibrary_[Spec_Alubum].Name,
VIPImageLibrary_[Vip_Alubum].Name
};
for (int i = 0; i < GameHelper.GetCommonModel().MultiModal - 1; i++)
{
downloadNameList.Insert(i, ConfigSystem.GetLevelUnlockConfig()[i].Name);
}
Debug.Log(
$"[init down picture Album]---1---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// 添加不在downloadNameList中的项,最多添加12个
// var addedCount = 0;
// for (var i = 0; i < liveConfigList.Count && addedCount < 6; i++)
// if (!downloadNameList.Contains(liveConfigList[i].Name))
// {
// downloadNameList.Add(liveConfigList[i].Name);
// addedCount++;
// }
Debug.Log(
$"[init down picture Album]---2---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
// int centerIndex = GameHelper.GetLevel();
// int totalCount = downloadNameList.Count;
// // 计算起始索引和实际要取的数量
// int rangeStart = Math.Max(0, centerIndex - 5);
// int rangeEnd = Math.Min(totalCount, centerIndex + 5);
// int rangeCount = rangeEnd - rangeStart;
// // 获取范围内元素并反转
// var segment = downloadNameList.GetRange(rangeStart, rangeCount);
// segment.Reverse();
// // 移除原始位置的元素
// downloadNameList.RemoveRange(rangeStart, rangeCount);
// // 插入反转后的元素到最前面
// downloadNameList.InsertRange(0, segment);
Debug.Log(
$"[init down picture Album]---3---nameList----------{JsonConvert.SerializeObject(downloadNameList)}");
foreach (var name in downloadNameList)
{
var localPath = Path.Combine(TextureHelper.getResPath(), FolderNames.AlbumName, name + ".jpg");
Debug.Log($"[预下载 Albums 路径]-------localPath===={localPath}");
if (!File.Exists(localPath))
{
Debug.Log($"[开始预下载 Albums ]--------------name-{name}");
TextureHelper.SetImgLoader(null, name,
s =>
{
Debug.Log($"[init down Album picture]----------------{name}");
}, "LevelAlbums/", FolderNames.AlbumName, false);
}
}
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
@@ -1,3 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<resources xmlns:tools="http://schemas.android.com/tools">
</resources>
<resources xmlns:tools="http://schemas.android.com/tools" tools:keep="@string/gcm_defaultSenderId,@string/google_storage_bucket,@string/project_id,@string/google_api_key,@string/google_crash_reporting_api_key,@string/google_app_id">
<string name="gcm_defaultSenderId" translatable="false">339238925993</string>
<string name="google_storage_bucket" translatable="false">ball-kingdom-crush.firebasestorage.app</string>
<string name="project_id" translatable="false">ball-kingdom-crush</string>
<string name="google_api_key" translatable="false">AIzaSyDxHji1beIuNjNbilpGCU8Knn_e7uPZO4Q</string>
<string name="google_crash_reporting_api_key" translatable="false">AIzaSyDxHji1beIuNjNbilpGCU8Knn_e7uPZO4Q</string>
<string name="google_app_id" translatable="false">1:339238925993:android:811016faebac0501da5bb8</string>
</resources>
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">360cc687-20b6-4da1-987e-70daa67adc9c</string></resources>
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">cd78cd9b-c719-494b-9593-41184cca43b2</string></resources>
File diff suppressed because one or more lines are too long
@@ -1,123 +1,123 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8702631063239601380
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6087296153318453413}
- component: {fileID: 3031433386932376368}
- component: {fileID: 3133524035003936403}
- component: {fileID: 6755228158183553068}
m_Layer: 0
m_Name: fx_first_reward
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6087296153318453413
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8702631063239601380}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3031433386932376368
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8702631063239601380}
m_Mesh: {fileID: 0}
--- !u!23 &3133524035003936403
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8702631063239601380}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: ddfdf9fc621387e46b34822e5928535a, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &6755228158183553068
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8702631063239601380}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3}
m_Name:
m_EditorClassIdentifier:
skeletonDataAsset: {fileID: 11400000, guid: ff2355adab38616429ea63aa0a3ce8c6, type: 2}
initialSkinName:
initialFlipX: 0
initialFlipY: 0
updateWhenInvisible: 3
separatorSlotNames: []
zSpacing: 0
useClipping: 1
immutableTriangles: 0
pmaVertexColors: 1
clearStateOnDisable: 0
tintBlack: 0
singleSubmesh: 0
fixDrawOrder: 0
addNormals: 0
calculateTangents: 0
maskInteraction: 0
maskMaterials:
materialsMaskDisabled: []
materialsInsideMask: []
materialsOutsideMask: []
disableRenderingOnOverride: 1
_animationName:
loop: 1
timeScale: 1
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8702631063239601380
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6087296153318453413}
- component: {fileID: 3031433386932376368}
- component: {fileID: 3133524035003936403}
- component: {fileID: 6755228158183553068}
m_Layer: 0
m_Name: fx_first_reward
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6087296153318453413
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8702631063239601380}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3031433386932376368
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8702631063239601380}
m_Mesh: {fileID: 0}
--- !u!23 &3133524035003936403
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8702631063239601380}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: ddfdf9fc621387e46b34822e5928535a, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &6755228158183553068
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8702631063239601380}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3}
m_Name:
m_EditorClassIdentifier:
skeletonDataAsset: {fileID: 11400000, guid: ff2355adab38616429ea63aa0a3ce8c6, type: 2}
initialSkinName:
initialFlipX: 0
initialFlipY: 0
updateWhenInvisible: 3
separatorSlotNames: []
zSpacing: 0
useClipping: 1
immutableTriangles: 0
pmaVertexColors: 1
clearStateOnDisable: 0
tintBlack: 0
singleSubmesh: 0
fixDrawOrder: 0
addNormals: 0
calculateTangents: 0
maskInteraction: 0
maskMaterials:
materialsMaskDisabled: []
materialsInsideMask: []
materialsOutsideMask: []
disableRenderingOnOverride: 1
_animationName:
loop: 1
timeScale: 1
@@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: c13e2d3740e824fc2ba1c4a18f37f906
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: effect.spine.fx_first_reward.assetbundle
assetBundleVariant:
fileFormatVersion: 2
guid: c13e2d3740e824fc2ba1c4a18f37f906
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: effect.spine.fx_first_reward.assetbundle
assetBundleVariant:
@@ -1,27 +1,27 @@
wings_new_rewards.png
size: 1309,799
format: RGBA8888
filter: Linear,Linear
repeat: none
Bonus
rotate: false
xy: 801, 272
size: 506, 95
orig: 506, 95
offset: 0, 0
index: -1
baoxiang
rotate: false
xy: 801, 369
size: 459, 428
orig: 459, 428
offset: 0, 0
index: -1
light
rotate: false
xy: 2, 2
size: 797, 795
orig: 797, 795
offset: 0, 0
index: -1
wings_new_rewards.png
size: 1309,799
format: RGBA8888
filter: Linear,Linear
repeat: none
Bonus
rotate: false
xy: 801, 272
size: 506, 95
orig: 506, 95
offset: 0, 0
index: -1
baoxiang
rotate: false
xy: 801, 369
size: 459, 428
orig: 459, 428
offset: 0, 0
index: -1
light
rotate: false
xy: 2, 2
size: 797, 795
orig: 797, 795
offset: 0, 0
index: -1
@@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 4c92f2a8ec5d5b54c86d63d8048c902e
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4c92f2a8ec5d5b54c86d63d8048c902e
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: a5473f0b984615b4297b645f2bb17584
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a5473f0b984615b4297b645f2bb17584
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,127 +1,127 @@
fileFormatVersion: 2
guid: 8b9574ff6f6f0084d9c91bf8e94aa45f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8b9574ff6f6f0084d9c91bf8e94aa45f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: 5191a896aab382147bac9b23f23f1ffa
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5191a896aab382147bac9b23f23f1ffa
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: e8323d0d51b09b64bb266a4cee8b9b87
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e8323d0d51b09b64bb266a4cee8b9b87
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -1,31 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f1b3b4b945939a54ea0b23d3396115fb, type: 3}
m_Name: wings_new_rewards_SkeletonData
m_EditorClassIdentifier:
atlasAssets:
- {fileID: 11400000, guid: 5191a896aab382147bac9b23f23f1ffa, type: 2}
scale: 0.01
skeletonJSON: {fileID: 4900000, guid: a5473f0b984615b4297b645f2bb17584, type: 3}
isUpgradingBlendModeMaterials: 0
blendModeMaterials:
requiresBlendModeMaterials: 0
applyAdditiveMaterial: 0
additiveMaterials: []
multiplyMaterials: []
screenMaterials: []
skeletonDataModifiers: []
fromAnimation: []
toAnimation: []
duration: []
defaultMix: 0.2
controller: {fileID: 0}
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f1b3b4b945939a54ea0b23d3396115fb, type: 3}
m_Name: wings_new_rewards_SkeletonData
m_EditorClassIdentifier:
atlasAssets:
- {fileID: 11400000, guid: 5191a896aab382147bac9b23f23f1ffa, type: 2}
scale: 0.01
skeletonJSON: {fileID: 4900000, guid: a5473f0b984615b4297b645f2bb17584, type: 3}
isUpgradingBlendModeMaterials: 0
blendModeMaterials:
requiresBlendModeMaterials: 0
applyAdditiveMaterial: 0
additiveMaterials: []
multiplyMaterials: []
screenMaterials: []
skeletonDataModifiers: []
fromAnimation: []
toAnimation: []
duration: []
defaultMix: 0.2
controller: {fileID: 0}
@@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: ff2355adab38616429ea63aa0a3ce8c6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ff2355adab38616429ea63aa0a3ce8c6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 784 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

After

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

@@ -1,140 +0,0 @@
fileFormatVersion: 2
guid: f03717a86352d5a4da9d6269479b879e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 KiB

After

Width:  |  Height:  |  Size: 583 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 KiB

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 KiB

After

Width:  |  Height:  |  Size: 442 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 KiB

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 KiB

After

Width:  |  Height:  |  Size: 998 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 KiB

@@ -1,127 +0,0 @@
fileFormatVersion: 2
guid: 1e89d0d8dd25bab4782eb767ea77b1f0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 MiB

After

Width:  |  Height:  |  Size: 7.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 5.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 MiB

@@ -1,127 +0,0 @@
fileFormatVersion: 2
guid: 770110aaf5a0d0641883e7438d2273ff
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 KiB

After

Width:  |  Height:  |  Size: 483 KiB

@@ -106,6 +106,19 @@ TextureImporter:
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
-281
View File
@@ -1,281 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DataEyeAnalytics;
using Newtonsoft.Json;
using UnityEngine;
namespace BallKingdomCrush
{
public class BIManager : MonoBehaviour
{
private static BIManager _instance;
private static readonly object _initLock = new object();
// 状态标志
private bool _initialized = false; // 仅在初始化成功后为 true
private bool _initializing = false; // 防止并发多次尝试初始化
private string ntpServer = "time.windows.com";
private string defaultChannel = "gp";
private int maxInitRetries = 6;
private float retryIntervalSeconds = 0.5f;
public static BIManager Instance
{
get
{
if (_instance == null)
{
var go = new GameObject("BIManager");
DontDestroyOnLoad(go);
_instance = go.AddComponent<BIManager>();
}
return _instance;
}
}
private void Awake()
{
// 单例保护:如果场景里已有实例,销毁重复的
if (_instance == null)
{
_instance = this;
DontDestroyOnLoad(gameObject);
}
else if (_instance != this)
{
Destroy(gameObject);
return;
}
}
private void Start()
{
// Start 调用 InitBI 是安全的:InitBI 本身是幂等且线程安全的
InitBI();
}
/// <summary>
/// 对外统一初始化入口(幂等、线程安全)
/// </summary>
public void InitBI()
{
// 快速检查
if (_initialized) return;
lock (_initLock)
{
if (_initialized || _initializing)
{
// 已经初始化或正在初始化,直接返回
return;
}
_initializing = true;
}
// 使用协程执行初始化(必要时可以做重试)
StartCoroutine(DoInitCoroutine());
}
private IEnumerator DoInitCoroutine()
{
try
{
int attempt = 0;
Exception lastException = null;
while (attempt < maxInitRetries)
{
attempt++;
try
{
// 这里不主动调用 DataEyeAnalyticsAPI.Init(...) 假设你使用的是场景里的 DataEyeAnalytics 预制体,
// SDK 会在预制体 Awake/Start 里初始化。如果你的流程是手动 Init,请在这里调用 Init(appId)。
// 1) 校准时间(默认实例)
DataEyeAnalyticsAPI.CalibrateTimeWithNtp(ntpServer);
// 2) 设置超参数
var superProperties = new Dictionary<string, object>
{
{ "channel", defaultChannel }
};
DataEyeAnalyticsAPI.SetSuperProperties(superProperties);
// 3) 开启自动采集
DataEyeAnalyticsAPI.EnableAutoTrack(AUTO_TRACK_EVENTS.ALL);
// 如果上面没有抛异常,认为初始化成功
_initialized = true;
Debug.Log($"[BIManager] InitBI succeeded on attempt {attempt}");
yield break;
}
catch (ArgumentNullException ane)
{
// 典型:DataEye 内部 instance 还没创建(appId 为 null -> retry
lastException = ane;
Debug.LogWarning(
$"[BIManager] DataEye not ready (attempt {attempt}), will retry. msg={ane.Message}");
}
catch (Exception ex)
{
// 其他异常,记录并决定是否重试
lastException = ex;
Debug.LogWarning($"[BIManager] InitBI attempt {attempt} threw: {ex.Message}");
}
// 等待后重试
yield return new WaitForSeconds(retryIntervalSeconds);
}
// 重试用尽仍失败 —— 打日志(不再抛异常以免影响游戏流程)
Debug.LogError("[BIManager] InitBI failed after retries. Last exception: " +
(lastException?.ToString() ?? "null"));
}
finally
{
lock (_initLock)
{
_initializing = false;
}
}
}
// ================= 通用埋点 =================
public void TrackEvent(string eventName, Dictionary<string, object> properties = null)
{
// if (properties == null)
// properties = new Dictionary<string, object>();
//
// DataEyeAnalyticsAPI.Track(eventName, properties);
// DataEyeAnalyticsAPI.Flush();
//
// 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
}
+5 -2
View File
@@ -64,9 +64,12 @@ public class CreatAnimalCard : MonoBehaviour
card_item_list.Clear();
// ---------- 新增:先从0~15中挑选 card_type_max 个不同的类型 ----------
List<int> allTypes = Enumerable.Range(0, 15).ToList(); // [0,1,2,...,15]
List<int> allTypes = Enumerable.Range(0, 15).ToList(); // [0,1,2,...,14]
List<int> chosenTypes = new List<int>();
for (int i = 0; i < card_type_max; i++)
int actualTypeMax = Mathf.Min(card_type_max, allTypes.Count);
for (int i = 0; i < actualTypeMax; i++)
{
int idx = UnityEngine.Random.Range(0, allTypes.Count);
chosenTypes.Add(allTypes[idx]);
+274 -89
View File
@@ -6,6 +6,7 @@
// 请将商品 ID 替换为你在 App Store Connect / Google Play Console 中配置的真实 ID。
// ============================================================
using System;
using System.Collections;
using System.Collections.Generic;
using SDK_IAP;
@@ -196,7 +197,7 @@ namespace BallKingdomCrush
if (result.success)
{
Debug.Log($"[IAP Google] 订阅成功: {subscriptionName} ({result.productId}) | tid={result.transactionId}");
ShowSubscriptionInfo();
// ShowSubscriptionInfo();
onSuccess?.Invoke();
}
else
@@ -269,20 +270,59 @@ namespace BallKingdomCrush
// ──────────────────────────────────────────────────────────
// 订阅信息查询
// ──────────────────────────────────────────────────────────
public void ShowSubscriptionInfo()
/// <summary>显示指定商品的订阅信息</summary>
/// <param name="productId">商品ID</param>
public void ShowSubscriptionInfo(string productId)
{
var info = IAPManager.GetSubscriptionInfo(PRODUCT_VIP_MONTH);
Debug.Log($"[IAP Google] VIP 订阅状态:");
var info = IAPManager.GetSubscriptionInfo(productId);
Debug.Log($"[IAP Google] VIP 订阅状态 ({productId}):");
Debug.Log($" isSubscribed = {info.isSubscribed}");
Debug.Log($" isExpired = {info.isExpired}");
Debug.Log($" expireDate = {info.expireDate:yyyy-MM-dd HH:mm:ss}");
Debug.Log($" expireDate = {info.expireDate}");
Debug.Log($" isAutoRenewing= {info.isAutoRenewing}");
if (info.isSubscribed && !info.isExpired)
{
int vipLevel = GetVipLevelByProductId(productId);
if (vipLevel > 0)
{
DataMgr.VipLevel.Value = vipLevel;
Debug.Log($"[IAP Google] 设置 VIP 等级: {vipLevel}");
}
if (info.expireDate.Year > 1970 && info.expireDate.Year < 10000)
{
var expireTimestamp = ((DateTimeOffset)info.expireDate).ToUnixTimeSeconds();
Debug.Log($"Expire timestamp: {expireTimestamp}");
DataMgr.VipExpirationTime.Value = Math.Max(DataMgr.VipExpirationTime.Value, expireTimestamp);
}
else
{
Debug.LogWarning($"[IAP Google] 无效的到期时间: {info.expireDate}");
}
}
else
{
Debug.Log($"[IAP Google] 用户未订阅或订阅已过期");
}
}
/// <summary>根据商品ID获取VIP等级</summary>
/// <param name="productId">商品ID</param>
/// <returns>VIP等级:周订阅=1,月订阅=2,年订阅=3,其他=0</returns>
private int GetVipLevelByProductId(string productId)
{
if (productId == PRODUCT_VIP_WEEK)
return 1;
else if (productId == PRODUCT_VIP_MONTH)
return 2;
else if (productId == PRODUCT_VIP_YEAR)
return 3;
return 0;
}
// ──────────────────────────────────────────────────────────
// 全局发货处理(OnDeliver 事件接收)
// ──────────────────────────────────────────────────────────
/// <summary>
/// 统一发货处理入口。
/// 无论是新购买、补单、还是恢复购买,都会触发此方法。
@@ -290,97 +330,242 @@ namespace BallKingdomCrush
/// </summary>
private void HandleDeliver(string productId)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
if (!IsValidProduct(productId))
{
Debug.LogWarning($"[IAP Google] 非法商品ID,拒绝发货: {productId}");
return;
}
Debug.Log($"[IAP Google] 发货通知: {productId}");
GameDispatcher.Instance.Dispatch(GameMsg.IAP_PAY_SUCCESS, productId);
PurchasingManager.SendEventClickByName(productId,"open");
PurchasingManager.SendEventClickByName(productId,"success");
// switch (productId)
// {
// // 消耗品
// case PRODUCT_FIRST_GIFT:
// Debug.Log("[IAP Google] 发放首充礼包 - 100金币");
// // GoldManager.Add(100);
// break;
//
// case PRODUCT_REMOVE_ADS:
// Debug.Log("[IAP Google] 发放移除广告权益");
// // AdsManager.Disable();
// break;
//
// case PRODUCT_PASS_BONUS:
// Debug.Log("[IAP Google] 发放通行证礼包");
// // PassBonusManager.Grant();
// break;
//
// case PRODUCT_SHOP_1:
// Debug.Log("[IAP Google] 发放商店档位1奖励");
// // ShopManager.GrantReward(1);
// break;
//
// case PRODUCT_SHOP_2:
// Debug.Log("[IAP Google] 发放商店档位2奖励");
// // ShopManager.GrantReward(2);
// break;
//
// case PRODUCT_SHOP_3:
// Debug.Log("[IAP Google] 发放商店档位3奖励");
// // ShopManager.GrantReward(3);
// break;
//
// case PRODUCT_SHOP_4:
// Debug.Log("[IAP Google] 发放商店档位4奖励");
// // ShopManager.GrantReward(4);
// break;
//
// case PRODUCT_SHOP_5:
// Debug.Log("[IAP Google] 发放商店档位5奖励");
// // ShopManager.GrantReward(5);
// break;
//
// case PRODUCT_THREE_DAY:
// Debug.Log("[IAP Google] 发放三天礼包");
// // ThreeDayManager.Grant();
// break;
//
// // 非消耗品
// case PRODUCT_SPACE_BONUS:
// Debug.Log("[IAP Google] 增加背包空间一格");
// // InventoryManager.AddSpace(1);
// break;
//
// // 订阅
// case PRODUCT_VIP_WEEK:
// Debug.Log("[IAP Google] 激活VIP周卡");
// // VipManager.Activate(7);
// break;
//
// case PRODUCT_VIP_MONTH:
// Debug.Log("[IAP Google] 激活VIP月卡");
// // VipManager.Activate(30);
// break;
//
// case PRODUCT_VIP_YEAR:
// Debug.Log("[IAP Google] 激活VIP年卡");
// // VipManager.Activate(365);
// break;
//
// default:
// Debug.LogWarning($"[IAP Google] 未知商品 ID: {productId}");
// break;
// }
if (productId == PRODUCT_VIP_WEEK || productId == PRODUCT_VIP_MONTH || productId == PRODUCT_VIP_YEAR)
{
// 订阅商品:需要先获取有效的订阅信息,成功后才会分发支付成功消息
StartCoroutine(DelayedGetSubscriptionInfo(productId));
}
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
// 非订阅商品(消耗品):直接发货
Debug.Log($"[IAP Google] 发货通知: {productId}");
GameDispatcher.Instance.Dispatch(GameMsg.IAP_PAY_SUCCESS, productId);
PurchasingManager.SendEventClickByName(productId, "open");
PurchasingManager.SendEventClickByName(productId, "success");
}
}
private IEnumerator DelayedGetSubscriptionInfo(string productId)
{
Debug.Log($"[IAP Google] 开始获取订阅信息: {productId}");
// 先尝试立即获取一次
var immediateInfo = IAPManager.GetSubscriptionInfo(productId);
// 检查是否是无效数据
bool isInvalid = immediateInfo.expireDate == default(DateTime) ||
(immediateInfo.expireDate.Year == 1 && !immediateInfo.isSubscribed);
if (!isInvalid && immediateInfo.isSubscribed)
{
// 立即获取到了有效数据,直接处理
bool success = ProcessSubscriptionInfo(immediateInfo, productId);
if (success)
{
DispatchPaySuccess(productId);
}
yield break;
}
// 无效数据,开始重试
Debug.Log($"[IAP Google] 订阅信息未就绪,开始重试...");
int maxRetries = 5;
float waitTime = 1.5f;
for (int i = 0; i < maxRetries; i++)
{
yield return new WaitForSeconds(waitTime); // 每次等待0.5秒
var info = IAPManager.GetSubscriptionInfo(productId);
if (info.isSubscribed && !info.isExpired && info.expireDate.Year > 1970)
{
Debug.Log($"[IAP Google] 订阅信息获取成功 (重试 {i + 1} 次)");
bool success = ProcessSubscriptionInfo(info, productId);
if (success)
{
DispatchPaySuccess(productId);
}
yield break;
}
Debug.Log($"[IAP Google] 第 {i + 1} 次重试: isSubscribed={info.isSubscribed}, isExpired={info.isExpired}, expireDate={info.expireDate}");
}
// 所有重试都失败了,使用降级方案
Debug.LogError($"[IAP Google] 无法获取订阅信息,使用降级方案");
bool fallbackSuccess = ProcessFallbackSubscription(productId);
if (fallbackSuccess)
{
DispatchPaySuccess(productId);
}
else
{
// 降级也失败了,上报错误,不分发支付成功
Debug.LogError($"[IAP Google] 降级方案也失败,支付成功消息将不分发,请检查配置");
PurchasingManager.SendEventClickByName(productId, "open");
// 可选:向用户显示错误提示
}
}
/// <summary>
/// 处理订阅信息,设置VIP等级和过期时间
/// </summary>
/// <returns>是否设置成功</returns>
private bool ProcessSubscriptionInfo(SubscriptionInfoLite info, string productId)
{
try
{
Debug.Log($"[IAP Google] VIP 订阅状态 ({productId}):");
Debug.Log($" isSubscribed = {info.isSubscribed}");
Debug.Log($" isExpired = {info.isExpired}");
Debug.Log($" expireDate = {info.expireDate}");
Debug.Log($" isAutoRenewing= {info.isAutoRenewing}");
// 获取VIP等级
int vipLevel = GetVipLevelByProductId(productId);
if (vipLevel <= 0)
{
Debug.LogError($"[IAP Google] 无法获取VIP等级,商品ID: {productId}");
return false;
}
// 获取过期时间戳
long expireTimestamp = 0;
if (info.expireDate.Year > 1970 && info.expireDate.Year < 10000)
{
expireTimestamp = ((DateTimeOffset)info.expireDate).ToUnixTimeSeconds();
}
else
{
Debug.LogWarning($"[IAP Google] 无效的到期时间: {info.expireDate},使用预估时间");
expireTimestamp = GetEstimatedExpireTimestamp(productId);
}
if (expireTimestamp <= 0)
{
Debug.LogError($"[IAP Google] 无法获取有效的过期时间戳");
return false;
}
// 保存数据(使用前后对比,确保设置成功)
int oldVipLevel = DataMgr.VipLevel.Value;
long oldExpireTime = DataMgr.VipExpirationTime.Value;
DataMgr.VipLevel.Value = Math.Max(DataMgr.VipLevel.Value, vipLevel);
DataMgr.VipExpirationTime.Value = Math.Max(DataMgr.VipExpirationTime.Value, expireTimestamp);
// 验证设置是否成功
bool vipLevelSuccess = DataMgr.VipLevel.Value >= vipLevel;
bool expireTimeSuccess = DataMgr.VipExpirationTime.Value >= expireTimestamp;
if (vipLevelSuccess && expireTimeSuccess)
{
Debug.Log($"[IAP Google] VIP设置成功 - 等级: {vipLevel} (原:{oldVipLevel}), 过期时间: {expireTimestamp} (原:{oldExpireTime})");
// 可选:触发VIP状态更新事件
return true;
}
else
{
Debug.LogError($"[IAP Google] VIP设置失败 - 等级设置: {vipLevelSuccess}, 过期时间设置: {expireTimeSuccess}");
return false;
}
}
catch (Exception e)
{
Debug.LogError($"[IAP Google] 处理订阅信息时发生异常: {e.Message}\n{e.StackTrace}");
return false;
}
}
/// <summary>
/// 降级方案:当无法从商店获取订阅信息时,根据商品类型估算VIP信息
/// </summary>
private bool ProcessFallbackSubscription(string productId)
{
try
{
Debug.LogWarning($"[IAP Google] 执行降级方案: {productId}");
int vipLevel = GetVipLevelByProductId(productId);
if (vipLevel <= 0)
{
Debug.LogError($"[IAP Google] 降级方案失败 - 无法获取VIP等级");
return false;
}
long expireTimestamp = GetEstimatedExpireTimestamp(productId);
if (expireTimestamp <= 0)
{
Debug.LogError($"[IAP Google] 降级方案失败 - 无法获取预估过期时间");
return false;
}
// 设置VIP信息
DataMgr.VipLevel.Value = Math.Max(DataMgr.VipLevel.Value, vipLevel);
DataMgr.VipExpirationTime.Value = Math.Max(DataMgr.VipExpirationTime.Value, expireTimestamp);
Debug.Log($"[IAP Google] 降级方案成功 - 等级: {vipLevel}, 过期时间: {expireTimestamp}");
return true;
}
catch (Exception e)
{
Debug.LogError($"[IAP Google] 降级方案异常: {e.Message}");
return false;
}
}
/// <summary>
/// 获取预估的过期时间戳
/// </summary>
private long GetEstimatedExpireTimestamp(string productId)
{
TimeSpan duration;
if (productId == PRODUCT_VIP_WEEK)
{
duration = TimeSpan.FromDays(7);
}
else if (productId == PRODUCT_VIP_MONTH)
{
duration = TimeSpan.FromDays(30);
}
else if (productId == PRODUCT_VIP_YEAR)
{
duration = TimeSpan.FromDays(365);
}
else
{
duration = TimeSpan.FromDays(30);
}
var expireDate = DateTime.UtcNow.Add(duration);
return ((DateTimeOffset)expireDate).ToUnixTimeSeconds();
}
/// <summary>
/// 分发支付成功消息(统一出口)
/// </summary>
private void DispatchPaySuccess(string productId)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
Debug.Log($"[IAP Google] 支付成功并完成发货: {productId}");
GameDispatcher.Instance.Dispatch(GameMsg.IAP_PAY_SUCCESS, productId);
PurchasingManager.SendEventClickByName(productId, "open");
PurchasingManager.SendEventClickByName(productId, "success");
}
/// <summary>验证商品ID是否为已定义的有效商品</summary>
/// <param name="productId">商品ID</param>
/// <returns>是否为有效商品</returns>
+2 -2
View File
@@ -38,8 +38,8 @@ public class LoveLegendRoot : MonoBehaviour
App.InitApplication(SuperApplication.Instance);
NetworkManager.haveSimCard = HasSIMCard();
MarkdownKit.Instance.LoadText("privacy", "https://official.piggyhydration.com/privacy.md");
MarkdownKit.Instance.LoadText("user", "https://official.piggyhydration.com/user.md");
MarkdownKit.Instance.LoadText("privacy", "https://www.ballcrushbest.com/privacy.md");
MarkdownKit.Instance.LoadText("user", "https://www.ballcrushbest.com/user.md");
}
private static string adInfoLabel = "";
+1 -1
View File
@@ -537,7 +537,7 @@ public class MaxPayManager
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
// Debug.LogWarning("OnPurchaseFailedproduct:" + product.transactionID + " failureReason:" + failureReason);
BIManager.Instance.TrackPurchase(paydata.amount, paydata.currency, "1", paydata.sku, "paid_err");
// BIManager.Instance.TrackPurchase(paydata.amount, paydata.currency, "1", paydata.sku, "paid_err");
DOVirtual.DelayedCall(1, () => { SaveData.GetSaveObject().max_pay_object = null; });
}
@@ -1,462 +1,462 @@
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
using System.Collections.Generic;
using FGUI.LG_albums;
using FGUI.LG_Common;
using SGModule.DataStorage;
using DG.Tweening;
using SGModule.Common.Extensions;
using System.Linq;
using SGModule.NetKit;
namespace BallKingdomCrush
{
public class AlbumDetailUI : BaseUI
{
private AlbumDetailUICtrl ctrl;
private AlbumDetailModel model;
private FGUI.LG_albums.com_albumsDetail ui;
public AlbumDetailUI(AlbumDetailUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.AlbumDetailUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_albums";
uiInfo.assetName = "com_albumsDetail";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.AlbumDetailModel) as AlbumDetailModel;
}
protected override void OnClose()
{
if (loader != null && !loader.isDisposed && loader.texture != null)
{
loader.texture.Dispose();
loader.texture = null;
}
loader = null;
if (new_index != -1)
{
GameDispatcher.Instance.Dispatch(GameMsg.UnlockAlbums, index);
}
}
protected override void OnBind()
{
ui = baseUI as FGUI.LG_albums.com_albumsDetail;
}
private List<LevelUnlock> LevelData;
private int new_index = -1;
private int index;
private GLoader loader = new GLoader();
protected override void OnOpenBefore(object args)
{
index = (int)args;
Debug.Log(index);
ui.btn_close.SetClick(() =>
{
CtrlCloseUI();
});
LevelData = ConfigSystem.GetConfig<LevelUnlock>();
// ui.list_.SetVirtual();
// ui.list_.itemRenderer = RendererList;
// ui.list_.numItems = GameHelper.GetLevel() - 1;
// ui.list_.ScrollToView(new_index);
RendererList();
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.BuyVip, refrsh);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.BuyVip, refrsh);
}
#endregion
//初始化页面逻辑
private void refrsh(object a = null)
{
DOVirtual.DelayedCall(0.5f, () =>
{
// ui.list_.numItems = GameHelper.GetLevel() - 1;
RendererList();
});
}
// void RendererList(int index, GObject obj)
void RendererList()
{
item_albumsDetails item = (item_albumsDetails)ui.com_item;
loader = item.com_loader.GetChild("loader") as GLoader;
// if (GameHelper.GetVipPrivilege(Subscription.VipLevel.As<int>()))
// {
// (item.btn_vip as btn_claim_2).have_vip.selectedIndex = 1;
// }
// if (GameHelper.GetVipPrivilege(Subscription.SLVLevel.As<int>()))
// {
// (item.btn_watch as btn_claim_1).have_vip.selectedIndex = 1;
// }
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
var btn_down_coin = (FGUI.LG_Common.btn_unlock)item.btn_download_coin;
btn_down_coin.title = downloadCoinNum.As<string>();
btn_down_coin.down_load.selectedIndex = GameHelper.GetVipLevel() >= 1 ? 0 : 1;
if (GameHelper.GetVipLevel() > 0)
{
(item.btn_download as FGUI.LG_Common.btn_claim).have_vip.selectedIndex = 1;
item.is_vip.selectedIndex = 1;
}
else
{
item.is_vip.selectedIndex = 0;
}
if (index < GameHelper.GetCommonModel().MultiModal - 1)
{
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
item.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() > 0)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
string file_name = "";
if (levelunlock_ != null)
{
if (levelunlock_.type == 0)
{
if (levelunlock_.config_index >= ConfigSystem.GetConfig<FreeImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<FreeImageLibrary>().Count - 1;
FreeImageLibrary _leveldata = ConfigSystem.GetConfig<FreeImageLibrary>()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
else if (levelunlock_.type == 1)
{
if (levelunlock_.config_index >= ConfigSystem.GetConfig<ADImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<ADImageLibrary>().Count - 1;
ADImageLibrary _leveldata = ConfigSystem.GetConfig<ADImageLibrary>()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
else if (levelunlock_.type == 2)
{
if (levelunlock_.config_index >= ConfigSystem.GetConfig<SpecialImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<SpecialImageLibrary>().Count - 1;
SpecialImageLibrary _leveldata = ConfigSystem.GetConfig<SpecialImageLibrary>()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
else if (levelunlock_.type == 3)
{
if (levelunlock_.config_index >= ConfigSystem.GetConfig<VIPImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<VIPImageLibrary>().Count - 1;
VIPImageLibrary _leveldata = ConfigSystem.GetConfig<VIPImageLibrary>()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
item.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() > 0)
{
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName, CtrlCloseUI);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName, CtrlCloseUI);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
}
else
{
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
item.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() > 0)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
}
}
// if (LevelData[index].LeveType == 0)
// {
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/");
// item.type.selectedIndex = 0;
// }
// else if (LevelData[index].LeveType == 1) //特殊关
// {
// if (DataMgr.LevelUnlockList.Value.Contains(index))
// {
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/");
// item.type.selectedIndex = 0;
// }
// else
// {
// item.type.selectedIndex = 1;
// item.btn_pay.title = LevelData[index].PassCoins.ToString();
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, (s) =>
// {
// TextureHelper.SetImageBlur(item.com_loader.GetChild("loader") as GLoader);
// }, "LevelAlbums/");
// item.btn_pay.SetClick(() =>
// {
// if (DataMgr.Coin.Value >= LevelData[index].PassCoins)
// {
// new_index = index;
// DataMgr.Coin.Value -= LevelData[index].PassCoins;
// GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// else
// {
// GameHelper.ShowTips("Not enough golds");
// }
// });
// item.btn_watch.SetClick(() =>
// {
// if (GameHelper.GetVipPrivilege(Subscription.SLVLevel.As<int>()))
// {
// new_index = index;
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// else
// {
// GameHelper.ShowVideoAd("UnlockSpecialLevel", isSuccess =>
// {
// if (isSuccess)
// {
// new_index = index;
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// });
// }
// });
// }
// }
// else if (LevelData[index].LeveType == 2)//vip关
// {
// if (DataMgr.LevelUnlockList.Value.Contains(index))
// {
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/");
// item.type.selectedIndex = 0;
// }
// else
// {
// item.type.selectedIndex = 2;
// item.btn_pay.title = LevelData[index].PassCoins.ToString();
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, (s) =>
// {
// TextureHelper.SetImageBlur(item.com_loader.GetChild("loader") as GLoader);
// }, "LevelAlbums/");
// item.btn_pay.SetClick(() =>
// {
// if (DataMgr.Coin.Value >= LevelData[index].PassCoins)
// {
// new_index = index;
// DataMgr.Coin.Value -= LevelData[index].PassCoins;
// GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// else
// {
// GameHelper.ShowTips("Not enough golds");
// }
// });
// item.btn_vip.SetClick(() =>
// {
// if (GameHelper.GetVipPrivilege(Subscription.VipLevel.As<int>()))
// {
// new_index = index;
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// else
// {
// uiCtrlDispatcher.Dispatch(UICtrlMsg.VipClubViewUI_Open, 2);
// }
// });
// }
// }
// if (item.type.selectedIndex == 0)
// {
// if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
// {
// (item.btn_download as FGUI.LG_Common.btn_claim).have_vip.selectedIndex = 1;
// item.is_vip.selectedIndex = 1;
// }
// else
// {
// item.is_vip.selectedIndex = 0;
// }
// }
// else if (item.type.selectedIndex == 1)
// {
// if (GameHelper.GetVipPrivilege(Subscription.SLVLevel.As<int>()))
// {
// item.is_vip.selectedIndex = 1;
// }
// else item.is_vip.selectedIndex = 0;
// }
// else if (item.type.selectedIndex == 2)
// {
// if (GameHelper.GetVipPrivilege(Subscription.VipLevel.As<int>()))
// {
// item.is_vip.selectedIndex = 1;
// }
// else item.is_vip.selectedIndex = 0;
// }
}
}
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
using System.Collections.Generic;
using FGUI.LG_albums;
using FGUI.LG_Common;
using SGModule.DataStorage;
using DG.Tweening;
using SGModule.Common.Extensions;
using System.Linq;
using SGModule.NetKit;
namespace BallKingdomCrush
{
public class AlbumDetailUI : BaseUI
{
private AlbumDetailUICtrl ctrl;
private AlbumDetailModel model;
private FGUI.LG_albums.com_albumsDetail ui;
public AlbumDetailUI(AlbumDetailUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.AlbumDetailUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_albums";
uiInfo.assetName = "com_albumsDetail";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.AlbumDetailModel) as AlbumDetailModel;
}
protected override void OnClose()
{
if (loader != null && !loader.isDisposed && loader.texture != null)
{
loader.texture.Dispose();
loader.texture = null;
}
loader = null;
if (new_index != -1)
{
GameDispatcher.Instance.Dispatch(GameMsg.UnlockAlbums, index);
}
}
protected override void OnBind()
{
ui = baseUI as FGUI.LG_albums.com_albumsDetail;
}
private List<LevelUnlock> LevelData;
private int new_index = -1;
private int index;
private GLoader loader = new GLoader();
protected override void OnOpenBefore(object args)
{
index = (int)args;
Debug.Log(index);
ui.btn_close.SetClick(() =>
{
CtrlCloseUI();
});
LevelData = ConfigSystem.GetLevelUnlockConfig();
// ui.list_.SetVirtual();
// ui.list_.itemRenderer = RendererList;
// ui.list_.numItems = GameHelper.GetLevel() - 1;
// ui.list_.ScrollToView(new_index);
RendererList();
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.BuyVip, refrsh);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.BuyVip, refrsh);
}
#endregion
//初始化页面逻辑
private void refrsh(object a = null)
{
DOVirtual.DelayedCall(0.5f, () =>
{
// ui.list_.numItems = GameHelper.GetLevel() - 1;
RendererList();
});
}
// void RendererList(int index, GObject obj)
void RendererList()
{
item_albumsDetails item = (item_albumsDetails)ui.com_item;
loader = item.com_loader.GetChild("loader") as GLoader;
// if (GameHelper.GetVipPrivilege(Subscription.VipLevel.As<int>()))
// {
// (item.btn_vip as btn_claim_2).have_vip.selectedIndex = 1;
// }
// if (GameHelper.GetVipPrivilege(Subscription.SLVLevel.As<int>()))
// {
// (item.btn_watch as btn_claim_1).have_vip.selectedIndex = 1;
// }
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
var btn_down_coin = (FGUI.LG_Common.btn_unlock)item.btn_download_coin;
btn_down_coin.title = downloadCoinNum.As<string>();
btn_down_coin.down_load.selectedIndex = GameHelper.GetVipLevel() >= 1 ? 0 : 1;
if (GameHelper.GetVipLevel() > 0)
{
(item.btn_download as FGUI.LG_Common.btn_claim).have_vip.selectedIndex = 1;
item.is_vip.selectedIndex = 1;
}
else
{
item.is_vip.selectedIndex = 0;
}
if (index < GameHelper.GetCommonModel().MultiModal - 1)
{
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
item.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() > 0)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
string file_name = "";
if (levelunlock_ != null)
{
if (levelunlock_.type == 0)
{
if (levelunlock_.config_index >= ConfigSystem.GetFreeImageConfig().Count) levelunlock_.config_index = ConfigSystem.GetFreeImageConfig().Count - 1;
FreeImageLibrary _leveldata = ConfigSystem.GetFreeImageConfig()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
else if (levelunlock_.type == 1)
{
if (levelunlock_.config_index >= ConfigSystem.GetADImageConfig().Count) levelunlock_.config_index = ConfigSystem.GetADImageConfig().Count - 1;
ADImageLibrary _leveldata = ConfigSystem.GetADImageConfig()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
else if (levelunlock_.type == 2)
{
if (levelunlock_.config_index >= ConfigSystem.GetSpecialImageConfig().Count) levelunlock_.config_index = ConfigSystem.GetSpecialImageConfig().Count - 1;
SpecialImageLibrary _leveldata = ConfigSystem.GetSpecialImageConfig()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
else if (levelunlock_.type == 3)
{
if (levelunlock_.config_index >= ConfigSystem.GetVIPImageConfig().Count) levelunlock_.config_index = ConfigSystem.GetVIPImageConfig().Count - 1;
VIPImageLibrary _leveldata = ConfigSystem.GetVIPImageConfig()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
item.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() > 0)
{
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName, CtrlCloseUI);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName, CtrlCloseUI);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
}
else
{
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
item.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() > 0)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
}
}
// if (LevelData[index].LeveType == 0)
// {
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/");
// item.type.selectedIndex = 0;
// }
// else if (LevelData[index].LeveType == 1) //特殊关
// {
// if (DataMgr.LevelUnlockList.Value.Contains(index))
// {
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/");
// item.type.selectedIndex = 0;
// }
// else
// {
// item.type.selectedIndex = 1;
// item.btn_pay.title = LevelData[index].PassCoins.ToString();
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, (s) =>
// {
// TextureHelper.SetImageBlur(item.com_loader.GetChild("loader") as GLoader);
// }, "LevelAlbums/");
// item.btn_pay.SetClick(() =>
// {
// if (DataMgr.Coin.Value >= LevelData[index].PassCoins)
// {
// new_index = index;
// DataMgr.Coin.Value -= LevelData[index].PassCoins;
// GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// else
// {
// GameHelper.ShowTips("Not enough golds");
// }
// });
// item.btn_watch.SetClick(() =>
// {
// if (GameHelper.GetVipPrivilege(Subscription.SLVLevel.As<int>()))
// {
// new_index = index;
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// else
// {
// GameHelper.ShowVideoAd("UnlockSpecialLevel", isSuccess =>
// {
// if (isSuccess)
// {
// new_index = index;
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// });
// }
// });
// }
// }
// else if (LevelData[index].LeveType == 2)//vip关
// {
// if (DataMgr.LevelUnlockList.Value.Contains(index))
// {
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/");
// item.type.selectedIndex = 0;
// }
// else
// {
// item.type.selectedIndex = 2;
// item.btn_pay.title = LevelData[index].PassCoins.ToString();
// TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, (s) =>
// {
// TextureHelper.SetImageBlur(item.com_loader.GetChild("loader") as GLoader);
// }, "LevelAlbums/");
// item.btn_pay.SetClick(() =>
// {
// if (DataMgr.Coin.Value >= LevelData[index].PassCoins)
// {
// new_index = index;
// DataMgr.Coin.Value -= LevelData[index].PassCoins;
// GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// else
// {
// GameHelper.ShowTips("Not enough golds");
// }
// });
// item.btn_vip.SetClick(() =>
// {
// if (GameHelper.GetVipPrivilege(Subscription.VipLevel.As<int>()))
// {
// new_index = index;
// DataMgr.LevelUnlockList.Value.Add(index);
// GameHelper.ShowTips("Unlocked!");
// DataMgr.LevelUnlockList.Save();
// GameDispatcher.Instance.Dispatch(GameMsg.UnlockLevelsuccess);
// CtrlCloseUI();
// }
// else
// {
// uiCtrlDispatcher.Dispatch(UICtrlMsg.VipClubViewUI_Open, 2);
// }
// });
// }
// }
// if (item.type.selectedIndex == 0)
// {
// if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
// {
// (item.btn_download as FGUI.LG_Common.btn_claim).have_vip.selectedIndex = 1;
// item.is_vip.selectedIndex = 1;
// }
// else
// {
// item.is_vip.selectedIndex = 0;
// }
// }
// else if (item.type.selectedIndex == 1)
// {
// if (GameHelper.GetVipPrivilege(Subscription.SLVLevel.As<int>()))
// {
// item.is_vip.selectedIndex = 1;
// }
// else item.is_vip.selectedIndex = 0;
// }
// else if (item.type.selectedIndex == 2)
// {
// if (GameHelper.GetVipPrivilege(Subscription.VipLevel.As<int>()))
// {
// item.is_vip.selectedIndex = 1;
// }
// else item.is_vip.selectedIndex = 0;
// }
}
}
}
+430 -430
View File
@@ -1,431 +1,431 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using DG.Tweening;
using FairyGUI;
using FGUI.LG_albums;
using UnityEngine;
namespace BallKingdomCrush
{
public class AlubumUI : BaseUI
{
private AlubumUICtrl ctrl;
private AlubumModel model;
private com_albums ui;
private long[] UpDatatime;
public AlubumUI(AlubumUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.AlubumUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_albums";
uiInfo.assetName = "com_albums";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
//初始化页面逻辑
private void InitView(object a = null)
{
UpDatatime = new long[LevelData.Count];
ImageName = new string[LevelData.Count];
ui.list_albums.itemRenderer = RendererList;
ui.list_albums.numItems = LevelData.Count;
InitScroll();
}
private void SetItemData(object obj = null)
{
UpDatatime[(int)obj] = 0;
ui.list_albums.RefreshVirtualList();
}
#region
protected override void OnInit()
{
GLoaderPool.Instance.Init(null, 24, 312, 310);
}
protected override void OnClose()
{
foreach (var t in loader_list)
if (t != null && !t.isDisposed && t.texture != null)
{
t.texture.Dispose();
t.texture = null;
}
// 1. 解除 UI 对 Loader 的引用
for (var i = 0; i < ui.list_albums.numChildren; i++)
{
var item = ui.list_albums.GetChildAt(i) as item_albums;
if (item != null && item.com_loader.loader != null) item.com_loader.loader = null; // 清掉 GLoader 引用
}
activeLoaders.Clear();
_fileIsExist.Clear();
GLoaderPool.Instance.DisposeAll();
TextureHelper.ClearMaterialPool();
// 强制卸载未使用的资源
// Resources.UnloadUnusedAssets();
// MemoryManager.CleanMemoryMonitor();
}
protected override void OnBind()
{
ui = baseUI as com_albums;
}
private List<LevelUnlock> LevelData;
private readonly List<GLoader> loader_list = new();
protected override void OnOpenBefore(object args)
{
_throttle = new Throttle(1f);
LevelData = ConfigSystem.GetConfig<LevelUnlock>();
ui.list_albums.SetVirtual();
ui.btn_close1.SetClick(() => { CtrlCloseUI(); });
InitView();
}
private const int MaxVisibleCount = 18; // 一屏显示18个
private const int PreloadCount = 3; // 上下各预加载一屏
private readonly Dictionary<int, GLoader> activeLoaders = new();
private readonly Dictionary<int, bool> _fileIsExist = new();
private Throttle _throttle;
private void InitScroll()
{
// ui.list_albums.scrollPane.onScroll.Add(OnScrollUpdate);
ui.list_albums.scrollPane.onScrollEnd.Add(OnScrollEndCB); // 保留结束时的整理
OnScrollEnd();
}
private void OnScrollUpdate()
{
_throttle.Execute(UpdateVisibleAndPreload);
}
private void OnScrollEndCB()
{
// UpdateVisibleAndPreload();
OnScrollEnd();
// Debug.Log("更新一次");
}
private void UpdateVisibleAndPreload()
{
// Debug.Log("[UpdateVisibleAndPreload]--------111111--------- ");
// if (LevelData == null || LevelData.Count == 0) return;
// var firstVisibleIndex = ui.list_albums.GetFirstChildInView();
// var lastVisibleIndex = Mathf.Min(firstVisibleIndex + MaxVisibleCount - 1, ui.list_albums.numItems - 1);
// var startIndex = Mathf.Max(0, firstVisibleIndex - PreloadCount);
// var endIndex = Mathf.Min(ui.list_albums.numItems - 1, lastVisibleIndex + PreloadCount);
// // 回收超出范围 loader
// var keysToRemove = new List<int>();
// foreach (var kv in activeLoaders)
// {
// var idx = kv.Key;
// if (idx < startIndex || idx > endIndex)
// {
// GLoaderPool.Instance.ReturnLoader(kv.Value);
// var oldItem = ui.list_albums.GetChildAt(idx) as item_albums;
// if (oldItem != null) oldItem.com_loader.loader = null;
// keysToRemove.Add(idx);
// }
// }
// foreach (var k in keysToRemove) activeLoaders.Remove(k);
// // 分配 loader 并加载图片
// for (var i = startIndex; i <= endIndex; i++)
// {
// if (activeLoaders.ContainsKey(i)) continue;
// var item = ui.list_albums.GetChildAt(i) as item_albums;
// if (item == null) continue;
// if (item.com_loader.loader != null && !item.com_loader.loader.isDisposed)
// GLoaderPool.Instance.ReturnLoader(item.com_loader.loader);
// var loader = GLoaderPool.Instance.GetLoader();
// item.com_loader.loader = loader;
// item.com_loader.AddChild(loader);
// loader.SetSize(item.com_loader.loader.width, item.com_loader.loader.height);
// _fileIsExist.TryGetValue(i, out var value);
// if (!value)
// {
// var localPath = Path.Combine(TextureHelper.getResPath(), LevelData[i].Name + ".jpg");
// if (File.Exists(localPath))
// {
// _fileIsExist[i] = true;
// Debug.Log($"[SetImgLoader] 本地存在,直接加载 {LevelData[i].Name}");
// CrazyAsyKit.StartCoroutine(TextureHelper.LoadTexture(LevelData[i].Name, loader, null,
// "LevelAlbums/"));
// }
// else
// {
// _fileIsExist[i] = false;
// }
// }
// else
// {
// CrazyAsyKit.StartCoroutine(TextureHelper.LoadTexture(LevelData[i].Name, loader, null,
// "LevelAlbums/"));
// }
// activeLoaders[i] = loader;
// }
// Debug.Log($"[ScrollUpdate] active loaders={activeLoaders.Count}, pool={GLoaderPool.Instance.GetPoolCount()}, inUse={GLoaderPool.Instance.GetInUseCount()}");
}
private void OnScrollEnd()
{
for (int i = 0; i < UpDatatime.Length; i++)
{
UpDatatime[i] = 0;
// ImageName[i] = "";
}
// DOVirtual.DelayedCall(0.1f, () =>
// {
ui.list_albums.RefreshVirtualList();
// });
// if (LevelData == null || LevelData.Count == 0) return;
// var firstVisibleIndex = ui.list_albums.GetFirstChildInView();
// var lastVisibleIndex = Mathf.Min(firstVisibleIndex + MaxVisibleCount - 1, ui.list_albums.numItems - 1);
// var startIndex = Mathf.Max(0, firstVisibleIndex - PreloadCount);
// var endIndex = Mathf.Min(ui.list_albums.numItems - 1, lastVisibleIndex + PreloadCount);
// // Debug.Log($"[ScrollEnd] start index={startIndex} end index={endIndex}");
// var tasks = new List<(GLoader loader, string fileName, Action<NTexture> callback, string folder)>();
// // 分配 loader 并加载图片
// for (var i = startIndex; i <= endIndex; i++)
// {
// _fileIsExist.TryGetValue(i, out var value);
// if (value) continue;
// if (GameHelper.GetLevel() < i + 1) continue;
// var item = ui.list_albums.GetChildAt(i) as item_albums;
// if (item == null) continue;
// if (item.com_loader.loader != null && !item.com_loader.loader.isDisposed)
// GLoaderPool.Instance.ReturnLoader(item.com_loader.loader);
// var loader = GLoaderPool.Instance.GetLoader();
// item.com_loader.loader = loader;
// item.com_loader.AddChild(loader);
// loader.SetSize(item.com_loader.loader.width, item.com_loader.loader.height);
// var idx = i;
// tasks.Add((loader, LevelData[i].Name, NTexture =>
// {
// if (NTexture != null) _fileIsExist[idx] = true;
// }, "LevelAlbums/"));
// activeLoaders[i] = loader;
// }
// if (tasks.Count > 0) TextureHelper.SetImgLoaders(tasks);
}
private string[] ImageName;
private void RendererList(int index, GObject obj)
{
// Debug.Log("Render list" );
// Debug.Log(JsonConvert.SerializeObject(LevelData[index]));
item_albums item = (item_albums)obj;
item.text_num.text = (index + 1).ToString();
if (index < GameHelper.GetCommonModel().MultiModal - 1)
{
item.type_.selectedIndex = 0;
if (GameHelper.GetLevel() > index + 1)
{
item.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.AlbumDetailUI_Open, index); });
}
else
{
item.SetClick(() => { GameHelper.ShowTips("lv_unlock", true); });
}
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
if (levelunlock_ != null)
{
item.type_.selectedIndex = levelunlock_.type;
}
else item.type_.selectedIndex = 0;
if (GameHelper.GetLevel() > index + 1)
{
item.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.AlbumDetailUI_Open, index); });
}
else
{
item.SetClick(() => { GameHelper.ShowTips("lv_unlock", true); });
}
}
if (GameHelper.GetNowTime() < UpDatatime[index] + 1) return;
UpDatatime[index] = GameHelper.GetNowTime();
// if (!activeLoaders.ContainsValue(item.com_loader.loader)) activeLoaders[index] = item.com_loader.loader;
if (!loader_list.Contains(item.com_loader.GetChild("loader") as GLoader))
loader_list.Add(item.com_loader.GetChild("loader") as GLoader);
if (index < GameHelper.GetCommonModel().MultiModal - 1)
{
if (GameHelper.GetLevel() > index + 1)
{
item.isUnlock.selectedIndex = 1;
if (item.com_loader.loader.texture == null ||
item.com_loader.loader.texture.nativeTexture.name != LevelData[index].Name)
{
// item.isUnlock.selectedIndex = 0;
// if (item.com_loader.loader.texture != null)
// {
// item.com_loader.loader.texture.Dispose(); // 释放 GPU 资源
// item.com_loader.loader.texture = null; // 断开引用
// }
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name,
(a) => { Debug.Log(item.com_loader.loader.texture.nativeTexture.name); }, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
item.touchable = true;
}
else
{
item.isUnlock.selectedIndex = 0;
// item.touchable = false;
}
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
if (GameHelper.GetLevel() > index + 1)
{
if (levelunlock_ != null)
{
item.isUnlock.selectedIndex = 1;
if (item.com_loader.loader.texture == null || item.com_loader.loader.texture.nativeTexture.name != ImageName[index])
{
if (levelunlock_.type == 0)
{
if (levelunlock_.config_index >= ConfigSystem.GetConfig<FreeImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<FreeImageLibrary>().Count - 1;
FreeImageLibrary _leveldata = ConfigSystem.GetConfig<FreeImageLibrary>()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
else if (levelunlock_.type == 1)
{
if (levelunlock_.config_index >= ConfigSystem.GetConfig<ADImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<ADImageLibrary>().Count - 1;
ADImageLibrary _leveldata = ConfigSystem.GetConfig<ADImageLibrary>()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
else if (levelunlock_.type == 2)
{
if (levelunlock_.config_index >= ConfigSystem.GetConfig<SpecialImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<SpecialImageLibrary>().Count - 1;
SpecialImageLibrary _leveldata = ConfigSystem.GetConfig<SpecialImageLibrary>()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
else if (levelunlock_.type == 3)
{
if (levelunlock_.config_index >= ConfigSystem.GetConfig<VIPImageLibrary>().Count) levelunlock_.config_index = ConfigSystem.GetConfig<VIPImageLibrary>().Count - 1;
VIPImageLibrary _leveldata = ConfigSystem.GetConfig<VIPImageLibrary>()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
}
}
else
{
item.isUnlock.selectedIndex = 1;
if (item.com_loader.loader.texture == null || item.com_loader.loader.texture.nativeTexture.name != LevelData[index].Name)
{
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
}
}
else
{
// item.touchable = false;
item.isUnlock.selectedIndex = 0;
}
}
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.UnlockAlbums, SetItemData);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.UnlockAlbums, SetItemData);
}
#endregion
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using DG.Tweening;
using FairyGUI;
using FGUI.LG_albums;
using UnityEngine;
namespace BallKingdomCrush
{
public class AlubumUI : BaseUI
{
private AlubumUICtrl ctrl;
private AlubumModel model;
private com_albums ui;
private long[] UpDatatime;
public AlubumUI(AlubumUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.AlubumUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_albums";
uiInfo.assetName = "com_albums";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
//初始化页面逻辑
private void InitView(object a = null)
{
UpDatatime = new long[LevelData.Count];
ImageName = new string[LevelData.Count];
ui.list_albums.itemRenderer = RendererList;
ui.list_albums.numItems = LevelData.Count;
InitScroll();
}
private void SetItemData(object obj = null)
{
UpDatatime[(int)obj] = 0;
ui.list_albums.RefreshVirtualList();
}
#region
protected override void OnInit()
{
GLoaderPool.Instance.Init(null, 24, 312, 310);
}
protected override void OnClose()
{
foreach (var t in loader_list)
if (t != null && !t.isDisposed && t.texture != null)
{
t.texture.Dispose();
t.texture = null;
}
// 1. 解除 UI 对 Loader 的引用
for (var i = 0; i < ui.list_albums.numChildren; i++)
{
var item = ui.list_albums.GetChildAt(i) as item_albums;
if (item != null && item.com_loader.loader != null) item.com_loader.loader = null; // 清掉 GLoader 引用
}
activeLoaders.Clear();
_fileIsExist.Clear();
GLoaderPool.Instance.DisposeAll();
TextureHelper.ClearMaterialPool();
// 强制卸载未使用的资源
// Resources.UnloadUnusedAssets();
// MemoryManager.CleanMemoryMonitor();
}
protected override void OnBind()
{
ui = baseUI as com_albums;
}
private List<LevelUnlock> LevelData;
private readonly List<GLoader> loader_list = new();
protected override void OnOpenBefore(object args)
{
_throttle = new Throttle(1f);
LevelData = ConfigSystem.GetLevelUnlockConfig();
ui.list_albums.SetVirtual();
ui.btn_close1.SetClick(() => { CtrlCloseUI(); });
InitView();
}
private const int MaxVisibleCount = 18; // 一屏显示18个
private const int PreloadCount = 3; // 上下各预加载一屏
private readonly Dictionary<int, GLoader> activeLoaders = new();
private readonly Dictionary<int, bool> _fileIsExist = new();
private Throttle _throttle;
private void InitScroll()
{
// ui.list_albums.scrollPane.onScroll.Add(OnScrollUpdate);
ui.list_albums.scrollPane.onScrollEnd.Add(OnScrollEndCB); // 保留结束时的整理
OnScrollEnd();
}
private void OnScrollUpdate()
{
_throttle.Execute(UpdateVisibleAndPreload);
}
private void OnScrollEndCB()
{
// UpdateVisibleAndPreload();
OnScrollEnd();
// Debug.Log("更新一次");
}
private void UpdateVisibleAndPreload()
{
// Debug.Log("[UpdateVisibleAndPreload]--------111111--------- ");
// if (LevelData == null || LevelData.Count == 0) return;
// var firstVisibleIndex = ui.list_albums.GetFirstChildInView();
// var lastVisibleIndex = Mathf.Min(firstVisibleIndex + MaxVisibleCount - 1, ui.list_albums.numItems - 1);
// var startIndex = Mathf.Max(0, firstVisibleIndex - PreloadCount);
// var endIndex = Mathf.Min(ui.list_albums.numItems - 1, lastVisibleIndex + PreloadCount);
// // 回收超出范围 loader
// var keysToRemove = new List<int>();
// foreach (var kv in activeLoaders)
// {
// var idx = kv.Key;
// if (idx < startIndex || idx > endIndex)
// {
// GLoaderPool.Instance.ReturnLoader(kv.Value);
// var oldItem = ui.list_albums.GetChildAt(idx) as item_albums;
// if (oldItem != null) oldItem.com_loader.loader = null;
// keysToRemove.Add(idx);
// }
// }
// foreach (var k in keysToRemove) activeLoaders.Remove(k);
// // 分配 loader 并加载图片
// for (var i = startIndex; i <= endIndex; i++)
// {
// if (activeLoaders.ContainsKey(i)) continue;
// var item = ui.list_albums.GetChildAt(i) as item_albums;
// if (item == null) continue;
// if (item.com_loader.loader != null && !item.com_loader.loader.isDisposed)
// GLoaderPool.Instance.ReturnLoader(item.com_loader.loader);
// var loader = GLoaderPool.Instance.GetLoader();
// item.com_loader.loader = loader;
// item.com_loader.AddChild(loader);
// loader.SetSize(item.com_loader.loader.width, item.com_loader.loader.height);
// _fileIsExist.TryGetValue(i, out var value);
// if (!value)
// {
// var localPath = Path.Combine(TextureHelper.getResPath(), LevelData[i].Name + ".jpg");
// if (File.Exists(localPath))
// {
// _fileIsExist[i] = true;
// Debug.Log($"[SetImgLoader] 本地存在,直接加载 {LevelData[i].Name}");
// CrazyAsyKit.StartCoroutine(TextureHelper.LoadTexture(LevelData[i].Name, loader, null,
// "LevelAlbums/"));
// }
// else
// {
// _fileIsExist[i] = false;
// }
// }
// else
// {
// CrazyAsyKit.StartCoroutine(TextureHelper.LoadTexture(LevelData[i].Name, loader, null,
// "LevelAlbums/"));
// }
// activeLoaders[i] = loader;
// }
// Debug.Log($"[ScrollUpdate] active loaders={activeLoaders.Count}, pool={GLoaderPool.Instance.GetPoolCount()}, inUse={GLoaderPool.Instance.GetInUseCount()}");
}
private void OnScrollEnd()
{
for (int i = 0; i < UpDatatime.Length; i++)
{
UpDatatime[i] = 0;
// ImageName[i] = "";
}
// DOVirtual.DelayedCall(0.1f, () =>
// {
ui.list_albums.RefreshVirtualList();
// });
// if (LevelData == null || LevelData.Count == 0) return;
// var firstVisibleIndex = ui.list_albums.GetFirstChildInView();
// var lastVisibleIndex = Mathf.Min(firstVisibleIndex + MaxVisibleCount - 1, ui.list_albums.numItems - 1);
// var startIndex = Mathf.Max(0, firstVisibleIndex - PreloadCount);
// var endIndex = Mathf.Min(ui.list_albums.numItems - 1, lastVisibleIndex + PreloadCount);
// // Debug.Log($"[ScrollEnd] start index={startIndex} end index={endIndex}");
// var tasks = new List<(GLoader loader, string fileName, Action<NTexture> callback, string folder)>();
// // 分配 loader 并加载图片
// for (var i = startIndex; i <= endIndex; i++)
// {
// _fileIsExist.TryGetValue(i, out var value);
// if (value) continue;
// if (GameHelper.GetLevel() < i + 1) continue;
// var item = ui.list_albums.GetChildAt(i) as item_albums;
// if (item == null) continue;
// if (item.com_loader.loader != null && !item.com_loader.loader.isDisposed)
// GLoaderPool.Instance.ReturnLoader(item.com_loader.loader);
// var loader = GLoaderPool.Instance.GetLoader();
// item.com_loader.loader = loader;
// item.com_loader.AddChild(loader);
// loader.SetSize(item.com_loader.loader.width, item.com_loader.loader.height);
// var idx = i;
// tasks.Add((loader, LevelData[i].Name, NTexture =>
// {
// if (NTexture != null) _fileIsExist[idx] = true;
// }, "LevelAlbums/"));
// activeLoaders[i] = loader;
// }
// if (tasks.Count > 0) TextureHelper.SetImgLoaders(tasks);
}
private string[] ImageName;
private void RendererList(int index, GObject obj)
{
// Debug.Log("Render list" );
// Debug.Log(JsonConvert.SerializeObject(LevelData[index]));
item_albums item = (item_albums)obj;
item.text_num.text = (index + 1).ToString();
if (index < GameHelper.GetCommonModel().MultiModal - 1)
{
item.type_.selectedIndex = 0;
if (GameHelper.GetLevel() > index + 1)
{
item.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.AlbumDetailUI_Open, index); });
}
else
{
item.SetClick(() => { GameHelper.ShowTips("lv_unlock", true); });
}
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
if (levelunlock_ != null)
{
item.type_.selectedIndex = levelunlock_.type;
}
else item.type_.selectedIndex = 0;
if (GameHelper.GetLevel() > index + 1)
{
item.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.AlbumDetailUI_Open, index); });
}
else
{
item.SetClick(() => { GameHelper.ShowTips("lv_unlock", true); });
}
}
if (GameHelper.GetNowTime() < UpDatatime[index] + 1) return;
UpDatatime[index] = GameHelper.GetNowTime();
// if (!activeLoaders.ContainsValue(item.com_loader.loader)) activeLoaders[index] = item.com_loader.loader;
if (!loader_list.Contains(item.com_loader.GetChild("loader") as GLoader))
loader_list.Add(item.com_loader.GetChild("loader") as GLoader);
if (index < GameHelper.GetCommonModel().MultiModal - 1)
{
if (GameHelper.GetLevel() > index + 1)
{
item.isUnlock.selectedIndex = 1;
if (item.com_loader.loader.texture == null ||
item.com_loader.loader.texture.nativeTexture.name != LevelData[index].Name)
{
// item.isUnlock.selectedIndex = 0;
// if (item.com_loader.loader.texture != null)
// {
// item.com_loader.loader.texture.Dispose(); // 释放 GPU 资源
// item.com_loader.loader.texture = null; // 断开引用
// }
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name,
(a) => { Debug.Log(item.com_loader.loader.texture.nativeTexture.name); }, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
item.touchable = true;
}
else
{
item.isUnlock.selectedIndex = 0;
// item.touchable = false;
}
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == index + 1);
if (GameHelper.GetLevel() > index + 1)
{
if (levelunlock_ != null)
{
item.isUnlock.selectedIndex = 1;
if (item.com_loader.loader.texture == null || item.com_loader.loader.texture.nativeTexture.name != ImageName[index])
{
if (levelunlock_.type == 0)
{
if (levelunlock_.config_index >= ConfigSystem.GetFreeImageConfig().Count) levelunlock_.config_index = ConfigSystem.GetFreeImageConfig().Count - 1;
FreeImageLibrary _leveldata = ConfigSystem.GetFreeImageConfig()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
else if (levelunlock_.type == 1)
{
if (levelunlock_.config_index >= ConfigSystem.GetADImageConfig().Count) levelunlock_.config_index = ConfigSystem.GetADImageConfig().Count - 1;
ADImageLibrary _leveldata = ConfigSystem.GetADImageConfig()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
else if (levelunlock_.type == 2)
{
if (levelunlock_.config_index >= ConfigSystem.GetSpecialImageConfig().Count) levelunlock_.config_index = ConfigSystem.GetSpecialImageConfig().Count - 1;
SpecialImageLibrary _leveldata = ConfigSystem.GetSpecialImageConfig()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
else if (levelunlock_.type == 3)
{
if (levelunlock_.config_index >= ConfigSystem.GetVIPImageConfig().Count) levelunlock_.config_index = ConfigSystem.GetVIPImageConfig().Count - 1;
VIPImageLibrary _leveldata = ConfigSystem.GetVIPImageConfig()[levelunlock_.config_index];
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
}
}
else
{
item.isUnlock.selectedIndex = 1;
if (item.com_loader.loader.texture == null || item.com_loader.loader.texture.nativeTexture.name != LevelData[index].Name)
{
TextureHelper.SetImgLoader(item.com_loader.GetChild("loader") as GLoader, LevelData[index].Name, null, "LevelAlbums/", FolderNames.AlbumName);
ImageName[index] = LevelData[index].Name;
}
}
}
else
{
// item.touchable = false;
item.isUnlock.selectedIndex = 0;
}
}
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.UnlockAlbums, SetItemData);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.UnlockAlbums, SetItemData);
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+295 -295
View File
@@ -1,296 +1,296 @@
using System.Collections.Generic;
using FairyGUI;
using FGUI.LG_live;
using SGModule.Common.Extensions;
using UnityEngine;
using UnityEngine.Video;
namespace BallKingdomCrush
{
public class LiveUI : BaseUI
{
private const int MaxVisibleCount = 6; // 一屏最多6个播放器
private static readonly Dictionary<item_live, VideoPlayer> dictionary_ = new();
private LiveUICtrl ctrl;
private float late_time = 0.1f;
private List<Live> LiveConfig;
private LiveModel model;
private com_live ui;
private GameObject videoParent;
public LiveUI(LiveUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.LiveUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_live";
uiInfo.assetName = "com_live";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
private void UpdateEvent()
{
late_time = 0.1f;
}
// 初始化页面逻辑
private void InitView()
{
}
#region
protected override void OnInit()
{
videoParent = new GameObject("VideoPlayerParent");
VideoPlayerPool.Instance.Init(videoParent, MaxVisibleCount);
}
protected override void OnClose()
{
// 归还所有播放器
foreach (var kvp in dictionary_)
VideoPlayerPool.Instance.ReturnPlayer(kvp.Value);
dictionary_.Clear();
VideoPlayerPool.Instance.DisposeAll();
Object.Destroy(videoParent);
foreach (var t in loader_list)
if (t != null && !t.isDisposed && t.texture != null)
{
t.texture.Dispose();
t.texture = null;
}
GLoaderPool.Instance.DisposeAll();
TextureHelper.ClearMaterialPool();
// 强制卸载未使用的资源
Resources.UnloadUnusedAssets();
MemoryManager.CleanMemoryMonitor();
}
protected override void OnBind()
{
ui = baseUI as com_live;
}
private readonly List<GLoader> loader_list = new();
protected override void OnOpenBefore(object args)
{
LiveConfig = ConfigSystem.GetConfig<Live>();
ui.list_.itemRenderer = RendererList;
Debug.Log($"LiveConfig.Count==1=== {LiveConfig.Count}");
ui.list_.numItems = LiveConfig.Count;
ui.btn_close.SetClick(() => { CtrlCloseUI(); });
InitView();
// 滚动过程中实时刷新可见播放器
ui.list_.scrollPane.onScrollEnd.Add(OnScrollEnd);
// 打开页面时初始化一次
OnScrollEnd();
}
private HashSet<item_live> lastVisibleItems = new();
private void OnScrollEnd()
{
Debug.Log($"[OnScrollEnd]==lastVisibleItems=== {lastVisibleItems.Count}");
// 1️⃣ 回收上一次的可见播放器
foreach (var oldItem in lastVisibleItems)
if (dictionary_.TryGetValue(oldItem, out var player))
{
player.Pause();
player.targetTexture?.Release();
VideoPlayerPool.Instance.ReturnPlayer(player);
dictionary_.Remove(oldItem);
oldItem.com_loader.visible = false;
oldItem.img_cover.visible = true;
}
lastVisibleItems.Clear();
// 2️⃣ 获取当前可见项
var firstIndex = ui.list_.GetFirstChildInView();
var lastIndex = Mathf.Min(firstIndex + MaxVisibleCount, ui.list_.numItems);
HashSet<item_live> newVisibleItems = new();
for (var i = firstIndex; i < lastIndex; i++)
if (ui.list_.GetChildAt(i) is item_live item)
{
newVisibleItems.Add(item);
// 分配播放器
if (!dictionary_.ContainsKey(item))
{
var player = VideoPlayerPool.Instance.GetPlayer();
if (player != null)
{
dictionary_[item] = player;
BindPlayerToItem(item, i);
}
}
}
// 3️⃣ 保存为“上一次可见项”
lastVisibleItems = newVisibleItems;
}
private void BindPlayerToItem(item_live item, int index)
{
var data = PreDownloadManager.GetLiveDataByIndex(LiveConfig[index], index);
Debug.Log($"[绑定播放器 进度] progress==1=== {data.progress}");
if (data.progress <= 0) return;
var player = dictionary_[item];
var loader = item.com_loader.GetChild("loader") as GLoader;
item.com_loader.visible = true;
if (!loader_list.Contains(loader)) loader_list.Add(loader);
TextureHelper.SetVideoLoader(player, loader, LiveConfig[index].Name, vp =>
{
if (vp != null && !item.isDisposed)
{
if (data.progress >= 100)
{
item.img_cover.visible = false;
GameDispatcher.Instance.Dispatch(GameMsg.liveVideoLoaded);
}
}
});
}
private void RendererList(int index, GObject obj)
{
var livedata_ = PreDownloadManager.GetLiveDataByIndex(LiveConfig[index], index);
var item = (item_live)obj;
// UI状态显示
item.state.selectedIndex = livedata_.progress <= 0 ? 1 : 0;
if (LiveConfig[index].SubscribeUnlock == 1)
{
if (livedata_.progress < 100) item.vip.selectedIndex = 1;
else item.vip.selectedIndex = 2;
}
else item.vip.selectedIndex = 0;
item.mask.img_mask.fillAmount = (float)(100 - livedata_.progress) / 100;
var coverLoader = item.img_cover.GetChild("loader") as GLoader;
LiveVideoManager.Instance.GetVideoCover(coverLoader, LiveConfig[index].Name + "_cover", (tex) => {
if (tex != null) {
if (coverLoader != null) {
coverLoader.texture = new NTexture(tex);
coverLoader.visible = true;
}
}
});
// 点击事件
item.SetClick(() =>
{
if (GameHelper.GetLevel() < GameHelper.GetCommonModel().UnlockLive[1])
{
if (DataMgr.IsUnlockLive.Value < 0 && DataMgr.VipLevel.Value < 0) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SecretUnlockUI_Open, 2);
else if (DataMgr.IsUnlockLive.Value == 0) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockTipsUI_Open, 2);
else HandleDetailOpen(item, index);
}
else
{
HandleDetailOpen(item, index);
}
});
}
private void HandleDetailOpen(item_live item, int index)
{
if (dictionary_.TryGetValue(item, out var player))
uiCtrlDispatcher.Dispatch(UICtrlMsg.LiveDetailUI_Open, (index, player));
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.LiveChange, Refresh);
HallManager.Instance.UpdateEvent += UpdateEvent;
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.LiveChange, Refresh);
HallManager.Instance.UpdateEvent -= UpdateEvent;
}
private void Refresh(object param = null)
{
var index = param.As<int>();
// ui.list_.itemRenderer = RendererList;
// Debug.Log($"LiveConfig.Count==2=== {LiveConfig.Count}");
// ui.list_.numItems = LiveConfig.Count;
if (ui.list_.GetChildAt(index) is item_live item)
{
item.state.selectedIndex = 0;
var livedata_ = PreDownloadManager.GetLiveDataByIndex(LiveConfig[index], index);
item.mask.img_mask.fillAmount = (float)(100 - livedata_.progress) / 100;
BindPlayerToItem(item, index);
if (LiveConfig[index].SubscribeUnlock == 1)
{
if (livedata_.progress < 100) item.vip.selectedIndex = 1;
else item.vip.selectedIndex = 2;
}
else item.vip.selectedIndex = 0;
}
}
#endregion
}
public class LiveData
{
public int AD_num;
public int progress;
public int Singleprogress;
public long LiveADTime;
}
using System.Collections.Generic;
using FairyGUI;
using FGUI.LG_live;
using SGModule.Common.Extensions;
using UnityEngine;
using UnityEngine.Video;
namespace BallKingdomCrush
{
public class LiveUI : BaseUI
{
private const int MaxVisibleCount = 6; // 一屏最多6个播放器
private static readonly Dictionary<item_live, VideoPlayer> dictionary_ = new();
private LiveUICtrl ctrl;
private float late_time = 0.1f;
private List<Live> LiveConfig;
private LiveModel model;
private com_live ui;
private GameObject videoParent;
public LiveUI(LiveUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.LiveUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_live";
uiInfo.assetName = "com_live";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
private void UpdateEvent()
{
late_time = 0.1f;
}
// 初始化页面逻辑
private void InitView()
{
}
#region
protected override void OnInit()
{
videoParent = new GameObject("VideoPlayerParent");
VideoPlayerPool.Instance.Init(videoParent, MaxVisibleCount);
}
protected override void OnClose()
{
// 归还所有播放器
foreach (var kvp in dictionary_)
VideoPlayerPool.Instance.ReturnPlayer(kvp.Value);
dictionary_.Clear();
VideoPlayerPool.Instance.DisposeAll();
Object.Destroy(videoParent);
foreach (var t in loader_list)
if (t != null && !t.isDisposed && t.texture != null)
{
t.texture.Dispose();
t.texture = null;
}
GLoaderPool.Instance.DisposeAll();
TextureHelper.ClearMaterialPool();
// 强制卸载未使用的资源
// Resources.UnloadUnusedAssets();
// MemoryManager.CleanMemoryMonitor();
}
protected override void OnBind()
{
ui = baseUI as com_live;
}
private readonly List<GLoader> loader_list = new();
protected override void OnOpenBefore(object args)
{
LiveConfig = ConfigSystem.GetLiveConfig();
ui.list_.itemRenderer = RendererList;
Debug.Log($"LiveConfig.Count==1=== {LiveConfig.Count}");
ui.list_.numItems = LiveConfig.Count;
ui.btn_close.SetClick(() => { CtrlCloseUI(); });
InitView();
// 滚动过程中实时刷新可见播放器
ui.list_.scrollPane.onScrollEnd.Add(OnScrollEnd);
// 打开页面时初始化一次
OnScrollEnd();
}
private HashSet<item_live> lastVisibleItems = new();
private void OnScrollEnd()
{
Debug.Log($"[OnScrollEnd]==lastVisibleItems=== {lastVisibleItems.Count}");
// 1️⃣ 回收上一次的可见播放器
foreach (var oldItem in lastVisibleItems)
if (dictionary_.TryGetValue(oldItem, out var player))
{
player.Pause();
player.targetTexture?.Release();
VideoPlayerPool.Instance.ReturnPlayer(player);
dictionary_.Remove(oldItem);
oldItem.com_loader.visible = false;
oldItem.img_cover.visible = true;
}
lastVisibleItems.Clear();
// 2️⃣ 获取当前可见项
var firstIndex = ui.list_.GetFirstChildInView();
var lastIndex = Mathf.Min(firstIndex + MaxVisibleCount, ui.list_.numItems);
HashSet<item_live> newVisibleItems = new();
for (var i = firstIndex; i < lastIndex; i++)
if (ui.list_.GetChildAt(i) is item_live item)
{
newVisibleItems.Add(item);
// 分配播放器
if (!dictionary_.ContainsKey(item))
{
var player = VideoPlayerPool.Instance.GetPlayer();
if (player != null)
{
dictionary_[item] = player;
BindPlayerToItem(item, i);
}
}
}
// 3️⃣ 保存为“上一次可见项”
lastVisibleItems = newVisibleItems;
}
private void BindPlayerToItem(item_live item, int index)
{
var data = PreDownloadManager.GetLiveDataByIndex(LiveConfig[index], index);
Debug.Log($"[绑定播放器 进度] progress==1=== {data.progress}");
if (data.progress <= 0) return;
var player = dictionary_[item];
var loader = item.com_loader.GetChild("loader") as GLoader;
item.com_loader.visible = true;
if (!loader_list.Contains(loader)) loader_list.Add(loader);
TextureHelper.SetVideoLoader(player, loader, LiveConfig[index].Name, vp =>
{
if (vp != null && !item.isDisposed)
{
if (data.progress >= 100)
{
item.img_cover.visible = false;
GameDispatcher.Instance.Dispatch(GameMsg.liveVideoLoaded);
}
}
});
}
private void RendererList(int index, GObject obj)
{
var livedata_ = PreDownloadManager.GetLiveDataByIndex(LiveConfig[index], index);
var item = (item_live)obj;
// UI状态显示
item.state.selectedIndex = livedata_.progress <= 0 ? 1 : 0;
if (LiveConfig[index].SubscribeUnlock == 1)
{
if (livedata_.progress < 100) item.vip.selectedIndex = 1;
else item.vip.selectedIndex = 2;
}
else item.vip.selectedIndex = 0;
item.mask.img_mask.fillAmount = (float)(100 - livedata_.progress) / 100;
var coverLoader = item.img_cover.GetChild("loader") as GLoader;
LiveVideoManager.Instance.GetVideoCover(coverLoader, LiveConfig[index].Name + "_cover", (tex) => {
if (tex != null) {
if (coverLoader != null) {
coverLoader.texture = new NTexture(tex);
coverLoader.visible = true;
}
}
});
// 点击事件
item.SetClick(() =>
{
if (GameHelper.GetLevel() < GameHelper.GetCommonModel().UnlockLive[1])
{
if (DataMgr.IsUnlockLive.Value < 0 && DataMgr.VipLevel.Value < 0) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SecretUnlockUI_Open, 2);
else if (DataMgr.IsUnlockLive.Value == 0) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockTipsUI_Open, 2);
else HandleDetailOpen(item, index);
}
else
{
HandleDetailOpen(item, index);
}
});
}
private void HandleDetailOpen(item_live item, int index)
{
if (dictionary_.TryGetValue(item, out var player))
uiCtrlDispatcher.Dispatch(UICtrlMsg.LiveDetailUI_Open, (index, player));
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.LiveChange, Refresh);
HallManager.Instance.UpdateEvent += UpdateEvent;
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.LiveChange, Refresh);
HallManager.Instance.UpdateEvent -= UpdateEvent;
}
private void Refresh(object param = null)
{
var index = param.As<int>();
// ui.list_.itemRenderer = RendererList;
// Debug.Log($"LiveConfig.Count==2=== {LiveConfig.Count}");
// ui.list_.numItems = LiveConfig.Count;
if (ui.list_.GetChildAt(index) is item_live item)
{
item.state.selectedIndex = 0;
var livedata_ = PreDownloadManager.GetLiveDataByIndex(LiveConfig[index], index);
item.mask.img_mask.fillAmount = (float)(100 - livedata_.progress) / 100;
BindPlayerToItem(item, index);
if (LiveConfig[index].SubscribeUnlock == 1)
{
if (livedata_.progress < 100) item.vip.selectedIndex = 1;
else item.vip.selectedIndex = 2;
}
else item.vip.selectedIndex = 0;
}
}
#endregion
}
public class LiveData
{
public int AD_num;
public int progress;
public int Singleprogress;
public long LiveADTime;
}
}
+345 -345
View File
@@ -1,346 +1,346 @@
using System;
using DG.Tweening;
using FairyGUI;
using FGUI.LG_Common;
using FGUI.LG_live;
using Newtonsoft.Json;
using SGModule.Common.Extensions;
using SGModule.NetKit;
using UnityEngine;
using UnityEngine.Video;
using Object = UnityEngine.Object;
namespace BallKingdomCrush
{
public class LiveDetailUI : BaseUI
{
private LiveDetailUICtrl ctrl;
private LiveDetailModel model;
private com_liveDetail ui;
private VideoPlayer video;
public LiveDetailUI(LiveDetailUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.LiveDetailUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_live";
uiInfo.assetName = "com_liveDetail";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
//初始化页面逻辑
private void Updata()
{
if (GameHelper.GetNowTime() < livedata_.LiveADTime)
{
Debug.Log("??????????????????");
(ui.btn_watchad as btn_ad).state.selectedIndex = 1;
(ui.btn_watchad as btn_ad).text_time.text = CommonHelper.TimeFormat(
(int)livedata_.LiveADTime - Convert.ToInt32(GameHelper.GetNowTime()),
CountDownType.Hour);
}
else
{
(ui.btn_watchad as btn_ad).state.selectedIndex = 0;
if (LiveConfig.AD == livedata_.AD_num + 1)
ui.btn_watchad.title = "+" + (100 - livedata_.progress) + "%";
else
ui.btn_watchad.title = "+" + livedata_.Singleprogress + "%";
}
}
private void InitView(object a = null)
{
// TextureHelper.SetImgLoader(ui.com_loader.GetChild("loader") as GLoader, LiveConfig.Name, () =>
// {
// });
Debug.Log(JsonConvert.SerializeObject(livedata_));
Debug.Log(JsonConvert.SerializeObject(LiveConfig));
Updata();
var btn_down_coin = ((btn_unlock)ui.btn_download_coin);
if (GameHelper.GetVipLevel() >= 1)
{
(ui.btn_download as btn_claim_1).have_vip.selectedIndex = 1;
ui.is_vip.selectedIndex = 1;
}
else
{
ui.is_vip.selectedIndex = 0;
btn_down_coin.down_load.selectedIndex = 1;
}
if (livedata_.progress < 100)
{
ui.state.selectedIndex = 0;
if (LiveConfig.AD == 0) ui.can_speed.selectedIndex = 1;
if (LiveConfig.SubscribeUnlock == 1)
{
ui.SubscribeUnlock.selectedIndex = 1;
if (GameHelper.GetVipLevel() > 0)
{
ui.btn_pay.visible = false;
ui.btn_watchad.visible = false;
}
}
else
{
ui.SubscribeUnlock.selectedIndex = 0;
}
}
else
{
ui.state.selectedIndex = 1;
if (video != null) video.Play();
}
(ui.img_cover.GetChild("img_mask") as GImage).fillAmount = (float)(100 - livedata_.progress) / 100;
ui.progress_live.value = (float)livedata_.progress;
//ui.btn_pay.title = LiveConfig.GoldCoins.ToString();
Debug.Log(LiveConfig.GoldCoins);
var need_gold = (int)MathF.Ceiling((100f - livedata_.progress) * LiveConfig.GoldCoins / 100);
ui.btn_pay.title = need_gold.ToString();
if (LiveConfig.AD == livedata_.AD_num + 1)
ui.btn_watchad.title = "+" + (100 - livedata_.progress) + "%";
else
ui.btn_watchad.title = "+" + livedata_.Singleprogress + "%";
ui.btn_pay.SetClick(() =>
{
if (DataMgr.Coin.Value >= need_gold)
{
DataMgr.Coin.Value -= need_gold;
livedata_.progress = 100;
DataMgr.LiveDataDic.Value[index] = livedata_;
Debug.Log($"[解锁成功 0] LiveData总数为: {DataMgr.LiveDataDic.Value.Count}");
DataMgr.LiveDataDic.Save();
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
GameDispatcher.Instance.Dispatch(GameMsg.LiveChange, index);
InitView();
GameHelper.ShowTips("unlock_success", true);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.unlock_live_resources);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
ui.btn_watchad.SetClick(() =>
{
if (livedata_.LiveADTime < GameHelper.GetNowTime())
GameHelper.ShowVideoAd("UnlockLive", isSuccess =>
{
if (isSuccess)
{
livedata_.AD_num++;
if (LiveConfig.AD == livedata_.AD_num)
{
livedata_.progress = 100;
GameHelper.ShowTips("unlock_success", true);
}
else
{
livedata_.progress += livedata_.Singleprogress;
}
DataMgr.LiveDataDic.Value[index] = livedata_;
Debug.Log($"[解锁成功 1] LiveData总数为: {DataMgr.LiveDataDic.Value.Count}");
DataMgr.LiveDataDic.Save();
livedata_.LiveADTime = GameHelper.GetNowTime() + LiveConfig.CD;
SaveData.SaveDataFunc();
// if (livedata_.progress == 100) HandlePvPlay();
InitView();
GameDispatcher.Instance.Dispatch(GameMsg.LiveChange, index);
}
});
});
ui.btn_vip_unlock.SetClick(() =>
{
if (GameHelper.GetVipLevel() > 0)
{
livedata_.progress = 100;
DataMgr.LiveDataDic.Value[index] = livedata_;
Debug.Log($"[解锁成功 0] LiveData总数为: {DataMgr.LiveDataDic.Value.Count}");
DataMgr.LiveDataDic.Save();
GameDispatcher.Instance.Dispatch(GameMsg.LiveChange, index);
// HandlePvPlay();
InitView();
GameHelper.ShowTips("unlock_success", true);
string eventName = ADEventTrack.Property.vip_live_unclock_ + (index + 1);
TrackKit.SendEvent(ADEventTrack.VipLive, eventName);
}
else
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.VipClubViewUI_Open, 2);
TrackKit.SendEvent(ADEventTrack.VipLive, ADEventTrack.Property.vip_live_unclock);
}
});
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.LiveDetailModel) as LiveDetailModel;
}
protected override void OnClose()
{
if (video != null) Object.Destroy(video.gameObject);
HallManager.Instance.UpdateSecondEvent -= Updata;
VideoPlayerHandover.Return();
}
protected override void OnBind()
{
ui = baseUI as com_liveDetail;
}
private void HandlePvPlay()
{
Debug.Log("HandlePvPlay: " + index);
var secondUIRoot = ui.displayObject.gameObject.transform;
var loader = ui.com_loader.GetChild("loader") as GLoader;
// 接管播放器
VideoPlayerHandover.TakeOver(player, secondUIRoot, loader);
ui.img_cover.visible = false;
}
private int index;
private VideoPlayer player;
private LiveData livedata_;
private Live LiveConfig;
protected override void OnOpenBefore(object args)
{
var tuple = ((int index, VideoPlayer player))args;
index = tuple.index;
player = tuple.player;
player.audioOutputMode = VideoAudioOutputMode.None;
// 从配置表取配置(这里还是 List,如果有 Id 字段可改成字典)
LiveConfig = ConfigSystem.GetConfig<Live>()[index];
livedata_ = PreDownloadManager.GetLiveDataByIndex(LiveConfig, index);
ui.btn_close.SetClick(() => { CtrlCloseUI(); });
if (livedata_.progress >= 100 && LiveVideoManager.Instance.ExistVideo(LiveConfig.Name))
HandlePvPlay();
else
{
var coverLoader = ui.img_cover.GetChild("loader") as GLoader;
LiveVideoManager.Instance.GetVideoCover(coverLoader, LiveConfig.Name + "_cover", (tex) =>
{
if (tex != null)
{
if (coverLoader != null)
{
coverLoader.texture = new NTexture(tex);
coverLoader.visible = true;
}
}
});
}
var btn_down_coin = ((btn_unlock)ui.btn_download_coin);
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
btn_down_coin.title = downloadCoinNum.ToString();
HallManager.Instance.UpdateSecondEvent += Updata;
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
TextureHelper.SaveVideoToAlbum(LiveConfig.Name, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
ui.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() >= 1)
{
TextureHelper.SaveVideoToAlbum(LiveConfig.Name, CtrlCloseUI);
}
else
GameHelper.ShowVideoAd("DownloadLive", isSuccess =>
{
if (isSuccess) TextureHelper.SaveVideoToAlbum(LiveConfig.Name, CtrlCloseUI);
});
});
InitView();
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.BuyVip, InitView);
GameDispatcher.Instance.AddListener(GameMsg.liveVideoLoaded, liveVideoLoaded);
}
protected override void RemoveListener()
{
HallManager.Instance.UpdateSecondEvent -= Updata;
GameDispatcher.Instance.RemoveListener(GameMsg.BuyVip, InitView);
GameDispatcher.Instance.RemoveListener(GameMsg.liveVideoLoaded, liveVideoLoaded);
}
private void liveVideoLoaded(object o)
{
HandlePvPlay();
// InitView();
}
#endregion
}
using System;
using DG.Tweening;
using FairyGUI;
using FGUI.LG_Common;
using FGUI.LG_live;
using Newtonsoft.Json;
using SGModule.Common.Extensions;
using SGModule.NetKit;
using UnityEngine;
using UnityEngine.Video;
using Object = UnityEngine.Object;
namespace BallKingdomCrush
{
public class LiveDetailUI : BaseUI
{
private LiveDetailUICtrl ctrl;
private LiveDetailModel model;
private com_liveDetail ui;
private VideoPlayer video;
public LiveDetailUI(LiveDetailUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.LiveDetailUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_live";
uiInfo.assetName = "com_liveDetail";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
//初始化页面逻辑
private void Updata()
{
if (GameHelper.GetNowTime() < livedata_.LiveADTime)
{
Debug.Log("??????????????????");
(ui.btn_watchad as btn_ad).state.selectedIndex = 1;
(ui.btn_watchad as btn_ad).text_time.text = CommonHelper.TimeFormat(
(int)livedata_.LiveADTime - Convert.ToInt32(GameHelper.GetNowTime()),
CountDownType.Hour);
}
else
{
(ui.btn_watchad as btn_ad).state.selectedIndex = 0;
if (LiveConfig.AD == livedata_.AD_num + 1)
ui.btn_watchad.title = "+" + (100 - livedata_.progress) + "%";
else
ui.btn_watchad.title = "+" + livedata_.Singleprogress + "%";
}
}
private void InitView(object a = null)
{
// TextureHelper.SetImgLoader(ui.com_loader.GetChild("loader") as GLoader, LiveConfig.Name, () =>
// {
// });
Debug.Log(JsonConvert.SerializeObject(livedata_));
Debug.Log(JsonConvert.SerializeObject(LiveConfig));
Updata();
var btn_down_coin = ((btn_unlock)ui.btn_download_coin);
if (GameHelper.GetVipLevel() >= 1)
{
(ui.btn_download as btn_claim_1).have_vip.selectedIndex = 1;
ui.is_vip.selectedIndex = 1;
}
else
{
ui.is_vip.selectedIndex = 0;
btn_down_coin.down_load.selectedIndex = 1;
}
if (livedata_.progress < 100)
{
ui.state.selectedIndex = 0;
if (LiveConfig.AD == 0) ui.can_speed.selectedIndex = 1;
if (LiveConfig.SubscribeUnlock == 1)
{
ui.SubscribeUnlock.selectedIndex = 1;
if (GameHelper.GetVipLevel() > 0)
{
ui.btn_pay.visible = false;
ui.btn_watchad.visible = false;
}
}
else
{
ui.SubscribeUnlock.selectedIndex = 0;
}
}
else
{
ui.state.selectedIndex = 1;
if (video != null) video.Play();
}
(ui.img_cover.GetChild("img_mask") as GImage).fillAmount = (float)(100 - livedata_.progress) / 100;
ui.progress_live.value = (float)livedata_.progress;
//ui.btn_pay.title = LiveConfig.GoldCoins.ToString();
Debug.Log(LiveConfig.GoldCoins);
var need_gold = (int)MathF.Ceiling((100f - livedata_.progress) * LiveConfig.GoldCoins / 100);
ui.btn_pay.title = need_gold.ToString();
if (LiveConfig.AD == livedata_.AD_num + 1)
ui.btn_watchad.title = "+" + (100 - livedata_.progress) + "%";
else
ui.btn_watchad.title = "+" + livedata_.Singleprogress + "%";
ui.btn_pay.SetClick(() =>
{
if (DataMgr.Coin.Value >= need_gold)
{
DataMgr.Coin.Value -= need_gold;
livedata_.progress = 100;
DataMgr.LiveDataDic.Value[index] = livedata_;
Debug.Log($"[解锁成功 0] LiveData总数为: {DataMgr.LiveDataDic.Value.Count}");
DataMgr.LiveDataDic.Save();
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
GameDispatcher.Instance.Dispatch(GameMsg.LiveChange, index);
InitView();
GameHelper.ShowTips("unlock_success", true);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.unlock_live_resources);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
ui.btn_watchad.SetClick(() =>
{
if (livedata_.LiveADTime < GameHelper.GetNowTime())
GameHelper.ShowVideoAd("UnlockLive", isSuccess =>
{
if (isSuccess)
{
livedata_.AD_num++;
if (LiveConfig.AD == livedata_.AD_num)
{
livedata_.progress = 100;
GameHelper.ShowTips("unlock_success", true);
}
else
{
livedata_.progress += livedata_.Singleprogress;
}
DataMgr.LiveDataDic.Value[index] = livedata_;
Debug.Log($"[解锁成功 1] LiveData总数为: {DataMgr.LiveDataDic.Value.Count}");
DataMgr.LiveDataDic.Save();
livedata_.LiveADTime = GameHelper.GetNowTime() + LiveConfig.CD;
SaveData.SaveDataFunc();
// if (livedata_.progress == 100) HandlePvPlay();
InitView();
GameDispatcher.Instance.Dispatch(GameMsg.LiveChange, index);
}
});
});
ui.btn_vip_unlock.SetClick(() =>
{
if (GameHelper.GetVipLevel() > 0)
{
livedata_.progress = 100;
DataMgr.LiveDataDic.Value[index] = livedata_;
Debug.Log($"[解锁成功 0] LiveData总数为: {DataMgr.LiveDataDic.Value.Count}");
DataMgr.LiveDataDic.Save();
GameDispatcher.Instance.Dispatch(GameMsg.LiveChange, index);
// HandlePvPlay();
InitView();
GameHelper.ShowTips("unlock_success", true);
string eventName = ADEventTrack.Property.vip_live_unclock_ + (index + 1);
TrackKit.SendEvent(ADEventTrack.VipLive, eventName);
}
else
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.VipClubViewUI_Open, 2);
TrackKit.SendEvent(ADEventTrack.VipLive, ADEventTrack.Property.vip_live_unclock);
}
});
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.LiveDetailModel) as LiveDetailModel;
}
protected override void OnClose()
{
if (video != null) Object.Destroy(video.gameObject);
HallManager.Instance.UpdateSecondEvent -= Updata;
VideoPlayerHandover.Return();
}
protected override void OnBind()
{
ui = baseUI as com_liveDetail;
}
private void HandlePvPlay()
{
Debug.Log("HandlePvPlay: " + index);
var secondUIRoot = ui.displayObject.gameObject.transform;
var loader = ui.com_loader.GetChild("loader") as GLoader;
// 接管播放器
VideoPlayerHandover.TakeOver(player, secondUIRoot, loader);
ui.img_cover.visible = false;
}
private int index;
private VideoPlayer player;
private LiveData livedata_;
private Live LiveConfig;
protected override void OnOpenBefore(object args)
{
var tuple = ((int index, VideoPlayer player))args;
index = tuple.index;
player = tuple.player;
player.audioOutputMode = VideoAudioOutputMode.None;
// 从配置表取配置(这里还是 List,如果有 Id 字段可改成字典)
LiveConfig = ConfigSystem.GetLiveConfig()[index];
livedata_ = PreDownloadManager.GetLiveDataByIndex(LiveConfig, index);
ui.btn_close.SetClick(() => { CtrlCloseUI(); });
if (livedata_.progress >= 100 && LiveVideoManager.Instance.ExistVideo(LiveConfig.Name))
HandlePvPlay();
else
{
var coverLoader = ui.img_cover.GetChild("loader") as GLoader;
LiveVideoManager.Instance.GetVideoCover(coverLoader, LiveConfig.Name + "_cover", (tex) =>
{
if (tex != null)
{
if (coverLoader != null)
{
coverLoader.texture = new NTexture(tex);
coverLoader.visible = true;
}
}
});
}
var btn_down_coin = ((btn_unlock)ui.btn_download_coin);
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
btn_down_coin.title = downloadCoinNum.ToString();
HallManager.Instance.UpdateSecondEvent += Updata;
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
DataMgr.Coin.Value -= downloadCoinNum;
GameDispatcher.Instance.Dispatch(GameMsg.Update101);
TextureHelper.SaveVideoToAlbum(LiveConfig.Name, CtrlCloseUI);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
ui.btn_download.SetClick(() =>
{
if (GameHelper.GetVipLevel() >= 1)
{
TextureHelper.SaveVideoToAlbum(LiveConfig.Name, CtrlCloseUI);
}
else
GameHelper.ShowVideoAd("DownloadLive", isSuccess =>
{
if (isSuccess) TextureHelper.SaveVideoToAlbum(LiveConfig.Name, CtrlCloseUI);
});
});
InitView();
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.BuyVip, InitView);
GameDispatcher.Instance.AddListener(GameMsg.liveVideoLoaded, liveVideoLoaded);
}
protected override void RemoveListener()
{
HallManager.Instance.UpdateSecondEvent -= Updata;
GameDispatcher.Instance.RemoveListener(GameMsg.BuyVip, InitView);
GameDispatcher.Instance.RemoveListener(GameMsg.liveVideoLoaded, liveVideoLoaded);
}
private void liveVideoLoaded(object o)
{
HandlePvPlay();
// InitView();
}
#endregion
}
}
+238 -234
View File
@@ -1,235 +1,239 @@
using System;
using FairyGUI;
using FGUI.ZM_Setting_07;
// using FGUI.G006_menu;
using UnityEngine;
namespace BallKingdomCrush
{
public class MenuUI : BaseUI
{
private MenuUICtrl ctrl;
private MenuModel model;
private FGUI.ZM_Setting_07.com_setting ui;
private int selectIndex = -1;
private int total_item;
public MenuUI(MenuUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.MenuUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "ZM_Setting_07";
uiInfo.assetName = "com_setting";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
model = moduleManager.GetModel(ModelConst.MenuModel) as MenuModel;
}
protected override void OnClose()
{
CommonHelper.FadeOut(ui);
}
protected override void OnBind()
{
ui = baseUI as FGUI.ZM_Setting_07.com_setting;
}
protected override void OnOpenBefore(object args)
{
total_item = 8;
selectIndex = DataMgr.PlayerAvatarId.Value;
InitView();
}
protected override void OnOpen(object args)
{
CommonHelper.FadeIn(ui);
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
HallManager.Instance.AddChangeGiftSwitch(InitView);
}
protected override void RemoveListener()
{
HallManager.Instance.RemoveChangeGiftSwitch(InitView);
}
#endregion
private void InitView()
{
var namStr = GameHelper.GetUserName();
// com_Person.edit_name.input.text = namStr;
// com_Person.btn_update.SetClick(UpdateUserInfo);
// com_Person.edit_name.btn_amend.SetClick(SaveName);
ui.btn_back.SetClick(OnCloseView);
ui.btn_music.SetClick(OnClickSetMusic);
ui.btn_sound.SetClick(OnClickSoundBtn);
ui.btn_privacy.menus.selectedIndex = btn_menu.Menus_privacy;
ui.btn_terms.menus.selectedIndex = btn_menu.Menus_terms;
ui.btn_language.menus.selectedIndex = btn_menu.Menus_delete;
ui.btn_official.menus.selectedIndex = btn_menu.Menus_official;
ui.btn_restore.menus.selectedIndex = 4;
ui.btn_privacy.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrivacyUI_Open, 0); });
ui.btn_terms.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrivacyUI_Open, 1); });
ui.btn_language.SetClick(() =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LanguageViewUI_Open);
});
ui.btn_official.SetClick(() => { Application.OpenURL("https://official.piggyhydration.com/"); });
ui.btn_restore.SetClick(Restore);
SetUID();
SetVersion();
RefreshMusicUI();
// com_Person.list.itemRenderer = UpdateItem;
// com_Person.list.numItems = total_item;
}
private void Restore()
{
if (GameHelper.IsAdModelOfPay()) return;
// GooglePayManager.Instance.RestoreNonConsumable();
}
// private void UpdateItem(int index, GObject items)
// {
// var currentIndex = index + 1;
// var head = items as btn_item_head;
// var imgHead = head.head as btn_head;
// TextureHelper.SetAvatarToLoader(currentIndex, imgHead.load_avatar);
// head.head_select.selectedIndex = selectIndex == currentIndex
// ? btn_item_head.Head_select_select
// : btn_item_head.Head_select_none;
// head.SetClick(() =>
// {
// selectIndex = currentIndex;
// com_Person.list.numItems = total_item;
// });
// }
private void UpdateUserInfo()
{
if (selectIndex != -1)
{
DataMgr.PlayerAvatarId.Value = selectIndex;
}
SaveName();
OnCloseView();
}
private void SaveName()
{
// var name = com_Person.edit_name.input.text;
// if (string.IsNullOrEmpty(name) || name.IsNullOrWhiteSpace())
// {
// GameHelper.ShowTips("empty_input", true);
// return;
// }
// // if (name.Equals(GameHelper.GetPlayerInviteCode()))
// // {
// // return;
// // }
// if (name.Equals(PreferencesMgr.Instance.PlayerName)) return;
// GameHelper.ShowTips($"Name changed successfully");
// PreferencesMgr.Instance.PlayerName = name;
}
private void SetVersion()
{
ui.text_version.SetVar("count", Application.version).FlushVars();
}
private void SetUID()
{
ui.text_uid.SetVar("UID", GameHelper.GetLoginModel().Uid.ToString()).FlushVars();
}
public override void OnSwitchLanguage()
{
base.OnSwitchLanguage();
SetVersion();
SetUID();
}
private void CloseMenu(Action action = null)
{
CtrlCloseUI();
action?.Invoke();
}
private void OnCloseView()
{
CloseMenu();
}
private void OnClickSetMusic()
{
model.IsOpenMusic = !model.IsOpenMusic;
RefreshMusicUI();
}
private void OnClickSoundBtn()
{
model.IsOpenEffect = !model.IsOpenEffect;
RefreshMusicUI();
}
private void RefreshMusicUI()
{
ui.btn_music.music_on_off.selectedIndex =
model.IsOpenMusic ? 0 : 1;
ui.btn_sound.sound_on_off.selectedIndex =
model.IsOpenEffect ? 0 : 1;
}
}
using System;
using FairyGUI;
using FGUI.ZM_Setting_07;
// using FGUI.G006_menu;
using UnityEngine;
namespace BallKingdomCrush
{
public class MenuUI : BaseUI
{
private MenuUICtrl ctrl;
private MenuModel model;
private FGUI.ZM_Setting_07.com_setting ui;
private int selectIndex = -1;
private int total_item;
public MenuUI(MenuUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.MenuUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "ZM_Setting_07";
uiInfo.assetName = "com_setting";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
model = moduleManager.GetModel(ModelConst.MenuModel) as MenuModel;
}
protected override void OnClose()
{
CommonHelper.FadeOut(ui);
}
protected override void OnBind()
{
ui = baseUI as FGUI.ZM_Setting_07.com_setting;
}
protected override void OnOpenBefore(object args)
{
total_item = 8;
selectIndex = DataMgr.PlayerAvatarId.Value;
InitView();
}
protected override void OnOpen(object args)
{
CommonHelper.FadeIn(ui);
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
HallManager.Instance.AddChangeGiftSwitch(InitView);
}
protected override void RemoveListener()
{
HallManager.Instance.RemoveChangeGiftSwitch(InitView);
}
#endregion
private void InitView()
{
var namStr = GameHelper.GetUserName();
// com_Person.edit_name.input.text = namStr;
// com_Person.btn_update.SetClick(UpdateUserInfo);
// com_Person.edit_name.btn_amend.SetClick(SaveName);
ui.btn_back.SetClick(OnCloseView);
ui.btn_music.SetClick(OnClickSetMusic);
ui.btn_sound.SetClick(OnClickSoundBtn);
ui.btn_privacy.menus.selectedIndex = btn_menu.Menus_privacy;
ui.btn_terms.menus.selectedIndex = btn_menu.Menus_terms;
ui.btn_language.menus.selectedIndex = btn_menu.Menus_delete;
ui.btn_official.menus.selectedIndex = btn_menu.Menus_official;
ui.btn_email.menus.selectedIndex = 5;
ui.btn_restore.menus.selectedIndex = 4;
ui.btn_privacy.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrivacyUI_Open, 0); });
ui.btn_terms.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrivacyUI_Open, 1); });
ui.btn_language.SetClick(() =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LanguageViewUI_Open);
});
ui.btn_official.SetClick(() => { Application.OpenURL("https://www.ballcrushbest.com"); });
ui.btn_restore.SetClick(Restore);
ui.btn_email.SetClick(() => {
GameHelper.OpenEmail();
});
SetUID();
SetVersion();
RefreshMusicUI();
// com_Person.list.itemRenderer = UpdateItem;
// com_Person.list.numItems = total_item;
}
private void Restore()
{
if (GameHelper.IsAdModelOfPay()) return;
// GooglePayManager.Instance.RestoreNonConsumable();
}
// private void UpdateItem(int index, GObject items)
// {
// var currentIndex = index + 1;
// var head = items as btn_item_head;
// var imgHead = head.head as btn_head;
// TextureHelper.SetAvatarToLoader(currentIndex, imgHead.load_avatar);
// head.head_select.selectedIndex = selectIndex == currentIndex
// ? btn_item_head.Head_select_select
// : btn_item_head.Head_select_none;
// head.SetClick(() =>
// {
// selectIndex = currentIndex;
// com_Person.list.numItems = total_item;
// });
// }
private void UpdateUserInfo()
{
if (selectIndex != -1)
{
DataMgr.PlayerAvatarId.Value = selectIndex;
}
SaveName();
OnCloseView();
}
private void SaveName()
{
// var name = com_Person.edit_name.input.text;
// if (string.IsNullOrEmpty(name) || name.IsNullOrWhiteSpace())
// {
// GameHelper.ShowTips("empty_input", true);
// return;
// }
// // if (name.Equals(GameHelper.GetPlayerInviteCode()))
// // {
// // return;
// // }
// if (name.Equals(PreferencesMgr.Instance.PlayerName)) return;
// GameHelper.ShowTips($"Name changed successfully");
// PreferencesMgr.Instance.PlayerName = name;
}
private void SetVersion()
{
ui.text_version.SetVar("count", Application.version).FlushVars();
}
private void SetUID()
{
ui.text_uid.SetVar("UID", GameHelper.GetLoginModel().Uid.ToString()).FlushVars();
}
public override void OnSwitchLanguage()
{
base.OnSwitchLanguage();
SetVersion();
SetUID();
}
private void CloseMenu(Action action = null)
{
CtrlCloseUI();
action?.Invoke();
}
private void OnCloseView()
{
CloseMenu();
}
private void OnClickSetMusic()
{
model.IsOpenMusic = !model.IsOpenMusic;
RefreshMusicUI();
}
private void OnClickSoundBtn()
{
model.IsOpenEffect = !model.IsOpenEffect;
RefreshMusicUI();
}
private void RefreshMusicUI()
{
ui.btn_music.music_on_off.selectedIndex =
model.IsOpenMusic ? 0 : 1;
ui.btn_sound.sound_on_off.selectedIndex =
model.IsOpenEffect ? 0 : 1;
}
}
}
File diff suppressed because it is too large Load Diff
+122 -122
View File
@@ -1,123 +1,123 @@
using System;
using DG.Tweening;
using Newtonsoft.Json;
using Spine.Unity;
using UnityEngine;
namespace BallKingdomCrush
{
public class OpenGameUI : BaseUI
{
private OpenGameUICtrl ctrl;
private OpenGameModel model;
private FGUI.ZM_Game_04.com_open ui;
public OpenGameUI(OpenGameUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.OpenGameUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "ZM_Game_04";
uiInfo.assetName = "com_open";
uiInfo.layerType = UILayerType.Highest;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = false;
}
#region
protected override void OnInit()
{
// model = ModuleManager.Instance.GetModel(ModelConst.OpenGameModel) as OpenGameModel;
}
protected override void OnClose()
{
}
protected override void OnBind()
{
ui = baseUI as FGUI.ZM_Game_04.com_open;
}
protected override void OnOpenBefore(object args)
{
Debug.Log(JsonConvert.SerializeObject(DataMgr.LevelUnlockList.Value));
DOVirtual.DelayedCall(0.7f, () =>
{
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, args);
});
InitView();
if (GameHelper.IsGiftSwitch())
{
DOVirtual.DelayedCall(0.2f, () =>
{
Debug.Log($"open 1 game------------------{GameHelper.GetLevel() - 1}");
if (GameHelper.GetLevel() - 1 < ConfigSystem.GetConfig<LevelUnlock>().Count)
{
LevelUnlock levelUnlock_ = ConfigSystem.GetConfig<LevelUnlock>()[GameHelper.GetLevel() - 1];
Debug.Log($"open 2 game------------------{levelUnlock_.LeveType}");
if (levelUnlock_.LeveType != 0)
{
Debug.Log($"open 3 game------------------{DataMgr.LevelUnlockList.Value.Count}");
if (!DataMgr.LevelUnlockList.Value.Contains(GameHelper.GetLevel() - 1))
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelUI_Open, GameHelper.GetLevel() - 1);
}
}
}
});
}
ui.t0.Play();
if (AudioManager.Instance.IsOpenEffect)
{
AudioManager.Instance.PlayDynamicEffect(AudioConst.game_open);
}
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
}
protected override void RemoveListener()
{
}
#endregion
private Action closeCallback;
//初始化页面逻辑
private void InitView()
{
string stage = Language.GetContentParams("need_lv_text", GameHelper.GetLevel());
ui.text_level.text = stage;
DOVirtual.DelayedCall(1.2f, () => { CtrlCloseUI(); });
}
}
using System;
using DG.Tweening;
using Newtonsoft.Json;
using Spine.Unity;
using UnityEngine;
namespace BallKingdomCrush
{
public class OpenGameUI : BaseUI
{
private OpenGameUICtrl ctrl;
private OpenGameModel model;
private FGUI.ZM_Game_04.com_open ui;
public OpenGameUI(OpenGameUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.OpenGameUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "ZM_Game_04";
uiInfo.assetName = "com_open";
uiInfo.layerType = UILayerType.Highest;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = false;
}
#region
protected override void OnInit()
{
// model = ModuleManager.Instance.GetModel(ModelConst.OpenGameModel) as OpenGameModel;
}
protected override void OnClose()
{
}
protected override void OnBind()
{
ui = baseUI as FGUI.ZM_Game_04.com_open;
}
protected override void OnOpenBefore(object args)
{
Debug.Log(JsonConvert.SerializeObject(DataMgr.LevelUnlockList.Value));
DOVirtual.DelayedCall(0.7f, () =>
{
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, args);
});
InitView();
if (GameHelper.IsGiftSwitch())
{
DOVirtual.DelayedCall(0.2f, () =>
{
Debug.Log($"open 1 game------------------{GameHelper.GetLevel() - 1}");
if (GameHelper.GetLevel() - 1 < ConfigSystem.GetLevelUnlockConfig().Count)
{
LevelUnlock levelUnlock_ = ConfigSystem.GetLevelUnlockConfig()[GameHelper.GetLevel() - 1];
Debug.Log($"open 2 game------------------{levelUnlock_.LeveType}");
if (levelUnlock_.LeveType != 0)
{
Debug.Log($"open 3 game------------------{DataMgr.LevelUnlockList.Value.Count}");
if (!DataMgr.LevelUnlockList.Value.Contains(GameHelper.GetLevel() - 1))
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelUI_Open, GameHelper.GetLevel() - 1);
}
}
}
});
}
ui.t0.Play();
if (AudioManager.Instance.IsOpenEffect)
{
AudioManager.Instance.PlayDynamicEffect(AudioConst.game_open);
}
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
protected override void AddListener()
{
}
protected override void RemoveListener()
{
}
#endregion
private Action closeCallback;
//初始化页面逻辑
private void InitView()
{
string stage = Language.GetContentParams("need_lv_text", GameHelper.GetLevel());
ui.text_level.text = stage;
DOVirtual.DelayedCall(1.2f, () => { CtrlCloseUI(); });
}
}
}
File diff suppressed because it is too large Load Diff
+35 -11
View File
@@ -4,9 +4,11 @@ using AppsFlyerSDK;
using FairyGUI;
using IgnoreOPS;
using SGModule.Common.Extensions;
using SGModule.GooglePay;
using SGModule.Net;
using SGModule.NetKit;
using UnityEngine;
using ZrZYFo6bYXYM71YyLSDK;
namespace BallKingdomCrush
{
@@ -291,10 +293,10 @@ namespace BallKingdomCrush
int startIndex = "secret_albnums".Length;
string suffix = type[startIndex..]; // 截取 "gold" 后的所有字符
int suffix_num = int.Parse(suffix);
var model = ConfigSystem.GetConfig<SecretAlbums>()[suffix_num];
var model = ConfigSystem.GetSecretAlbumsConfig()[suffix_num];
if (model.PayType == (int)UnlockPayType.Pay)
{
purch_number = ConfigSystem.GetConfig<SecretAlbums>()[suffix_num].DiscountPrice.ToString();
purch_number = ConfigSystem.GetSecretAlbumsConfig()[suffix_num].DiscountPrice.ToString();
}
}
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
@@ -303,20 +305,42 @@ namespace BallKingdomCrush
{
var payType = MaxPayManager.isOfficialPay ? 0 : 1;
// 付费上报BI
BIManager.Instance.TrackPurchase(purch_number.As<double>(), "USD", payType.ToString(), type, "paid");
// BIManager.Instance.TrackPurchase(purch_number.As<double>(), "USD", payType.ToString(), type, "paid");
Debug.Log("付费收益上报AF----------- " + revenue);
adCallbackInfo.Clear();
adCallbackInfo.Add("appsflyer_id", AppsFlyer.getAppsFlyerId());
adCallbackInfo.Add("customer_user_id", GameHelper.GetLoginModel().Uid.ToString());
adCallbackInfo.Add("af_currency", "USD");
adCallbackInfo.Add("af_revenue", revenue.ToString(CultureInfo.InvariantCulture));
AppsFlyer.sendEvent("af_purchase", adCallbackInfo);
// Debug.Log("付费收益上报AF----------- " + revenue);
// adCallbackInfo.Clear();
// adCallbackInfo.Add("appsflyer_id", AppsFlyer.getAppsFlyerId());
// adCallbackInfo.Add("customer_user_id", GameHelper.GetLoginModel().Uid.ToString());
// adCallbackInfo.Add("af_currency", "USD");
// adCallbackInfo.Add("af_revenue", revenue.ToString(CultureInfo.InvariantCulture));
// AppsFlyer.sendEvent("af_purchase", adCallbackInfo);
FireBaseManger.OnPayRevenueEvent(purch_number.As<double>());
// FireBaseManger.OnPayRevenueEvent(purch_number.As<double>());
// ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.Track("af_purchase", new Dictionary<string, string>()
// {
// {"evt1", "1"},
// });
TrackKit.SendEvent(AfPurchaseTrack.Event, AfPurchaseTrack.Property.af_revenue,(int)(purch_number.As<decimal>() * 10000));
var payData = new GooglePayData
{
sku = type,
currency = "USD",
amount = (int)(purch_number.As<decimal>() * 100),
isCompleted = true
};
//上报给服务器,用来做数据分析,之前创建订单接口改的
GooglePayNet.GooglePayCreate<GooglePayData>(payData, (response) =>
{
Debug.Log($"[付费收益] Purchase-----type--{type}----{response.IsSuccess}");
if (response.IsSuccess)
{
}
});
}
}
@@ -64,7 +64,7 @@ namespace BallKingdomCrush
// 强制卸载未使用的资源
// Resources.UnloadUnusedAssets();
MemoryManager.CleanMemoryMonitor();
// MemoryManager.CleanMemoryMonitor();
}
protected override void OnBind()
@@ -86,7 +86,7 @@ namespace BallKingdomCrush
var eventName = GameHelper.IsAdModelOfPay() ? ADEventTrack.AD_Event : ADEventTrack.MaxPayEvent;
TrackKit.SendEvent(eventName, ADEventTrack.Property.secret_albums_show);
_secretData = ConfigSystem.GetConfig<SecretAlbums>();
_secretData = ConfigSystem.GetSecretAlbumsConfig();
InitView();
}
@@ -66,7 +66,7 @@ namespace BallKingdomCrush
loader_list.Clear();
// 强制卸载未使用的资源
Resources.UnloadUnusedAssets();
// Resources.UnloadUnusedAssets();
}
protected override void OnBind()

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