public MechaComponentInfo(MechaComponentConfig mechaComponentConfig, Quality quality, string alias = "") { GUID = GetGUID(); MechaComponentConfig = mechaComponentConfig; Quality = quality; Alias = alias; AbilityGroup = ConfigManager.Instance.GetAbilityGroup(MechaComponentConfig.AbilityGroupConfigKey); MechaComponentQualityConfig = ConfigManager.Instance.GetMechaComponentQualityConfig(MechaComponentConfig.MechaComponentQualityConfigKey); CurrentQualityUpgradeData = MechaComponentQualityConfig.GetQualityUpgradeData(quality); if (CurrentQualityUpgradeData == null) { Debug.LogError($"未配置品质为{quality}的{MechaComponentType}"); } else { CurrentPowerUpgradeData = CurrentQualityUpgradeData.GetPowerUpgradeData(0); } M_TotalLife = CurrentQualityUpgradeData.Life; M_LeftLife = CurrentQualityUpgradeData.Life; if (ConfigManager.MechaComponentOriginalOccupiedGridInfoDict.TryGetValue(mechaComponentConfig.MechaComponentKey, out MechaComponentOriginalOccupiedGridInfo info)) { MechaComponentOriginalOccupiedGridInfo = info.Clone(); } }
public bool ValidateQuality(Quality quality) { if (MechaComponentPrefab) { MechaComponentConfig mcc = ConfigManager.Instance.GetMechaComponentConfig(MechaComponentPrefab.name); MechaComponentQualityConfig qc = ConfigManager.Instance.GetMechaComponentQualityConfig(mcc.MechaComponentQualityConfigKey); if (qc.GetQualityUpgradeData(quality) != null) { qualityMessage = ""; return(true); } else { qualityMessage = $"{MechaComponentPrefab.name}组件未配置{quality}品质"; return(false); } } else { qualityMessage = "机甲组件为空,请先设置机甲组件"; return(false); } }