2021-04-08 20:09:59 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public class UserSettingUpdateSystem : UpdateSystem<UserSetting>
|
|
|
|
|
{
|
|
|
|
|
public override void Update(UserSetting self)
|
|
|
|
|
{
|
|
|
|
|
if (self.canUse) return;
|
2021-04-11 19:50:39 +08:00
|
|
|
|
long now = TimeHelper.ClientNow();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if(now >= self.lastCD)
|
|
|
|
|
{
|
|
|
|
|
self.lastCD = now;
|
|
|
|
|
self.canUse = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class UserSettingDestroySystem : DestroySystem<UserSetting>
|
|
|
|
|
{
|
|
|
|
|
public override void Destroy(UserSetting self)
|
|
|
|
|
{
|
|
|
|
|
for (int i = self.MainUISlotArr.Length - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
self.MainUISlotArr[i]?.Dispose();
|
|
|
|
|
self.MainUISlotArr[i] = null;
|
|
|
|
|
}
|
|
|
|
|
self.CD = 5000;
|
|
|
|
|
self.AutoSkillList.Clear();
|
|
|
|
|
self.IsAutoSkill = false;
|
|
|
|
|
self.IsDisplayOthers = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static class UserSettingSystem
|
|
|
|
|
{
|
|
|
|
|
public static void UpdateAutoSkills(this UserSetting self, IEnumerable<int> list)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
self.AutoSkillList.Clear();
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (int skillId in list)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
self.AutoSkillList.AddLast(skillId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static LinkedList<int> GetAutoSkills(this UserSetting self)
|
|
|
|
|
{
|
|
|
|
|
return self.AutoSkillList;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取主UI格子信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="self"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static MainUISlot[] GetMainUISlots(this UserSetting self)
|
|
|
|
|
{
|
|
|
|
|
return self.MainUISlotArr;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新主UI格子信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="self"></param>
|
|
|
|
|
/// <param name="index"></param>
|
|
|
|
|
/// <param name="mainUISlot"></param>
|
|
|
|
|
public static void UpdateMainUISlot(this UserSetting self,int index, MainUISlot mainUISlot)
|
|
|
|
|
{
|
|
|
|
|
self.MainUISlotArr[index] = mainUISlot;
|
|
|
|
|
}
|
|
|
|
|
public static MainUISlot GetMainUISlot(this UserSetting self, int index)
|
|
|
|
|
{
|
|
|
|
|
return self.MainUISlotArr[index];
|
|
|
|
|
}
|
|
|
|
|
public static void SetCD(this UserSetting self,int CD)
|
|
|
|
|
{
|
|
|
|
|
self.CD = CD;
|
|
|
|
|
}
|
|
|
|
|
public static void StartCD(this UserSetting self,MainUIType mainUIType,int id,int skillCD)
|
|
|
|
|
{
|
|
|
|
|
self.canUse = false;
|
|
|
|
|
self.lastCD = TimeHelper.ClientNow() + self.CD;
|
|
|
|
|
MessageHelper.SendActor(self.GetParent<Unit>(), new M2C_StartCD { Time = self.CD,Type =mainUIType ,Id = id,SkillCD =skillCD});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|