小修
This commit is contained in:
@@ -28,6 +28,7 @@ namespace Continentis.MainGame
|
||||
public GameObject handCardObject;
|
||||
public GameObject intentionCardObject;
|
||||
public GameObject inspectionCardObject;
|
||||
public SerializableDictionary<string, Sprite> intentionMarkIcons;
|
||||
public SerializableDictionary<string, CardViewCollection> cardViewCollections;
|
||||
|
||||
[Header("GeneralUI")] public GameObject customImage;
|
||||
|
||||
@@ -20,11 +20,9 @@ namespace Continentis.MainGame
|
||||
TextInterpreter.SetVariable(keyword.Key, keyword.Key);
|
||||
}
|
||||
}
|
||||
|
||||
public static void InterpretText(CardInstance card, bool overrideDescription = false)
|
||||
|
||||
public static string InterpretText(CardInstance card, string textToInterpret)
|
||||
{
|
||||
//card.contentSubmodule.keywords.Clear();
|
||||
|
||||
foreach (KeyValuePair<string, float> attribute in card.attributeSubmodule.attributeGroup.current)
|
||||
{
|
||||
TextInterpreter.SetVariable(attribute.Key, attribute.Value);
|
||||
@@ -34,13 +32,18 @@ namespace Continentis.MainGame
|
||||
TextInterpreter.SetFunction("Attribute", new Func<string, string>((name) => GetAttribute(card, name, true, false)));
|
||||
TextInterpreter.SetFunction("Attribute", new Func<string, bool, string>((name, high) => GetAttribute(card, name, high, false)));
|
||||
TextInterpreter.SetFunction("Attribute", new Func<string, bool, bool, string>((name, high, percent) => GetAttribute(card, name, high, percent)));
|
||||
|
||||
string result = DynamicTextInterpreter.Parse(TextInterpreter, textToInterpret);
|
||||
|
||||
Debug.Log($"Interpreted Text: {result}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void InterpretText(CardInstance card)
|
||||
{
|
||||
string descriptionToParse = card.contentSubmodule.originalFunctionText;
|
||||
string result = DynamicTextInterpreter.Parse(TextInterpreter, descriptionToParse);
|
||||
|
||||
string result = InterpretText(card, descriptionToParse);
|
||||
card.contentSubmodule.interpretedFunctionText = result;
|
||||
|
||||
Debug.Log($"Interpreted Description: {result}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Continentis.MainGame.Card
|
||||
[Header("Intention")]
|
||||
public List<string> intentionIconKeys;
|
||||
public List<string> intentionValueNames;
|
||||
public string intentionTextOverride;
|
||||
public float baseWeight = 0f;
|
||||
|
||||
[Header("Attributes")] [Tooltip("可变属性,这个属性会自动设置BaseAttr进入Original,设置Attr,BaseAttrOffset=0,以及DisplayAttr进入Current")]
|
||||
|
||||
@@ -188,6 +188,26 @@ namespace Continentis.MainGame.Card
|
||||
this.intentionCardView = intentionCardView;
|
||||
intentionCardView.transform.localScale = Vector3.one;
|
||||
intentionCardView.Setup(this);
|
||||
|
||||
string iconMarkKey = cardData.intentionIconKeys[0];
|
||||
Sprite iconSprite = MainGameManager.Instance.basePrefabs.intentionMarkIcons[iconMarkKey];
|
||||
if (string.IsNullOrEmpty(cardData.intentionTextOverride))
|
||||
{
|
||||
if (cardData.intentionValueNames.Count > 0)
|
||||
{
|
||||
string intentionValue = attributeSubmodule.GetRoundCurrentAttribute(cardData.intentionValueNames[0]).ToString();
|
||||
intentionCardView.intentionMark.SetMark(iconSprite, intentionValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
intentionCardView.intentionMark.SetMark(iconSprite);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
intentionCardView.intentionMark.SetMark(iconSprite, cardData.intentionTextOverride);
|
||||
}
|
||||
|
||||
return intentionCardView;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,13 @@ namespace Continentis.MainGame.Card
|
||||
public void SetMark(Sprite sprite, string text)
|
||||
{
|
||||
markImage.sprite = sprite;
|
||||
markText.text = text;
|
||||
markText.text = CardTextInterpreter.InterpretText(intentionCardView.card, text);
|
||||
}
|
||||
|
||||
public void SetMark(Sprite sprite)
|
||||
{
|
||||
markImage.sprite = sprite;
|
||||
markText.text = string.Empty;
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Continentis.MainGame.Card
|
||||
|
||||
private SerializedProperty intentionIconKeysProp;
|
||||
private SerializedProperty intentionValueNamesProp;
|
||||
private SerializedProperty intentionTextOverrideProp;
|
||||
private SerializedProperty baseWeightProp;
|
||||
|
||||
|
||||
@@ -60,6 +61,7 @@ namespace Continentis.MainGame.Card
|
||||
|
||||
intentionIconKeysProp = serializedObject.FindProperty("intentionIconKeys");
|
||||
intentionValueNamesProp = serializedObject.FindProperty("intentionValueNames");
|
||||
intentionTextOverrideProp = serializedObject.FindProperty("intentionTextOverride");
|
||||
baseWeightProp = serializedObject.FindProperty("baseWeight");
|
||||
|
||||
variableAttributesProp = serializedObject.FindProperty("variableAttributes");
|
||||
@@ -131,6 +133,7 @@ namespace Continentis.MainGame.Card
|
||||
EditorGUILayout.LabelField("Attributes", EditorStyles.boldLabel);
|
||||
DrawListWithEditRefSelector(intentionIconKeysProp, "IntentionIconKeys");
|
||||
DrawListWithLocalSelector(intentionValueNamesProp, "variableAttributes");
|
||||
EditorGUILayout.PropertyField(intentionTextOverrideProp);
|
||||
EditorGUILayout.PropertyField(baseWeightProp);
|
||||
EditorGUILayout.PropertyField(variableAttributesProp, true);
|
||||
EditorGUILayout.PropertyField(originalAttributesProp, true);
|
||||
|
||||
@@ -358,7 +358,7 @@ namespace SLSFramework.UModAssistance
|
||||
if (GUILayout.Button(item, EditorStyles.label))
|
||||
{
|
||||
_onSelectCallback?.Invoke(item);
|
||||
// this.Close(); // 可选:点击后关闭
|
||||
this.Close(); // 可选:点击后关闭
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user