1
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public class EntityBehaviourTree :EntityComponent
|
||||
public class EntityBehaviourTree :EntityBehavior
|
||||
{
|
||||
public BehaviourTreeOwner behaviourTree;
|
||||
[SerializeField] private Blackboard blackboard;
|
||||
|
18
Src/UnityPluginsSupport/Steamwork/6C.asset
Normal file
18
Src/UnityPluginsSupport/Steamwork/6C.asset
Normal 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:
|
8
Src/UnityPluginsSupport/Steamwork/6C.asset.meta
Normal file
8
Src/UnityPluginsSupport/Steamwork/6C.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc2d583887d8ad8448aa10300cf43732
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -3,7 +3,9 @@
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23"
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
14
Src/UnityPluginsSupport/Steamwork/ISteamInventoryItemDef.cs
Normal file
14
Src/UnityPluginsSupport/Steamwork/ISteamInventoryItemDef.cs
Normal 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; }
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd0f577e933a33148b9a4c81964cc8a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -28,6 +28,8 @@ namespace BITKit.Steamwork
|
||||
/// </summary>
|
||||
bool IsInitialized { get; }
|
||||
UniTask<Texture2D> GetAvatarAsync(CancellationToken token);
|
||||
|
||||
UniTask<ISteamInventoryItemDef[]> GetInventoryItemDefsAsync(CancellationToken token);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab6c34283d61d534183f9a63e54f932c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
30
Src/UnityPluginsSupport/Steamwork/SteamInventoryItemDef.cs
Normal file
30
Src/UnityPluginsSupport/Steamwork/SteamInventoryItemDef.cs
Normal 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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f840f91da7fdd1c47986c21e0ec163ac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
18
Src/UnityPluginsSupport/Steamwork/Steve.asset
Normal file
18
Src/UnityPluginsSupport/Steamwork/Steve.asset
Normal 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:
|
8
Src/UnityPluginsSupport/Steamwork/Steve.asset.meta
Normal file
8
Src/UnityPluginsSupport/Steamwork/Steve.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f20d4d8f87ed1646a09a656cc140a1c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user