This commit is contained in:
PC-20230316NUNE\Administrator
2024-03-20 14:22:36 +08:00
parent 8f2fb1010c
commit 98bead1a7c
52 changed files with 4112 additions and 4446 deletions

View File

@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@@ -301,3 +301,34 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1488571853
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1488571854}
m_Layer: 0
m_Name: Root
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1488571854
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1488571853}
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_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@@ -56,10 +56,6 @@ namespace Script
{
App.Sync.AddInput(info);
}
private void Update()
{
App.Sync.Update((int)(Time.deltaTime * 1000));
}
}
}

View File

@@ -1,10 +1,12 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using Game.Plugins.App;
using Plugins.JNGame.Sync.Frame;
using Plugins.JNGame.Util;
using UnityEngine;
using UnityEngine.SceneManagement;
using Object = UnityEngine.Object;
namespace Script.battle
{
@@ -26,14 +28,17 @@ namespace Script.battle
public class GBattleModeManager : SingletonScene<GBattleModeManager>
{
private static readonly string[] Worlds = { "NavDemo1", };
private static readonly string[] Worlds = { "WorldSceneMode", };
//当前模式
private GBattleMode _current = GBattleMode.Not;
private GBattleMode _current = GBattleMode.Default;
//当前模式实体
public Object root;
//是否本地模式
public Boolean isLocalMode = false;
//获取当前模式
public T GetMode<T>() where T : class
{
@@ -48,26 +53,25 @@ namespace Script.battle
}
//打开指定模式
public async UniTask Open(GBattleMode mode)
public async UniTask Open(GBattleMode mode, Boolean isLocalMode = false)
{
//销毁之前模式
_current = mode;
await OnReset();
await OnReset(mode);
//是否单机模式
this.isLocalMode = isLocalMode;
//开始同步
App.Sync.OnStart();
}
//重置当前模式
public async UniTask OnReset()
public async UniTask OnReset(GBattleMode mode)
{
await this.UnloadScene();
await UniTask.NextFrame();
await this.UnloadScene(mode);
App.Sync.OnReset();
await UniTask.NextFrame();
_current = mode;
await this.LoadScene();
_current = GBattleMode.Not;
}
//获取场景名称
@@ -83,29 +87,24 @@ namespace Script.battle
if (mode == GBattleMode.Not) return;
Debug.Log($"[GBattleModeManager] 打开场景{GetWorldName(mode)}");
await SceneManager.LoadSceneAsync(GetWorldName(mode));
await UniTask.NextFrame();
}
//销毁所有场景
private async UniTask UnloadScene()
private async UniTask UnloadScene(GBattleMode mode)
{
Debug.Log($"[GBattleModeManager] 关闭场景");
await SceneManager.UnloadSceneAsync(GetWorldName(mode));
await UniTask.NextFrame();
//
// for (int i = SceneManager.sceneCount - 1; i >= 0; i--)
// {
// try
// {
// await SceneManager.UnloadSceneAsync(SceneManager.GetSceneAt(i));
// }
// catch
// {
// // ignored
// }
// }
}
//刷新模式
private void Update()
{
App.Sync.Update((int)(Time.deltaTime * 1000));
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9fe2022df60c658429cbf569a7f748d0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameDemo1Mode : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@@ -1 +1 @@
Build from PC-20230316NUNE at 2024/2/22 19:22:15
Build from PC-20230316NUNE at 2024/3/15 14:24:59