You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.7 KiB
80 lines
2.7 KiB
using UnityEditor; |
|
using UnityEngine.UIElements; |
|
|
|
namespace PVSkill |
|
{ |
|
public class SkillEffectElement |
|
{ |
|
private VisualElement root; |
|
private SkillEffectConfig curSkillEffectConfig; |
|
|
|
// elem |
|
private Label effectTypeLbl; |
|
private Label canBeParryLbl; |
|
private Label canBeFightBackLbl; |
|
private Label canBeInterruptLbl; |
|
private Label canBeSupportLbl; |
|
private Label numericExpressionLbl; |
|
|
|
public SkillEffectElement(VisualElement root) |
|
{ |
|
var visualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/Editor/SkillEditor/SkillEffectElement.uxml"); |
|
visualTree.CloneTree(root); |
|
|
|
this.root = root; |
|
this.effectTypeLbl = root.Q<Label>("EffectTypeLbl"); |
|
this.canBeParryLbl = root.Q<Label>("CanBeParryLbl"); |
|
this.canBeFightBackLbl = root.Q<Label>("CanBeFightBackLbl"); |
|
this.canBeInterruptLbl = root.Q<Label>("CanBeInterruptLbl"); |
|
this.canBeSupportLbl = root.Q<Label>("CanBeSupportLbl"); |
|
this.numericExpressionLbl = root.Q<Label>("NumericExpressionLbl"); |
|
} |
|
|
|
public void SetEffectType(int type) |
|
{ |
|
this.effectTypeLbl.text = SkillEditorDefines.EffectTypeMap[type]; |
|
} |
|
|
|
public void SetCanBeParry(int value) |
|
{ |
|
this.canBeParryLbl.text = SkillEditorDefines.CanOrNot[value]; |
|
} |
|
|
|
public void SeCanBeFightBack(int value) |
|
{ |
|
this.canBeFightBackLbl.text = SkillEditorDefines.CanOrNot[value]; |
|
} |
|
|
|
public void SetCanBeInterrupt(int value) |
|
{ |
|
this.canBeInterruptLbl.text = SkillEditorDefines.CanOrNot[value]; |
|
} |
|
|
|
public void SetCanBeSupport(int value) |
|
{ |
|
this.canBeSupportLbl.text = SkillEditorDefines.CanOrNot[value]; |
|
} |
|
|
|
public void SEtNumericExpression(string exp) |
|
{ |
|
this.numericExpressionLbl.text = string.IsNullOrEmpty(exp) ? "空" : exp; |
|
} |
|
|
|
public void Hide() |
|
{ |
|
this.root.style.display = DisplayStyle.None; |
|
} |
|
|
|
public void SetDataByConfig(SkillEffectConfig config) |
|
{ |
|
this.curSkillEffectConfig = config; |
|
this.root.style.display = DisplayStyle.Flex; |
|
this.SetEffectType(config.EffectConfig); |
|
// this.SetCanBeParry(config.CanBeParry); |
|
// this.SetCanBeInterrupt(config.CanBeInterrupt); |
|
// this.SetCanBeSupport(config.CanBeSupport); |
|
// this.SeCanBeFightBack(config.CanBeFightBack); |
|
this.SEtNumericExpression(config.NumericExpression); |
|
} |
|
} |
|
} |