| | |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | using System; |
| | | |
| | | namespace Snxxz.UI
|
| | | { |
| | |
| | | [SerializeField] Transform m_ContainerSkill;//技能面板
|
| | | [SerializeField] Transform m_SkillPosition1;
|
| | | [SerializeField] Transform m_SkillPosition2;
|
| | | [SerializeField] AnimationFadeOut m_AnimationFadeOut;//右下角按钮组
|
| | | [SerializeField] RightBottomFadeInOut m_FunctionFadeInOut;//右下角按钮组
|
| | |
|
| | | [Header("主界面任务模块")]
|
| | | public float leftMiddleSwitchTime = 0.5f;//任务面板移动的速度
|
| | |
| | | [SerializeField] GameObject m_LeftImage;
|
| | | [SerializeField] GameObject m_RightImg;
|
| | |
|
| | | public bool IsSetCopyOfThePanelShow {
|
| | | get {
|
| | | return (m_RightTopFunction.localPosition - m_RightTopPosition1.localPosition).sqrMagnitude < (2.5 * 2.5);
|
| | | }
|
| | | }
|
| | | [SerializeField] ClickScreenOtherSpace m_RayMask;//便捷切换按钮 |
| | |
|
| | | void SetRightTopWidgetPosition(bool _bool)
|
| | | {
|
| | | if (_bool)
|
| | | {
|
| | | m_RightTopFunction.localPosition = m_RightTopPosition1.localPosition;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_RightTopFunction.localPosition = m_RightTopPosition2.localPosition;
|
| | | }
|
| | | }
|
| | |
|
| | | void SetRightTopWidgetPositionTween(bool _bool)
|
| | | {
|
| | | if (_bool)
|
| | | {
|
| | | m_RightTopFunction.DOLocalMoveY(m_RightTopPosition1.localPosition.y, rightTopSwitchTime);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_RightTopFunction.DOLocalMoveY(m_RightTopPosition2.localPosition.y, rightTopSwitchTime);
|
| | | }
|
| | | }
|
| | |
|
| | | void SetBossListPos(bool _bool)
|
| | | {
|
| | | if (_bool)
|
| | | {
|
| | | m_ContainerBossList.localPosition = m_RightTopPosition1.localPosition;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerBossList.localPosition = m_RightTopPosition2.localPosition;
|
| | | }
|
| | | }
|
| | |
|
| | | void SetBossListTweenPos(bool _bool)
|
| | | {
|
| | | if (_bool)
|
| | | {
|
| | | m_ContainerBossList.DOLocalMoveY(m_RightTopPosition1.localPosition.y, rightTopSwitchTime);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerBossList.DOLocalMoveY(m_RightTopPosition2.localPosition.y, rightTopSwitchTime);
|
| | | }
|
| | | }
|
| | |
|
| | | public void SetTipAndBossPos(bool _bool)
|
| | | {
|
| | | if (_bool)
|
| | | {
|
| | | SetRightTopWidgetPosition(true);
|
| | | SetBossListPos(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | SetRightTopWidgetPosition(false);
|
| | | SetBossListPos(true);
|
| | | }
|
| | | } |
| | | |
| | | public void SetTipAndBossTweenPos(bool _bool)
|
| | | {
|
| | | if (_bool)
|
| | | {
|
| | | SetRightTopWidgetPositionTween(true);
|
| | | SetBossListTweenPos(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | SetRightTopWidgetPositionTween(false);
|
| | | SetBossListTweenPos(true);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsRightTipPanelShow {
|
| | | get {
|
| | | return (m_ContainerSkill.localPosition - m_SkillPosition1.localPosition).sqrMagnitude < 1;
|
| | | }
|
| | | }
|
| | |
|
| | | public void SetSkillTipOrRightTipPos(bool _bool)
|
| | | {
|
| | | if (_bool)
|
| | | {
|
| | | m_AnimationFadeOut.FadeAtOnce();
|
| | | m_ContainerSkill.localPosition = m_SkillPosition1.localPosition;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_AnimationFadeOut.ImmediatelyAppear();
|
| | | m_ContainerSkill.localPosition = m_SkillPosition2.localPosition;
|
| | | }
|
| | | } |
| | | |
| | | public void SetSkillTipOrRightTipPosTween(bool _bool)
|
| | | {
|
| | | if (_bool)
|
| | | {
|
| | | m_AnimationFadeOut.FadeOut();
|
| | | m_ContainerSkill.DOLocalMoveX(m_SkillPosition1.localPosition.x, rightBottomSwitchTime);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_AnimationFadeOut.FadeIn();
|
| | | m_ContainerSkill.DOLocalMoveX(m_SkillPosition2.localPosition.x, rightBottomSwitchTime);
|
| | | }
|
| | | }
|
| | | TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
|
| | |
|
| | | public bool IsTaskAndPanelShow {
|
| | | get {
|
| | | return (m_ContainerLeftMiddle.localPosition - m_LeftMiddlePosition1.localPosition).sqrMagnitude < 3 * 3;
|
| | | }
|
| | | }
|
| | |
|
| | | void Start()
|
| | | {
|
| | | m_RayMask.AddListener(MarkRayButton);
|
| | | }
|
| | |
|
| | | void LateUpdate()
|
| | | {
|
| | | if (resetToDefaultTimer > 0f)
|
| | | {
|
| | | resetToDefaultTimer -= Time.deltaTime;
|
| | | if (resetToDefaultTimer <= 0f)
|
| | | {
|
| | | Switch(new SwitchParam() { showDefault = true, immediately = false });
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public void SetTaskPos(bool _bool)
|
| | |
| | | {
|
| | | m_ImageRotation.DOLocalRotate(Vector3.zero, rightBottomSwitchTime);
|
| | | }
|
| | | }
|
| | |
|
| | | public static RightTopState rightTopState { get; private set; }
|
| | | public static RightBottomState rightBottomState { get; private set; }
|
| | | public static bool isDefaultState { get; private set; }
|
| | | public static event Action<bool> switchFunctionStateEvent;
|
| | |
|
| | | float resetToDefaultTimer = 0;
|
| | | public void Switch(SwitchParam switchParams)
|
| | | {
|
| | | ProcessSwitch(switchParams);
|
| | | } |
| | | |
| | | private void ProcessSwitch(SwitchParam switchParams)
|
| | | {
|
| | | var mapId = PlayerDatas.Instance.baseData.MapID;
|
| | | var isDungeon = MapUtility.IsDungeon(mapId);
|
| | | var isNeutralMap = false;
|
| | | var isBossArea = PlayerDatas.Instance.hero != null && MapArea.IsInMapArea(PlayerDatas.Instance.hero.CurMapArea, MapArea.E_Type.Boss);
|
| | | var isGuiding = NewBieCenter.Instance.inGuiding;
|
| | |
|
| | | if (GeneralDefine.neutralBossMaps.Contains(mapId))
|
| | | {
|
| | | isNeutralMap = true;
|
| | | }
|
| | |
|
| | | m_ContainerBossList.gameObject.SetActive(isNeutralMap);
|
| | |
|
| | | rightTopState = RightTopState.Function;
|
| | | if ((isDungeon || isNeutralMap || isBossArea) && !isGuiding && switchParams.showDefault)
|
| | | {
|
| | | rightTopState = RightTopState.Boss;
|
| | | }
|
| | | else
|
| | | {
|
| | | rightTopState = RightTopState.Function;
|
| | | }
|
| | |
|
| | | switch (rightTopState)
|
| | | {
|
| | | case RightTopState.Function:
|
| | | if (switchParams.immediately)
|
| | | {
|
| | | m_RightTopFunction.localPosition = m_RightTopPosition1.localPosition;
|
| | | m_ContainerBossList.localPosition = m_RightTopPosition2.localPosition;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_RightTopFunction.DOLocalMoveY(m_RightTopPosition1.localPosition.y, rightTopSwitchTime);
|
| | | m_ContainerBossList.DOLocalMoveY(m_RightTopPosition2.localPosition.y, rightTopSwitchTime);
|
| | | }
|
| | | break;
|
| | | case RightTopState.Boss:
|
| | | if (switchParams.immediately)
|
| | | {
|
| | | m_ContainerBossList.localPosition = m_RightTopPosition1.localPosition;
|
| | | m_RightTopFunction.localPosition = m_RightTopPosition2.localPosition;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerBossList.DOLocalMoveY(m_RightTopPosition1.localPosition.y, rightTopSwitchTime);
|
| | | m_RightTopFunction.DOLocalMoveY(m_RightTopPosition2.localPosition.y, rightTopSwitchTime);
|
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | | var rightBottomState = switchParams.showDefault && !isGuiding ? RightBottomState.Skill : RightBottomState.Function;
|
| | |
|
| | | switch (rightBottomState)
|
| | | {
|
| | | case RightBottomState.Function:
|
| | | if (switchParams.immediately)
|
| | | {
|
| | | m_FunctionFadeInOut.SwitchImmedidately(true);
|
| | | m_ContainerSkill.localPosition = m_SkillPosition2.localPosition;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_FunctionFadeInOut.Switch(true);
|
| | | m_ContainerSkill.DOLocalMoveX(m_SkillPosition2.localPosition.x, rightBottomSwitchTime);
|
| | | }
|
| | | break;
|
| | | case RightBottomState.Skill:
|
| | | if (switchParams.immediately)
|
| | | {
|
| | | m_FunctionFadeInOut.SwitchImmedidately(false);
|
| | | m_ContainerSkill.localPosition = m_SkillPosition1.localPosition;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_FunctionFadeInOut.Switch(false);
|
| | | m_ContainerSkill.DOLocalMoveX(m_SkillPosition1.localPosition.x, rightBottomSwitchTime);
|
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | | isDefaultState = rightBottomState == RightBottomState.Skill;
|
| | | resetToDefaultTimer = !isDefaultState ? 7f : 0f;
|
| | | m_RayMask.gameObject.SetActive(!isDefaultState);
|
| | |
|
| | | if (switchFunctionStateEvent != null)
|
| | | {
|
| | | switchFunctionStateEvent(switchParams.immediately);
|
| | | }
|
| | | }
|
| | |
|
| | | private void MarkRayButton()
|
| | | {
|
| | | if (NewBieCenter.Instance.inGuiding)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (treasureModel.treasureStageUpShow || treasureModel.newGotShowing)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | Switch(new SwitchParam()
|
| | | {
|
| | | immediately = false,
|
| | | showDefault = true,
|
| | | });
|
| | | } |
| | | |
| | | public enum RightTopState
|
| | | {
|
| | | Function,
|
| | | Boss,
|
| | | } |
| | | |
| | | public enum RightBottomState
|
| | | {
|
| | | Function,
|
| | | Skill,
|
| | | } |
| | | |
| | | public struct SwitchParam
|
| | | {
|
| | | public bool showDefault;
|
| | | public bool immediately;
|
| | | } |
| | | |
| | | } |
| | | |
| | | } |