(client)feat:dev菜单可用生成实体
This commit is contained in:
@ -1132,6 +1132,52 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
actionButton: 27
|
||||
--- !u!1 &1891846098
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1891846100}
|
||||
- component: {fileID: 1891846099}
|
||||
m_Layer: 0
|
||||
m_Name: EntityLevel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1891846099
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1891846098}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: aa378b7511b04429b8b6b0efbcce825a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
entityLevel: {fileID: 1891846098}
|
||||
entityPrefab: {fileID: 3332598847335032684, guid: 6cd8b01a0f57372438dc30c864ae1530, type: 3}
|
||||
--- !u!4 &1891846100
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1891846098}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!224 &1892335252 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 4227482396833377269, guid: 72cde32427f7d914692a7b0d22fb791d, type: 3}
|
||||
@ -1380,3 +1426,4 @@ SceneRoots:
|
||||
- {fileID: 323725409}
|
||||
- {fileID: 1236970686}
|
||||
- {fileID: 603423468}
|
||||
- {fileID: 1891846100}
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
public class EntityManage:MonoBehaviour
|
||||
public class EntityManage:Utils.MonoSingleton<EntityManage>
|
||||
{
|
||||
public Dictionary<string, List<EntityPrefab>> factionEntities = new();
|
||||
|
||||
@ -84,5 +84,10 @@ namespace Managers
|
||||
Debug.LogError($"An error occurred while generating the entity: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
factionEntities.Clear();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Data;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@ -47,6 +48,8 @@ namespace UI
|
||||
{
|
||||
var button=InstantiatePrefab(buttonTemplate, menuContent.transform);
|
||||
button.Label = def.label;
|
||||
var pawnDef = def;
|
||||
button.AddListener(() => GenerateEntityCallback(pawnDef));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@ -78,6 +81,10 @@ namespace UI
|
||||
return instantiatedComponent;
|
||||
}
|
||||
|
||||
void GenerateEntityCallback(PawnDef pawnDef)
|
||||
{
|
||||
Managers.EntityManage.Instance.GenerateEntity(pawnDef, new(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user