76 lines
1.6 KiB
C#
76 lines
1.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
public class MyPageCustomBGControl : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField]
|
|
private UITexture _character;
|
|
|
|
[SerializeField]
|
|
private GameObject _root;
|
|
|
|
[SerializeField]
|
|
private UITexture _customBGTexture;
|
|
|
|
private GameObject _frontEffect;
|
|
|
|
private GameObject _backEffect;
|
|
|
|
private float _fadeOutTimer;
|
|
|
|
private bool _isFadeOut = true;
|
|
|
|
private Action _onFadeFinish;
|
|
|
|
private float _startShowTime;
|
|
|
|
public void SetEnable(bool enable)
|
|
{
|
|
_root.SetActive(enable);
|
|
}
|
|
|
|
public void ShowSpecialResetShader()
|
|
{
|
|
if (IsSpecialMypageShader(_character.material))
|
|
{
|
|
_startShowTime = Time.time;
|
|
SetSpecialResetShaderParameter();
|
|
ResetEffect(_frontEffect);
|
|
ResetEffect(_backEffect);
|
|
}
|
|
}
|
|
|
|
public void SetSpecialResetShaderParameter()
|
|
{
|
|
if (IsSpecialMypageShader(_character.material))
|
|
{
|
|
_character.material.SetFloat("_SceneTime", Time.time - _startShowTime);
|
|
_character.gameObject.SetActive(value: false);
|
|
_character.gameObject.SetActive(value: true);
|
|
}
|
|
}
|
|
|
|
private void ResetEffect(GameObject effect)
|
|
{
|
|
if (!(effect == null))
|
|
{
|
|
effect.SetActive(value: false);
|
|
ParticleSystem component = effect.GetComponent<ParticleSystem>();
|
|
component.Stop(withChildren: true);
|
|
component.Play(withChildren: true);
|
|
effect.SetActive(value: true);
|
|
}
|
|
}
|
|
|
|
private bool IsSpecialMypageShader(Material material)
|
|
{
|
|
return material.shader.name.Contains("VariantMypage");
|
|
}
|
|
}
|