8.30
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using SepCore.Definition;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace SepCore.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 编队界面逻辑(手写 partial,与自动生成的 SquadForm.cs 合并)。
|
||||
/// 以传入的角色列表重建角色槽列表,模板槽来自 SquadView.characterSlotTemplate。
|
||||
/// </summary>
|
||||
public partial class SquadForm : UGuiForm
|
||||
{
|
||||
/// <summary>
|
||||
/// 按传入的角色列表重建角色槽列表 UI,每名角色一个槽位。
|
||||
/// </summary>
|
||||
public void RefreshCharacterList(IReadOnlyList<CharacterSave> characters)
|
||||
{
|
||||
SquadView squadView = View;
|
||||
if (squadView == null || squadView.characterSlotRoot == null ||
|
||||
squadView.characterSlotTemplate == null)
|
||||
{
|
||||
Log.Warning("SquadForm is not fully configured.");
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterSlotItem template = squadView.characterSlotTemplate;
|
||||
template.gameObject.SetActive(false);
|
||||
|
||||
for (int i = squadView.characterSlotRoot.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
Transform child = squadView.characterSlotRoot.GetChild(i);
|
||||
if (child == template.transform)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
int characterCount = characters != null ? characters.Count : 0;
|
||||
for (int i = 0; i < characterCount; i++)
|
||||
{
|
||||
CharacterSlotItem slot = Instantiate(template, squadView.characterSlotRoot);
|
||||
slot.gameObject.SetActive(true);
|
||||
slot.SetCharacter(characters[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a629f39601d3456ca1a8228059fa845
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
// <auto-generated />
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.UI
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
public partial class SquadForm : UGuiForm
|
||||
{
|
||||
[SerializeField] private SquadView _view = null;
|
||||
|
||||
public SquadView View => _view;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6542ec01d550457587508eff74a6957
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
// <auto-generated />
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.UI
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
public partial class SquadView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] public global::TMPro.TextMeshProUGUI squadMemberText;
|
||||
[SerializeField] public global::UnityEngine.RectTransform characterSlotRoot;
|
||||
[SerializeField] public global::SepCore.UI.CharacterSlotItem characterSlotTemplate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6eacd1573559d4784862ed9c21d5928c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user