修复多个UI引用同一个模糊背景导致的问题

main
yurui 2024-08-15 13:31:51 +08:00
parent 98707ed4a8
commit 3d65c94eef
34 changed files with 54 additions and 42 deletions

Binary file not shown.

View File

@ -537,7 +537,7 @@ public class UI_TeamAndSkillSelectController : UIWindow
curIndex = skillIndex;
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
uint[] skillIds = team.GetPlayerSkillIDs();
curSelectSkillID = (int)skillIds[skillIndex];

View File

@ -117,7 +117,7 @@ public class UI_CardPoolDetailsPanelController : UIWindow
textProbability = GetComponent<TMP_Text>("Image_Bg/Scroll View/Viewport/Content/Probability/Text_Info");
textRule = GetComponent<TMP_Text>("Image_Bg/Scroll View/Viewport/Content/Rule/Text_Info");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
Transform tsCharacterRoot = FindObj("Image_Bg/Scroll View/Viewport/Content/Title/CharacterRoot").transform;
for (int i = 0; i < tsCharacterRoot.childCount; ++i)

View File

@ -159,7 +159,7 @@ public class UI_ExchangePanelController : UIWindow
textPatioCount = GetComponent<TMP_Text>("Image_Bg/DebrailsInfo/TextDebrails");
recycleView = GetComponent<RecycleView>("Image_Bg/ScrollView");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
recycleView.Init(RefreshItem);

View File

@ -136,7 +136,7 @@ public class UI_GuideTipController : UIWindow
textNextPage = GetComponent<TMP_Text>("ImageBg/ButtonNextPage/Text");
textTip = GetComponent<TMP_Text>("ImageBg/ImageTip/TextTip");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
bannerView.Init(OnChangeBanner);
CommonUtils.BindButton(buttonPrePage, OnPrePage);

View File

@ -59,7 +59,7 @@ public class UIPauseController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
Go_Clock = FindObj("UI_Clock");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
for (int i = 0; i < 3; i++)
{

View File

@ -55,7 +55,7 @@ public class UIDefeatGameController : UIWindow{
UIDefeatGameBinder.GetComponents(this);
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
_txtTips = new()
{

View File

@ -117,9 +117,9 @@ public class UIPassGameController : UIWindow
textDialogue = GetComponent<TMP_Text>("Image_WinBG/Image_PosterLu/Image_ActorLineBG/Text_Describe");
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
BindButton("Button_Close", _OnClickClose);
BindButton("Button_Close", _OnClickClose);
_imgWinStar = new List<Image>();
_imageFailedStart = new List<Image>();

View File

@ -80,7 +80,7 @@ public class UI_GetItemSettleController : UIWindow
UI_GetItemSettleBinder.GetComponents(this);
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
_goScrollViewContent = CommonUtils.GetGameObject(ScrollView_Reward.gameObject, "Viewport/Content");
_displayItemFirstList = new List<Item>();

View File

@ -609,8 +609,8 @@ public class UI_EmailController : UIWindow
mailContent = new MailContent(FindObj("Image_EmailBG/Right"), OnDelMail, OnGetMail);
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
recycleView.Init(RefreshItem);
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
recycleView.Init(RefreshItem);
BindButton(Button_GetAll,OnGetAllMail);
BindButton(Button_DeleteAll, OnDeleteAllMail);

View File

@ -86,7 +86,7 @@ public class UI_PVPRankInfoController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
_scrollViewPage = GetComponent<RecycleView>("Image_RankBG/LeftRank/ScrollViewPage");
_scrollViewList = GetComponent<RecycleView>("Image_RankBG/RightRank/ScrollViewInfo");

View File

@ -74,7 +74,7 @@ public class UI_PVPRankRewardController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
_pageList = new List<GameObject>();
for (TabType tab = 0; tab < TabType.Max; tab++)

View File

@ -104,7 +104,7 @@ public class UI_PurchaseController : UIWindow
genericItem = new GenericItem(FindObj("Image_BG/Image_ItemRect/GenericItem"));
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
BindButton(Button_Close, OnCloseBtnClick);
BindButton(Button_Min, OnMinBtnClick);

View File

@ -206,7 +206,7 @@ public class UIAdvanceController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
Transform tsMateralRoot = FindObj("Image_BG/UI_Materals").transform;
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
for (int i = 0; i < tsMateralRoot.childCount; ++i)
{

View File

@ -82,7 +82,7 @@ public class UIFavorableController : UIWindow
UIFavorableBinder.GetComponents(this);
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
BindButton(Button_Back, OnButton_BackClick);
BindButton(Button_Home, OnClickHome);

View File

@ -159,7 +159,7 @@ public class UILevelUpController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
dialogue = new(FindObj("Image_ActorLineBG"));

View File

@ -82,7 +82,7 @@ public class UIPosterController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
BindButton(Button_Back, OnButton_BackClick);
BindButton(Button_Poster, OnButton_Poster);

View File

@ -151,7 +151,7 @@ public class UIRankController : UIWindow
Transform tsMateralRoot = FindObj("Image_BG/UI_Materals").transform;
mLightRectObj = FindObj("Image_BG/LightRect/1");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
for (int i = 0; i < tsMateralRoot.childCount; ++i)
{

View File

@ -133,7 +133,7 @@ public class UISkill_LevelUpController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
Transform tsMateralRoot = FindObj("Image_BG/UI_Materals").transform;
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
for (int i = 0; i < tsMateralRoot.childCount; ++i)
{

View File

@ -154,8 +154,8 @@ public class UI_DailyBonusController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
_recycleView = GetComponent<RecycleView>("ImageBG/Reward/ScrollView");
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
_recycleView = GetComponent<RecycleView>("ImageBG/Reward/ScrollView");
BindButton("ImageBG/Button_Close", _OnClickClose);
}

View File

@ -193,7 +193,7 @@ public class SkinChangeController : UIWindow
UpperUI = FindObj("Image_BG/UpperUI");
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
Image_Poster.GetComponent<RectTransform>().sizeDelta = Vector2.zero;
PinchZoom = GetComponent<PinchZoomModule>("Image_BG/Image_Poster");

View File

@ -167,9 +167,9 @@ public class UICameraAndPosterChangeController : UIWindow
_sceneObj = FindObj("ImageBG/SceneChange");
_posterObj = FindObj("ImageBG/PosterChange");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
SceneScrollView.SetScrollRect(GetComponent<PhxhScrollView>("ImageBG/SceneChange/SceneScrollView"));
SceneScrollView.SetScrollRect(GetComponent<PhxhScrollView>("ImageBG/SceneChange/SceneScrollView"));
SceneScrollView.InitItemCellList(SceneScrollView.SceneItemCount());
_scrollPosterPool = GetComponent<RecycleView>("ImageBG/PosterChange/ChangeHeadPic/PosterScrollView");

View File

@ -44,7 +44,7 @@ public class UI_BackReturnController : UIWindow
rawImageGaussianBlurMask.gameObject.IsScaleShow(false);
await CommonUtils.CaptureScreenshot();
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
rawImageGaussianBlurMask.gameObject.IsScaleShow(true);
}

View File

@ -78,7 +78,7 @@ public class UI_BuyDiamondController : UIWindow
{
UI_BuyDiamondBinder.GetComponents(this);
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
mCurrentScrollViewContentObj = FindObj("Image_BG/PhxhScrollView/Viewport/Content");
_mCurrentScrollView = GetComponent<PhxhScrollView>("Image_BG/PhxhScrollView");
UI_ShortTip = FindObj("Image_BG/UI_ShortTip");

View File

@ -237,7 +237,7 @@ public class UI_BuyEnergyController : UIWindow
UI_BuyEnergyBinder.GetComponents(this);
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
BindButton();
BindInputFieldListener();

View File

@ -93,7 +93,7 @@ public class UI_ChoosePersonController : UIWindow
goSelect1 = FindObj("Image_BG/ButtonModel1/ImageSelect");
goSelect2 = FindObj("Image_BG/ButtonModel2/ImageSelect");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
selectModelId = 0;
OnModel(0);

View File

@ -152,7 +152,7 @@ public class UI_LevelDetailController : UIWindow
// _numItem = FindObj("Image_BG/RewardAndSweep/Text_Sweep/SweepNum/ItemNum");
_maskObj = FindObj("Image_BG/ImageMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
//test
_maskObj.gameObject.SetActive(true);

View File

@ -52,7 +52,7 @@ public class UI_LongTipController : UIWindow
UI_LongTipBinder.GetComponents(this);
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
}
//invoke when open window

View File

@ -79,7 +79,7 @@ public class UI_NameConfirmWindowController : UIWindow
buttonClose = GetComponent<Button>("Image_Bg/Button_Close");
textContent = GetComponent<TMP_Text>("Image_Bg/Text_Info");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
BindButton(buttonConfirm, OnConfirm);
BindButton(buttonCancel, OnClose);

View File

@ -381,7 +381,7 @@ public class UI_NoticeController : UIWindow
noticeContent = new(FindObj("Image_NoticeBG/ContentRoot/Viewport/Content"));
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
tabRecycleView.Init(OnRefreshTab);
BindButton(buttonClose, OnClose);

View File

@ -73,7 +73,7 @@ public class UI_SettingController : UIWindow
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
BindButton(Button_Close, () => CloseWindow());
@ -293,7 +293,7 @@ public class UI_SettingController : UIWindow
{
GameSettingManager.Instance.SaveNewSettings(_settings);
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
}
private void Cancel()

View File

@ -7,6 +7,7 @@ using Gameplay.Net;
using NLDPB;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
@ -53,7 +54,7 @@ public class UI_WriteNameController : UIWindow
buttonConfirm = GetComponent<Button>("Image_BG/Button_Confirm");
inputField = GetComponent<TMP_InputField>("Image_BG/InputField (TMP)");
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
BindButton(buttonConfirm, OnConfirm);

View File

@ -122,7 +122,7 @@ public class UI_VehicleLevelUpController : UIWindow
mCurScrollView = GetComponent<PhxhScrollView>("Image_BG/Image_InfoBG/ScrollView");
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
mVehicleLvUpTab = TableManager.Instance.Tables.VehicleUpgrade;
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
rawImageGaussianBlurMask.texture = CommonUtils.GetScreenTexture2D();
_materialUI = FindObj("Image_BG/UI_Materals");

View File

@ -40,7 +40,7 @@ namespace Gameplay
{
public partial class CommonUtils
{
public static RenderTexture screenTexture;
private static RenderTexture screenTexture;
private static readonly int MainTex = Shader.PropertyToID("_MainTex");
private static readonly int BlurSize = Shader.PropertyToID("_BlurSize");
@ -49,7 +49,18 @@ namespace Gameplay
private const string ICON_ENVIRONMENT_PREFIX = "Icon_Environment_";
private const string ICON_DAYNIGHT_PREFIX = "Icon_Daynight_";
private const string SCREEN_SNAPSHOT = "ScreenSnapshot";
public static Texture2D GetScreenTexture2D()
{
Texture2D texture2D = new(screenTexture.width, screenTexture.height);
RenderTexture.active = screenTexture;
texture2D.ReadPixels(new Rect(0f, 0f, screenTexture.width, screenTexture.height), 0, 0);
texture2D.Apply();
RenderTexture.active = null;
return texture2D;
}
public static void DestoryGameObjectImmediate(ref GameObject obj)
{
if (null != obj)
@ -443,7 +454,7 @@ namespace Gameplay
int width = PerformanceManager.instance.fullScreenWidth;
int height = PerformanceManager.instance.fullScreenHeight;
if (null == screenTexture)
screenTexture = RenderTexturePool.Instance.Create(SCREEN_SNAPSHOT, width, height, 0);
screenTexture = RenderTexturePool.Instance.Create(SCREEN_SNAPSHOT, width, height);
// 先渲图
Camera uiCamera = CameraManager.Instance.UICamera;