56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using SLSFramework.General;
|
|
using UniRx;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.MainGame.Card
|
|
{
|
|
public class ContentSubmodule : SubmoduleBase<CardInstance>
|
|
{
|
|
public List<string> keywords;
|
|
|
|
public string cardName;
|
|
public Sprite cardSprite;
|
|
public Rarity cardRarity;
|
|
public CardType cardType;
|
|
public string originalFunctionText;
|
|
public string interpretedFunctionText;
|
|
|
|
/// <summary>
|
|
/// 标记:内容已更改,需要刷新
|
|
/// </summary>
|
|
public bool dirtyMark;
|
|
|
|
public ContentSubmodule(CardInstance card) : base(card)
|
|
{
|
|
keywords = card.cardData.keywords;
|
|
cardName = card.cardData.displayName.Localize();
|
|
cardSprite = card.cardData.cardSprite;
|
|
originalFunctionText = card.cardData.functionText.Localize();
|
|
cardRarity = card.cardData.cardRarity;
|
|
cardType = card.cardData.cardType;
|
|
dirtyMark = false;
|
|
|
|
Observable.EveryLateUpdate().Subscribe(_ =>
|
|
{
|
|
if (dirtyMark)
|
|
{
|
|
RefreshContent();
|
|
dirtyMark = false;
|
|
}
|
|
}).AddTo(card.disposables);
|
|
|
|
//CardDescriptionInterpreter.InterpretDescription(card);
|
|
//keywords = CardDescriptionInterpreter.GetKeywords(card.cardData.cardDescription);
|
|
//Debug.Log($"Extracted Keywords: {string.Join(", ", keywords)}");
|
|
}
|
|
|
|
public void RefreshContent()
|
|
{
|
|
CardTextInterpreter.InterpretText(owner);
|
|
owner.handCardView?.Setup();
|
|
owner.intentionCardView?.Setup();
|
|
}
|
|
}
|
|
} |