mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
提交
This commit is contained in:
@@ -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}
|
||||
|
@@ -56,10 +56,6 @@ namespace Script
|
||||
{
|
||||
App.Sync.AddInput(info);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
App.Sync.Update((int)(Time.deltaTime * 1000));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
8
JNFrame/Assets/Game/Script/battle/mode/Demo.meta
Normal file
8
JNFrame/Assets/Game/Script/battle/mode/Demo.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fe2022df60c658429cbf569a7f748d0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
18
JNFrame/Assets/Game/Script/battle/mode/Demo/GameDemo1Mode.cs
Normal file
18
JNFrame/Assets/Game/Script/battle/mode/Demo/GameDemo1Mode.cs
Normal 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec3e2e6eab7953640bd070cd7240d964
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1 +1 @@
|
||||
Build from PC-20230316NUNE at 2024/2/22 19:22:15
|
||||
Build from PC-20230316NUNE at 2024/3/15 14:24:59
|
Reference in New Issue
Block a user