hud 관련 버그 수정 및 최적화
This commit is contained in:
parent
cfc986cb83
commit
29a8d5af09
|
|
@ -111,7 +111,9 @@ public class Actor : MyCoroutine
|
|||
protected List<ProjectileData> list_SkillData = new List<ProjectileData>();
|
||||
ProjectileData m_SkillData;
|
||||
|
||||
public HUDUI m_HUDUI { get; set; }
|
||||
public HUDUI m_HUDUI;
|
||||
protected bool isHUDUI;
|
||||
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
|
|
@ -164,11 +166,20 @@ public class Actor : MyCoroutine
|
|||
|
||||
protected virtual void OnDestroy()
|
||||
{
|
||||
if (m_HUDUI) m_HUDUI.Off();
|
||||
Off_Common();
|
||||
}
|
||||
|
||||
virtual protected void Update() { }
|
||||
|
||||
void Off_Common()
|
||||
{
|
||||
if (isHUDUI)
|
||||
{
|
||||
m_HUDUI.Off(true);
|
||||
isHUDUI = false;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator Co_Update_ETC()
|
||||
{
|
||||
while (true)
|
||||
|
|
@ -259,8 +270,6 @@ public class Actor : MyCoroutine
|
|||
Init_CC();
|
||||
DeadStatus = false;
|
||||
m_Enemy = isEnemy;
|
||||
m_HUDUI = InGameInfo.Ins.Get_HUDUI();
|
||||
m_HUDUI.Init(this, transform);
|
||||
m_ServerData = sdata;
|
||||
CurAnim = eAnim.Idle;
|
||||
Play_Idle();
|
||||
|
|
@ -271,9 +280,18 @@ public class Actor : MyCoroutine
|
|||
}
|
||||
public virtual void Off()
|
||||
{
|
||||
if (!DSUtil.CheckNull(m_HUDUI)) m_HUDUI.Off();
|
||||
Off_Common();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
protected HUDUI Get_HUDUI()
|
||||
{
|
||||
if (!isHUDUI)
|
||||
{
|
||||
m_HUDUI = InGameInfo.Ins.Get_HUDUI();
|
||||
isHUDUI = m_HUDUI;
|
||||
}
|
||||
return m_HUDUI;
|
||||
}
|
||||
public virtual void Set_Card(int index, int chapter) { }
|
||||
public virtual void ReSet() { }
|
||||
public virtual void Set_Stat(bool init)
|
||||
|
|
@ -552,7 +570,7 @@ public class Actor : MyCoroutine
|
|||
return;
|
||||
#endif
|
||||
// UI 설정
|
||||
m_HUDUI.Set_HPSlider(m_Stat.Get_Stat(eStat.HP), m_Stat.Get_Stat(eStat.MaxHP));
|
||||
Get_HUDUI().Set_HPSlider(this);
|
||||
InGameInfo.Ins.Get_HUDDMGUI().Set(tf_HUD_Dmg, _dinfo.TextColor, _dinfo.Damage, _dinfo.Critical);
|
||||
//if (IsRole(eRole.Boss)) { GameUI.Ins.IngameUI.m_BossInfoUI.Set_HP(m_Stat.Get_Stat(eStat.HP), m_Stat.Get_Stat(eStat.MaxHP)); } // TODO 정인호 : 보스 hp ui
|
||||
}
|
||||
|
|
@ -721,8 +739,7 @@ public class Actor : MyCoroutine
|
|||
if (showhud)
|
||||
{
|
||||
InGameInfo.Ins.Get_HUDDMGUI().Set(tf_HUD_Dmg, "<color=#00ff00>", heal_hp, eStat.None);
|
||||
if (m_HUDUI != null)
|
||||
m_HUDUI.Set_HPSlider(m_Stat.Get_Stat(eStat.HP), m_Stat.Get_Stat(eStat.MaxHP));
|
||||
Get_HUDUI().Set_HPSlider(this);
|
||||
}
|
||||
}
|
||||
public virtual void Heal(double _hp, bool showhud = true)
|
||||
|
|
@ -742,9 +759,8 @@ public class Actor : MyCoroutine
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
if (!DSUtil.CheckNull(m_HUDUI)) m_HUDUI.Set_HPSlider(m_Stat.Get_Stat(eStat.HP), m_Stat.Get_Stat(eStat.MaxHP));
|
||||
if (showhud)
|
||||
InGameInfo.Ins.Get_HUDDMGUI().Set(tf_HUD_Dmg, "<color=#00ff00>", _hp, eStat.None);
|
||||
Get_HUDUI().Set_HPSlider(this);
|
||||
if (showhud) InGameInfo.Ins.Get_HUDDMGUI().Set(tf_HUD_Dmg, "<color=#00ff00>", _hp, eStat.None);
|
||||
}
|
||||
public virtual void Heal_MP(double _mp, bool showhud = true)
|
||||
{
|
||||
|
|
@ -849,6 +865,7 @@ public class Actor : MyCoroutine
|
|||
public ActorStatInfo Get_StatInfo() { return m_Stat; }
|
||||
public double Get_HP() { return m_Stat.Get_Stat(eStat.HP); }
|
||||
public double Get_MaxHP() { return m_Stat.Get_Stat(eStat.MaxHP); }
|
||||
public float Get_HPPercent() { return (float)(Get_HP() / Get_MaxHP()); }
|
||||
public double Get_MaxMP() { return m_Stat.Get_Stat(eStat.MaxMP); }
|
||||
public Actor Get_Target() { return m_Target; }
|
||||
public virtual void Del_Target(bool forcedel = false)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using CodeStage.AntiCheat.ObscuredTypes;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
|
@ -15,9 +13,6 @@ public class SummonActor : MyActor
|
|||
public void Set(bool isEnemy, Actor owner, float _time, float _attackrate, float _hprate, int projctileamount)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
m_HUDUI = InGameInfo.Ins.Get_HUDUI();
|
||||
m_HUDUI.gameObject.SetActive(true);
|
||||
m_HUDUI.Set_HPSlider(1d, 1d);
|
||||
OwnerActor = owner;
|
||||
|
||||
projctile_amount = projctileamount; projctile_amount.RandomizeCryptoKey();
|
||||
|
|
@ -34,6 +29,7 @@ public class SummonActor : MyActor
|
|||
Set_Warp(owner.Get_position() + Vector3.forward);
|
||||
InGameInfo.Ins.Show_Effect(SummonType == eSummon.Golem ? "Effect_Summoning_Golem" : "Effect_Summoning", transform.position);
|
||||
Set(isEnemy, owner, owner.Get_ServerData(), 0, true);
|
||||
Get_HUDUI().Set_HPSlider(this);
|
||||
|
||||
Set_Coroutine(() =>
|
||||
{
|
||||
|
|
@ -55,7 +51,7 @@ public class SummonActor : MyActor
|
|||
if (LifeTime > 0f)
|
||||
{
|
||||
LifeTime -= Time.deltaTime;
|
||||
m_HUDUI.Set(LifeTime / MaxLifeTime);
|
||||
Get_HUDUI().Set(this, LifeTime / MaxLifeTime);
|
||||
if (LifeTime <= 0f)
|
||||
{
|
||||
Set_Die();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ public class HUDBase : MyCoroutine
|
|||
protected Transform m_Target;
|
||||
protected Camera m_Camera;
|
||||
|
||||
protected float OffTime;
|
||||
|
||||
bool isRect = false, isCanvasRect = false, isMainCam = false, isTarget = false;
|
||||
|
||||
void Init()
|
||||
|
|
@ -44,6 +46,13 @@ public class HUDBase : MyCoroutine
|
|||
(ViewportPosition.y * m_CanvasRect.sizeDelta.y) - (m_CanvasRect.sizeDelta.y * 0.5f) - 15f);
|
||||
m_RectTransform.anchoredPosition = WorldObject_ScreenPosition;
|
||||
}
|
||||
|
||||
if (OffTime > 0f)
|
||||
{
|
||||
OffTime -= Time.deltaTime;
|
||||
if (OffTime <= 0f)
|
||||
Off(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Get_TextColor(eAttackType _attacktype)
|
||||
|
|
@ -60,9 +69,14 @@ public class HUDBase : MyCoroutine
|
|||
}
|
||||
}
|
||||
|
||||
public void Off()
|
||||
public void Off(bool deltarget)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
if (deltarget)
|
||||
{
|
||||
m_Target = null;
|
||||
isTarget = false;
|
||||
}
|
||||
Init();
|
||||
m_RectTransform.anchoredPosition = Vector3.one * 10000f; // 멀리 보내야 다음에 켜질 때 깜빡임 없어짐
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class HUDDMGUI : HUDBase
|
|||
{
|
||||
if (NewGameUI.Ins.m_BangchiUI.isActiveAndEnabled || !OptionInfo.Ins.go_check[0].activeSelf)
|
||||
{
|
||||
Off();
|
||||
Off(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ public class HUDDMGUI : HUDBase
|
|||
dmgs[1].enabled = usedmg2;
|
||||
m_Index = usedmg2 ? 1 : 0;
|
||||
|
||||
Set_Coroutine(Off, destroyTime);
|
||||
OffTime = destroyTime;
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
|
@ -16,42 +15,34 @@ public class HUDUI : HUDBase
|
|||
|
||||
Actor m_Actor;
|
||||
|
||||
public void Init(Actor _actor, Transform _target)
|
||||
public void Init(Actor _actor)
|
||||
{
|
||||
if (!gameObject.activeInHierarchy)
|
||||
gameObject.SetActive(true);
|
||||
|
||||
m_Actor = _actor;
|
||||
gameObject.SetActive(false);
|
||||
if (!m_Actor.IsRole(eRole.Summon)) OffTime = 5f;
|
||||
|
||||
HPSlider.fillRect.GetComponent<Image>().color = dic_Color[m_Actor.IsEnemy()];
|
||||
TimeSlider.value = 1f;
|
||||
TimeSlider.gameObject.SetActive(m_Actor.IsRole(eRole.Summon));
|
||||
Set_Target(_target);
|
||||
Set_Target(_actor.transform);
|
||||
go_BossIcon.SetActive(_actor.IsSubRole(eSubRol.Boss));
|
||||
}
|
||||
|
||||
public bool Get_Check()
|
||||
{
|
||||
if (DSUtil.CheckNull(m_Actor)) return true;
|
||||
if (m_Actor.IsDead()) return true;
|
||||
if (DSUtil.CheckNull(m_Actor) || m_Actor.IsDead()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Set_HPSlider(double Hp, double MaxHp)
|
||||
public void Set_HPSlider(Actor actor)
|
||||
{
|
||||
On_HUD();
|
||||
HPSlider.value = (float)(Hp / MaxHp);
|
||||
Init(actor);
|
||||
HPSlider.value = actor.Get_HPPercent();
|
||||
}
|
||||
public void Set(float _remaintime)
|
||||
public void Set(Actor actor, float _remaintime)
|
||||
{
|
||||
On_HUD();
|
||||
Init(actor);
|
||||
TimeSlider.value = _remaintime;
|
||||
}
|
||||
|
||||
void On_HUD()
|
||||
{
|
||||
if (!gameObject.activeInHierarchy)
|
||||
gameObject.SetActive(true);
|
||||
|
||||
if (IsInvoking("Off")) CancelInvoke("Off");
|
||||
Invoke("Off", 5f);
|
||||
}
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ public partial class InGameInfo : MyCoroutine
|
|||
{
|
||||
for (int i = 0; i < 150; i++)
|
||||
list_HUDDMGUI.Add(DSUtil.Get_Clone<HUDDMGUI>(handle.Result, NewGameUI.Ins.tf_HUD));
|
||||
list_HUDDMGUI.ForEach(f => f.Off());
|
||||
list_HUDDMGUI.ForEach(f => f.Off(true));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ public partial class InGameInfo : MyCoroutine
|
|||
{
|
||||
for (int i = 0; i < 100; i++)
|
||||
list_HUDUI.Add(DSUtil.Get_Clone<HUDUI>(handle.Result, NewGameUI.Ins.tf_HUD));
|
||||
list_HUDUI.ForEach(f => f.Off());
|
||||
list_HUDUI.ForEach(f => f.Off(true));
|
||||
});
|
||||
|
||||
//var sinfo = ServerInfo.Ins;
|
||||
|
|
@ -145,6 +145,12 @@ public partial class InGameInfo : MyCoroutine
|
|||
foreach (var item in dic_str_Effect)
|
||||
for (int i = 0; i < item.Value.Count; i++)
|
||||
item.Value[i].SetActive(false);
|
||||
|
||||
foreach (var item in dic_Obj)
|
||||
item.Value.SetActive(false);
|
||||
|
||||
list_HUDDMGUI.ForEach(f => f.Off(true));
|
||||
list_HUDUI.ForEach(f => f.Off(true));
|
||||
}
|
||||
|
||||
void OnCheaterDetected()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue