| | |
| | | public class GemBehaviour |
| | | { |
| | | public Image gemIcon; |
| | | public Image locked; |
| | | public Text gemName; |
| | | public Text[] propertyBehaviours; |
| | | public Text propertyBehaviour; |
| | | public RectTransform unLockContainer; |
| | | |
| | | public void Display(bool active, int gem) |
| | | { |
| | | if (active) |
| | | { |
| | | locked.gameObject.SetActive(false); |
| | | if (gem > 0) |
| | | { |
| | | var config = ItemConfig.Get(gem); |
| | |
| | | properties.Add(new Int2(config.Effect5, config.EffectValueA5)); |
| | | } |
| | | |
| | | for (int i = 0; i < propertyBehaviours.Length; i++) |
| | | var lines = new string[properties.Count]; |
| | | for (int i = 0; i < properties.Count; i++) |
| | | { |
| | | var behaviour = propertyBehaviours[i]; |
| | | if (i < properties.Count) |
| | | { |
| | | var property = properties[i]; |
| | | behaviour.gameObject.SetActive(true); |
| | | behaviour.text = string.Format("{0}+{1}", property.x, PlayerPropertyConfig.GetPropertyDescription(property.x, property.y)); |
| | | } |
| | | else |
| | | { |
| | | behaviour.gameObject.SetActive(false); |
| | | } |
| | | var property = properties[i]; |
| | | lines[i] = string.Format("{0}+{1}", property.x, PlayerPropertyConfig.GetPropertyDescription(property.x, property.y)); |
| | | } |
| | | |
| | | propertyBehaviour.text = string.Join("\r\n", lines); |
| | | } |
| | | else |
| | | { |
| | | gemIcon.gameObject.SetActive(false); |
| | | gemName.text = "未镶嵌"; |
| | | for (int i = 0; i < propertyBehaviours.Length; i++) |
| | | { |
| | | var behaviour = propertyBehaviours[i]; |
| | | behaviour.gameObject.SetActive(false); |
| | | } |
| | | propertyBehaviour.gameObject.SetActive(false); |
| | | } |
| | | |
| | | unLockContainer.gameObject.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | locked.gameObject.SetActive(true); |
| | | gemIcon.gameObject.SetActive(false); |
| | | gemName.text = "未镶嵌"; |
| | | for (int i = 0; i < propertyBehaviours.Length; i++) |
| | | { |
| | | var behaviour = propertyBehaviours[i]; |
| | | behaviour.gameObject.SetActive(false); |
| | | } |
| | | |
| | | propertyBehaviour.gameObject.SetActive(false); |
| | | unLockContainer.gameObject.SetActive(true); |
| | | } |
| | | } |