Commit 4b67e5c9 authored by zhangzhe's avatar zhangzhe

手速红包

parent 732644fe
fileFormatVersion: 2
guid: db76c39f755654664a45530e2dc02f0d
PrefabImporter:
guid: 047afee41e5ea4041b38650dde06204e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
......
fileFormatVersion: 2
guid: 66d2f797a9d094b3598e5816d772b676
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontName: Source Han Sans CN
fontNames:
- Source Han Sans CN
fallbackFontReferences:
- {fileID: 12800000, guid: 532935772d93543b6ad5b00a928141f1, type: 3}
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 532935772d93543b6ad5b00a928141f1
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontName: Source Han Sans CN
fontNames:
- Source Han Sans CN
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 0558eb6561e6248da921dfc2dc4fee78
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 255f6234fe21c4b299c8091085b4f763
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: 0d1d822fe5a9a4640af343b08ba37baa
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: 4d4a28df2f2414edc96f1e70c9f9216b
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:
This diff is collapsed.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 手速红包获得奖励弹窗
/// </summary>
public class HSRPGetDialog : MonoBehaviour
{
/// <summary>
/// 钱数文字
/// </summary>
public Text MoneyText;
private void OnEnable()
{
AdUtils.showFeedAd("HandSpeedRedPacketFeedAd");
}
/// <summary>
/// 设置控件数据
/// </summary>
public void SetUpSubviews(HSRPGetRewardModel dataModel)
{
MoneyText.text = "¥" + dataModel.cashYuan;
}
/// <summary>
/// 开心收下按钮点击事件
/// </summary>
public void DidSelectedTakeButton()
{
HSRPVM.RequestInternetForTakeReward();
gameObject.SetActive(false);
}
}
fileFormatVersion: 2
guid: 6a56630840185499e9865e7d0ff725c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 手速红包数据类
/// </summary>
public class HSRPVM : MonoBehaviour
{
/// <summary>
/// 手速红包奖励数据
/// </summary>
public static HSRPGetRewardModel getRewardModel;
/// <summary>
/// 获取手速红包奖励网络请求
/// </summary>
public static void RequestInternetForGetReward()
{
HttpTool.Instance._Get("app/v1/game/module/handSpeedRed/get", null, new Action<HSRPGetRewardModel>((bean) =>
{
getRewardModel = bean;
}), new Action<string, string>((code, errMsg) =>
{
Debug.unityLogger.Log("获取手速红包奖励网络请求失败" + code + errMsg);
}));
}
/// <summary>
/// 领取手速红包奖励网络请求
/// </summary>
public static void RequestInternetForTakeReward()
{
HttpTool.Instance._Post("app/v1/game/module/handSpeedRed/reward", null, new Action<EmptyModel>((bean) =>
{
// 领取后请求获取奖励接口, 预加载
RequestInternetForGetReward();
}), new Action<string, string>((code, errMsg) =>
{
Debug.unityLogger.Log("领取手速红包奖励网络请求失败" + code + errMsg);
}));
}
}
/// <summary>
/// 手速红包获取奖励数据类
/// </summary>
public class HSRPGetRewardModel
{
/// <summary>
/// 奖励金额(单位: 分)
/// </summary>
public int cash;
/// <summary>
/// 是否显示弹窗
/// 0 : 不显示
/// 1 : 显示
/// </summary>
public int showAd;
/// <summary>
/// 奖励金额(单位: 元)
/// </summary>
public double cashYuan;
}
fileFormatVersion: 2
guid: 560a5acc2e9944e55b62c77144bd10f8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -40,9 +40,14 @@ public class HandSpeedRedPacketItem : MonoBehaviour
/// </summary>
private float currentProgress;
/// <summary>
/// 手速红包领取奖励弹窗
/// </summary>
public GameObject HSRPGetDialog;
private void Awake()
{
RequestInternetForGetReward();
HSRPVM.RequestInternetForGetReward();
}
private void Update()
......@@ -52,51 +57,41 @@ public class HandSpeedRedPacketItem : MonoBehaviour
if (currentProgress >= 1)
{
currentProgress = 0;
EventCenter.Broadcast(MyEventType.HSRP_FlyRedPacket);
GetRedPacket();
}
currentProgress = Mathf.Clamp(currentProgress - dropSpeed * Time.deltaTime, 0, 1);
}
/// <summary>
/// 获取手速红包奖励网络请求
/// 手速红包点击事件
/// </summary>
private void RequestInternetForGetReward()
{
HttpTool.Instance._Get("app/v1/game/module/handSpeedRed/get", null, new Action<EmptyModel>((bean) =>
public void DidSelectedItem()
{
Instantiate(HSRPEffectPrefab, transform);
}), new Action<string, string>((code, errMsg) =>
{
Debug.unityLogger.Log("获取手速红包奖励网络请求失败" + code + errMsg);
}));
currentProgress = Mathf.Clamp(currentProgress + addSpeed, 0, 1);
}
/// <summary>
/// 领取手速红包奖励网络请求
/// 进度条点满, 获取红包方法
/// </summary>
private void RequestInternetForTakeReward()
{
HttpTool.Instance._Get("app/v1/game/module/handSpeedRed/reward", null, new Action<EmptyModel>((bean) =>
private void GetRedPacket()
{
currentProgress = 0;
EventCenter.Broadcast(MyEventType.HSRP_FlyRedPacket);
}), new Action<string, string>((code, errMsg) =>
if (HSRPVM.getRewardModel.showAd != 0)
{
Debug.unityLogger.Log("领取手速红包奖励网络请求失败" + code + errMsg);
}));
}
HSRPGetDialog.SetActive(true);
/// <summary>
/// 手速红包点击事件
/// </summary>
public void DidSelectedItem()
HSRPGetDialog script = HSRPGetDialog.GetComponent<HSRPGetDialog>();
script.SetUpSubviews(HSRPVM.getRewardModel);
}
else
{
GameObject gb = Instantiate(HSRPEffectPrefab, transform);
currentProgress = Mathf.Clamp(currentProgress + addSpeed, 0, 1);
HSRPVM.RequestInternetForTakeReward();
}
}
}
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