private void SkillsDictionaryClientPairRemoved( NetworkSyncDictionary <IProtoSkill, SkillLevelData> source, IProtoSkill key) { // this method might be called only in the editor mode or when the character is wiped // during normal play it's not possible as skill entries only added (and their exp gained) this.OnSkillsChanged(); Api.SafeInvoke(() => SkillLevelChanged?.Invoke(key, default)); }
public void OnSkillLevelChanged(IProtoSkill skill, SkillLevelData data) { this.OnSkillsChanged(); Api.SafeInvoke(() => SkillLevelChanged?.Invoke(skill, data)); var level = data.Level; if (level == 0) { return; } ClientTimersSystem.AddAction( delaySeconds: 1, () => { // show notification if (level == 1) { Client.Audio.PlayOneShot(SoundResourceSkillDiscovered, volume: 0.5f); NotificationSystem.ClientShowNotification( string.Format(NotificationSkillDiscovered, skill.Name), message: null, color: NotificationColor.Good, icon: skill.Icon, onClick: OnNotificationClick, playSound: false); } else { Client.Audio.PlayOneShot(SoundResourceSkillLevelUp, volume: 0.5f); NotificationSystem.ClientShowNotification( string.Format(NotificationSkillReachedLevel, skill.Name, level), color: NotificationColor.Good, icon: skill.Icon, onClick: OnNotificationClick, playSound: false); } }); void OnNotificationClick() { WindowSkills.OpenAndSelectSkill(skill); } }