删除图鉴内容

This commit is contained in:
2026-06-12 18:28:19 +08:00
parent 1e5f719b4e
commit e4381d18b5
200 changed files with 89 additions and 11093 deletions
+1 -237
View File
@@ -577,45 +577,7 @@ public static IEnumerator LoadTexture(string fileName, GLoader loader, Action<NT
return tempPath;
}
public static IEnumerator WriteTempBeforeOpenCoroutine_()
{
System.Diagnostics.Stopwatch stopwatch = System.Diagnostics.Stopwatch.StartNew();
var levelUnlocks = ConfigSystem.GetConfig<LevelUnlock>();
var FreeImageLibrary_ = ConfigSystem.GetConfig<FreeImageLibrary>();
var ADImageLibrary_ = ConfigSystem.GetConfig<ADImageLibrary>();
var SpecialImageLibrary_ = ConfigSystem.GetConfig<SpecialImageLibrary>();
var VIPImageLibrary_ = ConfigSystem.GetConfig<VIPImageLibrary>();
for (int i = 0; i < GameHelper.GetCommonModel().MultiModal - 1; i++)
{
GetDecryptedImagePath(levelUnlocks[i].Name, FolderNames.AlbumName);
yield return null;
}
var LevelUnlockListNew = DataMgr.LevelUnlockListNew.Value;
for (int i = 0; i <LevelUnlockListNew.Count; i++)
{
switch (LevelUnlockListNew[i].type)
{
case 0:
GetDecryptedImagePath(FreeImageLibrary_[LevelUnlockListNew[i].config_index].Name, FolderNames.AlbumName);
break;
case 1:
GetDecryptedImagePath(ADImageLibrary_[LevelUnlockListNew[i].config_index].Name, FolderNames.AlbumName);
break;
case 2:
GetDecryptedImagePath(SpecialImageLibrary_[LevelUnlockListNew[i].config_index].Name, FolderNames.AlbumName);
break;
case 3:
GetDecryptedImagePath(VIPImageLibrary_[LevelUnlockListNew[i].config_index].Name, FolderNames.AlbumName);
break;
}
yield return null;
}
stopwatch.Stop();
UnityEngine.Debug.Log($"WriteTempBeforeOpen 协程执行耗时: {stopwatch.ElapsedMilliseconds} 毫秒");
}
#endregion
@@ -628,136 +590,10 @@ public static IEnumerator LoadTexture(string fileName, GLoader loader, Action<NT
onReady?.Invoke();
}
public static void SaveImageToAlbum(string fileName, string encryptedFolder, Action onSuccess = null)
{
try
{
// 加密图片路径
string encryptedPath = Path.Combine(getResPath(), encryptedFolder, fileName + ".jpg");
if (!File.Exists(encryptedPath))
{
Debug.LogWarning($"加密图片不存在: {encryptedPath}");
return;
}
// 解密为字节数组
byte[] decryptedBytes = Rescrypt.DecryptFileToBytes(encryptedPath);
// 写入临时路径(系统可访问)
string tempPath = Path.Combine(Application.temporaryCachePath, fileName + "_temp.jpg");
File.WriteAllBytes(tempPath, decryptedBytes);
BrigdeIOS.SaveImageWithCustomDate(tempPath);
// 保存到系统相册
// NativeGallery.SaveImageToGallery(tempPath, "MyAlbum", fileName + ".jpg", (bool success, string path) =>
// {
// if (success)
// {
// GameHelper.ShowTips("save_successed", true);
// onSuccess?.Invoke();
// }
// else
// {
// Debug.LogWarning("保存到相册失败");
// }
//
// // 可选:清理临时文件
// if (File.Exists(tempPath))
// File.Delete(tempPath);
// });
}
catch (Exception ex)
{
Debug.LogError($"保存加密图片到相册失败: {ex.Message}");
}
}
public static void SaveVideoToAlbum(string fileName, Action onSuccess = null)
{
try
{
string localPath = Path.Combine(getResPath(), FolderNames.VideoName, fileName + ".mp4");
BrigdeIOS.SaveVideoWithCustomDate(localPath);
// File.SetCreationTime(localPath, DateTime.Now);
// File.SetCreationTimeUtc(localPath, DateTime.Now);
// File.SetLastWriteTime(localPath, DateTime.Now);
// File.SetLastWriteTimeUtc(localPath, DateTime.Now);
// // CrazyAsyKit.StartCoroutine(GetSaveVideo(fileName, (isSuccess) =>
// // {
//
// // }));
// NativeGallery.SaveVideoToGallery(localPath, "MyAlbum", "my_video.mp4", (bool success, string path) =>
// {
// if (success)
// {
// GameHelper.ShowTips("save_successed", true);
// onSuccess?.Invoke();
// }
// });
}
catch (Exception ex)
{
Debug.LogError($"保存加密视频到相册失败: {ex.Message}");
}
}
public static void SetVideoLoader(VideoPlayer player, GLoader loader, string fileName,
Action<VideoPlayer> action = null, bool play = true)
{
VideoLoadScheduler.EnqueueLoad(player, fileName, loader, videoPlayer =>
{
Debug.Log("RendererList------视频加载成功!-" + fileName);
Debug.Log("[绑定播放器 EnqueueLoad]=========1=== ");
if (videoPlayer != null)
{
Debug.Log("视频加载成功!");
action?.Invoke(videoPlayer);
}
else
{
Debug.Log("视频加载失败!");
VideoPlayerPool.Instance.ReturnPlayer(player);
action?.Invoke(null);
}
}, play);
}
public static void SetImageMosaic(GLoader loader, int num = 80)
{
var shader = Resources.Load<Shader>("LoveLegendAssets/Shader/Mosaic");
if (shader == null)
{
Debug.LogError("找不到 ShaderCustom/Mosaic。请确保 shader 名称正确并已包含到构建中。");
return;
}
var material = new Material(shader);
material.SetFloat("_BlockSize", num); // 假设你 shader 中的 blockSize 参数是这个
loader.material = material;
}
#region
public static void SetImageBlur(GLoader loader)
{
if (loader == null || loader.isDisposed || loader.texture == null || loader.material.name == "Custom/Blur") return;
if (loader.material != null) MaterialPool.Return(loader.material);
loader.material = MaterialPool.GetBlur();
}
public static void CancelImageBlur(GLoader loader)
{
if (loader == null || loader.isDisposed || loader.texture == null || loader.material == null || loader.material.name != "Custom/Blur") return;
if (loader.material != null) MaterialPool.Return(loader.material);
loader.material = MaterialPool.GetNormal();
}
#endregion
/// <summary>
@@ -771,78 +607,6 @@ public static IEnumerator LoadTexture(string fileName, GLoader loader, Action<NT
private static Sprite _currentBackgroundSprite;
private static SpriteRenderer _spriteRenderer;
private static NTexture _currentNTexture; // 新增:缓存 NTexture
public static void setGamebg(string fileName)
{
// 只获取一次组件
if (_spriteRenderer == null)
{
var go = GameObject.Find("game_bg");
if (go == null)
{
Debug.LogError("找不到名为 'game_bg' 的 GameObject");
return;
}
_spriteRenderer = go.GetComponent<SpriteRenderer>();
if (_spriteRenderer == null)
{
Debug.LogError("'game_bg' 上没有找到 SpriteRenderer 组件!");
return;
}
}
if (_spriteRenderer && _spriteRenderer.sprite && _spriteRenderer.sprite.texture.name == fileName)
{
return;
}
// 调用统一的 SetImgLoader,不需要再自己写下载逻辑
SetImgLoader(null, fileName, nTex =>
{
if (nTex != null && nTex.nativeTexture != null)
{
Debug.Log("背景图片加载成功!");
var tex2D = nTex.nativeTexture as Texture2D;
if (tex2D == null)
{
Debug.LogError("NTexture 转换失败!");
return;
}
tex2D.name = fileName;
// 创建 Sprite
var sprite = Sprite.Create(
tex2D,
new Rect(0, 0, tex2D.width, tex2D.height),
new Vector2(0.5f, 0.5f)
);
_spriteRenderer.sprite = sprite;
if (_currentNTexture != null)
{
_currentNTexture.Dispose();
_currentNTexture = null;
}
if (_currentBackgroundSprite != null)
{
Object.Destroy(_currentBackgroundSprite);
_currentBackgroundSprite = null;
}
_currentNTexture = nTex;
_currentBackgroundSprite = sprite;
var currentWidth = _spriteRenderer.sprite.bounds.size.x;
var scaleFactor = 64f / currentWidth;
// 等比缩放
_spriteRenderer.transform.localScale = new Vector3(scaleFactor, scaleFactor, 1);
}
else
{
Debug.LogError("背景图片加载失败!");
}
}, "LevelAlbums/", FolderNames.AlbumName, true, false, true); // ✅ 背景一般是立刻需要的,走优先下载
}
public static void GetCardIcon(bool isLogo = false, UnityAction<NTexture> action = null)
+19 -22
View File
@@ -87,32 +87,29 @@ namespace LoveLegend
type = a.type
})
.ToList();
if (GameHelper.IsGiftSwitch())
{
GameObject.Find("game_bg_a").SetActive(false);
}
//初始化商品
ApplePayManager.Instance.InitProduct(listB,
ConfigManager.GameConfig.packageName, PurchasingManager.ApplePaySuccessCallback(appleData));
if (GameHelper.IsGiftSwitch() && enterGame)
{
if (GameHelper.GetLevel() < GameHelper.GetCommonModel().MultiModal)
{
EnterGame(enterGame);
}
else
{
if (!DataMgr.LevelUnlockListNew.Value.Any(x => x.level_ == GameHelper.GetLevel()))
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open, true);
}
else
{
EnterGame(enterGame);
}
}
}
// if (GameHelper.IsGiftSwitch() && enterGame)
// {
// if (GameHelper.GetLevel() < GameHelper.GetCommonModel().MultiModal)
// {
// EnterGame(enterGame);
// }
// else
// {
// if (!DataMgr.LevelUnlockListNew.Value.Any(x => x.level_ == GameHelper.GetLevel()))
// {
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open, true);
// }
// else
// {
// EnterGame(enterGame);
// }
// }
// }
TrackKit.TrackLoginFunnel(LoginFunnelEventType.EnterHall);
-565
View File
@@ -1,565 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using FairyGUI;
using SGModule.Common.Base;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Video;
namespace LoveLegend
{
public class LiveVideoManager : SingletonMonoBehaviour<LiveVideoManager>
{
public static string videoBaseUrl = "";
// 封面缓存
// private readonly Dictionary<string, Texture2D> coverCache = new();
// 封面提取队列(避免同时开多个VideoPlayer
private readonly Queue<CoverTask> coverQueue = new();
// 已下载视频缓存
private readonly HashSet<string> downloadedVideos = new();
// 当前正在下载的视频,用于去重
private readonly HashSet<string> downloadingSet = new();
// ==== 队列 ====
// 普通视频队列和优先队列
private readonly Queue<VideoTask> normalQueue = new();
private readonly Queue<VideoTask> priorityQueue = new();
private bool isExtracting;
private Coroutine normalCoroutine;
private Coroutine priorityCoroutine;
private string videoLocalDir => Path.Combine(TextureHelper.getResPath(), "LiveVideos");
private string coverLocalDir => Path.Combine(TextureHelper.getResPath(), "LiveVideoCovers");
protected override void Awake()
{
base.Awake();
InitDirs();
InitCache();
}
private void InitDirs()
{
if (!Directory.Exists(videoLocalDir))
Directory.CreateDirectory(videoLocalDir);
if (!Directory.Exists(coverLocalDir))
Directory.CreateDirectory(coverLocalDir);
}
private void InitCache()
{
var files = Directory.GetFiles(videoLocalDir, "*.mp4");
foreach (var file in files)
{
var fileName = Path.GetFileNameWithoutExtension(file);
downloadedVideos.Add(fileName);
}
}
#region
public void ClearAllCache()
{
// foreach (var tex in coverCache.Values)
// if (tex != null)
// Destroy(tex);
// coverCache.Clear();
if (Directory.Exists(coverLocalDir))
{
Directory.Delete(coverLocalDir, true);
Directory.CreateDirectory(coverLocalDir);
}
if (Directory.Exists(videoLocalDir))
{
Directory.Delete(videoLocalDir, true);
Directory.CreateDirectory(videoLocalDir);
downloadedVideos.Clear();
}
}
#endregion
#region
public IEnumerator LoadCover(string fileName, Action<Texture2D> callback)
{
Texture2D tex = null;
var persistentPath = Path.Combine(TextureHelper.getResPath(), "LiveVideoCovers", fileName + ".png");
if (File.Exists(persistentPath))
{
tex = LoadTextureFromFile(persistentPath);
if (tex != null)
{
callback?.Invoke(tex);
yield break;
}
}
var saPath = Path.Combine(Application.streamingAssetsPath, "LiveVideoCovers", fileName + ".jpg");
#if UNITY_ANDROID && !UNITY_EDITOR
using (UnityWebRequest www = UnityWebRequestTexture.GetTexture(saPath))
{
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success)
tex = DownloadHandlerTexture.GetContent(www);
else
Debug.LogWarning($"LoadCover StreamingAssets失败: {www.error}, file: {fileName}");
}
#else
if (File.Exists(saPath))
try
{
var data = File.ReadAllBytes(saPath);
tex = new Texture2D(2, 2);
tex.LoadImage(data);
}
catch (Exception e)
{
Debug.LogWarning($"LoadCover StreamingAssets读取失败: {fileName}, error: {e}");
}
#endif
callback?.Invoke(tex);
}
#endregion
public static IEnumerator LoadVideoToPlayer(VideoPlayer player, string fileName, GLoader loader,
Action<VideoPlayer> onComplete, bool play = true)
{
string localPath = null;
var isDone = false;
Instance.GetVideoLocalPath(fileName, path =>
{
localPath = path;
isDone = true;
});
Debug.Log("LoadVideoToPlayer ------1------" + isDone);
while (!isDone)
yield return null;
if (string.IsNullOrEmpty(localPath))
{
onComplete?.Invoke(null);
yield break;
}
if (player.IsDestroyed())
{
onComplete?.Invoke(null);
yield break;
}
player.source = VideoSource.Url;
Debug.Log("LoadVideoToPlayer diaoyongyici: " + fileName);
player.url = Application.platform == RuntimePlatform.Android && !Application.isEditor
? localPath
: "file://" + localPath;
player.isLooping = true;
player.playOnAwake = false;
var rtWidth = (int)loader.width;
var rtHeight = (int)loader.height;
var rt = new RenderTexture(rtWidth, rtHeight, 0);
rt.Create();
player.targetTexture = rt;
if (!loader.isDisposed)
{
Debug.Log("LoadVideoToPlayer loader is isDisposed: ");
loader.texture = new NTexture(rt);
loader.visible = false;
}
player.Prepare();
var timeout = 3f;
var timer = 0f;
while (!player.IsDestroyed() && !player.isPrepared && timer < timeout)
{
yield return null;
timer += Time.deltaTime;
}
if (player.IsDestroyed())
{
onComplete?.Invoke(null);
yield break;
}
if (!player.isPrepared)
{
if (rt != null && !rt.Equals(null)) rt.Release();
onComplete?.Invoke(null);
yield break;
}
if (play)
player.Play();
else
player.Pause();
if (!loader.isDisposed)
loader.visible = true;
onComplete?.Invoke(player);
}
#region + + +
public void GetVideoLocalPath(string fileName, Action<string> callback, bool priority = true, int maxRetry = 3,
bool hardCancel = false)
{
var localPath = Path.Combine(videoLocalDir, fileName + ".mp4");
// 已下载直接回调
if (downloadedVideos.Contains(fileName) && File.Exists(localPath))
{
callback?.Invoke(localPath);
return;
}
// 去重:如果正在下载中,也直接等待回调
if (downloadingSet.Contains(fileName))
{
StartCoroutine(WaitForDownload(fileName, callback));
return;
}
var task = new VideoTask
{
FileName = fileName,
LocalPath = localPath,
Callback = callback,
MaxRetry = maxRetry
};
if (priority)
{
if (hardCancel)
{
// 硬取消:停止当前优先队列协程,清空队列
if (priorityCoroutine != null)
{
StopCoroutine(priorityCoroutine);
priorityCoroutine = null;
}
priorityQueue.Clear();
}
priorityQueue.Enqueue(task);
if (priorityCoroutine == null)
priorityCoroutine = StartCoroutine(ProcessPriorityQueue());
}
else
{
normalQueue.Enqueue(task);
if (normalCoroutine == null)
normalCoroutine = StartCoroutine(ProcessNormalQueue());
}
}
// 等待正在下载的视频完成再回调
private IEnumerator WaitForDownload(string fileName, Action<string> callback)
{
while (downloadingSet.Contains(fileName))
yield return null;
var localPath = Path.Combine(videoLocalDir, fileName + ".mp4");
callback?.Invoke(File.Exists(localPath) ? localPath : null);
}
// 优先队列协程(单任务)
private IEnumerator ProcessPriorityQueue()
{
while (priorityQueue.Count > 0)
{
var task = priorityQueue.Dequeue();
yield return DownloadVideoCoroutine(task);
}
priorityCoroutine = null;
}
// 普通队列协程(单任务)
private IEnumerator ProcessNormalQueue()
{
while (normalQueue.Count > 0)
{
var task = normalQueue.Dequeue();
yield return DownloadVideoCoroutine(task);
}
normalCoroutine = null;
}
// 核心下载协程
private IEnumerator DownloadVideoCoroutine(VideoTask task)
{
// 再次检查本地是否已有,避免重复下载
if (downloadedVideos.Contains(task.FileName) && File.Exists(task.LocalPath))
{
task.Callback?.Invoke(task.LocalPath);
yield break;
}
downloadingSet.Add(task.FileName);
var tmpPath = task.LocalPath + ".downloading";
var url = videoBaseUrl + "LiveAlbums/" + task.FileName + ".mp4";
if (File.Exists(tmpPath)) File.Delete(tmpPath);
var attempt = 0;
var success = false;
while (attempt < task.MaxRetry)
{
attempt++;
using (var www = UnityWebRequest.Get(url))
{
www.downloadHandler = new DownloadHandlerFile(tmpPath, true);
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success)
{
if (File.Exists(task.LocalPath)) File.Delete(task.LocalPath);
Debug.Log($"[DownloadVideo] 下载成功,开始解密视频 {task.FileName}");
Rescrypt.DecryptFile(tmpPath, task.LocalPath);
Debug.Log($"[DownloadVideo] 解密完成,保存路径:{task.LocalPath}");
downloadedVideos.Add(task.FileName);
success = true;
break;
}
Debug.LogWarning($"视频下载失败(第 {attempt} 次): {task.FileName}, {www.error}");
if (attempt < task.MaxRetry)
yield return new WaitForSeconds(1f);
}
}
if (!success)
{
Debug.LogError($"视频下载失败,超过最大重试次数:{task.FileName}");
if (File.Exists(tmpPath)) File.Delete(tmpPath);
}
downloadingSet.Remove(task.FileName);
task.Callback?.Invoke(success ? task.LocalPath : null);
LiveVideoMemoryManager.RequestCleanup();
}
#endregion
#region
// 你的封面逻辑保持不变
public void GetVideoCover(GLoader loader, string fileName, Action<Texture2D> onComplete)
{
// if (coverCache.TryGetValue(fileName, out var cached))
// {
// onComplete?.Invoke(cached);
// return;
// }
// var coverPath = Path.Combine(coverLocalDir, fileName + ".png");
// if (File.Exists(coverPath))
// {
// var tex = LoadTextureFromFile(coverPath);
// coverCache[fileName] = tex;
// onComplete?.Invoke(tex);
// return;
// }
StartCoroutine(LoadCover(fileName, onComplete));
coverQueue.Enqueue(new CoverTask { FileName = fileName, Callback = onComplete });
if (!isExtracting)
ProcessCoverQueue(loader);
}
private void ProcessCoverQueue(GLoader loader)
{
isExtracting = true;
while (coverQueue.Count > 0)
{
var task = coverQueue.Dequeue();
ProcessGetCoverCoroutine(loader, task.FileName, task.Callback);
}
isExtracting = false;
}
private void ProcessGetCoverCoroutine(GLoader loader, string fileName, Action<Texture2D> callback)
{
TextureHelper.SetImgLoader(loader, fileName,
(a) => {
// coverCache[fileName] = a.nativeTexture as Texture2D;
// callback?.Invoke(coverCache[fileName]);
callback?.Invoke(a.nativeTexture as Texture2D);
}, "LiveAlbums/", FolderNames.VideoCoversName);
}
private IEnumerator ExtractCoverFromVideo(string fileName, string videoPath, Action<Texture2D> callback)
{
var go = new GameObject("LiveVideoCoverExtractor_" + fileName);
var vp = go.AddComponent<VideoPlayer>();
vp.audioOutputMode = VideoAudioOutputMode.None;
vp.source = VideoSource.Url;
vp.url = Application.platform == RuntimePlatform.Android && !Application.isEditor
? videoPath
: "file://" + videoPath;
vp.isLooping = false;
vp.playOnAwake = false;
var rt = new RenderTexture(389, 583, 0);
vp.targetTexture = rt;
vp.Prepare();
var timeout = 5f;
var timer = 0f;
while (!vp.isPrepared && timer < timeout)
{
timer += Time.deltaTime;
yield return null;
}
if (!vp.isPrepared)
{
Debug.LogWarning($"LiveVideoManager: Video '{fileName}' prepare timeout.");
Destroy(go);
callback?.Invoke(null);
yield break;
}
vp.Pause();
yield return new WaitForEndOfFrame();
var tex = CaptureFrame(vp);
SaveCover(fileName, tex);
// coverCache[fileName] = tex;
callback?.Invoke(tex);
Destroy(go);
}
private Texture2D CaptureFrame(VideoPlayer vp)
{
var rt = vp.targetTexture;
RenderTexture.active = rt;
var tex = new Texture2D(rt.width, rt.height, TextureFormat.RGB24, false);
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
tex.Apply();
RenderTexture.active = null;
vp.Stop();
vp.targetTexture = null;
return tex;
}
private void SaveCover(string fileName, Texture2D tex)
{
try
{
var pngData = tex.EncodeToPNG();
var path = Path.Combine(coverLocalDir, fileName + ".png");
File.WriteAllBytes(path, pngData);
}
catch (Exception e)
{
Debug.LogWarning($"Save cover PNG failed for '{fileName}': {e}");
}
}
private Texture2D LoadTextureFromFile(string filePath)
{
try
{
var data = File.ReadAllBytes(filePath);
var tex = new Texture2D(2, 2);
tex.LoadImage(data);
return tex;
}
catch
{
return null;
}
}
public bool ExistVideo(string fileName)
{
var path = Path.Combine(videoLocalDir, fileName + ".mp4");
return File.Exists(path);
}
#endregion
}
internal class VideoTask
{
public Action<string> Callback;
public string FileName;
public string LocalPath;
public int MaxRetry;
}
internal class CoverTask
{
public Action<Texture2D> Callback;
public string FileName;
}
internal static class LiveVideoMemoryManager
{
private const int CLEANUP_INTERVAL = 30;
private const int CLEANUP_THRESHOLD = 10;
private static readonly float lastCleanupTime = 0f;
private static int downloadCount;
public static void RequestCleanup()
{
downloadCount++;
if (downloadCount >= CLEANUP_THRESHOLD ||
Time.realtimeSinceStartup - lastCleanupTime > CLEANUP_INTERVAL)
LiveVideoManager.Instance.StartCoroutine(CleanupCoroutine());
}
private static IEnumerator CleanupCoroutine()
{
yield return null;
// Debug.Log("[LiveVideoMemoryManager] 清理内存...");
// yield return Resources.UnloadUnusedAssets();
// GC.Collect();
//
// lastCleanupTime = Time.realtimeSinceStartup;
// downloadCount = 0;
}
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 8989cb844e004fd8b83f722f9b5ee575
timeCreated: 1754887895
@@ -1,179 +0,0 @@
Shader "Custom/Blur"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,0.2)
_BlurSize ("Blur Size", Float) = 5
_BlurQuality ("Blur Quality", Float ) = 5
_BlurStrength ("Blur Strength", Float) = 1.2
// 新增:FairyGUI的Stencil属性(模板测试用)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
// 新增:FairyGUI的颜色遮罩和混合模式属性
_ColorMask ("Color Mask", Float) = 15
_BlendSrcFactor ("Blend SrcFactor", Float) = 5
_BlendDstFactor ("Blend DstFactor", Float) = 10
}
SubShader
{
Tags {
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
// 新增:Stencil模板测试(关键,实现列表边框遮罩)
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
// 统一FairyGUI的渲染状态
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off }
Blend [_BlendSrcFactor] [_BlendDstFactor], One One // 替换原有Blend
ColorMask [_ColorMask] // 新增颜色遮罩
Pass
{
CGPROGRAM
#pragma multi_compile NOT_CLIPPED CLIPPED SOFT_CLIPPED ALPHA_MASK // 新增:FairyGUI裁剪宏
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_TexelSize;
fixed4 _Color;
float _BlurSize;
int _BlurQuality;
float _BlurStrength;
// 新增:FairyGUI裁剪参数(和Image shader一致)
#ifdef CLIPPED
float4 _ClipBox = float4(-2, -2, 0, 0); // 裁剪区域
#endif
#ifdef SOFT_CLIPPED
float4 _ClipBox = float4(-2, -2, 0, 0); // 软裁剪区域
float4 _ClipSoftness = float4(0, 0, 0, 0); // 软裁剪过渡
#endif
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
// 新增:裁剪坐标(用于FairyGUI裁剪计算)
#ifdef CLIPPED
float2 clipPos : TEXCOORD1;
#endif
#ifdef SOFT_CLIPPED
float2 clipPos : TEXCOORD1;
#endif
};
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = UnityObjectToClipPos(IN.vertex);
OUT.texcoord = IN.texcoord;
// 新增:颜色空间转换(和FairyGUI保持一致)
#if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
OUT.color.rgb = GammaToLinearSpace(IN.color.rgb) * _Color.rgb;
OUT.color.a = IN.color.a * _Color.a;
#else
OUT.color = IN.color * _Color;
#endif
// 新增:计算裁剪坐标(FairyGUI裁剪逻辑)
#ifdef CLIPPED
OUT.clipPos = mul(unity_ObjectToWorld, IN.vertex).xy * _ClipBox.zw + _ClipBox.xy;
#endif
#ifdef SOFT_CLIPPED
OUT.clipPos = mul(unity_ObjectToWorld, IN.vertex).xy * _ClipBox.zw + _ClipBox.xy;
#endif
return OUT;
}
// 高斯模糊权重计算(保留原有功能)
float GaussianWeight(int x, int y, float sigma)
{
return exp(-(x*x + y*y) / (2.0 * sigma * sigma)) / (2.0 * 3.14159 * sigma * sigma);
}
fixed4 frag(v2f IN) : SV_Target
{
float2 uv = IN.texcoord;
fixed4 col = fixed4(0,0,0,0);
// 高斯模糊计算(保留)
float totalWeight = 0.0;
float sigma = _BlurQuality * _BlurStrength;
int range = _BlurQuality * 2;
for (int x = -range; x <= range; x++)
{
for (int y = -range; y <= range; y++)
{
float weight = GaussianWeight(x, y, sigma);
totalWeight += weight;
float2 offset = float2(x, y) * _BlurSize * _MainTex_TexelSize.xy;
col += tex2D(_MainTex, uv + offset) * weight;
}
}
col /= totalWeight;
// 新增:FairyGUI裁剪逻辑(关键,适配列表边框裁剪)
#ifdef CLIPPED
float2 factor = abs(IN.clipPos);
if (max(factor.x, factor.y) > 1) col.a = 0; // 硬裁剪
#endif
#ifdef SOFT_CLIPPED
float2 factor = float2(0,0);
if (IN.clipPos.x < 0) factor.x = (1.0 - abs(IN.clipPos.x)) * _ClipSoftness.x;
else factor.x = (1.0 - IN.clipPos.x) * _ClipSoftness.z;
if (IN.clipPos.y < 0) factor.y = (1.0 - abs(IN.clipPos.y)) * _ClipSoftness.w;
else factor.y = (1.0 - IN.clipPos.y) * _ClipSoftness.y;
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0); // 软裁剪
#endif
#ifdef ALPHA_MASK
clip(col.a - 0.001); // 透明通道裁剪
#endif
// 应用颜色 tint(和FairyGUI颜色处理保持一致)
col.rgb *= IN.color.rgb;
return col;
}
ENDCG
}
}
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 6e83f364b956f4127a4fff5375b1b5fb
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,57 +0,0 @@
Shader "Custom/MosaicTransparent"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_BlockSize ("Block Size", Float) = 30
}
SubShader
{
Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }
LOD 100
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_ST;
float _BlockSize;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 uv = floor(i.uv * _BlockSize) / _BlockSize + 0.5 / _BlockSize;
fixed4 col = tex2D(_MainTex, uv);
return col;
}
ENDCG
}
}
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 1a297746d842d499597aabc2a0ca53c8
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
-3
View File
@@ -90,9 +90,7 @@ public static partial class DataMgr
public static DataStorage<List<int>> SecretUnlockList = BindDataStorage(DataKeys.SecretUnlockList, @default: new List<int>());
public static DataStorage<Dictionary<int, int>> SecretUnlockCd = new(DataKeys.SecretUnlockCd, defaultValue: new Dictionary<int, int>(), cloudSave: false);
public static DataStorage<Dictionary<int, int>> SecretUnlockADs = new(DataKeys.SecretUnlockADs, defaultValue: new Dictionary<int, int>());
public static DataStorage<List<LiveData>> LiveDataList = new(DataKeys.LiveDataList, defaultValue: new List<LiveData>());
public static DataStorage<List<string>> ApplePayTransactionID = BindDataStorage(DataKeys.ApplePayTransactionID, @default: new List<string>());
public static DataStorage<Dictionary<int, LiveData>> LiveDataDic = new(DataKeys.LiveDataDic, defaultValue: new Dictionary<int, LiveData>());
public static DataStorage<List<int>> LevelUnlockList = new(DataKeys.LevelUnlockList, defaultValue: new List<int>());
public static DataStorage<int> IsUnlockChat = BindDataStorage<int>(DataKeys.IsUnlockChat, null, -1);
public static DataStorage<List<ChatItem>> ChatData = new(DataKeys.ChatData, cloudSave: false);
@@ -104,7 +102,6 @@ public static partial class DataMgr
public static DataStorage<int> LevelUnlockAD = new(DataKeys.LevelUnlockListAD, defaultValue: -1);
public static DataStorage<int> LevelUnlockSpecial = new(DataKeys.LevelUnlockListSpecial, defaultValue: -1);
public static DataStorage<int> LevelUnlockVIP = new(DataKeys.LevelUnlockListVIP, defaultValue: -1);
public static DataStorage<List<Levelunlock>> LevelUnlockListNew = new(DataKeys.LevelUnlockListNew, defaultValue: new List<Levelunlock>());
#endregion
}
+6 -12
View File
@@ -95,7 +95,7 @@ namespace LoveLegend
// Debug.Log("OnLoadingComplete------------");
CtrlDispatcher.Instance.Dispatch(CtrlMsg.Game_StartReady);
if (GameHelper.IsGiftSwitch()) CrazyAsyKit.StartCoroutine(TextureHelper.WriteTempBeforeOpenCoroutine_());
TimerHelper.mEasy.AddTimer(0.5f, () =>
{
@@ -112,7 +112,7 @@ namespace LoveLegend
{
if (is_open) return;
is_open = true;
PreDownloadManager.InitializeLiveData();
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameLoginUI_Open);
ChatHelper.CheckReply();
@@ -120,16 +120,10 @@ namespace LoveLegend
if (GameHelper.IsGiftSwitch())
{
// PreDownloadManager.StartDownloadLivePicture();
// PreDownloadManager.StartDownloadAlbumsPicture();
// //预下载视频
// PreDownloadManager.StartDownload();
// PreDownloadManager.StartDownloadSecretPicture();
// DOVirtual.DelayedCall(2, () =>
// {
// ApplePayManager.GetVipHistory();
// });
DOVirtual.DelayedCall(2, () =>
{
ApplePayManager.GetVipHistory();
});
}
}
@@ -43,28 +43,8 @@ namespace LoveLegend
moduleManager.AddModel(ModelConst.ThreeDaysGiftModel, new ThreeDaysGiftModel());
moduleManager.AddModel(ModelConst.RewardMulNewModel, new RewardMulNewModel());
moduleManager.AddModel(ModelConst.LuckyPackModel, new LuckyPackModel());
moduleManager.AddModel(ModelConst.NewEndModel, new NewEndModel());
moduleManager.AddModel(ModelConst.UnlockLevelModel, new UnlockLevelModel());
moduleManager.AddModel(ModelConst.AlubumModel, new AlubumModel());
moduleManager.AddModel(ModelConst.AlbumDetailModel, new AlbumDetailModel());
moduleManager.AddModel(ModelConst.LiveModel, new LiveModel());
moduleManager.AddModel(ModelConst.LiveDetailModel, new LiveDetailModel());
moduleManager.AddModel(ModelConst.SecretAlbumsModel, new SecretAlbumsModel());
moduleManager.AddModel(ModelConst.SecretUnlockModel, new SecretUnlockModel());
moduleManager.AddModel(ModelConst.SecretAlbumsNextModel, new SecretAlbumsNextModel());
moduleManager.AddModel(ModelConst.SecretDetailModel, new SecretDetailModel());
moduleManager.AddModel(ModelConst.VipClubViewModel, new VipClubViewModel());
moduleManager.AddModel(ModelConst.LiveUnlockModel, new LiveUnlockModel());
moduleManager.AddModel(ModelConst.SubUnlockModel, new SubUnlockModel());
moduleManager.AddModel(ModelConst.ScAlbumLockModel, new ScAlbumLockModel());
moduleManager.AddModel(ModelConst.UnlockTipsModel, new UnlockTipsModel());
moduleManager.AddModel(ModelConst.NetworkErrorTipsModel, new NetworkErrorTipsModel());
moduleManager.AddModel(ModelConst.GoldRewardModel, new GoldRewardModel());
moduleManager.AddModel(ModelConst.ChatChooseModel, new ChatChooseModel());
moduleManager.AddModel(ModelConst.ChatModel, new ChatModel());
moduleManager.AddModel(ModelConst.ChatNumberModel, new ChatNumberModel());
moduleManager.AddModel(ModelConst.ChatUnlockModel, new ChatUnlockModel());
moduleManager.AddModel(ModelConst.UnlockLevelNewModel, new UnlockLevelNewModel());
moduleManager.AddModel(ModelConst.BroadcastModel, new BroadcastModel());
moduleManager.AddModel(ModelConst.GamePlayModel, new GamePlayModel());
moduleManager.AddModel(ModelConst.GameAddTimeModel, new GameAddTimeModel());
@@ -109,33 +89,14 @@ namespace LoveLegend
moduleManager.AddUICtrl(UICtrlConst.PersonViewUICtrl, new PersonViewUICtrl());
moduleManager.AddUICtrl(UICtrlConst.GuideViewUICtrl, new GuideViewUICtrl());
moduleManager.AddUICtrl(UICtrlConst.TipsViewUICtrl, new TipsViewUICtrl());
moduleManager.AddUICtrl(UICtrlConst.SecretAlbumsUICtrl, new SecretAlbumsUICtrl());
moduleManager.AddUICtrl(UICtrlConst.SecretUnlockUICtrl, new SecretUnlockUICtrl());
moduleManager.AddUICtrl(UICtrlConst.SecretAlbumsNextUICtrl, new SecretAlbumsNextUICtrl());
moduleManager.AddUICtrl(UICtrlConst.SecretDetailUICtrl, new SecretDetailUICtrl());
moduleManager.AddUICtrl(UICtrlConst.RecordViewUICtrl, new RecordViewUICtrl());
moduleManager.AddUICtrl(UICtrlConst.ThreeDaysGiftUICtrl, new ThreeDaysGiftUICtrl());
moduleManager.AddUICtrl(UICtrlConst.RewardMulNewUICtrl, new RewardMulNewUICtrl());
moduleManager.AddUICtrl(UICtrlConst.LuckyPackUICtrl, new LuckyPackUICtrl());
moduleManager.AddUICtrl(UICtrlConst.NewEndUICtrl, new NewEndUICtrl());
moduleManager.AddUICtrl(UICtrlConst.UnlockLevelUICtrl, new UnlockLevelUICtrl());
moduleManager.AddUICtrl(UICtrlConst.AlubumUICtrl, new AlubumUICtrl());
moduleManager.AddUICtrl(UICtrlConst.AlbumDetailUICtrl, new AlbumDetailUICtrl());
moduleManager.AddUICtrl(UICtrlConst.LiveUICtrl, new LiveUICtrl());
moduleManager.AddUICtrl(UICtrlConst.LiveDetailUICtrl, new LiveDetailUICtrl());
moduleManager.AddUICtrl(UICtrlConst.VipClubViewUICtrl, new VipClubViewUICtrl());
moduleManager.AddUICtrl(UICtrlConst.LiveUnlockUICtrl, new LiveUnlockUICtrl());
moduleManager.AddUICtrl(UICtrlConst.SubUnlockUICtrl, new SubUnlockUICtrl());
moduleManager.AddUICtrl(UICtrlConst.ScAlbumLockUICtrl, new ScAlbumLockUICtrl());
moduleManager.AddUICtrl(UICtrlConst.UnlockTipsUICtrl, new UnlockTipsUICtrl());
moduleManager.AddUICtrl(UICtrlConst.NetworkErrorTipsUICtrl, new NetworkErrorTipsUICtrl());
moduleManager.AddUICtrl(UICtrlConst.GoldRewardUICtrl, new GoldRewardUICtrl());
moduleManager.AddUICtrl(UICtrlConst.ChatChooseUICtrl, new ChatChooseUICtrl());
moduleManager.AddUICtrl(UICtrlConst.ChatUICtrl, new ChatUICtrl());
moduleManager.AddUICtrl(UICtrlConst.ChatNumberUICtrl, new ChatNumberUICtrl());
moduleManager.AddUICtrl(UICtrlConst.ChatUnlockUICtrl, new ChatUnlockUICtrl());
moduleManager.AddUICtrl(UICtrlConst.UnlockLevelNewUICtrl, new UnlockLevelNewUICtrl());
moduleManager.AddUICtrl(UICtrlConst.BroadcastUICtrl, new BroadcastUICtrl());
moduleManager.AddUICtrl(UICtrlConst.GamePlayUICtrl, new GamePlayUICtrl());
moduleManager.AddUICtrl(UICtrlConst.GameAddTimeUICtrl, new GameAddTimeUICtrl());
@@ -186,34 +147,9 @@ namespace LoveLegend
moduleManager.AddCtrl(CtrlConst.ThreeDaysGiftCtrl, new ThreeDaysGiftCtrl());
moduleManager.AddCtrl(CtrlConst.RewardMulNewCtrl, new RewardMulNewCtrl());
moduleManager.AddCtrl(CtrlConst.LuckyPackCtrl, new LuckyPackCtrl());
moduleManager.AddCtrl(CtrlConst.NewEndCtrl, new NewEndCtrl());
moduleManager.AddCtrl(CtrlConst.UnlockLevelCtrl, new UnlockLevelCtrl());
moduleManager.AddCtrl(CtrlConst.AlubumCtrl, new AlubumCtrl());
moduleManager.AddCtrl(CtrlConst.AlbumDetailCtrl, new AlbumDetailCtrl());
moduleManager.AddCtrl(CtrlConst.NewEndCtrl, new NewEndCtrl());
moduleManager.AddCtrl(CtrlConst.UnlockLevelCtrl, new UnlockLevelCtrl());
moduleManager.AddCtrl(CtrlConst.SecretAlbumsCtrl, new SecretAlbumsCtrl());
moduleManager.AddCtrl(CtrlConst.SecretUnlockCtrl, new SecretUnlockCtrl());
moduleManager.AddCtrl(CtrlConst.SecretAlbumsNextCtrl, new SecretAlbumsNextCtrl());
moduleManager.AddCtrl(CtrlConst.SecretDetailCtrl, new SecretDetailCtrl());
moduleManager.AddCtrl(CtrlConst.NewEndCtrl, new NewEndCtrl());
moduleManager.AddCtrl(CtrlConst.UnlockLevelCtrl, new UnlockLevelCtrl());
moduleManager.AddCtrl(CtrlConst.AlubumCtrl, new AlubumCtrl());
moduleManager.AddCtrl(CtrlConst.AlbumDetailCtrl, new AlbumDetailCtrl());
moduleManager.AddCtrl(CtrlConst.LiveCtrl, new LiveCtrl());
moduleManager.AddCtrl(CtrlConst.LiveDetailCtrl, new LiveDetailCtrl());
moduleManager.AddCtrl(CtrlConst.VipClubViewCtrl, new VipClubViewCtrl());
moduleManager.AddCtrl(CtrlConst.LiveUnlockCtrl, new LiveUnlockCtrl());
moduleManager.AddCtrl(CtrlConst.SubUnlockCtrl, new SubUnlockCtrl());
moduleManager.AddCtrl(CtrlConst.ScAlbumLockCtrl, new ScAlbumLockCtrl());
moduleManager.AddCtrl(CtrlConst.UnlockTipsCtrl, new UnlockTipsCtrl());
moduleManager.AddCtrl(CtrlConst.NetworkErrorTipsCtrl, new NetworkErrorTipsCtrl());
moduleManager.AddCtrl(CtrlConst.GoldRewardCtrl, new GoldRewardCtrl());
moduleManager.AddCtrl(CtrlConst.ChatChooseCtrl, new ChatChooseCtrl());
moduleManager.AddCtrl(CtrlConst.ChatCtrl, new ChatCtrl());
moduleManager.AddCtrl(CtrlConst.ChatNumberCtrl, new ChatNumberCtrl());
moduleManager.AddCtrl(CtrlConst.ChatUnlockCtrl, new ChatUnlockCtrl());
moduleManager.AddCtrl(CtrlConst.UnlockLevelNewCtrl, new UnlockLevelNewCtrl());
moduleManager.AddCtrl(CtrlConst.BroadcastCtrl, new BroadcastCtrl());
moduleManager.AddCtrl(CtrlConst.GamePlayCtrl, new GamePlayCtrl());
moduleManager.AddCtrl(CtrlConst.GameAddTimeCtrl, new GameAddTimeCtrl());
@@ -264,31 +200,9 @@ namespace LoveLegend
moduleManager.AddUIType(UIConst.ThreeDaysGiftUI, typeof(ThreeDaysGiftUI));
moduleManager.AddUIType(UIConst.RewardMulNewUI, typeof(RewardMulNewUI));
moduleManager.AddUIType(UIConst.LuckyPackUI, typeof(LuckyPackUI));
moduleManager.AddUIType(UIConst.SecretAlbumsUI, typeof(SecretAlbumsUI));
moduleManager.AddUIType(UIConst.SecretUnlockUI, typeof(SecretUnlockUI));
moduleManager.AddUIType(UIConst.SecretAlbumsNextUI, typeof(SecretAlbumsNextUI));
moduleManager.AddUIType(UIConst.SecretDetailUI, typeof(SecretDetailUI));
moduleManager.AddUIType(UIConst.NewEndUI, typeof(NewEndUI));
moduleManager.AddUIType(UIConst.UnlockLevelUI, typeof(UnlockLevelUI));
moduleManager.AddUIType(UIConst.AlubumUI, typeof(AlubumUI));
moduleManager.AddUIType(UIConst.AlbumDetailUI, typeof(AlbumDetailUI));
moduleManager.AddUIType(UIConst.LiveUI, typeof(LiveUI));
moduleManager.AddUIType(UIConst.LiveDetailUI, typeof(LiveDetailUI));
moduleManager.AddUIType(UIConst.VipClubViewUI, typeof(VipClubViewUI));
moduleManager.AddUIType(UIConst.LiveUnlockUI, typeof(LiveUnlockUI));
moduleManager.AddUIType(UIConst.SubUnlockUI, typeof(SubUnlockUI));
moduleManager.AddUIType(UIConst.ScAlbumLockUI, typeof(ScAlbumLockUI));
moduleManager.AddUIType(UIConst.UnlockTipsUI, typeof(UnlockTipsUI));
moduleManager.AddUIType(UIConst.NetworkErrorTipsUI, typeof(NetworkErrorTipsUI));
moduleManager.AddUIType(UIConst.GoldRewardUI, typeof(GoldRewardUI));
moduleManager.AddUIType(UIConst.ChatChooseUI, typeof(ChatChooseUI));
moduleManager.AddUIType(UIConst.ChatUI, typeof(ChatUI));
moduleManager.AddUIType(UIConst.ChatNumberUI, typeof(ChatNumberUI));
moduleManager.AddUIType(UIConst.ChatUnlockUI, typeof(ChatUnlockUI));
moduleManager.AddUIType(UIConst.UnlockLevelNewUI, typeof(UnlockLevelNewUI));
moduleManager.AddUIType(UIConst.BroadcastUI, typeof(BroadcastUI));
moduleManager.AddUIType(UIConst.GamePlayUI, typeof(GamePlayUI));
moduleManager.AddUIType(UIConst.GameAddTimeUI, typeof(GameAddTimeUI));
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d0a3a471d4eab4205adfabe3e6e03dfa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class AlbumDetailCtrl : BaseCtrl
{
public static AlbumDetailCtrl Instance { get; private set; }
private AlbumDetailModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.AlbumDetailModel) as AlbumDetailModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 742a1554a1ce547a18f4d2fcde5d052a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class AlbumDetailModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a5b5cfda3c4d14dc6ab5ea147569f119
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,299 +0,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 LoveLegend
{
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_1)item.btn_download_coin;
btn_down_coin.title = downloadCoinNum.As<string>();
btn_down_coin.down_load.selectedIndex = GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()) ? 0 : 1;
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;
}
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.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
GameHelper.AddGold(-downloadCoinNum);
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
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.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
{
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
GameHelper.AddGold(-downloadCoinNum);
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
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.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
}
else
{
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
}
});
}
});
btn_down_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
GameHelper.AddGold(-downloadCoinNum);
TextureHelper.SaveImageToAlbum(LevelData[index].Name, FolderNames.AlbumName);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
}
}
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 47ef18a651dc245c587515925adba37d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class AlbumDetailUICtrl : BaseUICtrl
{
private AlbumDetailUI ui;
private AlbumDetailModel model;
private uint openUIMsg = UICtrlMsg.AlbumDetailUI_Open;
private uint closeUIMsg = UICtrlMsg.AlbumDetailUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.AlbumDetailModel) as AlbumDetailModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new AlbumDetailUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a0ae060ce359f4428b4c82fd96f6f2c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 835af6bef1d644831a65b4e33ba7fa24
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class AlubumCtrl : BaseCtrl
{
public static AlubumCtrl Instance { get; private set; }
private AlubumModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.AlubumModel) as AlubumModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: afb7ba0a285a24cf6a2b59cbad176778
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class AlubumModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a84f029a2173e4a74b9b57cdd492a693
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-494
View File
@@ -1,494 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using DG.Tweening;
using FairyGUI;
using FGUI.LG_albums;
using UnityEngine;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace LoveLegend
{
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();
public SmartInvoker invoker;
protected override void OnOpenBefore(object args)
{
invoker = new SmartInvoker(() =>
{
for (int i = 0; i < UpDatatime.Length; i++)
{
UpDatatime[i] = 0;
// ImageName[i] = "";
}
ui.list_albums.RefreshVirtualList();
}, TimeSpan.FromSeconds(0.2f));
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 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()
{
invoker.Invoke();
// 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
}
public class SmartInvoker
{
private readonly Action _action;
private readonly TimeSpan _delay;
private DateTime _lastImmediateInvoke = DateTime.MinValue;
private CancellationTokenSource _cts = null;
private readonly object _lock = new object();
private bool _hasPending = false;
public SmartInvoker(Action action, TimeSpan delay)
{
_action = action;
_delay = delay;
}
public void Invoke()
{
lock (_lock)
{
var now = DateTime.UtcNow;
var timeSinceLast = now - _lastImmediateInvoke;
if (timeSinceLast >= _delay)
{
_lastImmediateInvoke = now;
_action();
Debug.Log("diaoyongyiciiiiiiiiiiiiiii");
}
else
{
_hasPending = true;
_cts?.Cancel();
_cts = new CancellationTokenSource();
var token = _cts.Token;
Task.Delay(_delay, token).ContinueWith(t =>
{
if (!t.IsCanceled)
{
lock (_lock)
{
if (_hasPending)
{
_lastImmediateInvoke = DateTime.UtcNow;
_hasPending = false;
_action();
Debug.Log("diaoyongyiciiiiiiiiiiiiiii");
}
}
}
}, TaskScheduler.Default);
}
}
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8211638a3a24a4f0f9e093343198e8ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class AlubumUICtrl : BaseUICtrl
{
private AlubumUI ui;
private AlubumModel model;
private uint openUIMsg = UICtrlMsg.AlubumUI_Open;
private uint closeUIMsg = UICtrlMsg.AlubumUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.AlubumModel) as AlubumModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new AlubumUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a1c15e9bbddc64e5ca24ec7c564207a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 6c531c42d4fca4ff7b2785c66a8f93e9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-25
View File
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class ChatCtrl : BaseCtrl
{
public static ChatCtrl Instance { get; private set; }
private ChatModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.ChatModel) as ChatModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4f85819b166c34048b8b0e9ca525fe8e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-20
View File
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class ChatModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f469f84c20ba64b5994e844b29a7f2fe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-352
View File
@@ -1,352 +0,0 @@
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
using IgnoreOPS;
using Newtonsoft.Json;
using System.Linq;
using FGUI.LG_AIchat;
using DG.Tweening;
using System.Collections.Generic;
using System;
using System.Linq.Expressions;
namespace LoveLegend
{
public class ChatUI : BaseUI
{
private ChatUICtrl ctrl;
private ChatModel model;
private FGUI.LG_AIchat.com_chat ui;
public ChatUI(ChatUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.ChatUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_AIchat";
uiInfo.assetName = "com_chat";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.ChatModel) as ChatModel;
}
protected override void OnClose()
{
ChatHelper.chat_red_list[chat_index] = false;
GameDispatcher.Instance.Dispatch(GameMsg.RefreshRedDot);
UnityManager.ShezhiACT(true);
}
protected override void OnBind()
{
ui = baseUI as FGUI.LG_AIchat.com_chat;
}
protected override void OnOpenBefore(object args)
{
// ChatHelper.GetMessage(1);
// ChatHelper.ResetMessage(1);
if (args != null) chat_index = (int)args;
if (DataMgr.ChatData.Value == null)
{
DataMgr.ChatData.Value = new List<ChatItem>();
}
if (Screen.safeArea.y != 0)
{
ui.group_.y += Screen.safeArea.y - 15;
}
Debug.Log(JsonConvert.SerializeObject(DataMgr.ChatData.Value));
ui.btn_close.SetClick(CtrlCloseUI);
ui.type.selectedIndex = ui.btn_tophead.type.selectedIndex = chat_index;
InitView();
ui.btn_photo.SetClick(() =>
{
GameHelper.ShowTips("launching_soon", true);
});
ui.btn_video.SetClick(() =>
{
GameHelper.ShowTips("launching_soon", true);
});
UnityManager.ShezhiACT(false);
}
public static bool IsSameDay(long timestamp)
{
// 假设时间戳是 Unix 时间戳(秒),如果是毫秒记得除以 1000
DateTime inputTime = DateTimeOffset.FromUnixTimeSeconds(timestamp).DateTime;
DateTime now = DateTimeOffset.FromUnixTimeSeconds(GameHelper.GetNowTime()).DateTime;
// 比较年月日是否一致
return inputTime.Date == now.Date;
}
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, addNewItem);
GameDispatcher.Instance.AddListener(GameMsg.AddChatNum, setChatNum);
GameDispatcher.Instance.AddListener(GameMsg.Gold_refresh, SetTopCurr);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.LiveChange, addNewItem);
GameDispatcher.Instance.RemoveListener(GameMsg.AddChatNum, setChatNum);
GameDispatcher.Instance.RemoveListener(GameMsg.Gold_refresh, SetTopCurr);
}
public void SetTopCurr(object a = null)
{
Debug.Log("??????????");
var btn_gold = ui.btn_gold as com_gold;
btn_gold.text_gold.text = $"{DataMgr.Coin.Value:N0}";
}
private void addNewItem(object a = null)
{
_ChatItem = DataMgr.ChatData.Value.FirstOrDefault(c => c.role == ChatType.GetType(chat_index));
if (_ChatItem.content_list.Count > list_count)
{
if (have_inputani && ChatHelper.unshow_message[chat_index] <= 0)
{
ui.list_.RemoveChildAt(list_count);
have_inputani = false;
}
// else if (have_inputani && ChatHelper.unshow_message[chat_index] > 0)
// {
// }
for (int i = list_count; i < _ChatItem.content_list.Count; i++)
{
if (_ChatItem.content_list[i].type == 1)
{
item_chatText_left com_msg = (item_chatText_left)UIPackage.CreateObject("LG_AIchat", "item_chatText_left");
com_msg.text_content.text = _ChatItem.content_list[i].text_content;
// if (chat_index == 0) com_msg.head.url = "ui://tksc66j2ljeg27";
// else if (chat_index == 1) com_msg.head.url = "ui://tksc66j2ljeg25";
// else if (chat_index == 2) com_msg.head.url = "ui://tksc66j2ljeg20";
com_msg.type.selectedIndex = chat_index;
if (ChatHelper.unshow_message[chat_index] <= 0 || (!have_inputani)) ui.list_.AddChild(com_msg);
else ui.list_.AddChildAt(com_msg, ui.list_.numChildren - 1);
}
}
// if (ChatHelper.unshow_message[chat_index] > 0)
// {
// item_chatText_left com_msg_ = (item_chatText_left)UIPackage.CreateObject("LG_AIchat", "item_chatText_left");
// com_msg_.t0.Play(-1, 0, null);
// if (chat_index == 0) com_msg_.head.url = "ui://tksc66j2ljeg27";
// else if (chat_index == 1) com_msg_.head.url = "ui://tksc66j2ljeg25";
// else if (chat_index == 2) com_msg_.head.url = "ui://tksc66j2ljeg20";
// ui.list_.AddChild(com_msg_);
// have_inputani = true;
// }
list_count = _ChatItem.content_list.Count;
ui.list_.ScrollToView(list_count - 1);
}
}
private void setChatNum(object a = null)
{
if (DataMgr.ChatFreeNumber.Value == 0 && DataMgr.ChatNumber.Value == 0)
{
// ui.have_free.selectedIndex = 1;
// ui.text_remainfreeNum.text = "Free:" + DataMgr.ChatFreeNumber.Value;
// ui.btn_send.state.selectedIndex = 0;
ui.btn_send.title = Language.GetContent("get_more");
}
else
{
// ui.have_free.selectedIndex = 0;
// ui.text_remainNum.text = ":" + DataMgr.ChatNumber.Value;
// ui.btn_send.state.selectedIndex = 1;
ui.btn_send.title = Language.GetContent("Send");
}
if (DataMgr.ChatFreeNumber.Value > 0)
{
ui.btn_send.text_remainNum.text = Language.GetContentParams("Free_1", DataMgr.ChatFreeNumber.Value);
}
else
{
ui.btn_send.text_remainNum.text = DataMgr.ChatNumber.Value.ToString();
}
// if (DataMgr.ChatFreeNumber.Value <= 0 && DataMgr.ChatNumber.Value <= 0) ui.btn_send.title = "Get More";
// else ui.btn_send.title = "Send";
}
#endregion
private ChatItem _ChatItem;
private int chat_index = 2;
private int list_count = 0;
//初始化页面逻辑
private void InitView()
{
Debug.Log(DataMgr.ChatData.Value);
SetTopCurr();
_ChatItem = DataMgr.ChatData.Value.FirstOrDefault(c => c.role == ChatType.GetType(chat_index));
Debug.Log(JsonConvert.SerializeObject(_ChatItem));
if (DataMgr.ChatRecoverDays.Value != DateTime.Now.Day)
{
DataMgr.ChatFreeNumber.Value = GameHelper.GetCommonModel().FreeMessages;
DataMgr.ChatRecoverDays.Value = DateTime.Now.Day;
}
setChatNum();
if (_ChatItem != null)
{
_ChatItem.content_list.RemoveAll(item => !IsSameDay(item.chat_time));
if (_ChatItem.content_list.Count > 100)
{
_ChatItem.content_list.RemoveRange(0, _ChatItem.content_list.Count - 100);
}
DataMgr.ChatData.Save();
list_count = _ChatItem.content_list.Count;
Debug.Log(list_count + "..................");
for (int i = 0; i < _ChatItem.content_list.Count; i++)
{
if (_ChatItem.content_list[i].type == 0)
{
item_chatText_right com_msg = (item_chatText_right)UIPackage.CreateObject("LG_AIchat", "item_chatText_right");
com_msg.text_content.text = _ChatItem.content_list[i].text_content;
GameHelper.SetSelfAvatar(com_msg.btn_head.load_avatar, DataMgr.PlayerAvatarId.Value);
ui.list_.AddChild(com_msg);
}
else
{
item_chatText_left com_msg = (item_chatText_left)UIPackage.CreateObject("LG_AIchat", "item_chatText_left");
com_msg.text_content.text = _ChatItem.content_list[i].text_content;
// if (chat_index == 0) com_msg.head.url = "ui://tksc66j2ljeg27";
// else if (chat_index == 1) com_msg.head.url = "ui://tksc66j2ljeg25";
// else if (chat_index == 2) com_msg.head.url = "ui://tksc66j2ljeg20";
com_msg.type.selectedIndex = chat_index;
ui.list_.AddChild(com_msg);
}
}
if (list_count > 3) ui.list_.ScrollToView(list_count - 1);
ChatHelper.CheckReply();
}
else
{
ChatHelper.GetMessage(chat_index);
DOVirtual.DelayedCall(1, () =>
{
ChatHelper.CheckReply();
});
}
// DataMgr.ChatData.Value = "";
ui.btn_send.SetClick(() =>
{
if (DataMgr.ChatFreeNumber.Value > 0 || DataMgr.ChatNumber.Value > 0)
{
if (ui.input_message.text.IsNullOrWhiteSpace())
{
GameHelper.ShowTips("message_tips", true);
return;
}
Debug.Log(ui.input_message.text.Length);
if (ui.input_message.text.Length > 200)
{
GameHelper.ShowTips("character_limit", true);
return;
}
if (DataMgr.ChatFreeNumber.Value > 0)
{
DataMgr.ChatFreeNumber.Value--;
}
else DataMgr.ChatNumber.Value--;
setChatNum();
ChatHelper.SendMessage(chat_index, ui.input_message.text);
list_count++;
DOVirtual.DelayedCall(4, () =>
{
Debug.Log("重复一次");
ChatHelper.CheckReply();
});
if (have_inputani)
{
ui.list_.RemoveChildAt(ui.list_.numItems - 1);
}
item_chatText_right com_msg = (item_chatText_right)UIPackage.CreateObject("LG_AIchat", "item_chatText_right");
com_msg.text_content.text = ui.input_message.text;
GameHelper.SetSelfAvatar(com_msg.btn_head.load_avatar, DataMgr.PlayerAvatarId.Value);
ui.list_.AddChild(com_msg);
item_chatText_left com_msg_ = (item_chatText_left)UIPackage.CreateObject("LG_AIchat", "item_chatText_left");
com_msg_.t0.Play(-1, 0, null);
// if (chat_index == 0) com_msg_.head.url = "ui://tksc66j2ljeg27";
// else if (chat_index == 1) com_msg_.head.url = "ui://tksc66j2ljeg25";
// else if (chat_index == 2) com_msg_.head.url = "ui://tksc66j2ljeg20";
com_msg_.type.selectedIndex = chat_index;
ui.list_.AddChild(com_msg_);
have_inputani = true;
if (_ChatItem == null)
{
_ChatItem = new ChatItem()
{
role = ChatType.GetType(chat_index),
content_list = new List<ChatText>(),
};
DataMgr.ChatData.Value.Add(_ChatItem);
}
_ChatItem.content_list.Add(new ChatText()
{
type = 0,
text_content = ui.input_message.text,
chat_time = GameHelper.GetNowTime(),
});
DataMgr.ChatData.Save();
ui.input_message.text = "";
ui.list_.ScrollToView(ui.list_.numItems - 1);
DOVirtual.DelayedCall(1, () =>
{
ChatHelper.CheckReply();
});
}
else
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatNumberUI_Open);
}
});
}
private bool have_inputani = false;
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 58ebdba9853c84405a4a4b497e81179c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class ChatUICtrl : BaseUICtrl
{
private ChatUI ui;
private ChatModel model;
private uint openUIMsg = UICtrlMsg.ChatUI_Open;
private uint closeUIMsg = UICtrlMsg.ChatUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.ChatModel) as ChatModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new ChatUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c8deb89af60a64834a3b0153598b0040
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: dacd1cefc6cec44538462f38924495ef
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class ChatChooseCtrl : BaseCtrl
{
public static ChatChooseCtrl Instance { get; private set; }
private ChatChooseModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.ChatChooseModel) as ChatChooseModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9eb2f8cf020ff4c0eb19c2f692b8671a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class ChatChooseModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7c92b4256954442228fec21a2bea9c70
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,161 +0,0 @@
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
using IgnoreOPS;
using SGModule.Common.Extensions;
namespace LoveLegend
{
public class ChatChooseUI : BaseUI
{
private ChatChooseUICtrl ctrl;
private ChatChooseModel model;
private FGUI.LG_AIchat.com_chatChoose ui;
public ChatChooseUI(ChatChooseUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.ChatChooseUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_AIchat";
uiInfo.assetName = "com_chatChoose";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.ChatChooseModel) as ChatChooseModel;
}
protected override void OnClose()
{
}
protected override void OnBind()
{
ui = baseUI as FGUI.LG_AIchat.com_chatChoose;
}
protected override void OnOpenBefore(object args)
{
if (Screen.safeArea.y != 0)
{
ui.btn_gold.y += Screen.safeArea.y - 15;
}
InitView();
ui.btn_close.SetClick(() =>
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatChooseUI_Close);
});
RefreshRed();
ui.btn_0.SetClick(() =>
{
if (DataMgr.IsUnlockChat.Value < 0 && !GameHelper.GetVipPrivilege(Subscription.UnlockAssitant.As<int>()))//未解锁。
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SecretUnlockUI_Open, 3);
}
else
{
if (DataMgr.IsUnlockChat.Value == 0)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockTipsUI_Open, 3);
}
else
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatUI_Open, 0);
}
}
});
ui.btn_1.SetClick(() =>
{
if (DataMgr.IsUnlockChat.Value < 0 && !GameHelper.GetVipPrivilege(Subscription.UnlockAssitant.As<int>()))//未解锁。
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SecretUnlockUI_Open, 3);
}
else
{
if (DataMgr.IsUnlockChat.Value == 0)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockTipsUI_Open, 3);
}
else
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatUI_Open, 1);
}
}
});
ui.btn_2.SetClick(() =>
{
if (DataMgr.IsUnlockChat.Value < 0 && !GameHelper.GetVipPrivilege(Subscription.UnlockAssitant.As<int>()))//未解锁。
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SecretUnlockUI_Open, 3);
}
else
{
if (DataMgr.IsUnlockChat.Value == 0)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.UnlockTipsUI_Open, 3);
}
else
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.ChatUI_Open, 2);
}
}
});
}
public void SetTopCurr(object a = null)
{
var btn_gold = ui.btn_gold as com_gold;
btn_gold.text_gold.text = $"{DataMgr.Coin.Value:N0}";
}
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.Gold_refresh, SetTopCurr);
GameDispatcher.Instance.AddListener(GameMsg.RefreshRedDot, RefreshRed);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.Gold_refresh, SetTopCurr);
GameDispatcher.Instance.RemoveListener(GameMsg.RefreshRedDot, RefreshRed);
}
#endregion
private void RefreshRed(object isShow = null)
{
ui.btn_0.red.visible = ChatHelper.GetChatRed(0);
ui.btn_1.red.visible = ChatHelper.GetChatRed(1);
ui.btn_2.red.visible = ChatHelper.GetChatRed(2);
}
//初始化页面逻辑
private void InitView()
{
SetTopCurr();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 83e9ae6711260435092c4e1af2e4ff5c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class ChatChooseUICtrl : BaseUICtrl
{
private ChatChooseUI ui;
private ChatChooseModel model;
private uint openUIMsg = UICtrlMsg.ChatChooseUI_Open;
private uint closeUIMsg = UICtrlMsg.ChatChooseUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.ChatChooseModel) as ChatChooseModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new ChatChooseUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d217670d04bcc416790bd6b0d443de38
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ad5fec9f1e982489eb60757842ee45e9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class ChatNumberCtrl : BaseCtrl
{
public static ChatNumberCtrl Instance { get; private set; }
private ChatNumberModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.ChatNumberModel) as ChatNumberModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0f1c72491f98a47f9984461d5b5797ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class ChatNumberModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b99d4915960364dcf83eda361634c06c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,116 +0,0 @@
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
namespace LoveLegend
{
public class ChatNumberUI : BaseUI
{
private ChatNumberUICtrl ctrl;
private ChatNumberModel model;
private FGUI.LG_AIchat.com_ChatNumber ui;
public ChatNumberUI(ChatNumberUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.ChatNumberUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_AIchat";
uiInfo.assetName = "com_ChatNumber";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.ChatNumberModel) as ChatNumberModel;
}
protected override void OnClose()
{
}
protected override void OnBind()
{
ui = baseUI as FGUI.LG_AIchat.com_ChatNumber;
}
protected override void OnOpenBefore(object args)
{
InitView();
}
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 void InitView()
{
ui.btn_close.SetClick(() =>
{
CtrlCloseUI();
});
int[] array = GameHelper.GetCommonModel().CoinsAccess;
ui.text_coins.SetVar("coin", array[0].ToString()).FlushVars();
ui.text_coins.SetVar("num", array[1].ToString()).FlushVars();
ui.text_ads.SetVar("num", GameHelper.GetCommonModel().AdAccess.ToString()).FlushVars();
ui.btn_coins.title = array[0].ToString();
ui.btn_coins.SetClick(() =>
{
if (DataMgr.Coin.Value >= array[0])
{
DataMgr.Coin.Value -= array[0];
DataMgr.ChatNumber.Value += array[1];
GameDispatcher.Instance.Dispatch(GameMsg.AddChatNum);
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
CtrlCloseUI();
GameHelper.ShowTips("more_message", true);
}
else GameHelper.ShowTips("no_enough_gold", true);
});
ui.btn_watch.SetClick(() =>
{
GameHelper.ShowVideoAd("TaskReward", (issuccess) =>
{
if (issuccess)
{
DataMgr.ChatNumber.Value += GameHelper.GetCommonModel().AdAccess;
GameDispatcher.Instance.Dispatch(GameMsg.AddChatNum);
CtrlCloseUI();
GameHelper.ShowTips("more_message", true);
}
});
});
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6aa550f4b878c46b1b94f94bd8344e29
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class ChatNumberUICtrl : BaseUICtrl
{
private ChatNumberUI ui;
private ChatNumberModel model;
private uint openUIMsg = UICtrlMsg.ChatNumberUI_Open;
private uint closeUIMsg = UICtrlMsg.ChatNumberUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.ChatNumberModel) as ChatNumberModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new ChatNumberUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: cfc256c0532ea497899ef69ce0fc0e54
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 327b4267fce094111a78bb54bdb1e83c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class ChatUnlockCtrl : BaseCtrl
{
public static ChatUnlockCtrl Instance { get; private set; }
private ChatUnlockModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.ChatUnlockModel) as ChatUnlockModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7c093fabf4fa34bf4a1fb3482d8f9761
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class ChatUnlockModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 47d86987ec02a450ea21d30862f75ef1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,92 +0,0 @@
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
using Spine.Unity;
using System;
namespace LoveLegend
{
public class ChatUnlockUI : BaseUI
{
private ChatUnlockUICtrl ctrl;
private ChatUnlockModel model;
private FGUI.LG_Unlock.com_chatUnlock ui;
public ChatUnlockUI(ChatUnlockUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.ChatUnlockUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_Unlock";
uiInfo.assetName = "com_chatUnlock";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.ChatUnlockModel) as ChatUnlockModel;
}
protected override void OnClose()
{
closeCallback?.Invoke();
}
protected override void OnBind()
{
ui = baseUI as FGUI.LG_Unlock.com_chatUnlock;
}
protected override void OnOpenBefore(object args)
{
InitView();
}
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()
{
SkeletonAnimation ske_pot = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_parent, Fx_Type.fx_chatunlock, ref closeCallback);
ske_pot.state.SetAnimation(0, "animation", true);
SkeletonAnimation ske_pot1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_parent1, Fx_Type.fx_chatunlock1, ref closeCallback);
ske_pot1.state.SetAnimation(0, "animation", true);
SkeletonAnimation ske_pot2 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_parent2, Fx_Type.fx_chatunlock2, ref closeCallback);
ske_pot2.state.SetAnimation(0, "animation", true);
ui.btn_close.SetClick(CtrlCloseUI);
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d75d7fcc65bbb4bd9bea1bbe54ce9bdd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class ChatUnlockUICtrl : BaseUICtrl
{
private ChatUnlockUI ui;
private ChatUnlockModel model;
private uint openUIMsg = UICtrlMsg.ChatUnlockUI_Open;
private uint closeUIMsg = UICtrlMsg.ChatUnlockUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.ChatUnlockModel) as ChatUnlockModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new ChatUnlockUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e758e321c0de44349be76c88070b8e85
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b05bab87ee5860d45b1e0e643cda6b64
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+9 -72
View File
@@ -191,8 +191,6 @@ namespace LoveLegend
}
}
// ui.bg_loader;
Setbg();
if (GameHelper.IsGiftSwitch() && GameHelper.GetCommonModel().Assitant == 1 && GameHelper.GetLevel() >= GameHelper.GetCommonModel().AssitantPreview)
{
ui.btn_chat.visible = true;
@@ -207,65 +205,6 @@ namespace LoveLegend
}
}
void Setbg(object a = null)
{
if (!GameHelper.IsGiftSwitch())
{
return;
}
if (GameHelper.GetLevel() - 1 < GameHelper.GetCommonModel().MultiModal)
{
int level_ = GameHelper.GetLevel() - 2;
if (level_ <= 0) level_ = 0;
if (level_ >= ConfigSystem.GetConfig<LevelUnlock>().Count) level_ = ConfigSystem.GetConfig<LevelUnlock>().Count - 1;
TextureHelper.SetImgLoader(ui.bg_loader, ConfigSystem.GetConfig<LevelUnlock>()[level_].Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == GameHelper.GetLevel() - 1);
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(ui.bg_loader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
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(ui.bg_loader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
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(ui.bg_loader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
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(ui.bg_loader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
}
else
{
int level_ = GameHelper.GetLevel() - 1;
if (level_ < 0) level_ = 0;
if (level_ >= ConfigSystem.GetConfig<LevelUnlock>().Count) level_ = ConfigSystem.GetConfig<LevelUnlock>().Count - 1;
TextureHelper.SetImgLoader(ui.bg_loader, ConfigSystem.GetConfig<LevelUnlock>()[level_].Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
}
if (!loader_list.Contains(ui.bg_loader))
{
loader_list.Add(ui.bg_loader);
}
}
private List<GLoader> loader_list = new List<GLoader>();
float showResurgence()
{
@@ -344,7 +283,6 @@ namespace LoveLegend
GameDispatcher.Instance.AddListener(GameMsg.RefreshRedDot, RefreshRed);
GameDispatcher.Instance.AddListener(GameMsg.Gold_refresh, Chang101);
GameDispatcher.Instance.AddListener(GameMsg.UpdateNoads, SetBtnAds);
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.AlubumUI_Close, Setbg);
GameDispatcher.Instance.AddListener(GameMsg.Update101, Chang101);
}
@@ -356,7 +294,6 @@ namespace LoveLegend
GameDispatcher.Instance.RemoveListener(GameMsg.RefreshRedDot, RefreshRed);
GameDispatcher.Instance.RemoveListener(GameMsg.Gold_refresh, Chang101);
GameDispatcher.Instance.RemoveListener(GameMsg.UpdateNoads, SetBtnAds);
UICtrlDispatcher.Instance.RemoveListener(UICtrlMsg.AlubumUI_Close, Setbg);
GameDispatcher.Instance.RemoveListener(GameMsg.Update101, Chang101);
}
#endregion
@@ -770,15 +707,15 @@ namespace LoveLegend
}
else
{
if (!DataMgr.LevelUnlockListNew.Value.Any(x => x.level_ == GameHelper.GetLevel()))
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open, true);
}
else
{
GameHelper.gameType = 0;
GameDispatcher.Instance.Dispatch(GameMsg.OpenGame);
}
// if (!DataMgr.LevelUnlockListNew.Value.Any(x => x.level_ == GameHelper.GetLevel()))
// {
// uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open, true);
// }
// else
// {
// GameHelper.gameType = 0;
// GameDispatcher.Instance.Dispatch(GameMsg.OpenGame);
// }
}
}
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: fb7087fd6b2e94143a0c7b911552878c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-25
View File
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class LiveCtrl : BaseCtrl
{
public static LiveCtrl Instance { get; private set; }
private LiveModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.LiveModel) as LiveModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1dfd5cbd0c9b24c4386fdc8ffbf50be7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-20
View File
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class LiveModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d2707d74e0e92400e9f2707b8bbbcbd9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-419
View File
@@ -1,419 +0,0 @@
// using System;
using System;
using System.Collections.Generic;
using System.IO;
// using System.IO;
using FairyGUI;
using FGUI.LG_Common;
using FGUI.LG_live;
using SGModule.Common.Extensions;
using UnityEngine;
using UnityEngine.Video;
namespace LoveLegend
{
public class LiveUI : BaseUI
{
private const int MaxVisibleCount = 6; // 一屏最多6个播放器
private const int PreloadCount = 2; // 上下各预加载一屏
private static readonly Dictionary<item_live, VideoPlayer> dictionary_ = new();
private readonly Dictionary<int, GLoader> activeLoaders = new();
private readonly Dictionary<int, bool> _fileIsExist = 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 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)
{
var livedata_ = PreDownloadManager.GetLiveDataByIndex(LiveConfig[index], index);
item.state.selectedIndex = livedata_.progress >= 100 ? 0 : 1;
item.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;
}
}
// 初始化页面逻辑
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();
UnityEngine.Object.Destroy(videoParent);
foreach (var t in loader_list)
if (t != null && !t.isDisposed && t.texture != null)
{
t.texture.Dispose();
t.texture = null;
}
MemoryManager.CleanMemoryMonitor();
activeLoaders.Clear();
_fileIsExist.Clear();
GLoaderPool.Instance.DisposeAll();
}
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.onScroll.Add(OnScrollUpdate);
ui.list_.scrollPane.onScrollEnd.Add(OnScrollEnd);
// 打开页面时初始化一次
OnScrollEnd();
}
private void OnScrollUpdate()
{
if (LiveConfig == null || LiveConfig.Count == 0) return;
var firstVisibleIndex = ui.list_.GetFirstChildInView();
var lastVisibleIndex = Mathf.Min(firstVisibleIndex + MaxVisibleCount - 1, ui.list_.numItems - 1);
var startIndex = Mathf.Max(0, firstVisibleIndex - PreloadCount);
var endIndex = Mathf.Min(ui.list_.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_.GetChildAt(idx) as item_live;
if (oldItem != null) {
(oldItem.img_cover as com_loaderMask_circlle).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_.GetChildAt(i) as item_live;
if (item == null) continue;
if ((item.img_cover as com_loaderMask_circlle).loader != null && !(item.img_cover as com_loaderMask_circlle).loader.isDisposed)
GLoaderPool.Instance.ReturnLoader((item.img_cover as com_loaderMask_circlle).loader);
var loader = GLoaderPool.Instance.GetLoader();
(item.img_cover as com_loaderMask_circlle).loader = loader;
item.img_cover.AddChild(loader);
loader.SetSize(item.img_cover.width, item.img_cover.height);
item.img_cover.visible = true;
_fileIsExist.TryGetValue(i, out var value);
if (!value)
{
var localPath = Path.Combine(TextureHelper.getResPath(), "LiveVideoCovers", LiveConfig[i].Name + "_cover" + ".jpg");
if (File.Exists(localPath))
{
_fileIsExist[i] = true;
Debug.Log($"[SetImgLoader] 本地存在,直接加载 {LiveConfig[i].Name + "_cover"}");
CrazyAsyKit.StartCoroutine(TextureHelper.LoadTexture(LiveConfig[i].Name + "_cover", loader, null,
"LiveVideoCovers/"));
}
else
{
_fileIsExist[i] = false;
CrazyAsyKit.StartCoroutine(LiveVideoManager.Instance.LoadCover(LiveConfig[i].Name + "_cover", tex =>
{
if (tex != null)
{
if (loader != null)
{
loader.texture = new NTexture(tex);
loader.visible = true;
}
}
else
{
Debug.LogWarning("封面获取失败");
}
}));
}
}
else
{
CrazyAsyKit.StartCoroutine(TextureHelper.LoadTexture(LiveConfig[i].Name + "_cover", loader, null,
"LiveVideoCovers/"));
}
activeLoaders[i] = loader;
}
}
private HashSet<item_live> lastVisibleItems = new();
private void OnScrollEnd()
{
var tasks = new List<(GLoader loader, string fileName, Action<NTexture> callback, string folder, string localFolder)>();
var firstVisibleIndex = ui.list_.GetFirstChildInView();
var lastVisibleIndex = Mathf.Min(firstVisibleIndex + MaxVisibleCount - 1, ui.list_.numItems - 1);
var startIndex = Mathf.Max(0, firstVisibleIndex - PreloadCount);
var endIndex = Mathf.Min(ui.list_.numItems - 1, lastVisibleIndex + PreloadCount);
for (var i = startIndex; i <= endIndex; i++)
{
_fileIsExist.TryGetValue(i, out var value);
if (value) continue;
if (ui.list_.GetChildAt(i) is item_live item)
{
if ((item.img_cover as com_loaderMask_circlle).loader != null && !(item.img_cover as com_loaderMask_circlle).loader.isDisposed)
GLoaderPool.Instance.ReturnLoader((item.img_cover as com_loaderMask_circlle).loader);
var loader = GLoaderPool.Instance.GetLoader();
(item.img_cover as com_loaderMask_circlle).loader = loader;
item.img_cover.AddChild(loader);
loader.SetSize(item.img_cover.width, item.img_cover.height);
var idx = i;
tasks.Add((loader, LiveConfig[i].Name + "_cover", texture =>
{
if (texture != null) _fileIsExist[idx] = true;
}, "LiveAlbums/", FolderNames.VideoCoversName));
activeLoaders[i] = loader;
}
}
TextureHelper.SetImgLoaders(tasks);
Debug.Log($"[OnScrollEnd]==lastVisibleItems=== {lastVisibleItems.Count}");
VideoLoadScheduler.ClearAll();
// 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 < 100) 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 < 100 ? 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.img_mask.fillAmount = (float)(100 - livedata_.progress) / 100;
// 点击事件
item.SetClick(() =>
{
if (GameHelper.GetLevel() < GameHelper.GetCommonModel().UnlockLive[1])
{
if (DataMgr.IsUnlockLive.Value < 0 && !GameHelper.GetVipPrivilege(Subscription.UnlockLive.As<int>()))
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)
{
dictionary_.TryGetValue(item, out var player);
// 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;
}
#endregion
}
public class LiveData
{
public int AD_num;
public int progress;
public int Singleprogress;
public long LiveADTime;
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: cbb17c03db4e0495b9889ddb4645b9a8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class LiveUICtrl : BaseUICtrl
{
private LiveUI ui;
private LiveModel model;
private uint openUIMsg = UICtrlMsg.LiveUI_Open;
private uint closeUIMsg = UICtrlMsg.LiveUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.LiveModel) as LiveModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new LiveUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c836b814e852a4eaf80adb503b8602fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 0aa401e787e17493f96b7619aec184fe
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class LiveDetailCtrl : BaseCtrl
{
public static LiveDetailCtrl Instance { get; private set; }
private LiveDetailModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.LiveDetailModel) as LiveDetailModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 35b20b630f8bf4c80baf0f2b6fa4f1e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class LiveDetailModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a6c3a05ddce334b378bf365745a1d482
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,378 +0,0 @@
using System;
using System.IO;
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 LoveLegend
{
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_claim_4).state.selectedIndex = 1;
(ui.btn_watchad as btn_claim_4).text_time.text = CommonHelper.TimeFormat(
(int)livedata_.LiveADTime - Convert.ToInt32(GameHelper.GetNowTime()),
CountDownType.Hour);
}
else
{
(ui.btn_watchad as btn_claim_4).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()
{
Updata();
var btn_down_coin = ((btn_unlock_1)ui.btn_download_coin);
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
{
(ui.btn_download as btn_claim).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;
ui.SubscribeUnlock.selectedIndex = 0;
if (video != null) video.Play();
}
ui.img_mask.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);
// HandlePvPlay();
InitView();
GameHelper.ShowTips("unlock_success", true);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
UICtrlDispatcher.Instance.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();
// var loader = ui.com_loader.GetChild("loader") as GLoader;
// if (loader?.texture != null)
// {
// loader.texture.Dispose();
// loader.texture = null;
// }
}
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;
});
var localPath = Path.Combine(TextureHelper.getResPath(), "LiveVideos", LiveConfig.Name + ".mp4");
if (!File.Exists(localPath))
{
ui.img_cover.visible = true;
setCover();
} else
{
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;
if (player != null)
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)
HandlePvPlay();
else
{
setCover();
}
var btn_down_coin = ((btn_unlock_1)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);
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
ui.btn_download.SetClick(() =>
{
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
TextureHelper.SaveVideoToAlbum(LiveConfig.Name);
else
GameHelper.ShowVideoAd("DownloadLive", isSuccess =>
{
if (isSuccess) TextureHelper.SaveVideoToAlbum(LiveConfig.Name);
});
});
InitView();
}
private void setCover()
{
var coverLoader = ui.img_cover.GetChild("loader") as GLoader;
if (coverLoader?.texture != null)
{
coverLoader.texture.Dispose();
coverLoader.texture = null;
}
LiveVideoManager.Instance.GetVideoCover(coverLoader, LiveConfig.Name + "_cover", (tex) =>
{
if (tex != null && coverLoader != null && !coverLoader.isDisposed)
{
coverLoader.texture = new NTexture(tex)
{
destroyMethod = DestroyMethod.Destroy
};
coverLoader.visible = true;
}
else
{
Debug.LogError("封面获取失败");
}
});
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
private void vipLevelChange(object o)
{
InitView();
}
private void liveVideoLoaded(object o)
{
HandlePvPlay();
// InitView();
}
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.BuyVip, vipLevelChange);//VIP订阅后更新头像的vip图标
GameDispatcher.Instance.AddListener(GameMsg.liveVideoLoaded, liveVideoLoaded);
}
protected override void RemoveListener()
{
HallManager.Instance.UpdateSecondEvent -= Updata;
GameDispatcher.Instance.RemoveListener(GameMsg.BuyVip, vipLevelChange);//VIP订阅后更新头像的vip图标
GameDispatcher.Instance.RemoveListener(GameMsg.liveVideoLoaded, liveVideoLoaded);
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 01d3c04cad33b4561b62c4c347fb230d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class LiveDetailUICtrl : BaseUICtrl
{
private LiveDetailUI ui;
private LiveDetailModel model;
private uint openUIMsg = UICtrlMsg.LiveDetailUI_Open;
private uint closeUIMsg = UICtrlMsg.LiveDetailUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.LiveDetailModel) as LiveDetailModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new LiveDetailUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 547517fcf624749f8918034cdddf3439
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f498539405054457d8d286a7a4b42f43
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class LiveUnlockCtrl : BaseCtrl
{
public static LiveUnlockCtrl Instance { get; private set; }
private LiveUnlockModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.LiveUnlockModel) as LiveUnlockModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 46ac813492896461f8dbc545cca5ab00
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class LiveUnlockModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: bd80a1535fee24f07b4596aa2b264959
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,85 +0,0 @@
using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
namespace LoveLegend
{
public class LiveUnlockUI : BaseUI
{
private LiveUnlockUICtrl ctrl;
private LiveUnlockModel model;
private FGUI.LG_Unlock.com_LiveUnlock ui;
public LiveUnlockUI(LiveUnlockUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.LiveUnlockUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_Unlock";
uiInfo.assetName = "com_LiveUnlock";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.LiveUnlockModel) as LiveUnlockModel;
}
protected override void OnClose()
{
}
protected override void OnBind()
{
ui = baseUI as FGUI.LG_Unlock.com_LiveUnlock;
}
protected override void OnOpenBefore(object args)
{
InitView();
}
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 void InitView()
{
ui.btn_close.SetClick(() =>
{
CtrlCloseUI();
});
ui.text_unlock.SetVar("num", GameHelper.GetCommonModel().UnlockLive[1].ToString()).FlushVars();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 197cdb189090f453696f748dcd1d99db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
namespace LoveLegend
{
public class LiveUnlockUICtrl : BaseUICtrl
{
private LiveUnlockUI ui;
private LiveUnlockModel model;
private uint openUIMsg = UICtrlMsg.LiveUnlockUI_Open;
private uint closeUIMsg = UICtrlMsg.LiveUnlockUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.LiveUnlockModel) as LiveUnlockModel;
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new LiveUnlockUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 52929d3607e234b84a6c9c28a8703118
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 77837cfdaa9fc465b832206be0f35ec1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,25 +0,0 @@
namespace LoveLegend
{
public class NewEndCtrl : BaseCtrl
{
public static NewEndCtrl Instance { get; private set; }
private NewEndModel model;
#region
protected override void OnInit()
{
Instance = this;
//model = ModuleManager.Instance..GetModel(ModelConst.NewEndModel) as NewEndModel;
}
protected override void OnDispose()
{
Instance = null;
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4cb25adad943c4000a9fdcf5b872da17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,20 +0,0 @@
namespace LoveLegend
{
public class NewEndModel : BaseModel
{
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
#endregion
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c0db3836b736c446c9bbe4821de78a17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-674
View File
@@ -1,674 +0,0 @@
using System;
using System.Collections.Generic;
using DG.Tweening;
using FairyGUI;
using FGUI.LG_Common;
using FGUI.LG_End;
using FGUI.ZM_Common_01;
using Newtonsoft.Json;
using Spine.Unity;
using UnityEngine;
using btn_claim = FGUI.LG_Common.btn_claim;
using SGModule.Common.Extensions;
using System.Linq;
using SGModule.NetKit;
namespace LoveLegend
{
public class NewEndUI : BaseUI
{
private readonly List<GLoader> loader_list = new();
private readonly List<int> rate_list = new();
private Action closeCallback;
private NewEndUICtrl ctrl;
private List<item_wheel> list_1;
private NewEndModel model;
private int next_level;
private int rate_idnex = 3;
private int scroll_number;
private int scroll_type = 1;
private com_newend ui;
public NewEndUI(NewEndUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.NewEndUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "LG_End";
uiInfo.assetName = "com_newend";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
private void UnlockLevelsuccess(object a = null)
{
CtrlCloseUI();
}
private void endClose()
{
var lv = GameHelper.GetCommonModel().MultiModal;
if (GameHelper.GetLevel() >= GameHelper.GetCommonModel().MultiModal)
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open);
is_unlock_level = true;
}
CtrlCloseUI();
}
//初始化页面逻辑
private void InitView()
{
if (GameHelper.IsGiftSwitch())
{
if (!loader_list.Contains(ui.loader_bgimg)) loader_list.Add(ui.loader_bgimg);
// TextureHelper.SetImgLoader(ui.loader_bgimg, LevelData.Name, null, "LevelAlbums/");
if (GameHelper.GetLevel() < GameHelper.GetCommonModel().MultiModal)
{
int level_ = GameHelper.GetLevel() - 1;
if (level_ < 0) level_ = 0;
if (level_ >= ConfigSystem.GetConfig<LevelUnlock>().Count) level_ = ConfigSystem.GetConfig<LevelUnlock>().Count - 1;
TextureHelper.SetImgLoader(ui.loader_bgimg, ConfigSystem.GetConfig<LevelUnlock>()[level_].Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == GameHelper.GetLevel());
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(ui.loader_bgimg, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
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(ui.loader_bgimg, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
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(ui.loader_bgimg, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
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(ui.loader_bgimg, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
}
else
{
int level_ = GameHelper.GetLevel() - 1;
if (level_ < 0) level_ = 0;
if (level_ >= ConfigSystem.GetConfig<LevelUnlock>().Count) level_ = ConfigSystem.GetConfig<LevelUnlock>().Count - 1;
TextureHelper.SetImgLoader(ui.loader_bgimg, ConfigSystem.GetConfig<LevelUnlock>()[level_].Name, null, "LevelAlbums/", FolderNames.AlbumName);
}
}
}
ui.tetx_level.text = Language.GetContentParams("level", successData_.level);
ui.text_award.text = successData_.ch_number.ToString();
Debug.Log(JsonConvert.SerializeObject(successData_) + "/////////////////");
Debug.Log("/////////////////4");
// if (!successData_.IsWin) ui.text_award.text = DataMgr.Coin.Value.ToString();
Debug.Log(GetNextSpecialLevel());
next_level = GetNextSpecialLevel();
var levelUnlock_ = ConfigSystem.GetConfig<LevelUnlock>()[next_level];
if (levelUnlock_.LeveType == 1)
ui.text_levelType.text = "Special level";
else if (levelUnlock_.LeveType == 2) ui.text_levelType.text = "VIP level";
ui.progress_level.max = next_level;
ui.progress_level.value = successData_.level;
// if (successData_.IsLevelSuccess && successData_.level == next_level)
// //打开解锁界面
// ui.btn_continue.SetClick(() =>
// {
// uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelUI_Open, next_level);
// });
// else
ui.btn_continue.SetClick(() =>
{
endClose();
});
((btn_claim4)ui.btn_claim).title = $"{successData_.ch_number}";
var delayTime = successData_.IsLevelSuccess ? 1f : 0f;
if (!successData_.IsWin)
{
delayTime = 0f;
ui.win_lose.selectedIndex = 0;
}
else
{
ui.win_lose.selectedIndex = 1;
}
if (!GameHelper.IsGiftSwitch()) delayTime = 0;
ui.step.selectedIndex = !successData_.IsLevelSuccess || !successData_.IsWin ? 1 : 0;
Debug.Log("/////////////////5");
DOVirtual.DelayedCall(delayTime, () =>
{
Debug.Log(delayTime);
Debug.Log("/////////////////6");
ui.step.selectedIndex = 1;
var anim_bg = FXManager.Instance.SetFx<SkeletonAnimation>(ui.GetChild("bg_parent") as GGraph, Fx_Type.fx_end_bg, ref closeCallback);
if (successData_.IsWin)
{
anim_bg.state.SetAnimation(0, "win", false);
anim_bg.state.Complete += (trackEntry) =>
{
anim_bg.state.SetAnimation(0, "win_stop", true);
};
var fireworks = FXManager.Instance.SetFx<SkeletonAnimation>(ui.GetChild("congra_parent") as GGraph, Fx_Type.fx_win, ref closeCallback);
fireworks.state.SetAnimation(0, "out", true);
var coin = FXManager.Instance.SetFx<SkeletonAnimation>(ui.GetChild("coin_parent") as GGraph, Fx_Type.fx_wins, ref closeCallback);
coin.state.SetAnimation(0, "animation", true);
coin.state.Complete += (trackEntry) =>
{
coin.state.SetAnimation(0, "animation2", true);
};
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetCommonConf().FreeClaims)
((btn_claim3)ui.btn_mult).state.selectedIndex = 1;
else ((btn_claim3)ui.btn_mult).state.selectedIndex = 0;
ui.btn_mult.SetClick(() =>
{
if (!GameHelper.GetCloseResult()) return;
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetCommonConf().FreeClaims)
{
ui.btn_mult.touchable = ui.btn_claim.touchable = false;
SaveData.SaveDataFunc();
StartScroll();
}
else
{
GameHelper.ShowVideoAd("GameEnd", isSuccess =>
{
if (isSuccess)
{
ui.btn_mult.touchable = ui.btn_claim.touchable = false;
StartScroll();
}
});
}
});
ui.btn_claim.SetClick(() =>
{
if (!GameHelper.GetCloseResult()) return;
ui.btn_mult.touchable = ui.btn_claim.touchable = false;
DOVirtual.DelayedCall(2f, () => { GameHelper.addInterAdnumber(); });
GetReward(successData_.ch_number);
});
AudioManager.Instance.PlayDynamicEffect(AudioConst.Victoriously);
}
else
{
anim_bg.state.SetAnimation(0, "lose", false);
anim_bg.state.Complete += (trackEntry) =>
{
anim_bg.state.SetAnimation(0, "lose_stop", true);
};
ui.btn_restart.SetClick(() =>
{
if (!GameHelper.GetCloseResult()) return;
GameHelper.addInterAdnumber();
if (!successData_.IsWin) GameHelper.SetLevelstate(3);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NewEndUI_Close);
});
}
});
if (GameHelper.GetVipPrivilege(Subscription.DoubleLevelReward.As<int>())) ((wheel)ui.wheel).have_vip.selectedIndex = 1;
if (successData_.boost_array != null)
{
((wheel_)ui.wheel.GetChild("wheel_")).t0.Play(Scroll);
((wheel_)ui.wheel.GetChild("wheel_")).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title =
GameHelper.Get101Str((decimal)successData_.ch_number *
successData_.boost_array[rate_idnex % 5]);
});
ui.btn_mult.title =
GameHelper.Get101Str((decimal)successData_.ch_number * successData_.boost_array[rate_idnex]);
list_1 = new List<item_wheel>
{
((wheel_)ui.wheel.GetChild("wheel_")).item_0, ((wheel_)ui.wheel.GetChild("wheel_")).item_1,
(ui.wheel.GetChild("wheel_") as wheel_).item_2, (ui.wheel.GetChild("wheel_") as wheel_).item_3,
(ui.wheel.GetChild("wheel_") as wheel_).item_4, (ui.wheel.GetChild("wheel_") as wheel_).item_5,
(ui.wheel.GetChild("wheel_") as wheel_).item_6, (ui.wheel.GetChild("wheel_") as wheel_).item_7
};
// list_1[2].img_light.visible = true;
for (var i = 0; i < list_1.Count; i++)
{
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
list_1[i].text_rate.text = "X" + successData_.boost_array[i % successData_.boost_array.Length];
}
}
}
private void StartScroll()
{
((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale =
((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale = 5.0f;
scroll_type = 2;
}
private void Scroll()
{
if (scroll_type == 1)
{
scroll_number++;
rate_list.Clear();
for (var i = 0; i < 8; i++)
rate_list.Add(successData_.boost_array[(scroll_number + i) % successData_.boost_array.Length]);
for (var i = 0; i < list_1.Count; i++)
{
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
list_1[i].text_rate.text = "X" + rate_list[i];
}
((wheel_)ui.wheel.GetChild("wheel_")).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title = GameHelper.Get101Str((decimal)successData_.ch_number *
successData_.boost_array[
rate_idnex % successData_.boost_array.Length]);
});
((wheel_)ui.wheel.GetChild("wheel_")).t0.Play(Scroll);
}
else
{
scroll_number++;
rate_list.Clear();
for (var i = 0; i < 8; i++)
rate_list.Add(successData_.boost_array[(scroll_number + i) % successData_.boost_array.Length]);
// bool need_return = false;
if (((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale < 2.2f &&
list_1[4].text_rate.text == "X" + successData_.rate)
{
//开始领取
var reward = successData_.ch_number * successData_.rate;
if (GameHelper.GetVipPrivilege(Subscription.DoubleLevelReward.As<int>())) reward *= 2;
GetReward(reward);
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
SaveData.GetSaveObject().LargeRewardNum++;
SaveData.SaveDataFunc();
return;
}
for (var i = 0; i < list_1.Count; i++)
{
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
list_1[i].text_rate.text = "X" + rate_list[i];
}
// if (need_return)
// {
// (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = 0;
// return;
// }
((wheel_)ui.wheel.GetChild("wheel_")).t1.Play(() =>
{
rate_idnex++;
ui.btn_mult.title = GameHelper.Get101Str((decimal)successData_.ch_number *
successData_.boost_array[
rate_idnex % successData_.boost_array.Length]);
});
((wheel_)ui.wheel.GetChild("wheel_")).t0.Play(Scroll);
((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale =
((wheel_)ui.wheel.GetChild("wheel_")).t0.timeScale - 0.3f;
}
}
private void GetReward(float awardNum)
{
var startObj = ui.btn_mult;
var endObj = ui.btn_gold;
var pos = GameHelper.GetUICenterPosition(endObj);
var rewardData = new RewardData();
var rewardSingleData = new RewardSingleData(101, (decimal)awardNum, RewardOrigin.Play)
{
startPosition = GameHelper.GetUICenterPosition(startObj),
endPosition = new Vector2(pos.x, pos.y)
};
rewardData.AddReward(rewardSingleData);
rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange;
rewardData.AddCompleted(success =>
{
if (success)
{
RefreshAwardNum((decimal)awardNum, 101);
if (successData_.IsLevelSuccess)
{
if (!loader_list.Contains(ui.com_loader.GetChild("loader") as GLoader))
loader_list.Add(ui.com_loader.GetChild("loader") as GLoader);
GameDispatcher.Instance.Dispatch(GameMsg.reset_game);
if (GameHelper.GetLevel() < GameHelper.GetCommonModel().MultiModal)
{
TextureHelper.SetImgLoader(ui.com_loader.GetChild("loader") as GLoader, LevelData.Name, null, "LevelAlbums/", FolderNames.AlbumName);
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
ui.btn_download_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
GameHelper.AddGold(-downloadCoinNum);
ui.btn_gold.GetChild("text_gold").text = $"{DataMgr.Coin.Value:N0}";
TextureHelper.SaveImageToAlbum(LevelData.Name, FolderNames.AlbumName);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
endClose();
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
ui.btn_download.SetClick(() =>
{
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
{
TextureHelper.SaveImageToAlbum(LevelData.Name, FolderNames.AlbumName);
endClose();
}
else
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(LevelData.Name, FolderNames.AlbumName);
endClose();
}
});
});
}
else
{
Levelunlock levelunlock_ = DataMgr.LevelUnlockListNew.Value.FirstOrDefault(x => x.level_ == GameHelper.GetLevel());
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(ui.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(ui.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(ui.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(ui.com_loader.GetChild("loader") as GLoader, _leveldata.Name, null, "LevelAlbums/", FolderNames.AlbumName);
file_name = _leveldata.Name;
}
}
else
{
TextureHelper.SetImgLoader(ui.com_loader.GetChild("loader") as GLoader, LevelData.Name, null,
"LevelAlbums/", FolderNames.AlbumName);
}
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
ui.btn_download_coin.SetClick(() =>
{
if (GameHelper.Get101() >= downloadCoinNum)
{
GameHelper.AddGold(-downloadCoinNum);
ui.btn_gold.GetChild("text_gold").text = $"{DataMgr.Coin.Value:N0}";
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
TrackKit.SendEvent(ADEventTrack.Coinsbuy, ADEventTrack.Property.download);
endClose();
}
else
{
GameHelper.ShowTips("no_enough_gold", true);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Open);
}
});
ui.btn_download.SetClick(() =>
{
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
{
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
endClose();
}
else
GameHelper.ShowVideoAd("DownloadImage", isSuccess =>
{
if (isSuccess)
{
TextureHelper.SaveImageToAlbum(file_name, FolderNames.AlbumName);
endClose();
}
});
});
}
// TextureHelper.SetImgLoader(ui.com_loader.GetChild("loader") as GLoader, LevelData.Name, null,
// "LevelAlbums/");
GameHelper.SetLevel(GameHelper.GetLevel() + 1);
DOVirtual.DelayedCall(1.5f, () =>
{
if (GameHelper.IsGiftSwitch())
{
ui.step.selectedIndex = 2;
}
else
{
CtrlCloseUI();
}
});
}
else
{
CtrlCloseUI();
}
}
});
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
}
private void RefreshAwardNum(decimal num = -1, int id = 102)
{
if (num < 0) num = DataMgr.Coin.Value;
var btnCoin = ui.btn_gold as com_gold;
var gTextField = btnCoin.text_gold;
CommonHelper.ShowNumAnim(gTextField, num, id);
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.NewEndModel) as NewEndModel;
}
private bool is_unlock_level = false;
protected override void OnClose()
{
GameHelper.SetCloseResult(false);
closeCallback?.Invoke();
if (!is_unlock_level)
{
if (successData_.IsLevelSuccess && !GameHelper.is_first_login)
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, successData_.IsWin);
else
GameDispatcher.Instance.Dispatch(GameMsg.CheckEnd);
}
foreach (var t in loader_list)
if (t != null && !t.isDisposed && t.texture != null)
{
t.texture.Dispose();
t.texture = null;
}
loader_list.Clear();
MemoryManager.CleanMemoryMonitor();
}
protected override void OnBind()
{
ui = baseUI as com_newend;
}
private LevelUnlock LevelData;
protected override void OnOpenBefore(object args)
{
if (Screen.safeArea.y != 0) ui.btn_gold.y += 68;
Debug.Log("//////////////////////0");
Debug.Log(JsonConvert.SerializeObject(args));
successData_ = (SuccessData)args;
successData_.ch_number = (int)successData_.ch_number;
// 修改后的代码
var levelDataList = ConfigSystem.GetConfig<LevelUnlock>();
var levelIndex = successData_.level - 1;
// 确保索引不超出范围,如果超出则使用最后一个元素
if (levelDataList is { Count: > 0 })
{
if (levelIndex >= 0 && levelIndex < levelDataList.Count)
LevelData = levelDataList[levelIndex];
else
// 超出范围后,使用最后一个元素
LevelData = levelDataList[^1];
}
else
{
Debug.LogError("LevelUnlockModel DataList is null or empty");
}
var btnDownCoin = ((btn_unlock_1)ui.btn_download_coin);
var downloadCoinNum = ConfigSystem.GetCommonConf().CoinsDownload;
btnDownCoin.title = downloadCoinNum.ToString();
ui.btn_gold.GetChild("text_gold").text = $"{DataMgr.Coin.Value:N0}";
if (GameHelper.GetVipPrivilege(Subscription.FreeDownImage.As<int>()))
{
((btn_claim)ui.btn_download).have_vip.selectedIndex = 1;
ui.is_vip.selectedIndex = 1;
}
else
{
ui.is_vip.selectedIndex = 0;
btnDownCoin.down_load.selectedIndex = 1;
}
if (GameHelper.IsGiftSwitch() && successData_.IsLevelSuccess)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
GameHelper.PlayGameTimeEvent(1, () => { GameHelper.RequestGameConfig(); });
}
else
{
GameHelper.SetCloseResult(true);
}
Debug.Log("//////////////////////3");
InitView();
}
private int GetNextSpecialLevel()
{
var now_level = successData_.level;
var list_ = ConfigSystem.GetConfig<LevelUnlock>();
for (var i = now_level; i < list_.Count; i++)
if (list_[i].LeveType != 0)
return i;
return 0;
}
private SuccessData successData_;
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region
public void OnUpdate101(object a = null)
{
com_gold btn_gold = ui.btn_gold as com_gold;
btn_gold.text_gold.text = $"{DataMgr.Coin.Value:N0}";
}
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.UnlockLevelsuccess, UnlockLevelsuccess);
GameDispatcher.Instance.AddListener(GameMsg.Update101, OnUpdate101);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.UnlockLevelsuccess, UnlockLevelsuccess);
GameDispatcher.Instance.RemoveListener(GameMsg.Update101, OnUpdate101);
}
#endregion
}
}

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