251 lines
5.8 KiB
C#
251 lines
5.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
public enum ItemCategory
|
|
{
|
|
Material = 1,
|
|
Recipe = 2,
|
|
Pan = 3,
|
|
}
|
|
|
|
public enum ShopItemType
|
|
{
|
|
Consumable = 1,
|
|
NonConsumable = 2,
|
|
}
|
|
|
|
public enum ProductRarity
|
|
{
|
|
Normal = 1,
|
|
Yellow = 2,
|
|
Copper = 3,
|
|
Silver = 4,
|
|
Gold = 5,
|
|
Rainbow = 6,
|
|
}
|
|
|
|
public enum CornFieldUpgradeType
|
|
{
|
|
FieldTop = 1,
|
|
FieldCenter = 2,
|
|
FieldBottom = 3,
|
|
Machine = 4,
|
|
}
|
|
|
|
public enum MissionCategory
|
|
{
|
|
Normal = 1,
|
|
Daily = 2,
|
|
}
|
|
|
|
public enum MissionCondition
|
|
{
|
|
CornCount = 1,
|
|
CustomerCount = 2,
|
|
SalesCount = 3,
|
|
RareSalesCount = 4,
|
|
RecipeCount = 5,
|
|
CoinConsumeCount = 6,
|
|
SaltSalesCount = 7,
|
|
}
|
|
|
|
public enum MissionRewardType
|
|
{
|
|
Coin = 1,
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class MissionData
|
|
{
|
|
public int id;
|
|
public int category;
|
|
public int shopLevel;
|
|
public int condition;
|
|
public int count;
|
|
public int rewardType;
|
|
public int reward;
|
|
public MissionCategory Category => (MissionCategory) category;
|
|
public MissionCondition Condition => (MissionCondition) condition;
|
|
public MissionRewardType RewardType => (MissionRewardType) rewardType;
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class RarityData
|
|
{
|
|
public int id;
|
|
public int rate;
|
|
public int bulkOrderBonus;
|
|
public ProductRarity Rarity => (ProductRarity)id;
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class PanData
|
|
{
|
|
public int id;
|
|
public int nameId;
|
|
public string name;
|
|
public string text;
|
|
public int rarity;
|
|
public string prefabName;
|
|
public ProductRarity Rarity => (ProductRarity)rarity;
|
|
public RectTransform GetPrefab()
|
|
{
|
|
return Resources.Load<RectTransform>("Pans/" + prefabName);
|
|
}
|
|
public RectTransform GetIconPrefab()
|
|
{
|
|
return Resources.Load<RectTransform>("MaterialIcons/" + prefabName);
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class FieldUpgradeData
|
|
{
|
|
public int type;
|
|
public int level;
|
|
public int price;
|
|
public int harvested;
|
|
public string prefabName;
|
|
public CornFieldUpgradeType Type => (CornFieldUpgradeType) type;
|
|
|
|
public RectTransform GetIconPrefab()
|
|
{
|
|
return Resources.Load<RectTransform>("MachineIcons/" + prefabName);
|
|
}
|
|
|
|
public Animator GetPrefab()
|
|
{
|
|
return Resources.Load<Animator>("Machines/" + prefabName);
|
|
}
|
|
public static CornFieldUpgradeType PlantTypeToUpgradeType(PlantLineType lineType)
|
|
{
|
|
switch (lineType)
|
|
{
|
|
case PlantLineType.Top:
|
|
return CornFieldUpgradeType.FieldTop;
|
|
case PlantLineType.Center:
|
|
return CornFieldUpgradeType.FieldCenter;
|
|
case PlantLineType.Bottom:
|
|
return CornFieldUpgradeType.FieldBottom;
|
|
default:
|
|
throw new ArgumentOutOfRangeException(nameof(lineType), lineType, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ProductData
|
|
{
|
|
public int id;
|
|
public int nameId;
|
|
public string name;
|
|
public int shopLevel;
|
|
public int price;
|
|
public int volume;
|
|
public string text;
|
|
public int material1Id;
|
|
public int material2Id;
|
|
public int material3Id;
|
|
// public int cookingType;
|
|
public string prefabName;
|
|
private List<(int id, int amount)> materialList;
|
|
public List<(int id, int amount)> MaterialList
|
|
{
|
|
get
|
|
{
|
|
if (materialList == null)
|
|
{
|
|
materialList = new List<(int id, int amount)>
|
|
{
|
|
(material1Id,15 * volume),
|
|
(material2Id,1),
|
|
(material3Id,1),
|
|
};
|
|
}
|
|
return materialList;
|
|
}
|
|
}
|
|
|
|
public int GetMaterialCount()
|
|
{
|
|
return materialList.Count(material => material.id != Const.NotSetMaterialId);
|
|
}
|
|
|
|
public Transform GetIconPrefab()
|
|
{
|
|
return Resources.Load<Transform>("PopcornIcons/" + (string.IsNullOrEmpty(prefabName) ? "package_salt" : prefabName));
|
|
}
|
|
public Transform GetLargePrefab()
|
|
{
|
|
return Resources.Load<Transform>("PopcornIcons/" + (string.IsNullOrEmpty(prefabName) ? "package_salt" : prefabName));
|
|
}
|
|
|
|
public MarketPopcornView GetMarketPrefab()
|
|
{
|
|
return Resources.Load<MarketPopcornView>("Popcorns/" + (string.IsNullOrEmpty(prefabName) ? "package_salt" : prefabName));
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class BulkOrderData
|
|
{
|
|
public int id;
|
|
public int shopLevel;
|
|
public int maxOrder;
|
|
public int firstOrderCondition;
|
|
public int retryCondition;
|
|
public int productId1;
|
|
public int count1;
|
|
public int productId2;
|
|
public int count2;
|
|
public int productId3;
|
|
public int count3;
|
|
public int rewardCoin;
|
|
public int rewardHeart;
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class BulkOrderTextData
|
|
{
|
|
public int id;
|
|
public int shopLevel;
|
|
public string requestText;
|
|
public string thanksText;
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ShopLevelData
|
|
{
|
|
public int id;
|
|
public int shopLevel;
|
|
public int heart;
|
|
public int customer;
|
|
public int achievement;
|
|
public string text;
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ShopData {
|
|
public int id;
|
|
public int nameId;
|
|
public int itemId;
|
|
public string name;
|
|
public int price;
|
|
public string text;
|
|
public int category;
|
|
public int consumeType;
|
|
public string prefabName;
|
|
public ItemCategory Category => (ItemCategory)category;
|
|
public ShopItemType ConsumeType => (ShopItemType)consumeType;
|
|
|
|
public Transform GetPrefab()
|
|
{
|
|
return Resources.Load<Transform>("Materials/" + (string.IsNullOrEmpty(prefabName) ? "corn" : prefabName));
|
|
}
|
|
public Transform GetIconPrefab()
|
|
{
|
|
return Resources.Load<Transform>("MaterialIcons/" + (string.IsNullOrEmpty(prefabName) ? "corn" : prefabName));
|
|
}
|
|
} |