修改促销时间问题

This commit is contained in:
xiaohui.wang 2022-04-15 11:17:36 +08:00
parent ffe5d28fa4
commit 86f23c9dc0
8 changed files with 40 additions and 17 deletions

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bad4fa5e5d4eb4cacb76dd1446af3d84
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -46,7 +46,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 27, y: 24, z: 26, w: 21}
spriteBorder: {x: 47, y: 26, z: 84, w: 21}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1

View File

@ -519,7 +519,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 12345
m_Text: '12 '
--- !u!1 &137127163584464918
GameObject:
m_ObjectHideFlags: 0
@ -991,7 +991,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: ff4d597826f53ac49821fc3d60148965, type: 3}
m_Sprite: {fileID: 21300000, guid: 582b70d53a85e4e74be0fb9ca6be120c, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1

View File

@ -393,7 +393,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 582b70d53a85e4e74be0fb9ca6be120c, type: 3}
m_Sprite: {fileID: 21300000, guid: ff4d597826f53ac49821fc3d60148965, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1

View File

@ -44,7 +44,7 @@ public class ShopHeaderTabView : MonoBehaviour
if (null!= freshSale)
{
GameDataManager.sale = GameDataManager.GetTimeStamp(dateTime) + JoypacUtils.OnlineParametersIntByJoypacSDK(StaticOnlineParams.SaleVideoTime);
freshSale(true);
freshSale(false);
}
});

View File

@ -48,10 +48,18 @@ public class ShopItemView : MonoBehaviour
nomalPrice = shopData.price>nomalPrice?shopData.price:nomalPrice;
shopData.price = (int)(nomalPrice * 0.8f);
}
else if(nomalPrice!=-1&&GameDataManager.sale<= dateNowTime)
else if (sale)
{
nomalPrice = shopData.price > nomalPrice ? shopData.price : nomalPrice;
shopData.price = (int)(nomalPrice * 0.8f);
}
else if (nomalPrice != -1 && GameDataManager.sale < dateNowTime)
{
shopData.price = nomalPrice;
}
if (shopData.id == 14 )
{
shopData.price = 1;
@ -99,8 +107,17 @@ public class ShopItemView : MonoBehaviour
onObject.SetActive(shopData.price <= GameDataManager.GameData.adCount);
offObject.SetActive(!onObject.activeSelf);
if ((shopData.id == 14|| shopData.id == 15) && GetItemAmount(shopData) > 0)
{
progressText.text = string.Format(ProgressFormat, "1", "1");
if (shopData.id == 14)
progressBar.value = Mathf.InverseLerp(0, shopData.price, 1);
videoButton.gameObject.SetActive(false);
onObject.SetActive(false);
offObject.SetActive(false);
soldOutObject.SetActive(true);
}
else if (shopData.id == 14)
{
progressText.text = string.Format(ProgressFormat, CryptoPrefs.GetInt("ShowButterDialog", 0), "1");
@ -109,7 +126,7 @@ public class ShopItemView : MonoBehaviour
offObject.SetActive(false);
soldOutObject.SetActive(true);
}
if (shopData.id == 15)
else if(shopData.id == 15 )
{
progressText.text = string.Format(ProgressFormat, CryptoPrefs.GetInt("ShowStrawBerryDialog", 0), "1");
@ -151,7 +168,21 @@ public class ShopItemView : MonoBehaviour
}
}
private int GetItemAmount(ShopData shopData)
{
var gameData = GameDataManager.GameData;
switch (shopData.Category)
{
case ItemCategory.Material:
return gameData.Material.Find(data => data.Id == shopData.itemId)?.Amount ?? 0;
case ItemCategory.Recipe:
return gameData.MyRecipes.Contains(shopData.itemId) ? 1 : 0;
case ItemCategory.Pan:
return gameData.Pans.Contains(shopData.itemId) ? 1 : 0;
default:
throw new ArgumentOutOfRangeException();
}
}
public void SetStockCount(int stock)
{