public void AddCD(TData key, int cd) { if (this.ContainsKey(key)) { return; } var cdData = new CD(cd); this.Add(key, cdData); Callback_OnAdded?.Invoke(key, cdData); }
public TDBaseAlertData Add(string alertName, BaseUnit cast = null) { if (!Table.Contains(alertName)) { if (CommonAlert == alertName) { CLog.Error("请手动添加 CommonAlert"); } return(null); } TDBaseAlertData tempAlert = null; if (IsHaveCache(alertName)) { tempAlert = GetCache(alertName); CachesAlert.Remove(alertName); } else { tempAlert = Table.Find(alertName).Copy(); } tempAlert.Cast = cast?cast:LocalPlayer; if (tempAlert == null) { CLog.Error("未找到alert errorId=" + alertName); return(null); } //判断通知是否可以被合并 var mergeAlert = CanMerge(tempAlert); if (mergeAlert != null) { mergeAlert.OnMerge(); Callback_OnMerge?.Invoke(mergeAlert); } else { tempAlert.ID = IDMgr.GetNextId(); Data.Add(tempAlert); tempAlert.OnBeAdded(SelfBaseUnit); Callback_OnAdded?.Invoke(tempAlert); tempAlert.OnStart(); } return(tempAlert); }
public void AddSkill(string skillName) { if (!Table.Contains(skillName)) { return; } TData tempSkill = Table.Find(skillName).Copy() as TData; if (tempSkill != null) { tempSkill.Index = _baseSkills.Count; tempSkill.OnBeAdded(Mono); _baseSkills.Add(tempSkill); Callback_OnAdded?.Invoke(tempSkill); tempSkill.Callback_OnCDOver += OnSkillCDOver; } }
public void AddSkill(string skillName) { if (!TDLuaMgr.Contains(skillName)) { return; } TData tempSkill = TDLuaMgr.Get <TData>(skillName).Copy <TData>(); if (tempSkill != null) { tempSkill.SkillIndex = _baseSkills.Count; tempSkill.OnBeAdded(SelfMono); _baseSkills.Add(tempSkill); Callback_OnAdded?.Invoke(tempSkill); tempSkill.Callback_OnCDOver += OnSkillCDOver; } }
private TData Add(string tdid, BaseUnit cast = null, Callback <TData> action = null, bool isAutoTrigger = false) { if (!TDLuaMgr.Contains(tdid)) { if (CommonAlert == tdid) { CLog.Error("没有:{0},请手动添加CommonAlert", tdid); } else { CLog.Error("没有:{0},请手动添加Alert", tdid); } return(null); } TData sourceAlert = TDLuaMgr.Get <TData>(tdid); sourceAlert.Cast = cast ? cast : LocalPlayer; sourceAlert.AlertMgr = this; //判断通知是否可以被合并 var finalAlert = CanMerge(sourceAlert); if (finalAlert != null) { finalAlert.OnMerge(); Callback_OnMerge?.Invoke(finalAlert); } else { finalAlert = sourceAlert.Copy <TData>(); finalAlert.ID = IDUtil.Gen(); finalAlert.OnBeAdded(SelfBaseUnit); Data.Add(finalAlert); if (finalAlert.Type == AlertType.Interaction) { //推送最近一次的谈判信息 if (ArticleMgr.IsStarNegotiation) { ArticleMgr.PushNagotiationToAlert(finalAlert); } InteractionData.Add(finalAlert); Callback_OnInteractionChange?.Invoke(finalAlert); } else if (finalAlert.Type == AlertType.Disposable) { DisposableData.Add(finalAlert); Callback_DisposableChange?.Invoke(finalAlert); } else if (finalAlert.Type == AlertType.Continue) { ContinueData.Add(finalAlert); Callback_ContinueChange?.Invoke(finalAlert); } action?.Invoke(finalAlert); if (BaseGlobal.IsUnReadData) { Callback_OnAdded?.Invoke(finalAlert); } } if (finalAlert.IsAutoTrigger || isAutoTrigger) { finalAlert.DoLeftClickTrigger(); } return(finalAlert); }