| | |
| | | public class HazyDemonKingDungeonWin : Window
|
| | | {
|
| | | [SerializeField] CyclicScroll m_CyclicScroll;
|
| | | [SerializeField] HazyDemonKingPlayerBehaviour m_BelongToPlayer;
|
| | | [SerializeField] RectTransform m_ContainerPlayerList;
|
| | | [SerializeField] Text m_MyAtkTargetName;
|
| | |
|
| | | [SerializeField] Transform m_ContainerInvincibleBuff;
|
| | | [SerializeField] SmoothSlider m_BuffSlider;
|
| | |
|
| | | [SerializeField] Vector3[] m_PlayerListPositions;
|
| | | [SerializeField] Vector2 m_PlayerListSize;
|
| | |
|
| | |
|
| | | DateTime invincibleBuffEndTime = DateTime.Now;
|
| | |
| | |
|
| | | List<uint> playerIds = new List<uint>();
|
| | | List<uint> clonePlayerIds = new List<uint>();
|
| | |
|
| | | uint belongToPlayerId = 0;
|
| | |
|
| | | HazyDemonKingModel model { get { return ModelCenter.Instance.GetModel<HazyDemonKingModel>(); } }
|
| | | DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
| | |
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | Display();
|
| | |
|
| | | model.onPlayerInfoRefresh += OnPlayerInfoRefresh;
|
| | | StatusMgr.onReceiveStatus += OnReceiveStatus;
|
| | | GlobalTimeEvent.Instance.secondEvent += PerSecond;
|
| | | }
|
| | |
|
| | | protected override void OnActived()
|
| | | {
|
| | | base.OnActived();
|
| | | Display();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | m_BelongToPlayer.Dispose();
|
| | | m_CyclicScroll.Dispose();
|
| | | model.onPlayerInfoRefresh -= OnPlayerInfoRefresh;
|
| | | StatusMgr.onReceiveStatus -= OnReceiveStatus;
|
| | |
| | |
|
| | | void Display()
|
| | | {
|
| | | DisplayBelongTo();
|
| | | DisplayPlayers();
|
| | | DisplayMyTargetName();
|
| | | DisplayInvincibleBuff();
|
| | |
| | | {
|
| | | playerIds.Clear();
|
| | | clonePlayerIds.Clear();
|
| | | playerIds.AddRange(model.GetPlayerIds());
|
| | |
|
| | | foreach (var sid in model.GetPlayerIds())
|
| | | {
|
| | | if (!model.IsExistBelongTo(sid))
|
| | | {
|
| | | playerIds.Add(sid);
|
| | | }
|
| | | }
|
| | |
|
| | | playerIds.Sort(Compare);
|
| | | clonePlayerIds.AddRange(playerIds);
|
| | |
|
| | | m_CyclicScroll.Init(playerIds);
|
| | | }
|
| | |
|
| | | void DisplayBelongTo()
|
| | | {
|
| | | belongToPlayerId = 0;
|
| | | foreach (var sid in model.GetPlayerIds())
|
| | | {
|
| | | if (model.IsExistBelongTo(sid))
|
| | | {
|
| | | belongToPlayerId = sid;
|
| | | }
|
| | | }
|
| | |
|
| | | m_BelongToPlayer.Dispose();
|
| | | if (belongToPlayerId == 0)
|
| | | {
|
| | | m_BelongToPlayer.gameObject.SetActive(false);
|
| | | m_ContainerPlayerList.localPosition = m_PlayerListPositions[1];
|
| | | m_ContainerPlayerList.sizeDelta = m_ContainerPlayerList.sizeDelta.SetY(m_PlayerListSize.y);
|
| | | m_CyclicScroll.rectTransform.localPosition = Vector3.zero;
|
| | | m_CyclicScroll.rectTransform.sizeDelta = m_CyclicScroll.rectTransform.sizeDelta.SetY(m_PlayerListSize.y);
|
| | | return;
|
| | | }
|
| | | m_ContainerPlayerList.sizeDelta = m_ContainerPlayerList.sizeDelta.SetY(m_PlayerListSize.x);
|
| | | m_ContainerPlayerList.localPosition = m_PlayerListPositions[0];
|
| | | m_CyclicScroll.rectTransform.localPosition = Vector3.zero;
|
| | | m_CyclicScroll.rectTransform.sizeDelta = m_CyclicScroll.rectTransform.sizeDelta.SetY(m_PlayerListSize.x);
|
| | | m_BelongToPlayer.gameObject.SetActive(true);
|
| | | m_BelongToPlayer.Display(belongToPlayerId);
|
| | | }
|
| | |
|
| | | void DisplayInvincibleBuff()
|
| | |
| | | {
|
| | | DisplayMyTargetName();
|
| | | }
|
| | |
|
| | | if (!model.IsExistBelongTo(belongToPlayerId))
|
| | | {
|
| | | foreach (var sid in model.GetPlayerIds())
|
| | | {
|
| | | if (model.IsExistBelongTo(sid))
|
| | | {
|
| | | belongToPlayerId = sid;
|
| | | DisplayBelongTo();
|
| | | DisplayPlayers();
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | void DisplayMyTargetName()
|
| | |
| | |
|
| | | int Compare(uint lhs, uint rhs)
|
| | | {
|
| | | var lhs_bossBelong = model.IsExistBelongTo(lhs);
|
| | | var rhs_bossBelong = model.IsExistBelongTo(rhs);
|
| | | if (lhs_bossBelong != rhs_bossBelong)
|
| | | {
|
| | | return -lhs_bossBelong.CompareTo(rhs_bossBelong);
|
| | | }
|
| | |
|
| | | bool lhs_isMySelf = lhs == PlayerDatas.Instance.PlayerId;
|
| | | bool rhs_isMySelf = rhs == PlayerDatas.Instance.PlayerId;
|
| | | if (lhs_isMySelf != rhs_isMySelf)
|