This commit is contained in:
CortexCore
2023-11-06 01:17:23 +08:00
parent bd40165ade
commit 5446067f91
114 changed files with 2023 additions and 414 deletions

View File

@@ -14,7 +14,6 @@ namespace BITKit
public class CinemachineHelper : MonoBehaviour
{
internal static CinemachineHelper Singleton { get; private set; }
[SerializeReference, SubclassSelector] public References ads;
public float Ads { get; private set; }
public CinemachineBrain brain;
private void Awake()
@@ -24,13 +23,9 @@ namespace BITKit
private void FixedUpdate()
{
var playerConfig = Data.Get<PlayerConfig>();
var currentActive = brain.ActiveVirtualCamera as CinemachineVirtualCamera;
if (currentActive is not null && playerConfig is not null)
{
var currentFov = currentActive.m_Lens.FieldOfView;
Ads = currentFov / playerConfig.Fov;
}
if (brain.ActiveVirtualCamera is not CinemachineVirtualCamera currentActive) return;
var currentFov = currentActive.m_Lens.FieldOfView;
Ads = currentFov / PlayerConfig.Singleton.Fov;
}
}
}

View File

@@ -7,7 +7,7 @@ using UnityEngine;
namespace BITKit
{
public class EntityBehaviourTree :EntityComponent
public class EntityBehaviourTree :EntityBehavior
{
public BehaviourTreeOwner behaviourTree;
[SerializeField] private Blackboard blackboard;

View File

@@ -0,0 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab6c34283d61d534183f9a63e54f932c, type: 3}
m_Name: 6C
m_EditorClassIdentifier:
addressablePath: Cosmetics/6C
id: 4980
defId: 3071
type:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cc2d583887d8ad8448aa10300cf43732
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,7 +3,9 @@
"rootNamespace": "",
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:f51ebe6a0ceec4240a699833d6309b23"
"GUID:f51ebe6a0ceec4240a699833d6309b23",
"GUID:d525ad6bd40672747bde77962f1c401e",
"GUID:49b49c76ee64f6b41bf28ef951cb0e50"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit.Steamwork
{
public interface ISteamInventoryItemDef:IAddressable
{
ulong Id { get; }
int DefId { get; }
string Type { get; }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dd0f577e933a33148b9a4c81964cc8a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -28,6 +28,8 @@ namespace BITKit.Steamwork
/// </summary>
bool IsInitialized { get; }
UniTask<Texture2D> GetAvatarAsync(CancellationToken token);
UniTask<ISteamInventoryItemDef[]> GetInventoryItemDefsAsync(CancellationToken token);
}
}

View File

@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit.Steamwork
{
public sealed class ScriptableInventoryItemDef: ScriptableObject,ISteamInventoryItemDef
{
[SerializeField] private string addressablePath;
[SerializeField] private ulong id;
[SerializeField] private int defId;
[SerializeField] private string type;
public string AddressablePath => addressablePath;
public ulong Id => id;
public int DefId => defId;
public string Type => type;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab6c34283d61d534183f9a63e54f932c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;
namespace BITKit.Steamwork
{
public class SteamInventoryItemDef : ISteamInventoryItemDef
{
public string AddressablePath { get; internal set; }
public ulong Id { get; internal set;}
public int DefId { get; internal set;}
public string Type { get; internal set;}
}
[Serializable]
public sealed class UnityInventoryItemDef:ISteamInventoryItemDef
{
[SerializeField] private Object obj;
private ISteamInventoryItemDef _steamInventoryItemDefImplementation=>obj as ISteamInventoryItemDef;
public string AddressablePath => _steamInventoryItemDefImplementation.AddressablePath;
public ulong Id => _steamInventoryItemDefImplementation.Id;
public int DefId => _steamInventoryItemDefImplementation.DefId;
public string Type => _steamInventoryItemDefImplementation.Type;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f840f91da7fdd1c47986c21e0ec163ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -19,6 +19,9 @@ namespace BITKit.Steamwork
[Header(Constant.Header.Settings)]
[SerializeField] private TextAsset allowCharacters;
[Header(Constant.Header.Settings)]
[SerializeField] private Optional<UnityInventoryItemDef[]> overrideInventoryItemDefs;
//接口实现
public ulong SteamId => SteamClient.SteamId;
public string Name =>SteamClient.IsValid ? SteamClient.Name.Where(x=>allowCharacters.text.Contains(x)).Aggregate("",(current, c) => current+c) : Environment.UserDomainName;
@@ -30,6 +33,18 @@ namespace BITKit.Steamwork
return avatar.Value.Covert();
}
public async UniTask<ISteamInventoryItemDef[]> GetInventoryItemDefsAsync(CancellationToken token)
{
if(overrideInventoryItemDefs.Allow)return overrideInventoryItemDefs.Value;
var items = await SteamInventory.GetAllItemsAsync();
if(items.HasValue is false)return Array.Empty<ISteamInventoryItemDef>();
return items.Value.GetItems().Select(x => new SteamInventoryItemDef()
{
Id = x.Id,
DefId = x.DefId
}).Cast<ISteamInventoryItemDef>().ToArray();
}
public int Id => (int)SteamClient.SteamId.AccountId;
private bool initialized;
@@ -50,10 +65,10 @@ namespace BITKit.Steamwork
initialized = true;
BIT4Log.Log<SteamService>("已初始化Steam");
}
catch (Exception)
catch (Exception e)
{
BIT4Log.Warning<SteamService>("Steam初始化失败请验证客户端是否运行");
throw;
Debug.Log(e);
}
}
@@ -73,5 +88,6 @@ namespace BITKit.Steamwork
public string Name => _steamServiceImplementation.Name;
public bool IsInitialized=>_steamServiceImplementation.IsInitialized;
public UniTask<Texture2D> GetAvatarAsync(CancellationToken token)=>_steamServiceImplementation.GetAvatarAsync(token);
public UniTask<ISteamInventoryItemDef[]> GetInventoryItemDefsAsync(CancellationToken token)=>_steamServiceImplementation.GetInventoryItemDefsAsync(token);
}
}

View File

@@ -0,0 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab6c34283d61d534183f9a63e54f932c, type: 3}
m_Name: Steve
m_EditorClassIdentifier:
addressablePath: Cosmetics/Steve
id: 4980
defId: 3070
type:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3f20d4d8f87ed1646a09a656cc140a1c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant: