Commit bb0adcfa authored by zhangzhe's avatar zhangzhe

手速红包

parent f2905e78
...@@ -173,8 +173,8 @@ ParticleSystem: ...@@ -173,8 +173,8 @@ ParticleSystem:
startSpeed: startSpeed:
serializedVersion: 2 serializedVersion: 2
minMaxState: 3 minMaxState: 3
scalar: 1.1 scalar: 2.5
minScalar: 0.9 minScalar: 2
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
...@@ -554,8 +554,8 @@ ParticleSystem: ...@@ -554,8 +554,8 @@ ParticleSystem:
startRotation: startRotation:
serializedVersion: 2 serializedVersion: 2
minMaxState: 3 minMaxState: 3
scalar: 1.5707963 scalar: 6.283185
minScalar: -1.5707963 minScalar: -6.283185
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
...@@ -2023,7 +2023,7 @@ ParticleSystem: ...@@ -2023,7 +2023,7 @@ ParticleSystem:
speedModifier: speedModifier:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 10 scalar: 0.4
minScalar: 1 minScalar: 1
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
...@@ -3440,8 +3440,8 @@ ParticleSystem: ...@@ -3440,8 +3440,8 @@ ParticleSystem:
curve: curve:
serializedVersion: 2 serializedVersion: 2
minMaxState: 3 minMaxState: 3
scalar: 3.1415925 scalar: 6.283185
minScalar: -3.1415925 minScalar: -6.283185
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 手速红包
/// </summary>
public class HandSpeedRedPacketItem : MonoBehaviour
{
/// <summary>
/// 红包弹出特效
/// </summary>
public GameObject HSRPEffectPrefab;
/// <summary>
/// 手速红包点击事件
/// </summary>
public void DidSelectedItem()
{
Instantiate(HSRPEffectPrefab, transform);
}
}
fileFormatVersion: 2
guid: 25642cc4e8d9b4e89936de39b39bc70f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 手速红包
/// </summary>
public class HandSpeedRedPacketItem : MonoBehaviour
{
/// <summary>
/// 红包弹出特效
/// </summary>
public GameObject HSRPEffectPrefab;
/// <summary>
/// 进度条
/// </summary>
public Image Progress;
/// <summary>
/// 自动衰减的速度
/// </summary>
private float dropSpeed = 0.27f;
/// <summary>
/// 点击增加的速度
/// </summary>
private float addSpeed = 0.12f;
/// <summary>
/// 当前进度
/// </summary>
private float currentProgress;
private ParticleSystem particleSys;
private ParticleSystem.Particle[] particles;
private void Awake()
{
//this.particleSys = HSRPEffectPrefab.GetComponent<ParticleSystem>();
//this.particles = new ParticleSystem.Particle[this.particleSys.main.maxParticles];
}
private void Update()
{
Progress.fillAmount = currentProgress;
if (currentProgress >= 1)
{
currentProgress = 0;
int count = this.particleSys.GetParticles(this.particles);
for (int i = 0; i < count; i++)
{
//朝目标点插值缓动
this.particles[i].position = Vector3.Lerp(this.particles[i].position, Vector3.zero, 1);
}
this.particleSys.SetParticles(this.particles, count);
}
currentProgress = Mathf.Clamp(currentProgress - dropSpeed * Time.deltaTime, 0, 1);
}
/// <summary>
/// 手速红包点击事件
/// </summary>
public void DidSelectedItem()
{
GameObject gb = Instantiate(HSRPEffectPrefab, transform);
this.particleSys = gb.GetComponent<ParticleSystem>();
StartCoroutine(GetAllP());
//this.particles = new ParticleSystem.Particle[this.particleSys.main.maxParticles];
//int count = particleSys.particleCount;
//for (int i = 0; i < count; i++)
//{
// //朝目标点插值缓动
// this.particles[i].position = Vector3.Lerp(this.particles[i].position, new Vector3(100, 100, 100), 1);
//}
//this.particleSys.SetParticles(this.particles, count);
currentProgress = Mathf.Clamp(currentProgress + addSpeed, 0, 1);
}
IEnumerator GetAllP()
{
yield return new WaitForSeconds(this.particleSys.main.duration);
//this.particleSys = gb.GetComponent<ParticleSystem>();
this.particles = new ParticleSystem.Particle[this.particleSys.main.maxParticles];
int count = particleSys.particleCount;
for (int i = 0; i<count; i++)
{
//朝目标点插值缓动
this.particles[i].position = Vector3.Lerp(this.particles[i].position, new Vector3(100, 100, 100), 1);
}
this.particleSys.SetParticles(this.particles, count);
}
}
...@@ -182,7 +182,6 @@ public class StartControl : MonoBehaviour ...@@ -182,7 +182,6 @@ public class StartControl : MonoBehaviour
private static int lastCloseTime; private static int lastCloseTime;
private void OnApplicationFocus(bool focus) private void OnApplicationFocus(bool focus)
{ {
Debug.Log("走没走");
if (focus) if (focus)
{ {
//切换到前台时执行,游戏启动时执行一次 //切换到前台时执行,游戏启动时执行一次
...@@ -251,16 +250,13 @@ public class StartControl : MonoBehaviour ...@@ -251,16 +250,13 @@ public class StartControl : MonoBehaviour
private void ShowRewardAd() private void ShowRewardAd()
{ {
Debug.Log("显示热启动广告");
AdUtils.PlayRewardAd("hot_lunch_reward", new Action<bool>((cb) => AdUtils.PlayRewardAd("hot_lunch_reward", new Action<bool>((cb) =>
{ {
Debug.Log("热启动广告启动完成");
if (cb) if (cb)
{ {
HttpTool.Instance._Get("app/v1/cscmnq/hotStart", null, new Action<EmptyModel>((bean) => HttpTool.Instance._Get("app/v1/cscmnq/hotStart", null, new Action<EmptyModel>((bean) =>
{ {
EventCenter.Broadcast(MyEventType.FlyHongbao); EventCenter.Broadcast(MyEventType.FlyHongbao);
Debug.Log("热启动广告奖励接口调用成功");
}), new Action<string, string>((code, errMsg) => }), new Action<string, string>((code, errMsg) =>
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment