fix:1、bug修复。

Signed-off-by: barry <barry@gmail.com>
This commit is contained in:
2026-07-14 09:28:01 +08:00
parent 7deaa15511
commit 4187297e82
24 changed files with 343 additions and 296 deletions
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using DG.Tweening;
using FairyGUI;
using FGUI.ZM_Common_01;
using Spine.Unity;
using UnityEngine;
@@ -47,6 +48,8 @@ namespace RedHotRoast
protected override void OnOpenBefore(object args)
{
ui.x = (GRoot.inst.width - 1080) / 2;
InitView();
//ui.y = 241;
@@ -67,17 +70,13 @@ namespace RedHotRoast
// }
text_ui = ui.broad_cast_text;
ui.btn_record.SetClick(OpenRecord);
ui.broad_cast_text.btn_broad.SetClick(OpenRecord);
text_ui.btn_broad.SetClick(OpenRecord);
if (ConfigSystem.GetConfig<exBrPool>() == null) return;
config_name_list = exBrPoolModel.config_name_list;
config_money_list = exBrPoolModel.config_money_list;
if (ConfigSystem.GetConfig<SubscribePodcast>() == null) return;
config_name_list = SubscribePodcastModel.config_name_list;
config_vip_level_list = SubscribePodcastModel.config_vip_level_list;
GameDispatcher.Instance.AddListener(GameMsg.hideBroadCast, hideEvent);
GameDispatcher.Instance.AddListener(GameMsg.showBroadCast, showEvent);
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.MainUI_Open, Setbuttom);
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.RainPlayUI_Open, Settop);
}
protected override void OnOpen(object args)
@@ -96,17 +95,23 @@ namespace RedHotRoast
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.hideBroadCast, hideEvent);
GameDispatcher.Instance.AddListener(GameMsg.showBroadCast, showEvent);
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.MainUI_Open, Setbuttom);
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.RainPlayUI_Open, Settop);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.hideBroadCast, hideEvent);
GameDispatcher.Instance.RemoveListener(GameMsg.showBroadCast, showEvent);
UICtrlDispatcher.Instance.RemoveListener(UICtrlMsg.MainUI_Open, Setbuttom);
UICtrlDispatcher.Instance.RemoveListener(UICtrlMsg.RainPlayUI_Open, Settop);
}
#endregion
private int time_count = 11;
private com_broadcast_text1 text_ui;
private List<string> config_name_list;
private List<string> config_vip_level_list;
private List<string> config_money_list;
private bool main_ui_show = true;
//初始化页面逻辑
@@ -118,7 +123,7 @@ namespace RedHotRoast
var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.broad_cast_text.bg_panel, Fx_Type.fx_broad, ref closeCallback);
sk.state.SetAnimation(0, "animation", true);
ui.broad_cast_text.bg_panel.SetScale(1.45f, 1.1f);
ui.broad_cast_text.bg_panel.scaleX = 1.1f;
}
private void OpenRecord()
@@ -153,37 +158,47 @@ namespace RedHotRoast
ui.group_.y += 68;
}
}
# if GAME_RELEASE
private const int MaxTime = 300;
#else
private const int MaxTime = 10;
#endif
void timeEvent()
{
time_count++;
// Debug.Log(time_count);
// Debug.Log(MaxTime);
if (time_count > MaxTime)
// if (time_count > 30)
// {
// time_count = 0;
// var name_index = UnityEngine.Random.Range(0, config_name_list.Count);
// var money_index = UnityEngine.Random.Range(0, config_money_list.Count);
// if (main_ui_show)
// {
// ui.visible = true;
// }
// Debug.Log(text_ui.cast_text.text);
// text_ui.cast_text.text = String.Format(text_ui.hide_text.text, config_name_list[name_index],
// config_money_list[money_index], DateTimeManager.Instance.GetCurrDateTime());
// text_ui.cast_text.x = 686;
// Tweener tweener = DOTween.To(() => text_ui.cast_text.x,
// x => text_ui.cast_text.x = x, -1300, 10);
// }
// time_count = 0;
//Debug.Log($"barry broad time count======== {time_count}");
if (time_count > 20)
{
time_count = 0;
var name_index = Random.Range(0, config_name_list.Count);
var money_index = Random.Range(0, config_vip_level_list.Count);
var money_index = Random.Range(0, config_money_list.Count);
Debug.Log(text_ui.cast_text.text);
string name = config_name_list[name_index];
if (name.Length > 8)
if (name.Length > 4)
{
name = name[..8] + "..";
name = name[..4] + "...";
}
string broad_text = String.Format(text_ui.hide_text.text, name,
config_vip_level_list[money_index], DateTimeManager.Instance.GetCurrDateTime());
// text_ui.hide_text.text = GameHelper.getDesByKey("makeup_4");
var money_text = GameHelper.Get102Str(decimal.Parse(config_money_list[money_index]));
string broad_text = String.Format(GameHelper.getDesByKey("makeup_4"), name, money_text, DateTimeManager.Instance.GetCurrDateTime());
text_ui.cast_text.text = broad_text;
var lv = GetVipLevelFromName(config_vip_level_list[money_index]);
text_ui.broad_icon_loader.url = $"ui://LG_Common/vip_{lv}";
// Tweener tweener = DOTween.To(() => ui.broad.x,
// x => ui.broad.x = x, 200, 0.5f);
ui.t0.Play();
DOVirtual.DelayedCall(3.5f, () =>
@@ -192,30 +207,11 @@ namespace RedHotRoast
// x => ui.broad.x = x, 1080, 0.5f);
ui.t1.Play();
});
string str = name + "#" + config_vip_level_list[money_index] + "#" + DateTimeManager.Instance.GetCurrDateTime();
string str = name + "-" + config_money_list[money_index] + "-" + DateTimeManager.Instance.GetCurrDateTime();
GameDispatcher.Instance.Dispatch(GameMsg.updateRecordList, str);
}
}
private int GetVipLevelFromName(string name)
{
var vip_level = 1;
switch (name)
{
case "Gold":
vip_level = 1;
break;
case "Platinum":
vip_level = 2;
break;
case "Diamond":
vip_level = 3;
break;
}
return vip_level;
}
}
}