Skip to content

Commit

Permalink
delete timer in nameplate
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Dec 5, 2024
1 parent 8353ffe commit 6c14eb2
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 248 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3898,14 +3898,17 @@ AnimatorStateTransition:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: wait_hand
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8620498086866718250}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.15
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1327,14 +1327,17 @@ AnimatorStateTransition:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: sit_wait
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8620498086866718250}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.15
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3240,14 +3240,17 @@ AnimatorStateTransition:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: wait_hand
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8620498086866718250}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.15
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,6 @@
background-image: resource('Data/UI/Assets/Target/HeadDisplay_DF_Target_Attack');
}

.nameplate .target-name {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 2px;
padding-bottom: 0;
padding-left: 2px;
-unity-font-definition: resource('Data/UI/Assets/Font/tahoma');
color: rgb(255, 255, 255);
-unity-font-style: bold;
font-size: 12px;
-unity-text-outline-width: 0.7px;
-unity-text-outline-color: rgb(0, 0, 0);
text-shadow: 0.3px 0.3px 1px rgb(0, 0, 0);
}

.nameplate .target-title {
margin-top: 0;
margin-right: 0;
Expand Down Expand Up @@ -111,3 +93,33 @@
flex-direction: row;
justify-content: center;
}

.nameplate.delete-timer .delete-timer-label {
display: flex;
}

.nameplate .target-name {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 2px;
padding-bottom: 0;
padding-left: 2px;
-unity-font-definition: resource('Data/UI/Assets/Font/tahoma');
color: rgb(255, 255, 255);
-unity-font-style: bold;
font-size: 12px;

-unity-text-outline-width: 1px;
-unity-text-outline-color: rgb(0, 0, 0);
text-shadow: 0.5px 0px 1px rgb(0, 0, 0);
}

.nameplate .delete-timer-label {
position: absolute;
top: -35px;
display: none;
font-size: 11px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<ui:Label text="Lvl: 1fdfdsfdsfdsfdsfdsf" name="EntityTitle" class="target-title" style="-unity-font-style: bold; -unity-text-outline-width: 1px; text-shadow: 0 0 1px rgb(0, 0, 0); font-size: 12px;" />
<ui:GroupBox name="NameContainer" class="nameplate-name-container">
<ui:VisualElement name="TargetBubbleLeft" class="target-bubble" />
<ui:Label text="Shnok" name="EntityName" class="target-name" style="-unity-text-outline-width: 1px; text-shadow: 0.5px 0 1px rgb(0, 0, 0); -unity-font-style: bold; -unity-font-definition: url(&quot;project://database/Assets/Resources/Data/UI/Assets/Font/tahoma.ttf?fileID=12800000&amp;guid=96fb7a735e76e0742bf125e2d4734bf3&amp;type=3#tahoma&quot;); font-size: 12px;" />
<ui:Label text="Shnok" name="EntityName" class="target-name" style="-unity-font-style: bold; -unity-font-definition: url(&quot;project://database/Assets/Resources/Data/UI/Assets/Font/tahoma.ttf?fileID=12800000&amp;guid=96fb7a735e76e0742bf125e2d4734bf3&amp;type=3#tahoma&quot;); font-size: 12px;" />
<ui:Label text="Shnok" name="DeleteTimer" class="target-name delete-timer-label" />
<ui:VisualElement name="TargetBubbleRight" class="target-bubble" style="flex-grow: 0;" />
</ui:GroupBox>
<ui:VisualElement name="GaugeContainer" template="HpBar" class="bar-container nameplate-gauge" style="width: 65px; margin-top: 5px; height: 2px;">
Expand Down
4 changes: 1 addition & 3 deletions l2-unity/Assets/Resources/Data/UI/_Elements/L2StyleSheet.uss
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,4 @@

.l2-color-4 {
color: rgb(220, 220, 220);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ private void StartWalking()
_AnimationController.SetBool(HumanoidAnimType.sit_wait, false);
_AnimationController.SetBool(HumanoidAnimType.wait, false);

UpdateWaitType(ChangeWaitTypePacket.WaitType.WT_STANDING);

_AnimationController.SetBool(HumanoidAnimType.walk, true);
}

Expand All @@ -68,9 +70,14 @@ private void StopWalking()
_AnimationController.SetBool(HumanoidAnimType.walk, false);

if (CharacterInfo.DeleteTimer > 0)
{
_AnimationController.SetBool(HumanoidAnimType.sit_wait, true);
UpdateWaitType(ChangeWaitTypePacket.WaitType.WT_SITTING);
}
else
{
_AnimationController.SetBool(HumanoidAnimType.wait, true);
}

transform.eulerAngles = _destEulerAngles;
}
Expand Down
1 change: 1 addition & 0 deletions l2-unity/Assets/Scripts/Game/Entity/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public abstract class Entity : MonoBehaviour
public Gear Gear { get { return _referenceHolder.Gear; } }
public Combat Combat { get { return _referenceHolder.Combat; } }
public bool IsDead { get { return Status.IsDead; } }
public bool IsSitting { get { return _sitting; } }

private void Awake()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using UnityEngine;
using UnityEngine.UIElements;

public class LobbyNameplate : Nameplate
{
private bool _isDeleteTimerVisible = false;

private Label _deleteTimerLabel;

public LobbyNameplate(VisualElement visualElement, Label entityName, Label entityTitle, Entity entity) : base(visualElement, entityName, entityTitle, entity)
{
_deleteTimerLabel = visualElement.Q<Label>("DeleteTimer");
}

public void ShowDeleteTimer()
{

if (!_isDeleteTimerVisible)
{
_isDeleteTimerVisible = true;
SetClassName(_nameplateEle, "delete-timer");
}
}

public void HideDeleteTimer()
{
if (_isDeleteTimerVisible)
{
_isDeleteTimerVisible = false;
RemoveClassName(_nameplateEle, "delete-timer");
}
}

public void UpdateTimer(int deleteTImer)
{
_deleteTimerLabel.text = $"Remaining Time : {DateUtils.ConvertSecondsToDate(deleteTImer)}";
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected virtual void UpdateNameplateStyle(Nameplate nameplate)
{
nameplate.NameplateOffsetHeight = nameplate.Entity.IsDead ?
nameplate.Entity.Appearance.CollisionHeight * 0.85f :
nameplate.Entity.Appearance.CollisionHeight * nameplateHeightMultiplier;
nameplate.Entity.Appearance.CollisionHeight * nameplateHeightMultiplier * (nameplate.Entity.IsSitting ? 0.70f : 1f);

nameplate.ManageColors();
}
Expand Down Expand Up @@ -164,7 +164,7 @@ protected virtual bool IsNameplateVisible(Transform target)
}

// Factory methods for creating nameplates
protected Nameplate CreateNameplate(Entity entity)
protected virtual Nameplate CreateNameplate(Entity entity)
{
VisualElement element = nameplateTemplate.Instantiate()[0];
Nameplate nameplate = new Nameplate(
Expand Down
Loading

0 comments on commit 6c14eb2

Please sign in to comment.