1
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6213801c4020124fb6cf6acf5308c1e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,70 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BITKit.Entities;
|
||||
using BITKit.WorldNode;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Net.Project.B.Interaction;
|
||||
using Project.B.CharacterController;
|
||||
using Project.B.Entities;
|
||||
using Project.B.Map;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Net.Like.Xue.Tokyo.GameService
|
||||
{
|
||||
public class GamePortalPlayerService
|
||||
{
|
||||
private readonly ILogger<GamePortalPlayerService> _logger;
|
||||
private readonly IWorldInteractionService _interactionService;
|
||||
private readonly IPlayerFactory _playerFactory;
|
||||
private readonly IWorldNodeService _worldNodeService;
|
||||
private readonly IGameMapService _gameMapService;
|
||||
private UniTaskCompletionSource<IEntity> _waitPlayer;
|
||||
|
||||
public GamePortalPlayerService(IWorldInteractionService interactionService, IWorldNodeService worldNodeService, IGameMapService gameMapService, ILogger<GamePortalPlayerService> logger, IPlayerFactory playerFactory)
|
||||
{
|
||||
_interactionService = interactionService;
|
||||
_worldNodeService = worldNodeService;
|
||||
_gameMapService = gameMapService;
|
||||
_logger = logger;
|
||||
_playerFactory = playerFactory;
|
||||
|
||||
_interactionService.OnInteraction += OnInteraction;
|
||||
_playerFactory.OnEntityCreated += OnEntityCreated;
|
||||
}
|
||||
|
||||
private UniTask OnEntityCreated(string arg1, IEntity arg2)
|
||||
{
|
||||
_waitPlayer?.TrySetResult(arg2);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
private async void OnInteraction(object arg1, IWorldInteractable arg2, WorldInteractionProcess arg3, object arg4)
|
||||
{
|
||||
if(arg1 is IEntity entity is false)return;
|
||||
if(arg3 is not WorldInteractionProcess.Performed)return;
|
||||
if(entity.ServiceProvider.GetRequiredService<ICharacterController>() is not {} characterController)return;
|
||||
if (_worldNodeService.WorldNodes.TryGetValue(arg2.Id, out var node) is false) return;
|
||||
|
||||
if(node.OfType<WorldPortalNode>().FirstOrDefault() is not {MapName:not null} portalNode)return;
|
||||
|
||||
if (string.IsNullOrEmpty(portalNode.MapName?.Value) is false)
|
||||
{
|
||||
_waitPlayer = new();
|
||||
await _gameMapService.StartMapAsync(portalNode.MapName.Value);
|
||||
|
||||
var player = await _waitPlayer.Task;
|
||||
characterController = player.ServiceProvider.GetRequiredService<ICharacterController>();
|
||||
}
|
||||
|
||||
await Task.Delay(300);
|
||||
|
||||
characterController.Position = portalNode.Position;
|
||||
Vector3 eulerAngle = portalNode.EulerAngle;
|
||||
characterController.Rotation = Quaternion.Euler(eulerAngle);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4e30a80c3826ed43be03b8aafb25d27
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Project.B.Entities;
|
||||
using Project.B.Map;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Net.Like.Xue.Tokyo.GameService
|
||||
{
|
||||
public class GameSpawnPlayerService
|
||||
{
|
||||
private readonly IGameMapService _gameMapService;
|
||||
private readonly IPlayerFactory _playerFactory;
|
||||
|
||||
public GameSpawnPlayerService(IGameMapService gameMapService, IPlayerFactory playerFactory)
|
||||
{
|
||||
_gameMapService = gameMapService;
|
||||
_playerFactory = playerFactory;
|
||||
|
||||
_gameMapService.OnMapChanged += OnMapChanged;
|
||||
}
|
||||
|
||||
private void OnMapChanged(Guid arg1, string arg2)
|
||||
{
|
||||
_playerFactory.CreateAsync(null,null).Forget();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc07b2ff95394294ea4303321b783dc0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"name": "Net.Like.Xue.Tokyo.GameService.Unity",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:12c795c5ebfb7b245a0399e28b4015e8",
|
||||
"GUID:c469c0b0902774247810f42d61a18bd7",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:e527b3ce3106f974585be5134b6200e9",
|
||||
"GUID:ecc5a2501a2c44d4cb8366674714f3d9",
|
||||
"GUID:d750d221812bb1d48baff92e6ef73e28",
|
||||
"GUID:d8b63aba1907145bea998dd612889d6b"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97858f2d82d5a4549a44f5d8e2dad161
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -34,9 +34,12 @@ namespace Net.Like.Xue.Tokyo
|
||||
serviceCollection.AddSingleton<UXMenu>();
|
||||
serviceCollection.AddSingleton<UXLevel>();
|
||||
serviceCollection.AddSingleton<UXHud>();
|
||||
serviceCollection.AddSingleton<UXMap>();
|
||||
serviceCollection.AddSingleton<IUXMap,UXMap>();
|
||||
serviceCollection.AddSingleton<IUXCosmetics, UXCosmetics<UXMenu>>();
|
||||
|
||||
serviceCollection.AddKeyedSingleton<IUXMap, UXMap<UXHud>>(nameof(UXHud));
|
||||
serviceCollection.AddKeyedSingleton<IUXMap, UXMap<IUXMap>>(nameof(UXMap));
|
||||
|
||||
serviceCollection.AddSingleton<IUXBuyStation, UXBuyStation>();
|
||||
|
||||
serviceCollection.AddSingleton<IUXInventory, UXInventory<UXHud>>();
|
||||
@@ -71,6 +74,9 @@ namespace Net.Like.Xue.Tokyo
|
||||
serviceProvider.GetRequiredService<IUXCosmetics>();
|
||||
|
||||
serviceProvider.GetRequiredService<IUXBuyStation>();
|
||||
|
||||
serviceProvider.GetRequiredKeyedService<IUXMap>(nameof(UXHud));
|
||||
serviceProvider.GetRequiredKeyedService<IUXMap>(nameof(UXMap));
|
||||
|
||||
var inventory = serviceProvider.GetRequiredService<IUXInventory>();
|
||||
inventory.AutoInspect = ItemQuality.Develop;
|
||||
@@ -82,7 +88,10 @@ namespace Net.Like.Xue.Tokyo
|
||||
|
||||
Application.targetFrameRate = 165;
|
||||
|
||||
BITApp.WalkUntilInitialize.TrySetResult();
|
||||
await destroyCancellationToken.WaitUntilCanceled();
|
||||
|
||||
BITApp.WalkUntilInitialize = new();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit;
|
||||
using NodeCanvas.Framework;
|
||||
using Pinwheel.Jupiter;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Net.Like.Xue.Tokyo
|
||||
{
|
||||
public class SetDayTime:MonoBehaviour
|
||||
{
|
||||
private JDayNightCycle _cycle;
|
||||
private void Start()
|
||||
{
|
||||
_cycle = GetComponent<JDayNightCycle>();
|
||||
Data.AddListener<float>("Time",OnSetTime);
|
||||
destroyCancellationToken.Register(Dispose);
|
||||
}
|
||||
private void Dispose()
|
||||
{
|
||||
Data.RemoveListender<float>("Time",OnSetTime);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Data.Set("Time", _cycle.Time);
|
||||
}
|
||||
|
||||
private void OnSetTime(float obj)
|
||||
{
|
||||
_cycle.Time = obj;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a777f9c70b86c2145b73636fda10642a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -8,6 +8,7 @@ using BITKit.UX;
|
||||
using BITKit.UX.Hotkey;
|
||||
using BITKit.WorldNode;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Net.Project.B.Emoji;
|
||||
using Net.Project.B.Interaction;
|
||||
using Net.Project.B.Quest;
|
||||
@@ -23,23 +24,23 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
{
|
||||
public class UXHud : UIToolKitPanel
|
||||
{
|
||||
private readonly IEntitiesService _entitiesService;
|
||||
private readonly IPlayerFactory _playerFactory;
|
||||
private readonly IGameMapService _gameMapService;
|
||||
private readonly IWorldInteractionService _interactionService;
|
||||
private readonly WorldInfoNodeService _worldInfoNodeService;
|
||||
private readonly IQuestService _questService;
|
||||
private readonly UXRadialMenu _radialMenu;
|
||||
|
||||
[Inject]
|
||||
private IEmojiService<AnimationClip> _emojiService;
|
||||
public UXHud(IUXService uxService, IGameMapService gameMapService, IWorldInteractionService interactionService, WorldInfoNodeService worldInfoNodeService, IQuestService questService, UXRadialMenu radialMenu, IPlayerFactory playerFactory) : base(uxService)
|
||||
public UXHud(IUXService uxService, IGameMapService gameMapService, IWorldInteractionService interactionService, IQuestService questService, UXRadialMenu radialMenu, IPlayerFactory playerFactory, IEntitiesService entitiesService) : base(uxService)
|
||||
{
|
||||
_gameMapService = gameMapService;
|
||||
_interactionService = interactionService;
|
||||
_worldInfoNodeService = worldInfoNodeService;
|
||||
_questService = questService;
|
||||
_radialMenu = radialMenu;
|
||||
_playerFactory = playerFactory;
|
||||
_entitiesService = entitiesService;
|
||||
|
||||
_gameMapService.OnMapChanged += OnMapChanged;
|
||||
|
||||
@@ -72,7 +73,16 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
{
|
||||
case WorldInteractionProcess.Hover:
|
||||
_interactionTips.SetActive(true);
|
||||
_interactionTips.text = _worldInfoNodeService.WorldInfoNodes.TryGetValue(arg2.Id, out var node) ? node.Name : "互动";
|
||||
if (_entitiesService.Entities.TryGetValue(arg2.Id, out var entity) &&
|
||||
entity.ServiceProvider.GetService<WorldInfoNode>() is { } infoNode && string.IsNullOrEmpty(infoNode.Name) is false)
|
||||
{
|
||||
_interactionTips.text = infoNode.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
_interactionTips.text = "互动";
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
_interactionTips.SetActive(false);
|
||||
@@ -88,11 +98,7 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
protected override string DocumentPath => "ux_hud";
|
||||
public override bool AllowInput => true;
|
||||
public override bool AllowCursor => false;
|
||||
|
||||
[UXBindPath("minimap-container")]
|
||||
private VisualElement _minimapContainer;
|
||||
[UXBindPath("minimap-player")]
|
||||
private VisualElement _miniPlayer;
|
||||
|
||||
[UXBindPath("interaction-tips")]
|
||||
private Label _interactionTips;
|
||||
[UXBindPath("time-slider")]
|
||||
@@ -117,10 +123,6 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
|
||||
_interactionTips.SetActive(false);
|
||||
|
||||
_minimapContainer.RegisterCallback<MouseDownEvent>(x =>
|
||||
{
|
||||
UXService.Entry<UXMap>();
|
||||
});
|
||||
|
||||
_timeSlider.RegisterValueChangedCallback(x => { Data.Set("Time", x.newValue); });
|
||||
_questContainer.Clear();
|
||||
@@ -138,7 +140,7 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
|
||||
if (Keyboard.current is { capsLockKey: { wasPressedThisFrame: true } } or {mKey:{wasPressedThisFrame:true}})
|
||||
{
|
||||
UXService.Entry<UXMap>();
|
||||
UXService.Entry<IUXMap>();
|
||||
}else if (Keyboard.current is { f1Key: { wasPressedThisFrame: true } })
|
||||
{
|
||||
var collection = new HotkeyCollection();
|
||||
|
@@ -2,12 +2,13 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit.UX;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Net.Project.B.UX;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Net.Like.Xue.Tokyo.UX
|
||||
{
|
||||
public class UXMap : UIToolKitPanel
|
||||
public class UXMap : UIToolKitPanel,IUXMap
|
||||
{
|
||||
public UXMap(IUXService uxService) : base(uxService)
|
||||
{
|
||||
@@ -15,14 +16,6 @@ namespace Net.Like.Xue.Tokyo.UX
|
||||
protected override string DocumentPath => "ux_map";
|
||||
public override bool CloseWhenClickOutside => true;
|
||||
public override bool AllowCursor => true;
|
||||
|
||||
[UXBindPath("minimap-container")]
|
||||
private VisualElement _minimapContainer;
|
||||
[UXBindPath("minimap-player")]
|
||||
private VisualElement _miniPlayer;
|
||||
|
||||
private Camera _minimapCamera;
|
||||
private Camera _mainCamera;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b08be9a0aba8744ba63c5d4335171a9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "Net.Like.Xue.Tokyo.Weather.Unity",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc40f4a6a57e06b499235c2a10cf715b
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,62 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Net.Like.Xue.Tokyo.Weather
|
||||
{
|
||||
public class ScriptableWeather : ScriptableObject
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[SerializeField] private LightingDataAsset lightingDataAsset;
|
||||
#endif
|
||||
[SerializeField] private Vector3 sunLightDirection = new Vector3(0, 1, 0);
|
||||
[SerializeField] private Color sunLightColor;
|
||||
[SerializeField] private float sunLightIntensity = 1;
|
||||
[SerializeField] private Material skyboxMaterial;
|
||||
[SerializeField] private FogMode fogMode;
|
||||
[SerializeField] private Color fogColor;
|
||||
[SerializeField] private float fogDensity;
|
||||
|
||||
[BIT]
|
||||
public void Save()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
lightingDataAsset = Lightmapping.lightingDataAsset;
|
||||
#endif
|
||||
|
||||
sunLightDirection = RenderSettings.sun.transform.eulerAngles;
|
||||
sunLightIntensity = RenderSettings.sun.intensity;
|
||||
sunLightColor = RenderSettings.sun.color;
|
||||
|
||||
skyboxMaterial = RenderSettings.skybox;
|
||||
|
||||
fogMode = RenderSettings.fogMode;
|
||||
fogColor = RenderSettings.fogColor;
|
||||
fogDensity = RenderSettings.fogDensity;
|
||||
#if UNITY_EDITOR
|
||||
EditorUtility.SetDirty(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
[BIT]
|
||||
public void Load()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
Lightmapping.lightingDataAsset = lightingDataAsset;
|
||||
#endif
|
||||
RenderSettings.sun.transform.eulerAngles = sunLightDirection;
|
||||
RenderSettings.sun.intensity = sunLightIntensity;
|
||||
RenderSettings.skybox = skyboxMaterial;
|
||||
RenderSettings.fogMode = fogMode;
|
||||
RenderSettings.fogColor = fogColor;
|
||||
RenderSettings.fogDensity = fogDensity;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ee90b8fd1e6ff14188e5fd9f8502255
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user