少年修仙传客户端代码仓库
client_linchunjie
2018-08-13 4927950f720ccea3f5b9d012d3ce127a2c12360e
2287【前端】添加上古战场提示
2个文件已修改
4个文件已添加
191 ■■■■■ 已修改文件
System/Message/BattleHint.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/BattleHint.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/BattleHintWin.cs 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/BattleHintWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/SysNotifyMgr.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/WindowBase/WindowCenter.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/BattleHint.cs
New file
@@ -0,0 +1,64 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class BattleHint : Singleton<BattleHint>
    {
        public BattleHint()
        {
            StageManager.Instance.onStageLoadFinish += OnStageLoadFinish;
        }
        private void OnStageLoadFinish()
        {
            Clear();
        }
        public event Action battleHintUpdate;
        Queue<string> battleHints = new Queue<string>();
        public void Receive(string msg)
        {
            if (!(StageManager.Instance.CurrentStage is DungeonStage))
            {
                return;
            }
            battleHints.Enqueue(msg);
            if (StageManager.Instance.isLoading)
            {
                return;
            }
            if (!WindowCenter.Instance.CheckOpen<BattleHintWin>())
            {
                WindowCenter.Instance.Open<BattleHintWin>();
            }
            else
            {
                if (battleHintUpdate != null)
                {
                    battleHintUpdate();
                }
            }
        }
        public bool TryGetBattleHint(out string msg)
        {
            msg = string.Empty;
            if (battleHints.Count > 0)
            {
                msg = battleHints.Dequeue();
                return true;
            }
            return false;
        }
        public void Clear()
        {
            battleHints.Clear();
        }
    }
}
System/Message/BattleHint.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2638bbc281bae6b459b24b1b6400b0d4
timeCreated: 1533972386
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Message/BattleHintWin.cs
New file
@@ -0,0 +1,97 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Saturday, August 11, 2018
//--------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class BattleHintWin : Window
    {
        [SerializeField] Image m_BattleHint;
        [SerializeField] ScaleTween m_BattleHintTween;
        [SerializeField, Header("保留时间")] float m_KeepTime = 2f;
        bool inBattleHint = false;
        #region Built-in
        protected override void BindController()
        {
        }
        protected override void AddListeners()
        {
        }
        protected override void OnPreOpen()
        {
            inBattleHint = false;
            m_BattleHintTween.gameObject.SetActive(false);
        }
        protected override void OnActived()
        {
            base.OnActived();
            DisplayBattleHint();
            BattleHint.Instance.battleHintUpdate += BattleHintUpdate;
        }
        protected override void OnAfterOpen()
        {
        }
        protected override void OnPreClose()
        {
            BattleHint.Instance.battleHintUpdate -= BattleHintUpdate;
        }
        protected override void OnAfterClose()
        {
        }
        #endregion
        private void BattleHintUpdate()
        {
            if (!inBattleHint)
            {
                DisplayBattleHint();
            }
        }
        void DisplayBattleHint()
        {
            string iconKey = string.Empty;
            if (BattleHint.Instance.TryGetBattleHint(out iconKey))
            {
                inBattleHint = true;
                m_BattleHint.SetSprite(iconKey);
                m_BattleHint.SetNativeSize();
                m_BattleHintTween.gameObject.SetActive(true);
                m_BattleHintTween.SetStartState();
                m_BattleHintTween.Play(OnBattleHintTweenComplete);
            }
        }
        void OnBattleHintTweenComplete()
        {
            StartCoroutine(Co_Complete());
        }
        IEnumerator Co_Complete()
        {
            yield return WaitingForSecondConst.GetWaitForSeconds(m_KeepTime);
            inBattleHint = false;
            m_BattleHintTween.gameObject.SetActive(false);
            DisplayBattleHint();
        }
    }
}
System/Message/BattleHintWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6a0e546fd3e74454595529a5928ad314
timeCreated: 1533971784
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/Message/SysNotifyMgr.cs
@@ -204,6 +204,9 @@
                        OnSysTipEvent(type[i], msg, tipInfoList);
                    }
                    break;
                case SysNotifyType.SysBattleHint:
                    BattleHint.Instance.Receive(msg);
                    break;
            }
        }
@@ -225,6 +228,7 @@
        SysTeamTip = 41,//队伍频道提示
        SysRealmTip = 100,//境界提示
        SysFixedTip1 = 11,//固定提示2
        SysBattleHint = 6,//上古战场提示
    }
    public int Compare(SystemHintData x, SystemHintData y)
System/WindowBase/WindowCenter.cs
@@ -13,7 +13,7 @@
        public event Action<Window> jumpWindowCloseEvent;
        List<string> closeAllIgnoreWindows = new List<string>() {
            "MessageWin", "NewBieWin", "NewItemGetWin", "AttributePromoteShowWin" ,"DungeonBeginCoolDownWin","DungeonFightWin","StatusTipWin"
            ,"ScrollTipWin","MarqueeWin","ExperienceOpenWin","TrumpetWin","BattlePrepareCoolDownWin","DungeonGradeWin"
            ,"ScrollTipWin","MarqueeWin","ExperienceOpenWin","TrumpetWin","BattlePrepareCoolDownWin","DungeonGradeWin","BattleHintWin"
        };
        UIRoot m_UIRoot;