Commit 9e294d6a authored by zhangzhe's avatar zhangzhe

手速红包

parent ce1af25a
......@@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 2036219049125648577}
- component: {fileID: 2036219049125648579}
- component: {fileID: 2036219049125648576}
- component: {fileID: 7386443188705361719}
m_Layer: 5
m_Name: HSRPEffect
m_TagString: Untagged
......@@ -110,7 +111,7 @@ ParticleSystem:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
moveWithTransform: 0
moveWithTransform: 1
moveWithCustomTransform: {fileID: 0}
scalingMode: 1
randomSeed: 0
......@@ -120,7 +121,7 @@ ParticleSystem:
startLifetime:
serializedVersion: 2
minMaxState: 0
scalar: 2
scalar: 1.5
minScalar: 5
maxCurve:
serializedVersion: 2
......@@ -1485,7 +1486,7 @@ ParticleSystem:
uvChannelMask: -1
rowMode: 1
sprites:
- sprite: {fileID: 21300000, guid: e0e576073c9ad4f058e1ca911b3c4246, type: 3}
- sprite: {fileID: 21300000, guid: 81a1bb038c5ec4b7f9da59601e8dd37c, type: 3}
flipU: 0
flipV: 0
VelocityModule:
......@@ -4759,3 +4760,16 @@ ParticleSystemRenderer:
m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0}
m_MaskInteraction: 0
--- !u!114 &7386443188705361719
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2036219049125648582}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a0fe74b5fef414e768d64a05959e7616, type: 3}
m_Name:
m_EditorClassIdentifier:
targetTransform: {fileID: 0}
fileFormatVersion: 2
guid: 6105781017f77470dbbeeab59369a825
guid: db76c39f755654664a45530e2dc02f0d
PrefabImporter:
externalObjects: {}
userData:
......
fileFormatVersion: 2
guid: 7b86a8a6ce47740cd8727473fa6028dd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 49069051be62e427c8093c19a141519a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 81a1bb038c5ec4b7f9da59601e8dd37c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 078858073981242788e17fad7f71e669
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
......@@ -163,5 +163,8 @@ public enum MyEventType
FlyRedHeart,
//关闭种树赚钱弹窗
CloseMakeMoney,
/// <summary>
/// 手速红包非红包
/// </summary>
HSRP_FlyRedPacket,
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
/// <summary>
/// 手速红包的特效
/// </summary>
public class HSRPEffect : MonoBehaviour
{
public Transform targetTransform;
private float speed = 0.05f;
private ParticleSystem particleSys;
private ParticleSystem.Particle[] particles;
private bool ifFly = false;
private List<Vector3> startPositions = new List<Vector3>();
private void Awake()
{
targetTransform = FindObjectOfType<HomeInfoControl>().transform.Find("Title/bg");
EventCenter.AddListener(MyEventType.HSRP_FlyRedPacket, FlyRedPacket);
this.particleSys = this.GetComponent<ParticleSystem>();
if (this.particleSys)
{
this.particles = new ParticleSystem.Particle[this.particleSys.main.maxParticles];
}
}
private void Update()
{
if (this.particleSys && this.targetTransform && ifFly)
{
int count = this.particleSys.GetParticles(this.particles);
for (int i = 0; i < count; i++)
{
//朝目标点插值缓动
this.particles[i].position = Vector3.Lerp(this.particles[i].position, this.targetTransform.position, speed);
//this.particles[i].position = new Vector3(0, 0);
}
this.particleSys.SetParticles(this.particles, count);
}
}
private void OnDestroy()
{
EventCenter.RemoveListener(MyEventType.HSRP_FlyRedPacket, FlyRedPacket);
}
/// <summary>
/// 红包飞到钱的位置
/// </summary>
private void FlyRedPacket()
{
this.particleSys.gravityModifier = 0;
ifFly = true;
}
}
fileFormatVersion: 2
guid: a0fe74b5fef414e768d64a05959e7616
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
......@@ -14,6 +15,11 @@ public class HandSpeedRedPacketItem : MonoBehaviour
/// </summary>
public GameObject HSRPEffectPrefab;
/// <summary>
/// 进度条背景
/// </summary>
public GameObject ProgressBg;
/// <summary>
/// 进度条
/// </summary>
......@@ -34,74 +40,63 @@ public class HandSpeedRedPacketItem : MonoBehaviour
/// </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];
RequestInternetForGetReward();
}
private void Update()
{
ProgressBg.SetActive(currentProgress != 0);
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);
EventCenter.Broadcast(MyEventType.HSRP_FlyRedPacket);
}
currentProgress = Mathf.Clamp(currentProgress - dropSpeed * Time.deltaTime, 0, 1);
}
/// <summary>
/// 手速红包点击事件
/// 获取手速红包奖励网络请求
/// </summary>
public void DidSelectedItem()
private void RequestInternetForGetReward()
{
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);
HttpTool.Instance._Get("app/v1/game/module/handSpeedRed/get", null, new Action<EmptyModel>((bean) =>
{
currentProgress = Mathf.Clamp(currentProgress + addSpeed, 0, 1);
}), new Action<string, string>((code, errMsg) =>
{
Debug.unityLogger.Log("获取手速红包奖励网络请求失败" + code + errMsg);
}));
}
IEnumerator GetAllP()
/// <summary>
/// 领取手速红包奖励网络请求
/// </summary>
private void RequestInternetForTakeReward()
{
yield return new WaitForSeconds(this.particleSys.main.duration);
//this.particleSys = gb.GetComponent<ParticleSystem>();
HttpTool.Instance._Get("app/v1/game/module/handSpeedRed/reward", null, new Action<EmptyModel>((bean) =>
{
this.particles = new ParticleSystem.Particle[this.particleSys.main.maxParticles];
int count = particleSys.particleCount;
for (int i = 0; i<count; i++)
}), new Action<string, string>((code, errMsg) =>
{
//朝目标点插值缓动
this.particles[i].position = Vector3.Lerp(this.particles[i].position, new Vector3(100, 100, 100), 1);
}
Debug.unityLogger.Log("领取手速红包奖励网络请求失败" + code + errMsg);
}));
}
/// <summary>
/// 手速红包点击事件
/// </summary>
public void DidSelectedItem()
{
GameObject gb = Instantiate(HSRPEffectPrefab, transform);
this.particleSys.SetParticles(this.particles, count);
currentProgress = Mathf.Clamp(currentProgress + addSpeed, 0, 1);
}
}
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