forked from Shardstone/trail-into-darkness
added documentation, fixed some bugs
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
using Jovian.Logger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Jovian.PopupSystem;
|
||||
using Jovian.PopupSystem.UI;
|
||||
using Nox.UI;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
@@ -72,40 +70,32 @@ namespace Nox.Game.UI {
|
||||
slot.portrait.sprite = portraitsHolder.portraits[idx];
|
||||
}
|
||||
|
||||
// Name
|
||||
if(slot.nameText != null) {
|
||||
slot.nameText.text = member.Name;
|
||||
}
|
||||
|
||||
UpdateSlotStats(slot, member);
|
||||
activeSlots.Add(slot);
|
||||
}
|
||||
|
||||
// Initialize all popup triggers under the container
|
||||
if(popupSystem != null) {
|
||||
popupSystem.InitializeTriggersInChildren(portraitsContainer, trigger => {
|
||||
var slot = trigger.GetComponentInParent<PartyMemberSlot>();
|
||||
if(slot == null) {
|
||||
return;
|
||||
}
|
||||
var slotIndex = activeSlots.IndexOf(slot);
|
||||
if(slotIndex < 0 || slotIndex >= trackedParty.members.Count) {
|
||||
return;
|
||||
}
|
||||
var member = trackedParty.members[slotIndex];
|
||||
trigger.Initialize(popupSystem, builder => BuildCharacterPopup(builder, member));
|
||||
});
|
||||
}
|
||||
popupSystem?.InitializeTriggersInChildren(portraitsContainer, (trigger, view) => {
|
||||
var slot = trigger.GetComponentInParent<PartyMemberSlot>();
|
||||
if(slot == null) {
|
||||
return;
|
||||
}
|
||||
var slotIndex = activeSlots.IndexOf(slot);
|
||||
if(slotIndex < 0 || slotIndex >= trackedParty.members.Count) {
|
||||
return;
|
||||
}
|
||||
var member = trackedParty.members[slotIndex];
|
||||
view.SetContent(builder => BuildCharacterPopup(builder, member));
|
||||
});
|
||||
}
|
||||
|
||||
private void BuildCharacterPopup(PopupContentBuilder builder, CharacterDefinition member) {
|
||||
GlobalLogger.LogInfo($"Building character popup for {member.Name}", LogCategory.UI);
|
||||
|
||||
// Header
|
||||
builder.AddHeader(member.Name);
|
||||
builder.AddText($"{member.Race} {member.Class}", "#CCCCCC");
|
||||
builder.AddText($"Role: {member.Role}");
|
||||
builder.AddSeparator();
|
||||
builder
|
||||
.AddHeader(member.Name)
|
||||
.AddText($"{member.Race} {member.Class}", "#CCCCCC")
|
||||
.AddText($"Role: {member.Role}")
|
||||
.AddSeparator();
|
||||
|
||||
// Stats
|
||||
if(member.Stats?.stats != null) {
|
||||
@@ -155,16 +145,10 @@ namespace Nox.Game.UI {
|
||||
if(slot.healthBar != null) {
|
||||
slot.healthBar.fillAmount = Mathf.Clamp01(health / 100f);
|
||||
}
|
||||
if(slot.healthText != null) {
|
||||
slot.healthText.text = health.ToString();
|
||||
}
|
||||
|
||||
if(slot.manaBar != null) {
|
||||
slot.manaBar.fillAmount = Mathf.Clamp01(mana / 100f);
|
||||
}
|
||||
if(slot.manaText != null) {
|
||||
slot.manaText.text = mana.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -7,8 +6,5 @@ namespace Nox.Game.UI {
|
||||
public Image portrait;
|
||||
public Image healthBar;
|
||||
public Image manaBar;
|
||||
public TextMeshProUGUI nameText;
|
||||
public TextMeshProUGUI healthText;
|
||||
public TextMeshProUGUI manaText;
|
||||
}
|
||||
}
|
||||
|
||||
8
Assets/Prefabs/UI/CharacterCreation.meta
Normal file
8
Assets/Prefabs/UI/CharacterCreation.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75a4a222ad797a54aac8ff58761899cf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Prefabs/UI/InGameGui.meta
Normal file
8
Assets/Prefabs/UI/InGameGui.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b57e33c3f937ba146a2a13d68b0ce173
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -92,7 +92,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &7663002820715980796
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -229,7 +229,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &8741529769002405325
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -408,7 +408,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.6156863, g: 0.6509804, b: 0.63529414, a: 1}
|
||||
m_Color: {r: 0.9818833, g: 1, b: 0, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -442,7 +442,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &32220060764936852
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -599,8 +599,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.041302264}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -0.19400787, y: -0.000015258789}
|
||||
m_SizeDelta: {x: -0.38810003, y: 0}
|
||||
m_AnchoredPosition: {x: -0.0000076293945, y: -0.000015258789}
|
||||
m_SizeDelta: {x: 0.000022888, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &713960887884573537
|
||||
CanvasRenderer:
|
||||
@@ -720,9 +720,6 @@ MonoBehaviour:
|
||||
portrait: {fileID: 1445432521138085750}
|
||||
healthBar: {fileID: 4550488616099254946}
|
||||
manaBar: {fileID: 4614622083837966787}
|
||||
nameText: {fileID: 7895725010274726425}
|
||||
healthText: {fileID: 2204466678496895551}
|
||||
manaText: {fileID: 1991527881912334546}
|
||||
--- !u!114 &3828666794624103248
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -778,8 +775,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.041302264}
|
||||
m_AnchorMax: {x: 1, y: 0.041302264}
|
||||
m_AnchoredPosition: {x: -0.19399261, y: -1.4669495}
|
||||
m_SizeDelta: {x: -0.3880005, y: 2.6903992}
|
||||
m_AnchoredPosition: {x: -0.19453812, y: -2.3094025}
|
||||
m_SizeDelta: {x: -0.38894, y: 4.3752}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2223287144791830491
|
||||
CanvasRenderer:
|
||||
@@ -802,7 +799,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.48627454, g: 0.06666667, b: 0.08627451, a: 1}
|
||||
m_Color: {r: 0.19131038, g: 0.06666666, b: 0.4862745, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
8
Assets/Prefabs/UI/IngameLogSystem.meta
Normal file
8
Assets/Prefabs/UI/IngameLogSystem.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80b7de964780c3a4d91efbe9df16d961
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Prefabs/UI/PopupSystem.meta
Normal file
8
Assets/Prefabs/UI/PopupSystem.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7ddc322bd65e7e46abca4c4c6540bb6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -39,7 +39,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 300, y: 500}
|
||||
m_SizeDelta: {x: 300, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!225 &1835601435911948781
|
||||
CanvasGroup:
|
||||
@@ -118,7 +118,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &7236468329886607693
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -219,14 +219,14 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.31132078, g: 0.22780241, b: 0.16006587, a: 1}
|
||||
m_Color: {r: 0.1509434, g: 0.116711326, b: 0.088999644, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Sprite: {fileID: 21300000, guid: 52125a3c3df558448a5af5a04dbf8d2d, type: 3}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
Reference in New Issue
Block a user