This commit is contained in:
parent
b714f76560
commit
ff7afe4133
Binary file not shown.
|
@ -2,7 +2,6 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Net.Project.B.Damage
|
namespace Net.Project.B.Damage
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BITKit.Entities;
|
using BITKit.Entities;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Project.B.Entities
|
namespace Project.B.Entities
|
||||||
{
|
{
|
||||||
|
@ -12,7 +11,7 @@ namespace Project.B.Entities
|
||||||
public interface IEntitiesFactory:IDisposable
|
public interface IEntitiesFactory:IDisposable
|
||||||
{
|
{
|
||||||
IReadOnlyDictionary<int,IEntity> Entities { get; }
|
IReadOnlyDictionary<int,IEntity> Entities { get; }
|
||||||
UniTask<IEntity> CreateAsync(string addressablePath,GameObject model);
|
UniTask<IEntity> CreateAsync(string addressablePath,object model);
|
||||||
public event Func<string, IEntity,UniTask> OnEntityCreate;
|
public event Func<string, IEntity,UniTask> OnEntityCreate;
|
||||||
public event Func<string, IEntity,UniTask> OnEntityCreated;
|
public event Func<string, IEntity,UniTask> OnEntityCreated;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Net.Project.B.Faction
|
namespace Net.Project.B.Faction
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,10 @@ namespace Project.B.Map
|
||||||
/// 切换场景后
|
/// 切换场景后
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Action<Guid,string> OnMapChanged;
|
event Action<Guid,string> OnMapChanged;
|
||||||
|
/// <summary>
|
||||||
|
/// 切换场景后,加载完成
|
||||||
|
/// </summary>
|
||||||
|
event Action<Guid,string> OnMapChangeCompleted;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 地图加载进度
|
/// 地图加载进度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -12,11 +12,15 @@ namespace Project.B.Map
|
||||||
[SerializeField] private string author;
|
[SerializeField] private string author;
|
||||||
[SerializeField] private string mapAddress;
|
[SerializeField] private string mapAddress;
|
||||||
[SerializeField] private Texture overview;
|
[SerializeField] private Texture overview;
|
||||||
|
[SerializeField] private Vector2 offset;
|
||||||
|
[SerializeField] private int size;
|
||||||
public string MapName => mapName;
|
public string MapName => mapName;
|
||||||
public string Author => author;
|
public string Author => author;
|
||||||
public string Description => description;
|
public string Description => description;
|
||||||
public object Overview => overview;
|
public object Overview => overview;
|
||||||
public string MapAddress => mapAddress;
|
public string MapAddress => mapAddress;
|
||||||
|
public Vector2 Offset => offset;
|
||||||
|
public int Size => size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -2,9 +2,9 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BITKit.WorldNode;
|
using BITKit.WorldNode;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
|
using UnityEngine;
|
||||||
namespace Net.Project.B.Interaction
|
namespace Net.Project.B.Interaction
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BITKit;
|
using BITKit;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Net.Project.B.Inventory
|
namespace Net.Project.B.Inventory
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace Project.B.Player
|
||||||
QuarterResolution,
|
QuarterResolution,
|
||||||
EighthResolution,
|
EighthResolution,
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
public enum Lang
|
public enum Lang
|
||||||
{
|
{
|
||||||
[Description("zh-CN")]
|
[Description("zh-CN")]
|
||||||
|
@ -38,7 +39,6 @@ namespace Project.B.Player
|
||||||
[Description("ja-JP")]
|
[Description("ja-JP")]
|
||||||
JP,
|
JP,
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 玩家设置
|
/// 玩家设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Net.Project.B.UX
|
||||||
public interface IUXDialogue : IUXPanel
|
public interface IUXDialogue : IUXPanel
|
||||||
{
|
{
|
||||||
event Func<string, string> OnSubtitle;
|
event Func<string, string> OnSubtitle;
|
||||||
public string SubtitleLanguage { get; set; }
|
public string[] SubtitleLanguages { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IUXInventory : IUXPanel
|
public interface IUXInventory : IUXPanel
|
||||||
|
|
|
@ -3,7 +3,9 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BITKit.Entities;
|
using BITKit.Entities;
|
||||||
using Net.Project.B.WorldNode;
|
using Net.Project.B.WorldNode;
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Net.Project.B.World
|
namespace Net.Project.B.World
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
||||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||||
"GUID:e527b3ce3106f974585be5134b6200e9",
|
"GUID:e527b3ce3106f974585be5134b6200e9",
|
||||||
"GUID:e18d548755c9bc8458ca189e16813742"
|
"GUID:e18d548755c9bc8458ca189e16813742",
|
||||||
|
"GUID:d8b63aba1907145bea998dd612889d6b",
|
||||||
|
"GUID:1193c2664d97cc049a6e4c486c6bce71"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BITKit;
|
using BITKit;
|
||||||
using BITKit.WorldNode;
|
using BITKit.WorldNode;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Net.Project.B.WorldNode
|
namespace Net.Project.B.WorldNode
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,32 +1,44 @@
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using BITKit;
|
using BITKit;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
namespace Net.Project.B.WorldNode
|
namespace Net.Project.B.WorldNode
|
||||||
{
|
{
|
||||||
public class UnityEnvironmentController : MonoBehaviour
|
public class UnityEnvironmentController : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField] private GameObject[] searchGameObjects;
|
||||||
[SerializeField] private GameObject[] staticGameObjects;
|
[SerializeField] private GameObject[] staticGameObjects;
|
||||||
|
[SerializeField] private UnityEvent onCompleted;
|
||||||
private void OnEnable()
|
|
||||||
{
|
|
||||||
if(Application.isEditor)return;
|
|
||||||
Execute();
|
|
||||||
Destroy(this);
|
|
||||||
}
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
Execute();
|
Execute();
|
||||||
|
onCompleted?.Invoke();
|
||||||
Destroy(this);
|
Destroy(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ContextMenu("Build Index")]
|
[ContextMenu("Build Index")]
|
||||||
public void Rebuild()
|
public void Rebuild()
|
||||||
{
|
{
|
||||||
staticGameObjects = GetComponentsInChildren<Transform>().Where(x=>x.gameObject.isStatic).Select(x=>x.gameObject).ToArray();
|
if (searchGameObjects is { Length: > 0 })
|
||||||
|
{
|
||||||
|
var hashSet = new HashSet<Transform>();
|
||||||
|
foreach (var searchGameObject in searchGameObjects)
|
||||||
|
{
|
||||||
|
if (!searchGameObject) continue;
|
||||||
|
hashSet.UnionWith(searchGameObject.GetComponentsInChildren<Transform>());
|
||||||
|
}
|
||||||
|
staticGameObjects = hashSet.Select(x => x.gameObject).ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
staticGameObjects = GetComponentsInChildren<Transform>().Where(x=>x.gameObject.isStatic).Select(x=>x.gameObject).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Log($"已获取到{staticGameObjects.Length}个物体");
|
Debug.Log($"已获取到{staticGameObjects.Length}个物体");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,3 +61,4 @@ namespace Net.Project.B.WorldNode
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -3,7 +3,9 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BITKit;
|
using BITKit;
|
||||||
using BITKit.WorldNode;
|
using BITKit.WorldNode;
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Net.Project.B.WorldNode
|
namespace Net.Project.B.WorldNode
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,6 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BITKit.WorldNode;
|
using BITKit.WorldNode;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Net.Project.B.WorldNode
|
namespace Net.Project.B.WorldNode
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||||
using BITKit.WorldNode;
|
using BITKit.WorldNode;
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Experimental.GlobalIllumination;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Net.Project.B.WorldNode
|
namespace Net.Project.B.WorldNode
|
||||||
|
@ -12,6 +13,7 @@ namespace Net.Project.B.WorldNode
|
||||||
public class UnitySeatNode :IWorldNode
|
public class UnitySeatNode :IWorldNode
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
public bool hidePlayer;
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
public float cameraDistance= 2;
|
public float cameraDistance= 2;
|
||||||
public Rigidbody Rigidbody;
|
public Rigidbody Rigidbody;
|
||||||
|
@ -20,6 +22,7 @@ namespace Net.Project.B.WorldNode
|
||||||
public Transform ExitObject;
|
public Transform ExitObject;
|
||||||
|
|
||||||
public float CameraDistance => cameraDistance;
|
public float CameraDistance => cameraDistance;
|
||||||
|
public bool HidePlayer => hidePlayer;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using BITKit;
|
||||||
|
using MemoryPack;
|
||||||
|
using Net.BITKit.Quadtree;
|
||||||
|
using Unity.Mathematics;
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor;
|
||||||
|
#endif
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
namespace Net.Project.B.WorldNode
|
||||||
|
{
|
||||||
|
public class UnityVegetationNode : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private float3[] positions;
|
||||||
|
[SerializeField] private float2 sizeFactor;
|
||||||
|
|
||||||
|
[SerializeField] private GameObject searchPrefab;
|
||||||
|
|
||||||
|
private Mesh _mesh;
|
||||||
|
private Mesh[] _subMeshes;
|
||||||
|
private Material[] _materials;
|
||||||
|
private List<Matrix4x4> _matrix4;
|
||||||
|
|
||||||
|
private readonly Quadtree _quadtree=new(default,new float2(2048,2048));
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_mesh = searchPrefab.GetComponentInChildren<MeshFilter>().sharedMesh;
|
||||||
|
_materials = searchPrefab.GetComponentInChildren<MeshRenderer>().sharedMaterials;
|
||||||
|
|
||||||
|
_matrix4 = new List<Matrix4x4>();
|
||||||
|
for (var i = 0; i < positions.Length; i++)
|
||||||
|
{
|
||||||
|
var position = positions[i];
|
||||||
|
var matrix = Matrix4x4.TRS(position, Quaternion.identity, Vector3.one);
|
||||||
|
_matrix4.Add(matrix);
|
||||||
|
|
||||||
|
_quadtree.Insert(i,position.xz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
for (var i = 0; i < _mesh.subMeshCount; i++)
|
||||||
|
{
|
||||||
|
Graphics.DrawMeshInstanced(_mesh,i,_materials[i],_matrix4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
private void OnDrawGizmosSelected()
|
||||||
|
{
|
||||||
|
foreach (var position in positions)
|
||||||
|
{
|
||||||
|
Gizmos.DrawCube(position,Vector3.one);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[ContextMenu(nameof(Search))]
|
||||||
|
private void Search()
|
||||||
|
{
|
||||||
|
var positionList = new List<float3>();
|
||||||
|
|
||||||
|
var allObjects = GameObject.FindObjectsOfType<GameObject>();
|
||||||
|
|
||||||
|
foreach (var obj in allObjects)
|
||||||
|
{
|
||||||
|
if (PrefabUtility.GetPrefabAssetType(obj) is not (PrefabAssetType.Regular or PrefabAssetType.Variant)) continue;
|
||||||
|
if (PrefabUtility.IsAnyPrefabInstanceRoot(obj) is false) continue;
|
||||||
|
var source = PrefabUtility.GetCorrespondingObjectFromOriginalSource(obj);
|
||||||
|
if(source!=searchPrefab)continue;
|
||||||
|
positionList.Add(obj.transform.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log($"已获取到{positionList.Count}个预制体");
|
||||||
|
positions = positionList.ToArray();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c438cc0299e15c4cb3706d97b11f726
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -2,13 +2,16 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BITKit.WorldNode;
|
using BITKit.WorldNode;
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Net.Project.B.WorldNode
|
namespace Net.Project.B.WorldNode
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class UnityVehicleNode : IWorldNode
|
public class UnityVehicleNode : IWorldNode
|
||||||
{
|
{
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
public Rigidbody rigidbody;
|
public Rigidbody rigidbody;
|
||||||
|
|
||||||
public GameObject seatObject;
|
public GameObject seatObject;
|
||||||
|
@ -36,6 +39,8 @@ namespace Net.Project.B.WorldNode
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public object WorldObject { get; set; }
|
public object WorldObject { get; set; }
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using BITKit.WorldNode;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Net.Project.B
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public sealed class UnityWorldChunkNode : IWorldNode
|
||||||
|
{
|
||||||
|
public string sceneName;
|
||||||
|
public bool includeColliders;
|
||||||
|
public GameObject lodGameObject;
|
||||||
|
public GameObject GameObject { get; set; }
|
||||||
|
public Bounds Bounds { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b0193be905ce2324a9f256a141778218
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue