Core/GameEngine/DataToCtl/ConnectedState.cs
@@ -65,7 +65,7 @@ { if (clock != null) { clock.Stop(); Clock.Stop(clock); } clock = null; @@ -90,9 +90,9 @@ if (clock != null) { clock.Stop(); Clock.Stop(clock); } clock = Clock.Create(DateTime.Now + new TimeSpan(_seconds * TimeSpan.TicksPerSecond), OnDetectEnd); clock = Clock.AlarmAt(DateTime.Now + new TimeSpan(_seconds * TimeSpan.TicksPerSecond), OnDetectEnd); } private void OnDetectEnd() Core/GameEngine/DataToCtl/CreateOrSelectRoleState.cs
@@ -60,7 +60,7 @@ { if (clock != null) { clock.Stop(); Clock.Stop(clock); } clock = null; base.OnExit(); @@ -77,9 +77,9 @@ if (clock != null) { clock.Stop(); Clock.Stop(clock); } clock = Clock.Create(DateTime.Now + new TimeSpan(_seconds * TimeSpan.TicksPerSecond), OnDetectEnd); clock = Clock.AlarmAt(DateTime.Now + new TimeSpan(_seconds * TimeSpan.TicksPerSecond), OnDetectEnd); } private void OnDetectEnd() Core/GameEngine/Login/Launch.cs
@@ -61,7 +61,6 @@ #endif #endif tasks.Enqueue(checkAssetValidTask); tasks.Enqueue(downLoadAssetTask); tasks.Enqueue(assetBundleInitTask); @@ -361,6 +360,7 @@ GlobalTimeEvent.Instance.Begin(); PackageRegedit.Init(); Clock.Init(); // ## PocoManager Start if (VersionConfig.Get().appId.Equals("test")) Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0310_tagRoleSkillChange.cs
@@ -13,10 +13,8 @@ public static event SkillChangeHandler SkillChangeEvent; MountModel m_HorseModel; MountModel horsemodel { get { MountModel horsemodel { get { return m_HorseModel ?? (m_HorseModel = ModelCenter.Instance.GetModel<MountModel>()); } } @@ -57,9 +55,9 @@ { Skill _skill = _hero.SkillMgr.Get(vNetData.NewSkillID); _skill.cd = vNetData.RemainTime * Constants.F_GAMMA; if (_skill.RefreshCD != null) if (Skill.RefreshCD != null) { _skill.RefreshCD(vNetData.RemainTime * Constants.F_GAMMA, _skill.skillInfo.config.CoolDownTime * Constants.F_GAMMA); Skill.RefreshCD(_skill.id, vNetData.RemainTime * Constants.F_GAMMA, _skill.skillInfo.config.CoolDownTime * Constants.F_GAMMA); } if (_skill.skillInfo.config.FuncType == 9) Core/NetworkPackage/DTCFile/ServerPack/HB4_Fight/DTCB403_tagMCAttackFail.cs
@@ -41,9 +41,9 @@ _skill.ClearServerHurtList(); _skill.DoPreparingFail(_hero.ServerInstID); if (_skill.RefreshCD != null) if (Skill.RefreshCD != null) { _skill.RefreshCD(0, _skill.skillInfo.config.CoolDownTime * Constants.F_GAMMA); Skill.RefreshCD(_skill.id, 0, _skill.skillInfo.config.CoolDownTime * Constants.F_GAMMA); } } } Fight/Actor/Skill/Skill.cs
@@ -13,27 +13,23 @@ public static event System.Action<int> OnSkillCDFinished; public static event System.Action<uint, int> OnSkillCast; public UnityEngine.Events.UnityAction<float, float> RefreshCD; public static UnityEngine.Events.UnityAction<int, float, float> RefreshCD; public event System.Action<uint> OnPreparingEnd; public event System.Action<uint> OnPreparingFail; public event System.Action OnPreparingCast; public uint OwnerID { get; private set; } public int id { public int id { get; private set; } private float m_Cd; public float cd { get { public float cd { get { return m_Cd; } set { set { m_Cd = value; } } @@ -54,14 +50,11 @@ public List<Vector3> warnPosList = new List<Vector3>();// 预警时候的位置 private bool m_CSkillPrepareEnd; public bool CSkillPrepareEnd { get { public bool CSkillPrepareEnd { get { return m_CSkillPrepareEnd; } set { set { m_CSkillPrepareEnd = value; } } @@ -75,40 +68,31 @@ } private E_SkillPrepareStatus m_SSkillPrepareStatus = E_SkillPrepareStatus.None; public E_SkillPrepareStatus SSkillPrepareStatus { get { public E_SkillPrepareStatus SSkillPrepareStatus { get { return m_SSkillPrepareStatus; } set { set { m_SSkillPrepareStatus = value; } } private bool m_SkillPreparing = false; public bool SkillPreparing { get { public bool SkillPreparing { get { return m_SkillPreparing; } set { set { m_SkillPreparing = value; } } private bool m_SkillCompelete = true; public bool SkillCompelete { get { public bool SkillCompelete { get { return m_SkillCompelete; } set { set { m_SkillCompelete = value; //if (id == 251) //{ @@ -201,7 +185,7 @@ { if (RefreshCD != null) { RefreshCD(cd, cd); RefreshCD(id, cd, cd); } } } @@ -216,7 +200,7 @@ cd = skillInfo.config.CoolDownTime * Constants.F_GAMMA; if (RefreshCD != null) { RefreshCD(cd, cd); RefreshCD(id,cd, cd); } } } Fight/Actor/Skill/SkillManager.cs
@@ -49,10 +49,10 @@ && _skill.skillInfo != null && _skill.skillInfo.config != null) { if (_skill.RefreshCD != null) if ( Skill.RefreshCD != null) { _skill.cd = 0; _skill.RefreshCD(0, _skill.skillInfo.config.CoolDownTime * Constants.F_GAMMA); Skill.RefreshCD( _skill.id,0, _skill.skillInfo.config.CoolDownTime * Constants.F_GAMMA); } } } System/AssetVersion/AssetVersionUtility.cs
@@ -87,7 +87,7 @@ } else { Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), GetAssetVersionFile); Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), GetAssetVersionFile); } } System/AssetVersion/InGameDownLoad.cs
@@ -415,9 +415,10 @@ var endTime = DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond * 3); if (netSwitchClock != null) { netSwitchClock.Stop(); Clock.Stop(netSwitchClock); } netSwitchClock = Clock.Create(endTime, () => netSwitchClock = Clock.AlarmAt(endTime, () => { if (CheckDominantDownLoad()) { @@ -454,7 +455,7 @@ { Pause(); var endTime = DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond * 10); Clock.Create(endTime, () => Clock.AlarmAt(endTime, () => { if (CheckDominantDownLoad()) { System/ClientVersion/VersionUtility.cs
@@ -97,7 +97,7 @@ else { step = Step.None; Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestVersionCheck); Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestVersionCheck); } } @@ -144,7 +144,7 @@ } else { Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestApkDownConfigs); Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestApkDownConfigs); } } @@ -327,20 +327,20 @@ else { step = Step.None; Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestMaoErVersionCheck); Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestMaoErVersionCheck); } } catch (System.Exception ex) { Debug.Log(ex); step = Step.None; Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestMaoErVersionCheck); Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestMaoErVersionCheck); } } else { step = Step.None; Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestMaoErVersionCheck); Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestMaoErVersionCheck); } } System/CrossServerOneVsOne/CrossServerOneVsOneCyclicScroll.cs
@@ -50,7 +50,7 @@ showing = true; this.enabled = false; Clock.Create(DateTime.Now + new TimeSpan((long)(0.5f * TimeSpan.TicksPerSecond)), OnUnfoldShowEnd); Clock.AlarmAt(DateTime.Now + new TimeSpan((long)(0.5f * TimeSpan.TicksPerSecond)), OnUnfoldShowEnd); } private void OnUnfoldShowEnd() @@ -70,7 +70,7 @@ showAchievementBehaviour.alphaTween.SetStartState(); showAchievementBehaviour.alphaTween.Play(); var endTime = DateTime.Now + new TimeSpan((long)(fadeOutTime * TimeSpan.TicksPerSecond)); Clock.Create(endTime, ReLocateItems); Clock.AlarmAt(endTime, ReLocateItems); } void ReLocateItems() @@ -80,7 +80,7 @@ ReLocateAllItems(showAchievementBehaviour); var endTime = DateTime.Now + new TimeSpan((long)(relocationTime * TimeSpan.TicksPerSecond)); Clock.Create(endTime, ShowEnd); Clock.AlarmAt(endTime, ShowEnd); } void ShowEnd() System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs
@@ -73,9 +73,11 @@ public void OnSwitchAccount() { IsMatching = false; if (clientMatchClock!=null ) if (clientMatchClock != null) { clientMatchClock.Stop(); Clock.Stop(clientMatchClock); clientMatchClock = null; } } @@ -470,7 +472,7 @@ var onMatchPackage = new HC002_tagGCCrossRealmPKStartMatch(); GameNetSystem.Instance.PushPackage(onMatchPackage, ServerType.Main); var randomWaitSeconds = UnityEngine.Random.Range(3, 8); clientMatchClock = Clock.Create(DateTime.Now + new TimeSpan(randomWaitSeconds * TimeSpan.TicksPerSecond), () => clientMatchClock = Clock.AlarmAt(DateTime.Now + new TimeSpan(randomWaitSeconds * TimeSpan.TicksPerSecond), () => { IsMatching = false; if (GameNetSystem.Instance.netState == GameNetSystem.NetState.Connected) @@ -489,9 +491,10 @@ } else { if (clientMatchClock != null && !clientMatchClock.stopped) if (clientMatchClock != null ) { clientMatchClock.Stop(); Clock.Stop(clientMatchClock); clientMatchClock = null; IsMatching = false; } else @@ -506,7 +509,7 @@ public void SendBuyMatchCount() { CC102_tagCMCrossRealmPKBuy pKBuy = new CC102_tagCMCrossRealmPKBuy(); var pKBuy = new CC102_tagCMCrossRealmPKBuy(); GameNetSystem.Instance.SendInfo(pKBuy); } System/Dungeon/DungeonModel.cs
@@ -413,7 +413,7 @@ if (ok) { teamModel.RequestExitTeam(); Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), () => { m_CurrentDungeon = _dungeon; @@ -708,7 +708,7 @@ if (_type == DungeonCoolDownType.WaitStart) { Clock.Create(dungeonCoolDowns[_type], OnBeginCoolDownEnd); Clock.AlarmAt(dungeonCoolDowns[_type], OnBeginCoolDownEnd); } } System/Dungeon/NormalDungeonEntranceWin.cs
@@ -312,7 +312,7 @@ if (_ok) { teamModel.RequestExitTeam(); Clock.Create(DateTime.Now + new TimeSpan(1 * TimeSpan.TicksPerSecond), Clock.AlarmAt(DateTime.Now + new TimeSpan(1 * TimeSpan.TicksPerSecond), () => { OpenDungeonSuppliesLack(_dungeon); System/Login/CrossServerLogin.cs
@@ -61,7 +61,7 @@ MaxProDef = (int)matchOK.MatchPlayer[0].MaxProDef, }; Clock.Create(DateTime.Now + new TimeSpan(3 * TimeSpan.TicksPerSecond), () => Clock.AlarmAt(DateTime.Now + new TimeSpan(3 * TimeSpan.TicksPerSecond), () => { if (oneVsOnePlayerData.waitForLoginCrossServer) { @@ -139,7 +139,7 @@ gamePortBuf = gamePort; StopLoginOverTimeProcess(); loginOverTimeClock = Clock.Create(DateTime.Now + new TimeSpan(30 * TimeSpan.TicksPerSecond), () => loginOverTimeClock = Clock.AlarmAt(DateTime.Now + new TimeSpan(30 * TimeSpan.TicksPerSecond), () => { busy = false; ReAccountLogin(); @@ -174,7 +174,7 @@ { this.reconnectBackGround = true; StopLoginOverTimeProcess(); loginOverTimeClock = Clock.Create(DateTime.Now + new TimeSpan(30 * TimeSpan.TicksPerSecond), () => loginOverTimeClock = Clock.AlarmAt(DateTime.Now + new TimeSpan(30 * TimeSpan.TicksPerSecond), () => { busy = false; ReAccountLogin(); @@ -193,8 +193,9 @@ { if (loginOverTimeClock != null) { loginOverTimeClock.Stop(); Clock.Stop(loginOverTimeClock); } loginOverTimeClock = null; } @@ -263,7 +264,7 @@ var sendInfo = new CC003_tagCGForceQuitCrossState(); GameNetSystem.Instance.SendInfo(sendInfo); GameNetSystem.Instance.crossServerConnected_Loigc = false; Clock.Create(DateTime.Now + new TimeSpan(2 * TimeSpan.TicksPerSecond), () => Clock.AlarmAt(DateTime.Now + new TimeSpan(2 * TimeSpan.TicksPerSecond), () => { GameNetSystem.Instance.Reconnect(); }); System/Login/ServerListCenter.cs
@@ -157,7 +157,7 @@ } else { Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestJumpUrl); Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestJumpUrl); } } @@ -193,7 +193,7 @@ } else { Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestServerCommonList); Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestServerCommonList); } } @@ -262,7 +262,7 @@ { if (StageLoad.Instance.currentStage == null || StageLoad.Instance.currentStage is LoginStage) { Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), () => Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), () => { RequestServerListPlayer(accountNameBuf); }); System/MainInterfacePanel/IsShowXpButton.cs
@@ -5,9 +5,9 @@ using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Collections.Generic; using System; //是否显示XP namespace Snxxz.UI { @@ -72,10 +72,7 @@ Skill.OnSkillCDFinished -= OnSkillCDFinished; Skill.OnSkillCast -= OnSkillCast; PlayerMainDate.Event_XpSkill -= OPenXpSkill; } private void OPenXpSkill()//获得技能 { @@ -112,9 +109,7 @@ m_UiEffect.Play(); } } } private void StorageList() { @@ -127,9 +122,9 @@ { ProhibitedToRelease.Add(int.Parse(list[i])); } } } } } System/MainInterfacePanel/LongPressShowPanel.cs
@@ -6,13 +6,42 @@ using System.Collections; using UnityEngine.UI; //技能详情面板 namespace Snxxz.UI { namespace Snxxz.UI { public class LongPressShowPanel:MonoBehaviour { public class LongPressShowPanel : MonoBehaviour { public Image m_Icon; public Text Name; public Text Describe; public void Display(int skillId) { var treasureModel = ModelCenter.Instance.GetModel<TreasureModel>(); var treasures = treasureModel.GetAllTreasure(); var treasureId = 0; for (int i = 0; i < treasures.Count; i++) { Treasure treasure; if (treasureModel.TryGetTreasure(treasures[i], out treasure)) { if (treasure.skillId == skillId) { treasureId = treasure.id; break; } } } var skillConfig = SkillConfig.Get(skillId); Name.text = skillConfig.SkillName; Describe.text = skillConfig.Description; var treasureConfig = TreasureConfig.Get(treasureId); m_Icon.SetSprite(treasureConfig.Icon); } } System/MainInterfacePanel/MainInterfaceWin.cs
@@ -27,7 +27,6 @@ [SerializeField] TopRightTip m_TopRightTip; [SerializeField] FunctionForecastTip m_FunctionForecastTip;//功能预告 [SerializeField] IsShowXpButton m_IsShowXp;//XP 技能常显 [SerializeField] SkillButtonEffects m_SkillButtonEffects; [SerializeField] FairyLeagueRemindBehaviour m_FairyLeagueRemind; [SerializeField] TeamInvitationEntrance m_TeamInvitationEntrance; [SerializeField] FairyCallMemberBehaviour m_FairyCallBehaviour; @@ -119,7 +118,6 @@ m_TaskListTip.Init(); m_IsShowXp.Init(); m_TopRightTip.Init(); m_SkillButtonEffects.Init(); m_AnimationFadeOut.Init(); m_TeamInvitationEntrance.Init(); m_FairyCallBehaviour.Init(); @@ -240,7 +238,6 @@ m_HighSettingFadeInFadeOut.UnInit(); m_TaskListTip.UnInit(); m_TopRightTip.UnInit(); m_SkillButtonEffects.UnInit(); m_FunctionForecastTip.Unit(); m_AnimationFadeOut.Unit(); m_TeamInvitationEntrance.UnInit(); System/MainInterfacePanel/SkillButtonEffects.cs
@@ -11,499 +11,6 @@ public class SkillButtonEffects : MonoBehaviour { [SerializeField] AttackButton m_Attack; [SerializeField] SkillButton m_BlinkSkill; [SerializeField] SkillButton m_Skill1; [SerializeField] SkillButton m_Skill2; [SerializeField] SkillButton m_Skill3; [SerializeField] SkillButton m_Skill4; [SerializeField] SkillButton m_Skill5; [SerializeField] SkillButton m_Skill6; [SerializeField] SkillButton m_Skill7; [SerializeField] SkillButton m_SkillXp; [SerializeField] Transform Skill1Info; [SerializeField] Transform Skill2Info; [SerializeField] Transform Skill3Info; [SerializeField] Transform Skill4Info; [SerializeField] Transform Skill5Info; [SerializeField] Transform Skill6Info; [SerializeField] Transform Skill7Info; [SerializeField] Transform XpSkillInfo; [SerializeField] GameObject SkillSelected1; [SerializeField] GameObject SkillSelected2; [SerializeField] GameObject SkillSelected3; [SerializeField] GameObject SkillSelected4; [SerializeField] GameObject SkillSelected5; [SerializeField] GameObject SkillSelected6; [SerializeField] GameObject SkillSelected7; [SerializeField] GameObject SkillSelectedXp; LongPressShowPanel _LongPressShowPanel; public float TimeLong = 1f; private bool BoolFb = false; private bool AccordingBool = true;//显示开关 private int SkillsHole = -1;//获取技能孔 private float _currentime = 0; private int m_PlayerXpSkillId = 0; private bool _bool = false; UIEffect effect; private float preTime = 0; private void Awake() { m_PlayerXpSkillId = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("XpSkillID").Numerical1)[PlayerDatas.Instance.baseData.Job];//获取各个职业的XP技能 MagicWeapon(); } public void Init() { SkillSelected1.SetActive(false); SkillSelected2.SetActive(false); SkillSelected3.SetActive(false); SkillSelected4.SetActive(false); SkillSelected5.SetActive(false); SkillSelected6.SetActive(false); SkillSelected7.SetActive(false); SkillSelectedXp.SetActive(false); TipShutDown(-1); Skill.OnSkillCDFinished += OnSkillCDFinished; Skill.OnSkillCast += OnSkillCast; } public void UnInit() { TipShutDown(-1); Skill.OnSkillCDFinished -= OnSkillCDFinished; Skill.OnSkillCast -= OnSkillCast; } private void OnSkillCast(uint objSID, int obj) { if (objSID != PlayerDatas.Instance.PlayerId) { return; } if (obj != 0 && obj == m_PlayerXpSkillId) { EffectMgr.Instance.PlayUIEffect(1023, 1500, m_SkillXp.transform, false); } int position = PlayerDatas.Instance.skill.ContainsQuickSkill(obj); switch ((SkillEffects)position) { case SkillEffects.skillEffect_1: EffectMgr.Instance.PlayUIEffect(1023, 1500, m_Skill1.transform, false); break; case SkillEffects.skillEffect_2: EffectMgr.Instance.PlayUIEffect(1023, 1500, m_Skill2.transform, false); break; case SkillEffects.skillEffect_3: EffectMgr.Instance.PlayUIEffect(1023, 1500, m_Skill3.transform, false); break; case SkillEffects.skillEffect_4: EffectMgr.Instance.PlayUIEffect(1023, 1500, m_Skill4.transform, false); break; case SkillEffects.skillEffect_5: EffectMgr.Instance.PlayUIEffect(1023, 1500, m_Skill5.transform, false); break; case SkillEffects.skillEffect_6: EffectMgr.Instance.PlayUIEffect(1023, 1500, m_Skill6.transform, false); break; case SkillEffects.skillEffect_7: EffectMgr.Instance.PlayUIEffect(1023, 1500, m_Skill7.transform, false); break; case SkillEffects.skillEffect_xp: //EffectMgr.Instance.PlayUIEffect(1023, 1500, m_SkillXp.transform, false); break; default: break; } } private void OnSkillCDFinished(int obj) { if (obj != 0 && obj == m_PlayerXpSkillId) { EffectMgr.Instance.PlayUIEffect(1024, 1500, m_SkillXp.transform, false); } int position = PlayerDatas.Instance.skill.ContainsQuickSkill(obj); switch ((SkillEffects)position) { case SkillEffects.skillEffect_1: EffectMgr.Instance.PlayUIEffect(1024, 1500, m_Skill1.transform, false); break; case SkillEffects.skillEffect_2: EffectMgr.Instance.PlayUIEffect(1024, 1500, m_Skill2.transform, false); break; case SkillEffects.skillEffect_3: EffectMgr.Instance.PlayUIEffect(1024, 1500, m_Skill3.transform, false); break; case SkillEffects.skillEffect_4: EffectMgr.Instance.PlayUIEffect(1024, 1500, m_Skill4.transform, false); break; case SkillEffects.skillEffect_5: EffectMgr.Instance.PlayUIEffect(1024, 1500, m_Skill5.transform, false); break; case SkillEffects.skillEffect_6: EffectMgr.Instance.PlayUIEffect(1024, 1500, m_Skill6.transform, false); break; case SkillEffects.skillEffect_7: EffectMgr.Instance.PlayUIEffect(1024, 1500, m_Skill7.transform, false); break; case SkillEffects.skillEffect_xp: //EffectMgr.Instance.PlayUIEffect(1024, 1500, m_SkillXp.transform, false); break; default: break; } } private void Start() { UIEventTrigger.Get(m_Attack.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_Skill1.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_Skill2.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_Skill3.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_Skill4.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_Skill5.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_Skill6.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_Skill7.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_SkillXp.gameObject).OnDown = DownAttackButton; UIEventTrigger.Get(m_Attack.gameObject).OnUp = UpAttackButton; UIEventTrigger.Get(m_Skill1.gameObject).OnUp = UpAttackButton; UIEventTrigger.Get(m_Skill2.gameObject).OnUp = UpAttackButton; UIEventTrigger.Get(m_Skill3.gameObject).OnUp = UpAttackButton; UIEventTrigger.Get(m_Skill4.gameObject).OnUp = UpAttackButton; UIEventTrigger.Get(m_Skill5.gameObject).OnUp = UpAttackButton; UIEventTrigger.Get(m_Skill6.gameObject).OnUp = UpAttackButton; UIEventTrigger.Get(m_Skill7.gameObject).OnUp = UpAttackButton; UIEventTrigger.Get(m_SkillXp.gameObject).OnUp = UpAttackButton; } private void OnComplete() { if (_bool) { effect = EffectMgr.Instance.PlayUIEffect(1021, 1500, m_Attack.transform, false); effect.OnComplete = OnComplete; } } void DownAttackButton(GameObject go) { switch (go.name) { case "AttackBtn": preTime = Time.time; effect = EffectMgr.Instance.PlayUIEffect(1021, 1500, m_Attack.transform, false); effect.OnComplete = OnComplete; _bool = true; break; case "Btn_Skill1": Prompting((int)SkillEffects.skillEffect_1); if (PlayerDatas.Instance.skill.GetQuickSkillByPos((int)SkillEffects.skillEffect_1) == null) { return; } BoolFb = true; AccordingBool = true; SkillsHole = (int)SkillEffects.skillEffect_1; SkillSelected1.SetActive(true); break; case "Btn_Skill2": Prompting((int)SkillEffects.skillEffect_2); if (PlayerDatas.Instance.skill.GetQuickSkillByPos((int)SkillEffects.skillEffect_2) == null) return; BoolFb = true; AccordingBool = true; SkillsHole = (int)SkillEffects.skillEffect_2; SkillSelected2.SetActive(true); break; case "Btn_Skill3": Prompting((int)SkillEffects.skillEffect_3); if (PlayerDatas.Instance.skill.GetQuickSkillByPos((int)SkillEffects.skillEffect_3) == null) return; BoolFb = true; AccordingBool = true; SkillsHole = (int)SkillEffects.skillEffect_3; SkillSelected3.SetActive(true); break; case "Btn_Skill4": Prompting((int)SkillEffects.skillEffect_4); if (PlayerDatas.Instance.skill.GetQuickSkillByPos((int)SkillEffects.skillEffect_4) == null) return; BoolFb = true; AccordingBool = true; SkillsHole = (int)SkillEffects.skillEffect_4; SkillSelected4.SetActive(true); break; case "Btn_Skill5": Prompting((int)SkillEffects.skillEffect_5); if (PlayerDatas.Instance.skill.GetQuickSkillByPos((int)SkillEffects.skillEffect_5) == null) return; BoolFb = true; AccordingBool = true; SkillsHole = (int)SkillEffects.skillEffect_5; SkillSelected5.SetActive(true); break; case "Btn_Skill6": Prompting((int)SkillEffects.skillEffect_6); if (PlayerDatas.Instance.skill.GetQuickSkillByPos((int)SkillEffects.skillEffect_6) == null) return; BoolFb = true; AccordingBool = true; SkillsHole = (int)SkillEffects.skillEffect_6; SkillSelected6.SetActive(true); break; case "Btn_Skill7": Prompting((int)SkillEffects.skillEffect_7); if (PlayerDatas.Instance.skill.GetQuickSkillByPos((int)SkillEffects.skillEffect_7) == null) return; BoolFb = true; AccordingBool = true; SkillsHole = (int)SkillEffects.skillEffect_7; SkillSelected7.SetActive(true); break; case "Btn_SkillXp": Prompting((int)SkillEffects.skillEffect_xp); var skillModel = ModelCenter.Instance.GetModel<SkillModel>(); var xpSkillId = skillModel.GetXpSkillID(); if (PlayerDatas.Instance.skill.GetSKillById(xpSkillId) != null) { BoolFb = true; AccordingBool = true; SkillsHole = (int)SkillEffects.skillEffect_xp; SkillSelectedXp.SetActive(true); } break; default: break; } } void UpAttackButton(GameObject go) { _currentime = 0; TipShutDown(-1); switch (go.name) { case "AttackBtn": _bool = false; if (effect != null) { if (Time.time - preTime < effect.duration) { effect.OnComplete = null; } } break; case "Btn_Skill1": BoolFb = false; SkillSelected1.SetActive(false); break; case "Btn_Skill2": BoolFb = false; SkillSelected2.SetActive(false); break; case "Btn_Skill3": BoolFb = false; SkillSelected3.SetActive(false); break; case "Btn_Skill4": BoolFb = false; SkillSelected4.SetActive(false); break; case "Btn_Skill5": BoolFb = false; SkillSelected5.SetActive(false); break; case "Btn_Skill6": BoolFb = false; SkillSelected6.SetActive(false); break; case "Btn_Skill7": BoolFb = false; SkillSelected7.SetActive(false); break; case "Btn_SkillXp": BoolFb = false; SkillSelectedXp.SetActive(false); break; default: break; } } private Dictionary<int, int> _SkillAndPreTreasure = new Dictionary<int, int>(); void MagicWeapon()//法宝获取 { var treasureModel = ModelCenter.Instance.GetModel<TreasureModel>(); var treasures = treasureModel.GetAllTreasure(); for (int i = 0; i < treasures.Count; i++) { Treasure treasure; if (treasureModel.TryGetTreasure(treasures[i], out treasure)) { _SkillAndPreTreasure[treasure.skillId] = treasures[i]; } } } private void LateUpdate() { if (BoolFb) { _currentime += Time.deltaTime; if (_currentime >= TimeLong) { if (AccordingBool) { DynamicallyCreate(); AccordingBool = false; } } } } void DynamicallyCreate() { TipShutDown(SkillsHole); switch ((SkillEffects)SkillsHole) { case SkillEffects.skillEffect_1: _LongPressShowPanel = Skill1Info.GetChild(0).GetComponent<LongPressShowPanel>(); break; case SkillEffects.skillEffect_2: _LongPressShowPanel = Skill2Info.GetChild(0).GetComponent<LongPressShowPanel>(); break; case SkillEffects.skillEffect_3: _LongPressShowPanel = Skill3Info.GetChild(0).GetComponent<LongPressShowPanel>(); break; case SkillEffects.skillEffect_4: _LongPressShowPanel = Skill4Info.GetChild(0).GetComponent<LongPressShowPanel>(); break; case SkillEffects.skillEffect_5: _LongPressShowPanel = Skill5Info.GetChild(0).GetComponent<LongPressShowPanel>(); break; case SkillEffects.skillEffect_6: _LongPressShowPanel = Skill6Info.GetChild(0).GetComponent<LongPressShowPanel>(); break; case SkillEffects.skillEffect_7: _LongPressShowPanel = Skill7Info.GetChild(0).GetComponent<LongPressShowPanel>(); break; case SkillEffects.skillEffect_xp: _LongPressShowPanel = XpSkillInfo.GetChild(0).GetComponent<LongPressShowPanel>(); break; } PlayerSkillData _PlayerSkillData = null; if ((SkillEffects)SkillsHole == SkillEffects.skillEffect_xp) { var skillModel = ModelCenter.Instance.GetModel<SkillModel>(); var xpSkillId = skillModel.GetXpSkillID(); _PlayerSkillData = PlayerDatas.Instance.skill.GetSKillById(xpSkillId); } else { _PlayerSkillData = PlayerDatas.Instance.skill.GetQuickSkillByPos(SkillsHole); } if (!_SkillAndPreTreasure.ContainsKey(_PlayerSkillData.id)) { DebugEx.LogError("法宝表没有对应的技能ID" + _PlayerSkillData.id); return; } else { int FBID = _SkillAndPreTreasure[_PlayerSkillData.id]; _LongPressShowPanel.Name.text = SkillConfig.Get(_PlayerSkillData.id).SkillName; _LongPressShowPanel.Describe.text = SkillConfig.Get(_PlayerSkillData.id).Description; var treasureConfig = TreasureConfig.Get(FBID); _LongPressShowPanel.m_Icon.SetSprite(treasureConfig.Icon); } } void TipShutDown(int _index) { Skill1Info.gameObject.SetActive((SkillEffects)_index == SkillEffects.skillEffect_1); Skill2Info.gameObject.SetActive((SkillEffects)_index == SkillEffects.skillEffect_2); Skill3Info.gameObject.SetActive((SkillEffects)_index == SkillEffects.skillEffect_3); Skill4Info.gameObject.SetActive((SkillEffects)_index == SkillEffects.skillEffect_4); Skill5Info.gameObject.SetActive((SkillEffects)_index == SkillEffects.skillEffect_5); Skill6Info.gameObject.SetActive((SkillEffects)_index == SkillEffects.skillEffect_6); Skill7Info.gameObject.SetActive((SkillEffects)_index == SkillEffects.skillEffect_7); XpSkillInfo.gameObject.SetActive((SkillEffects)_index == SkillEffects.skillEffect_xp); } void Prompting(int _Skillindex) { if (PlayerDatas.Instance.skill.GetQuickSkillByPos(_Skillindex) == null) { switch ((SkillEffects)_Skillindex) { case SkillEffects.skillEffect_1: SysNotifyMgr.Instance.ShowTip("Skill1Btn_Unlock"); break; case SkillEffects.skillEffect_2: SysNotifyMgr.Instance.ShowTip("Skill2Btn_Unlock"); break; case SkillEffects.skillEffect_3: SysNotifyMgr.Instance.ShowTip("Skill3Btn_Unlock"); break; case SkillEffects.skillEffect_4: SysNotifyMgr.Instance.ShowTip("Skill4Btn_Unlock"); break; case SkillEffects.skillEffect_5: SysNotifyMgr.Instance.ShowTip("Skill5Btn_Unlock"); break; case SkillEffects.skillEffect_6: SysNotifyMgr.Instance.ShowTip("Skill6Btn_Unlock"); break; case SkillEffects.skillEffect_7: SysNotifyMgr.Instance.ShowTip("Skill7Btn_Unlock"); break; case SkillEffects.skillEffect_xp: var skillModel = ModelCenter.Instance.GetModel<SkillModel>(); var xpSkillId = skillModel.GetXpSkillID(); if (PlayerDatas.Instance.skill.GetSKillById(xpSkillId) == null) { SysNotifyMgr.Instance.ShowTip("SkillXpBtn_Unlock"); } break; } } else { int SkillID = PlayerDatas.Instance.skill.GetQuickSkillByPos(_Skillindex).id; Skill _skill = PlayerDatas.Instance.hero.SkillMgr.Get(SkillID); if (!_skill.IsValid()) { SysNotifyMgr.Instance.ShowTip("SkillBtn_CD"); } } } private enum SkillEffects { skillEffect_1 = 0, skillEffect_2 = 1, skillEffect_3 = 2, skillEffect_4 = 3, skillEffect_5 = 4, skillEffect_6 = 5, skillEffect_7 = 6, skillEffect_xp = 7, } } } System/MainWin/AttackButton.cs
@@ -93,6 +93,7 @@ attackEvent.Invoke(); } EffectMgr.Instance.PlayUIEffect(1021, 1500, this.transform, false); clickResponse = false; } System/MainWin/MainWinSkillController.cs
New file @@ -0,0 +1,267 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Snxxz.UI { public class MainWinSkillController : Singleton<MainWinSkillController> { const int SKILL_COUNT_MAX = 7; public readonly LogicStruct<SkillCD> skillcd0 = new LogicStruct<SkillCD>(); public readonly LogicStruct<SkillCD> skillcd1 = new LogicStruct<SkillCD>(); public readonly LogicStruct<SkillCD> skillcd2 = new LogicStruct<SkillCD>(); public readonly LogicStruct<SkillCD> skillcd3 = new LogicStruct<SkillCD>(); public readonly LogicStruct<SkillCD> skillcd4 = new LogicStruct<SkillCD>(); public readonly LogicStruct<SkillCD> skillcd5 = new LogicStruct<SkillCD>(); public readonly LogicStruct<SkillCD> skillcd6 = new LogicStruct<SkillCD>(); public readonly LogicStruct<SkillCD> skillcd7 = new LogicStruct<SkillCD>(); public readonly LogicStruct<SkillCD> skillcdxp = new LogicStruct<SkillCD>(); public readonly LogicBool forbid0 = new LogicBool(); public readonly LogicBool forbid1 = new LogicBool(); public readonly LogicBool forbid2 = new LogicBool(); public readonly LogicBool forbid3 = new LogicBool(); public readonly LogicBool forbid4 = new LogicBool(); public readonly LogicBool forbid5 = new LogicBool(); public readonly LogicBool forbid6 = new LogicBool(); public readonly LogicBool forbid7 = new LogicBool(); public readonly LogicBool forbidxp = new LogicBool(); Dictionary<int, int> skillPlaceMap = new Dictionary<int, int>(); SkillModel model { get { return ModelCenter.Instance.GetModel<SkillModel>(); } } public MainWinSkillController() { PlayerSkillDatas.OnRefreshSkill -= OnSkillRefresh; Skill.RefreshCD += OnSkillCDRefresh; GA_Hero.OnStateEnter += OnSkillStateEnter; GA_Hero.OnStateEnd += OnSkillStateEnd; StatusMgr.OnGainCantCastSkillStatus += OnGainCantCastSkillStatus; StatusMgr.OnReleaseCantCastSkillStatus += OnReleaseCantCastSkillStatus; } public void Reset() { skillcd0.value = default(SkillCD); skillcd1.value = default(SkillCD); skillcd2.value = default(SkillCD); skillcd3.value = default(SkillCD); skillcd4.value = default(SkillCD); skillcd5.value = default(SkillCD); skillcd6.value = default(SkillCD); skillcd7.value = default(SkillCD); skillcdxp.value = default(SkillCD); forbid0.value = false; forbid1.value = false; forbid2.value = false; forbid3.value = false; forbid4.value = false; forbid5.value = false; forbid6.value = false; forbid7.value = false; forbidxp.value = false; skillPlaceMap.Clear(); } public LogicStruct<SkillCD> GetSkillCD(int index) { switch (index) { case 0: return skillcd0; case 1: return skillcd1; case 2: return skillcd2; case 3: return skillcd3; case 4: return skillcd4; case 5: return skillcd5; case 6: return skillcd6; case 7: return skillcd7; case 8: return skillcdxp; default: return null; } } public LogicBool GetSkillForbid(int index) { switch (index) { case 0: return forbid0; case 1: return forbid1; case 2: return forbid2; case 3: return forbid3; case 4: return forbid4; case 5: return forbid5; case 6: return forbid6; case 7: return forbid7; case 8: return forbidxp; default: return null; } } private void OnSkillRefresh() { skillPlaceMap.Clear(); for (int i = 0; i < SKILL_COUNT_MAX; i++) { var skillData = PlayerDatas.Instance.skill.GetQuickSkillByPos(i); if (skillData != null) { skillPlaceMap[skillData.id] = i + 1; } } var blinkSkill = PlayerDatas.Instance.skill.GetSKillById(190); if (blinkSkill != null) { skillPlaceMap[blinkSkill.id] = 0; } var skillXpId = model.GetXpSkillID(); if (skillXpId != 0) { skillPlaceMap[skillXpId] = 8; } } private void OnSkillCDRefresh(int skillId, float cd, float total) { if (skillPlaceMap.ContainsKey(skillId)) { var place = skillPlaceMap[skillId]; var skillcd = GetSkillCD(place); skillcd.value = skillcd.value.SetExclusiveCountDown(cd, total); } } private void OnSkillStateEnter(float time) { for (int i = 0; i <= 8; i++) { var skillcd = GetSkillCD(i); skillcd.value = skillcd.value.SetCommonCountDown(time); } } private void OnSkillStateEnd() { for (int i = 0; i <= 8; i++) { var skillcd = GetSkillCD(i); skillcd.value = skillcd.value.SetCommonCountDown(0); } } private void OnGainCantCastSkillStatus(float duration) { var forbid = !StatusMgr.Instance.CanCastSkill(PlayerDatas.Instance.baseData.PlayerID); for (int i = 0; i <= 8; i++) { var skillForbid = GetSkillForbid(i); skillForbid.value = forbid; } } private void OnReleaseCantCastSkillStatus() { var forbid = !StatusMgr.Instance.CanCastSkill(PlayerDatas.Instance.baseData.PlayerID); for (int i = 0; i <= 8; i++) { var skillForbid = GetSkillForbid(i); skillForbid.value = forbid; } } public struct SkillCD { public float exclusiveTotal; public float exclusiveOverTime; public float commonTotal; public float commonOverTime; public SkillCD SetCommonCountDown(float time) { commonTotal = time; commonOverTime = Time.realtimeSinceStartup + time; return this; } public SkillCD SetExclusiveCountDown(float cd, float total) { exclusiveTotal = total; exclusiveOverTime = Time.realtimeSinceStartup + cd; return this; } public bool IsCountDown() { if (exclusiveOverTime > Time.realtimeSinceStartup) { return true; } if (commonOverTime > Time.realtimeSinceStartup) { return true; } return false; } public float GetCountDownFillAmount() { if (exclusiveOverTime > Time.realtimeSinceStartup) { return exclusiveOverTime - Time.realtimeSinceStartup / exclusiveTotal; } if (commonOverTime > Time.realtimeSinceStartup) { return commonOverTime - Time.realtimeSinceStartup / commonTotal; } return 0f; } public float GetCountDown() { if (exclusiveOverTime > Time.realtimeSinceStartup) { return exclusiveOverTime - Time.realtimeSinceStartup; } return 0f; } } } } System/MainWin/MainWinSkillController.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 78c5929158f09c74dbdc5e481afcb400 timeCreated: 1555070239 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/MainWin/SkillButton.cs
@@ -6,7 +6,6 @@ using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using UnityEngine.EventSystems; using UnityEngine.Events; @@ -28,64 +27,32 @@ public class SkillButton : SkillButtonInterface, IPointerExitHandler { [SerializeField] int m_Index; [SerializeField] SkillTurnplate m_SkillTurnplate; [SerializeField] Image m_Icon; public Image icon { get { return m_Icon; } } [SerializeField] ImageEx m_Icon; [SerializeField] Transform m_Locked; public Transform locked { get { return m_Locked; } } [SerializeField] Text m_CoolDown; [SerializeField] Image m_CoolDownMask; [SerializeField] ScaleTween m_ScaleTween; [SerializeField] Image m_Selected; [SerializeField] LongPressShowPanel m_SkillTip; [Header("遮罩是否反向")] public bool Isreverse = false; public Image icon { get { return m_Icon; } } public Transform locked { get { return m_Locked; } } UIEvent skillEvent1 = new UIEvent(); UIEvent skillEvent2 = new UIEvent(); bool isExit = false; float m_TotalCoolDown = 0f; public float totalCoolDown { get { return m_TotalCoolDown; } set { m_TotalCoolDown = value; } } float m_CoolDownCompleteTime = 0f; public float coolDownCompleteTime { get { return m_CoolDownCompleteTime; } set { m_CoolDownCompleteTime = value; } } bool inCountDown = false; float timer = 0f; PlayerSkillData m_SkillData = null; Skill skillBuf = null; float fillAmountRevise = 1f; int skillId = 0; public void SetSkillData(PlayerSkillData _skillData) public void SetSkill(int skillId) { m_SkillData = _skillData; if (m_SkillData == null) this.skillId = skillId; if (this.skillId == 0) { locked.gameObject.SetActive(true); m_Icon.gameObject.SetActive(false); @@ -98,29 +65,27 @@ locked.gameObject.SetActive(false); m_Icon.gameObject.SetActive(true); } var skillConfig = m_SkillData.skillCfg; var skillConfig = SkillConfig.Get(this.skillId); m_Icon.SetSprite(skillConfig.IconName); if (skillBuf != null) { skillBuf.RefreshCD -= OnSkillCDRefresh; } if (PlayerDatas.Instance.hero != null) { skillBuf = PlayerDatas.Instance.hero.SkillMgr.Get(m_SkillData.id); OnSkillCDRefresh(skillBuf.cd, skillBuf.skillInfo.config.CoolDownTime * Constants.F_GAMMA); skillBuf.RefreshCD += OnSkillCDRefresh; } } DisplaySkillDynamicInfo(true); m_Selected.gameObject.SetActive(false); HideSkillTip(); } public void Dispose() { if (skillBuf != null) if (showSkillTipClock != null) { skillBuf.RefreshCD -= OnSkillCDRefresh; Clock.Stop(showSkillTipClock); showSkillTipClock = null; } if (m_Index != 0) { HideSkillTip(); } } @@ -140,72 +105,55 @@ skillEvent2.RemoveAllListeners(); } /// <summary> /// 剩余CD和总CD都是毫秒 /// </summary> /// <param name="_cd"></param> /// <param name="_totalCD"></param> private void OnSkillCDRefresh(float _cd, float _totalCD) { totalCoolDown = _totalCD; coolDownCompleteTime = Time.time + _cd; timer = 0f; } private void LateUpdate() { if (m_CoolDownCompleteTime > Time.time) DisplaySkillDynamicInfo(false); if (inCountDown) { var cd = m_CoolDownCompleteTime - Time.time; if (!m_CoolDown.gameObject.activeInHierarchy) if (!m_CoolDown.gameObject.activeSelf) { m_CoolDown.gameObject.SetActive(true); } if (m_CoolDownMask != null && !m_CoolDownMask.gameObject.activeInHierarchy) if (m_CoolDownMask != null && !m_CoolDownMask.gameObject.activeSelf) { m_CoolDownMask.gameObject.SetActive(true); } if (m_CoolDownMask != null) { if (Isreverse) { float flo = cd / totalCoolDown; m_CoolDownMask.fillAmount = 1.0f - flo; } else { m_CoolDownMask.fillAmount = cd / totalCoolDown; } m_CoolDownMask.fillAmount = MainWinSkillController.Instance.GetSkillCD(m_Index).value.GetCountDownFillAmount(); } timer -= Time.deltaTime; if (timer < 0f) { m_CoolDown.text = cd.ToString("f0"); var countDown = MainWinSkillController.Instance.GetSkillCD(m_Index).value.GetCountDown(); if (countDown > 1) { m_CoolDown.text = countDown.ToString("f0"); } else { m_CoolDown.text = ""; } timer += 1f; } } else { if (m_CoolDown.gameObject.activeInHierarchy) if (m_CoolDown.gameObject.activeSelf) { m_CoolDown.gameObject.SetActive(false); } if (m_CoolDownMask != null) { if (Isreverse) if (m_CoolDownMask.gameObject.activeSelf) { m_CoolDownMask.fillAmount = 1; } else { if (m_CoolDownMask.gameObject.activeInHierarchy) { m_CoolDownMask.gameObject.SetActive(false); } m_CoolDownMask.gameObject.SetActive(false); } } @@ -216,21 +164,34 @@ public override void OnPointerDown(PointerEventData eventData) { base.OnPointerDown(eventData); ProcessForbid(); PassEvent(eventData, ExecuteEvents.pointerDownHandler); if (m_SkillData == null) if (this.skillId == 0) { return; } if (m_ScaleTween != null) { m_ScaleTween.Play(); } skillEvent1.Invoke(); isExit = false; m_Selected.gameObject.SetActive(true); skillEvent1.Invoke(); if (m_Index != 0) { if (showSkillTipClock != null) { Clock.Stop(showSkillTipClock); } showSkillTipClock = Clock.AlarmAfter(1, ShowSkillTip); } isExit = false; } public override void OnPointerUp(PointerEventData eventData) @@ -239,18 +200,32 @@ PassEvent(eventData, ExecuteEvents.pointerUpHandler); if (m_SkillData == null) if (this.skillId == 0) { return; } if (m_ScaleTween != null) { m_ScaleTween.Play(true); } m_Selected.gameObject.SetActive(false); if (isExit == false) { skillEvent2.Invoke(); } if (showSkillTipClock != null) { Clock.Stop(showSkillTipClock); showSkillTipClock = null; } if (m_Index != 0) { HideSkillTip(); } } @@ -283,6 +258,152 @@ } } private void Awake() { Skill.OnSkillCDFinished += OnSkillPrepared; Skill.OnSkillCast += OnSkillCast; } private void OnDestroy() { Skill.OnSkillCDFinished += OnSkillPrepared; Skill.OnSkillCast += OnSkillCast; } private void OnSkillPrepared(int skillId) { if (!this.enabled) { return; } if (this.skillId != skillId) { return; } EffectMgr.Instance.PlayUIEffect(1024, 1500, this.transform, false); } private void OnSkillCast(uint playerInstanceId, int skillId) { if (!this.enabled) { return; } if (playerInstanceId != PlayerDatas.Instance.PlayerId) { return; } if (this.skillId != skillId) { return; } EffectMgr.Instance.PlayUIEffect(1023, 1500, this.transform, false); } private void ProcessForbid() { var isUnLocked = this.skillId != 0; if (!isUnLocked) { switch (m_Index) { case 1: SysNotifyMgr.Instance.ShowTip("Skill1Btn_Unlock"); break; case 2: SysNotifyMgr.Instance.ShowTip("Skill2Btn_Unlock"); break; case 3: SysNotifyMgr.Instance.ShowTip("Skill3Btn_Unlock"); break; case 4: SysNotifyMgr.Instance.ShowTip("Skill4Btn_Unlock"); break; case 5: SysNotifyMgr.Instance.ShowTip("Skill5Btn_Unlock"); break; case 6: SysNotifyMgr.Instance.ShowTip("Skill6Btn_Unlock"); break; case 7: SysNotifyMgr.Instance.ShowTip("Skill7Btn_Unlock"); break; case 8: SysNotifyMgr.Instance.ShowTip("SkillXpBtn_Unlock"); break; } return; } if (PlayerDatas.Instance.hero == null) { return; } var skill = PlayerDatas.Instance.hero.SkillMgr.Get(this.skillId); if (!skill.IsValid()) { SysNotifyMgr.Instance.ShowTip("SkillBtn_CD"); return; } } Clock showSkillTipClock; private void ShowSkillTip() { if (this.skillId == 0) { return; } if (m_SkillTip) { m_SkillTip.gameObject.SetActive(true); m_SkillTip.Display(this.skillId); } } private void HideSkillTip() { if (m_SkillTip) { m_SkillTip.gameObject.SetActive(false); } } private void DisplaySkillDynamicInfo(bool force) { var skillCd = MainWinSkillController.Instance.GetSkillCD(m_Index); if (force || skillCd.dirty) { var data = skillCd.Fetch(); inCountDown = data.IsCountDown(); var countDown = MainWinSkillController.Instance.GetSkillCD(m_Index).value.GetCountDown(); if (countDown > 0) { m_CoolDown.text = countDown.ToString("f0"); } else { m_CoolDown.text = ""; } } var skillForbid = MainWinSkillController.Instance.GetSkillForbid(m_Index); if (force || skillForbid.dirty) { m_Icon.gray = skillForbid.Fetch(); } } } } System/MainWin/SkillContainer.cs
@@ -3,7 +3,6 @@ // [ Date ]: Saturday, September 02, 2017 //-------------------------------------------------------- using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; @@ -49,7 +48,7 @@ public SkillButton skillXP { get { return m_SkillXP; } } const int SKILL_COUNT_MAX = 8; Dictionary<int, PlayerSkillData> indexSkillDataDict = new Dictionary<int, PlayerSkillData>(); Dictionary<int, int> indexSkillDataDict = new Dictionary<int, int>(); public void Init() { @@ -95,7 +94,18 @@ m_Skill5.RemoveAllListeners(); m_Skill6.RemoveAllListeners(); m_Skill7.RemoveAllListeners(); skillXP.RemoveAllListeners(); skillXP.RemoveAllListeners(); m_BlinkSkill.Dispose(); m_Skill1.Dispose(); m_Skill2.Dispose(); m_Skill3.Dispose(); m_Skill4.Dispose(); m_Skill5.Dispose(); m_Skill6.Dispose(); m_Skill7.Dispose(); skillXP.Dispose(); PlayerSkillDatas.OnRefreshSkill -= OnSkillRefresh; if (AchievementGoto.achievementType == AchievementGoto.ExcuteSkill) { @@ -107,22 +117,24 @@ { for (int i = 0; i < SKILL_COUNT_MAX; i++) { indexSkillDataDict[i] = PlayerDatas.Instance.skill.GetQuickSkillByPos(i); var skillData = PlayerDatas.Instance.skill.GetQuickSkillByPos(i); indexSkillDataDict[i] = skillData == null ? 0 : skillData.id; } m_Skill1.SetSkillData(indexSkillDataDict[0]); m_Skill2.SetSkillData(indexSkillDataDict[1]); m_Skill3.SetSkillData(indexSkillDataDict[2]); m_Skill4.SetSkillData(indexSkillDataDict[3]); m_Skill5.SetSkillData(indexSkillDataDict[4]); m_Skill6.SetSkillData(indexSkillDataDict[5]); m_Skill7.SetSkillData(indexSkillDataDict[6]); m_Skill1.SetSkill(indexSkillDataDict[0]); m_Skill2.SetSkill(indexSkillDataDict[1]); m_Skill3.SetSkill(indexSkillDataDict[2]); m_Skill4.SetSkill(indexSkillDataDict[3]); m_Skill5.SetSkill(indexSkillDataDict[4]); m_Skill6.SetSkill(indexSkillDataDict[5]); m_Skill7.SetSkill(indexSkillDataDict[6]); m_BlinkSkill.SetSkillData(PlayerDatas.Instance.skill.GetSKillById(190)); var blinkSkillData = PlayerDatas.Instance.skill.GetSKillById(190); m_BlinkSkill.SetSkill(blinkSkillData == null ? 0 : blinkSkillData.id); var model = ModelCenter.Instance.GetModel<SkillModel>(); var skillXpId = model.GetXpSkillID(); m_SkillXP.SetSkillData(PlayerDatas.Instance.skill.GetSKillById(skillXpId)); m_SkillXP.SetSkill(skillXpId); } void SwitchTarget() @@ -154,86 +166,79 @@ void CastSkill1() { if (indexSkillDataDict[0] == null) if (indexSkillDataDict[0] == 0) { DebugEx.Log("技能未解锁"); return; } DoCastSkill(indexSkillDataDict[0].id); DoCastSkill(indexSkillDataDict[0]); } void CastSkill2() { if (indexSkillDataDict[1] == null) if (indexSkillDataDict[1] == 0) { DebugEx.Log("技能未解锁"); return; } DoCastSkill(indexSkillDataDict[1].id); DoCastSkill(indexSkillDataDict[1]); } void CastSkill3() { if (indexSkillDataDict[2] == null) if (indexSkillDataDict[2] == 0) { DebugEx.Log("技能未解锁"); return; } DoCastSkill(indexSkillDataDict[2].id); DoCastSkill(indexSkillDataDict[2]); } void CastSkill4() { if (indexSkillDataDict[3] == null) if (indexSkillDataDict[3] == 0) { DebugEx.Log("技能未解锁"); return; } DoCastSkill(indexSkillDataDict[3].id); DoCastSkill(indexSkillDataDict[3]); } void CastSkill5() { if (indexSkillDataDict[4] == null) if (indexSkillDataDict[4] == 0) { DebugEx.Log("技能未解锁"); return; } DoCastSkill(indexSkillDataDict[4].id); DoCastSkill(indexSkillDataDict[4]); } void CastSkill6() { if (indexSkillDataDict[5] == null) if (indexSkillDataDict[5] == 0) { DebugEx.Log("技能未解锁"); return; } DoCastSkill(indexSkillDataDict[5].id); DoCastSkill(indexSkillDataDict[5]); } void CastSkill7() { if (indexSkillDataDict[6] == null) if (indexSkillDataDict[6] == 0) { DebugEx.Log("技能未解锁"); return; } DoCastSkill(indexSkillDataDict[6].id); DoCastSkill(indexSkillDataDict[6]); } void CastSkillXp() @@ -245,86 +250,85 @@ DebugEx.Log("技能未解锁"); return; } DoCastSkill(skillXpId); DoCastSkill(skillXpId); } void PrepareCastSkill1() { if (indexSkillDataDict[0] == null) if (indexSkillDataDict[0] == 0) { DebugEx.Log("技能未解锁"); return; } DoPrepareCast(indexSkillDataDict[0].id); DoPrepareCast(indexSkillDataDict[0]); } void PrepareCastSkill2() { if (indexSkillDataDict[1] == null) if (indexSkillDataDict[1] == 0) { DebugEx.Log("技能未解锁"); return; } DoPrepareCast(indexSkillDataDict[1].id); DoPrepareCast(indexSkillDataDict[1]); } void PrepareCastSkill3() { if (indexSkillDataDict[2] == null) if (indexSkillDataDict[2] == 0) { DebugEx.Log("技能未解锁"); return; } DoPrepareCast(indexSkillDataDict[2].id); DoPrepareCast(indexSkillDataDict[2]); } void PrepareCastSkill4() { if (indexSkillDataDict[3] == null) if (indexSkillDataDict[3] == 0) { DebugEx.Log("技能未解锁"); return; } DoPrepareCast(indexSkillDataDict[3].id); DoPrepareCast(indexSkillDataDict[3]); } void PrepareCastSkill5() { if (indexSkillDataDict[4] == null) if (indexSkillDataDict[4] == 0) { DebugEx.Log("技能未解锁"); return; } DoPrepareCast(indexSkillDataDict[4].id); DoPrepareCast(indexSkillDataDict[4]); } void PrepareCastSkill6() { if (indexSkillDataDict[5] == null) if (indexSkillDataDict[5] == 0) { DebugEx.Log("技能未解锁"); return; } DoPrepareCast(indexSkillDataDict[5].id); DoPrepareCast(indexSkillDataDict[5]); } void PrepareCastSkill7() { if (indexSkillDataDict[6] == null) if (indexSkillDataDict[6] == 0) { DebugEx.Log("技能未解锁"); return; } DoPrepareCast(indexSkillDataDict[6].id); DoPrepareCast(indexSkillDataDict[6]); } void PrepareCastSkillXp() System/NewBieGuidance/NewBieWin.cs
@@ -95,7 +95,7 @@ DisplayFunctionUnLock(config.Condition); if (config.Steps == null || config.Steps.Length == 0) { Clock.Create(5, Clock.AlarmAfter(5, () => { var guideId = config.ID; System/Skill/TreasureSkillWin.cs
@@ -93,9 +93,10 @@ { m_TreasurePotentials[i].StopUnlock(); } foreach (var clock in clocks) { clock.Stop(); Clock.Stop(clock); } clocks.Clear(); } @@ -248,11 +249,13 @@ { m_TreasurePotentials[i].StopUnlock(); } foreach (var clock in clocks) { clock.Stop(); Clock.Stop(clock); } clocks.Clear(); m_Controller.m_Scorller.RefreshActiveCellViews(); DisplaySkillDetial(); DisplayPotentials(); @@ -278,7 +281,7 @@ { m_TreasurePotentials[index].StartUnlock(); Clock clock = null; clock = Clock.Create(1, () => clock = Clock.AlarmAfter(1, () => { DisplayPotential(index); if (clock != null && clocks.Contains(clock)) System/Team/TeamModel.cs
@@ -133,16 +133,16 @@ } } if (m_MatchingClock != null && m_MatchingClock.isActiveAndEnabled) if (m_MatchingClock != null ) { m_MatchingClock.Stop(); Clock.Stop(m_MatchingClock); m_MatchingClock = null; } if (m_IsMatching) { matchingEndTime = DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond * GeneralDefine.teamMatchingTimeOut); m_MatchingClock = Clock.Create(matchingEndTime, OnMatchingCoolDownEnd); m_MatchingClock = Clock.AlarmAt(matchingEndTime, OnMatchingCoolDownEnd); } if (matchingStateChangeEvent != null) Utility/Clock.cs
@@ -1,80 +1,85 @@ using System; using UnityEngine; using System.Collections.Generic; using UnityEngine.Events; public class Clock : MonoBehaviour public class Clock { public bool stopped { get; private set; } public DateTime alarmTime { get; set; } DateTime alarmTime; UnityAction alarmCallBack; public void AddListener(UnityAction _action) public Clock(DateTime alarmTime, UnityAction callBack) { alarmCallBack += _action; this.alarmTime = alarmTime; this.alarmCallBack = callBack; } public void Stop() public bool CanAlarm() { stopped = true; GameObject.Destroy(this.gameObject); return DateTime.Now >= alarmTime; } private void Awake() public void Execute() { this.gameObject.hideFlags = HideFlags.HideInHierarchy; } private void LateUpdate() { if (System.DateTime.Now > alarmTime) if (alarmCallBack != null) { try alarmCallBack(); alarmCallBack = null; } } static List<Clock> clocks = new List<Clock>(); public static void Init() { new LogicUpdate().Start(OnUpdate); } public static Clock AlarmAt(DateTime alarmTime, UnityAction callBack) { var clock = new Clock(alarmTime, callBack); clocks.Add(clock); return clock; } public static Clock AlarmAfter(int seconds, UnityAction callBack) { var clock = new Clock(DateTime.Now.AddSeconds(seconds), callBack); clocks.Add(clock); return clock; } public static void Stop(Clock clock) { if (clocks.Contains(clock)) { clocks.Remove(clock); } } static void OnUpdate() { for (var i = clocks.Count - 1; i >= 0; i--) { var clock = clocks[i]; if (clock.CanAlarm()) { if (alarmCallBack != null) try { alarmCallBack(); alarmCallBack = null; clock.Execute(); } catch (Exception e) { Debug.LogException(e); } finally { clocks.RemoveAt(i); } } catch (System.Exception ex) { DebugEx.Log(ex); } finally { Stop(); } } } public static Clock Create(DateTime _alarmTime, UnityAction _action) { var carrier = new GameObject(); GameObject.DontDestroyOnLoad(carrier); var clock = carrier.AddComponent<Clock>(); clock.alarmTime = _alarmTime; clock.AddListener(_action); return clock; } public static Clock Create(int _seconds, UnityAction _action) { var carrier = new GameObject(); GameObject.DontDestroyOnLoad(carrier); var clock = carrier.AddComponent<Clock>(); clock.alarmTime = System.DateTime.Now + new TimeSpan(_seconds * TimeSpan.TicksPerSecond); clock.AddListener(_action); return clock; } }