| | |
| | | return;
|
| | | }
|
| | |
|
| | | bossInfo = new MonsterInfo()
|
| | | if (_show)
|
| | | {
|
| | | instanceId = _show ? _instanceId : 0,
|
| | | npcId = _show ? _npcId : 0,
|
| | | };
|
| | | bossInfo = new MonsterInfo()
|
| | | {
|
| | | instanceId = _instanceId,
|
| | | npcId = _npcId,
|
| | | };
|
| | |
|
| | | playerInfo = default(PlayerInfo);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (bossInfo.instanceId == _instanceId)
|
| | | {
|
| | | bossInfo = default(MonsterInfo);
|
| | | }
|
| | | }
|
| | |
|
| | | var mapId = PlayerDatas.Instance.baseData.MapID;
|
| | | var dataMapId = ModelCenter.Instance.GetModel<DungeonModel>().GetDataMapIdByMapId(mapId);
|
| | |
| | |
|
| | | }
|
| | |
|
| | | static void OnRefreshBossLifeBar(uint _instanceId, int _npcId, ulong _hp, ulong _maxHp)
|
| | | public static void OnRefreshBossLifeBar(uint _instanceId, int _npcId, ulong _hp, ulong _maxHp)
|
| | | {
|
| | | if (CrossServerUtility.IsCrossServerOneVsOne())
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | playerInfo = default(PlayerInfo);
|
| | | bossInfo = new MonsterInfo()
|
| | | {
|
| | | instanceId = _instanceId,
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (PlayerDatas.Instance.hero != null && PlayerDatas.Instance.hero.SelectTarget != null
|
| | | && PlayerDatas.Instance.hero.SelectTarget.ServerInstID == TargetBriefInfoWin.currentBossInstanceId)
|
| | | if (!WindowCenter.Instance.IsOpen("TargetBriefInfoWin"))
|
| | | {
|
| | | if (!WindowCenter.Instance.IsOpen("TargetBriefInfoWin"))
|
| | | {
|
| | | WindowCenter.Instance.Open<TargetBriefInfoWin>(true);
|
| | | }
|
| | | WindowCenter.Instance.Open<TargetBriefInfoWin>(true);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | playerInfo = new PlayerInfo()
|
| | | if (_show)
|
| | | {
|
| | | instanceId = _show ? _instanceId : 0,
|
| | | };
|
| | | playerInfo = new PlayerInfo()
|
| | | {
|
| | | instanceId = _instanceId,
|
| | | };
|
| | |
|
| | | bossInfo = default(MonsterInfo);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (playerInfo.instanceId == _instanceId)
|
| | | {
|
| | | playerInfo = default(PlayerInfo);
|
| | | }
|
| | | }
|
| | |
|
| | | if (WindowCenter.Instance.IsOpen("DemonJarBossLifeBarWin"))
|
| | | {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | bossInfo = default(MonsterInfo);
|
| | | playerInfo = new PlayerInfo()
|
| | | {
|
| | | instanceId = _instanceId,
|
| | |
| | | public int npcId;
|
| | | public ulong hp;
|
| | | public ulong maxHp;
|
| | |
|
| | | public static bool operator ==(MonsterInfo lhs, MonsterInfo rhs)
|
| | | {
|
| | | return lhs.instanceId == rhs.instanceId && lhs.npcId == rhs.npcId && lhs.hp == rhs.hp && lhs.maxHp == rhs.maxHp;
|
| | | }
|
| | |
|
| | | public static bool operator !=(MonsterInfo lhs, MonsterInfo rhs)
|
| | | {
|
| | | return lhs.instanceId != rhs.instanceId || lhs.npcId != rhs.npcId || lhs.hp != rhs.hp || lhs.maxHp != rhs.maxHp;
|
| | | }
|
| | | }
|
| | |
|
| | | public struct PlayerInfo
|
| | |
| | | public uint instanceId;
|
| | | public ulong hp;
|
| | | public ulong maxHp;
|
| | |
|
| | | public static bool operator ==(PlayerInfo lhs, PlayerInfo rhs)
|
| | | {
|
| | | return lhs.instanceId == rhs.instanceId && lhs.hp == rhs.hp && lhs.maxHp == rhs.maxHp;
|
| | | }
|
| | |
|
| | | public static bool operator !=(PlayerInfo lhs, PlayerInfo rhs)
|
| | | {
|
| | | return lhs.instanceId != rhs.instanceId || lhs.hp != rhs.hp || lhs.maxHp != rhs.maxHp;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | [SerializeField] PlayerLifeBar m_PlayerLifeBar;
|
| | | [SerializeField] FairyGrabBossBuffTip m_FairyGrabBossBuffTip;
|
| | |
|
| | | public static uint currentBossInstanceId = 0;
|
| | | public static uint currentPlayerInstanceId = 0;
|
| | | TargetBriefInfo.PlayerInfo playerInfo;
|
| | | TargetBriefInfo.MonsterInfo bossInfo;
|
| | |
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | |
| | | base.OnActived();
|
| | |
|
| | | this.transform.SetAsFirstSibling();
|
| | |
|
| | | playerInfo = TargetBriefInfo.playerInfo;
|
| | | bossInfo = TargetBriefInfo.bossInfo;
|
| | |
|
| | | if (playerInfo.instanceId != 0)
|
| | | {
|
| | | ShowPlayerLifeBar(playerInfo.instanceId, true);
|
| | | }
|
| | | else
|
| | | {
|
| | | ShowPlayerLifeBar(0, false);
|
| | |
|
| | | if (bossInfo.instanceId != 0)
|
| | | {
|
| | | ShowBossLifeBar(bossInfo.instanceId, bossInfo.npcId, true);
|
| | | }
|
| | | else
|
| | | {
|
| | | ShowBossLifeBar(0, 0, false);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void LateUpdate()
|
| | | {
|
| | | base.LateUpdate();
|
| | |
|
| | | if (TargetBriefInfo.bossInfo != bossInfo)
|
| | | {
|
| | | bossInfo = TargetBriefInfo.bossInfo;
|
| | | if (bossInfo.instanceId == 0)
|
| | | {
|
| | | ShowBossLifeBar(0, 0, false);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshBossLifeBar(bossInfo.instanceId, bossInfo.npcId, bossInfo.hp, bossInfo.maxHp);
|
| | | }
|
| | | }
|
| | |
|
| | | if (TargetBriefInfo.playerInfo != playerInfo)
|
| | | {
|
| | | playerInfo = TargetBriefInfo.playerInfo;
|
| | | if (playerInfo.instanceId == 0)
|
| | | {
|
| | | ShowPlayerLifeBar(0, false);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshPlayerLifeBar(playerInfo.instanceId, playerInfo.hp, playerInfo.maxHp);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | public void ShowBossLifeBar(uint _instanceId, int _npcId, bool _show)
|
| | | void ShowBossLifeBar(uint _instanceId, int _npcId, bool _show)
|
| | | {
|
| | | if (_show)
|
| | | {
|
| | | if (_instanceId == currentBossInstanceId)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | currentBossInstanceId = _instanceId;
|
| | |
|
| | | m_ContainerPlayer.gameObject.SetActive(false);
|
| | | m_ContainerBoss.gameObject.SetActive(true);
|
| | | m_FairyGrabBossBuffTip.Init();
|
| | |
| | | {
|
| | | m_ContainerBoss.gameObject.SetActive(false);
|
| | | m_FairyGrabBossBuffTip.UnInit();
|
| | | currentBossInstanceId = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | public void RefreshBossLifeBar(uint _instanceId, int _npcId, ulong _hp, ulong _maxHp)
|
| | | void RefreshBossLifeBar(uint _instanceId, int _npcId, ulong _hp, ulong _maxHp)
|
| | | {
|
| | | if (_instanceId != currentBossInstanceId)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | m_ContainerBoss.gameObject.SetActive(true);
|
| | | m_BossLifeBar.Show(_hp, _maxHp);
|
| | | }
|
| | |
|
| | | public void ShowPlayerLifeBar(uint _instanceId, bool _show)
|
| | | void ShowPlayerLifeBar(uint _instanceId, bool _show)
|
| | | {
|
| | | if (_show)
|
| | | {
|
| | | var player = GAMgr.Instance.GetBySID(_instanceId) as GActorPlayerBase;
|
| | |
|
| | | if (_instanceId != currentPlayerInstanceId && player != null)
|
| | | if (player != null)
|
| | | {
|
| | | currentPlayerInstanceId = _instanceId;
|
| | |
|
| | | m_ContainerPlayer.gameObject.SetActive(true);
|
| | | m_ContainerBoss.gameObject.SetActive(false);
|
| | | m_FairyGrabBossBuffTip.UnInit();
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (_instanceId == currentPlayerInstanceId)
|
| | | {
|
| | | m_ContainerPlayer.gameObject.SetActive(false);
|
| | | currentPlayerInstanceId = 0;
|
| | | }
|
| | | m_ContainerPlayer.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public void RefreshPlayerLifeBar(uint _instanceId, ulong _hp, ulong _maxHp)
|
| | | void RefreshPlayerLifeBar(uint _instanceId, ulong _hp, ulong _maxHp)
|
| | | {
|
| | | if (_instanceId != currentPlayerInstanceId)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | m_ContainerPlayer.gameObject.SetActive(true);
|
| | | m_PlayerLifeBar.Show(_hp, _maxHp);
|
| | | }
|