153 lines
5.2 KiB
C#
153 lines
5.2 KiB
C#
using System.Collections.Generic;
|
|
using Continentis.MainGame.Card;
|
|
using Continentis.MainGame.Character;
|
|
using DamageNumbersPro;
|
|
using SLSFramework.General;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.MainGame
|
|
{
|
|
public enum Rarity
|
|
{
|
|
None = 0,
|
|
Common = 10,
|
|
Uncommon = 20,
|
|
Rare = 30,
|
|
Epic = 40,
|
|
Legendary = 50,
|
|
Divine = 60
|
|
}
|
|
|
|
[CreateAssetMenu(menuName = "Continentis/MainGame/BasePrefabs", fileName = "MainGameBasePrefabs")]
|
|
public partial class BasePrefabs : ScriptableObject
|
|
{
|
|
[Header("Character")]
|
|
public GameObject combatCharacterView;
|
|
|
|
[Header("Cards")]
|
|
public GameObject handCardObject;
|
|
public GameObject intentionCardObject;
|
|
public GameObject inspectionCardObject;
|
|
public SerializableDictionary<string, Sprite> intentionMarkIcons;
|
|
public SerializableDictionary<string, CardViewCollection> cardViewCollections;
|
|
|
|
[Header("GeneralUI")] public GameObject customImage;
|
|
public GameObject informationBox;
|
|
public SerializableDictionary<Fraction, Color> fractionColors;
|
|
public SerializableDictionary<Rarity, Color> rarityColors;
|
|
|
|
[Header("CombatUI")]
|
|
public GameObject pointerArrow;
|
|
public GameObject hudContainer;
|
|
|
|
[Header("Texts")]
|
|
public GameObject hurtDamageNumber;
|
|
public GameObject blockedDamageNumber;
|
|
public GameObject healNumber;
|
|
public GameObject informationText;
|
|
}
|
|
|
|
public partial class BasePrefabs
|
|
{
|
|
public Color GetRarityColor(Rarity rarity)
|
|
{
|
|
if (rarityColors.TryGetValue(rarity, out Color color))
|
|
{
|
|
return color;
|
|
}
|
|
return Color.white;
|
|
}
|
|
}
|
|
|
|
public partial class BasePrefabs
|
|
{
|
|
public DamageNumber GenerateHurtText(int amount, CombatCharacterViewBase characterView)
|
|
{
|
|
Vector3 position = characterView.transform.position + Vector3.up * 0.5f;
|
|
|
|
if (characterView.numbersPivot != null)
|
|
{
|
|
position = characterView.numbersPivot.position;
|
|
}
|
|
|
|
DamageNumber infoText = GenerateHurtText(amount, position);
|
|
return infoText;
|
|
}
|
|
|
|
public DamageNumber GenerateHurtText(int amount, Vector3 position)
|
|
{
|
|
DamageNumber hurtText = GenerateCombatText(hurtDamageNumber, position);
|
|
hurtText.number = amount;
|
|
return hurtText;
|
|
}
|
|
|
|
public DamageNumber GenerateBlockedText(int amount, CombatCharacterViewBase characterView)
|
|
{
|
|
Vector3 position = characterView.transform.position + Vector3.up * 0.5f;
|
|
|
|
if (characterView.numbersPivot != null)
|
|
{
|
|
position = characterView.numbersPivot.position;
|
|
}
|
|
|
|
DamageNumber infoText = GenerateBlockedText(amount, position);
|
|
return infoText;
|
|
}
|
|
|
|
public DamageNumber GenerateBlockedText(int amount, Vector3 position)
|
|
{
|
|
DamageNumber blockedText = GenerateCombatText(blockedDamageNumber, position);
|
|
blockedText.number = amount;
|
|
return blockedText;
|
|
}
|
|
|
|
public DamageNumber GenerateHealText(int amount, CombatCharacterViewBase characterView)
|
|
{
|
|
Vector3 position = characterView.transform.position + Vector3.up * 0.5f;
|
|
|
|
if (characterView.numbersPivot != null)
|
|
{
|
|
position = characterView.numbersPivot.position;
|
|
}
|
|
|
|
DamageNumber infoText = GenerateHealText(amount, position);
|
|
return infoText;
|
|
}
|
|
|
|
public DamageNumber GenerateHealText(int amount, Vector3 position)
|
|
{
|
|
DamageNumber healText = GenerateCombatText(healNumber, position);
|
|
healText.number = amount;
|
|
return healText;
|
|
}
|
|
|
|
public DamageNumber GenerateInfoText(string content, CombatCharacterViewBase characterView, Color color = default, float size = 1)
|
|
{
|
|
Vector3 position = characterView.transform.position + Vector3.up;
|
|
|
|
if (characterView.textsPivot != null)
|
|
{
|
|
position = characterView.textsPivot.position;
|
|
}
|
|
|
|
DamageNumber infoText = GenerateCombatText(informationText, position, color, size);
|
|
infoText.leftText = content;
|
|
return infoText;
|
|
}
|
|
|
|
public DamageNumber GenerateInfoText(string content, Vector3 position, Color color = default, float size = 1)
|
|
{
|
|
DamageNumber infoText = GenerateCombatText(informationText, position, color, size);
|
|
infoText.leftText = content;
|
|
return infoText;
|
|
}
|
|
|
|
public DamageNumber GenerateCombatText(GameObject textPrefab, Vector3 position, Color color = default, float size = 1)
|
|
{
|
|
DamageNumber combatText = Instantiate(textPrefab, position, Quaternion.identity).GetComponent<DamageNumber>();
|
|
if (color != default) combatText.SetColor(color);
|
|
combatText.SetScale(size);
|
|
return combatText;
|
|
}
|
|
}
|
|
} |