updat core

This commit is contained in:
2024-10-21 16:20:37 +08:00
parent afc7f2d1bc
commit 93fe7b4d04
33 changed files with 1381 additions and 478 deletions

View File

@@ -4,11 +4,13 @@ using System.Linq;
using System.ScriptListener;
using Cysharp.Threading.Tasks;
using FJson;
using Framework.Asset;
using Framework.Audio;
using Framework.GamePool.manager;
using Framework.Timer;
using Framework.UI;
using Framework.Utils.SingletonTemplate;
using Game.Component;
using Game.Data;
using Game.EventDefine;
using IcecreamView;
@@ -16,6 +18,7 @@ using StateSystem;
using UniFramework.Event;
using UnityEngine;
using Views;
using Object = UnityEngine.Object;
namespace Game
{
@@ -38,6 +41,8 @@ namespace Game
public GameState CurrentGameState => this._gameFsm.CurrentState;
public int PartIndex = 1;
public RoomGlobalData RoomGlobalData
{
get => _roomGlobalData;
@@ -50,6 +55,10 @@ namespace Game
this._gameFsm.Active (GameState.InitGame , args);
GameUpdateMgr.Instance.AddUpdater (DoUpdate);
this.BindEvent ();
if (MapContent.Instance.ScenePart == null)
{
LoadScenePart (this.PartIndex);
}
this._gameFsm.OpenState (GameState.StartGame);
}
@@ -102,6 +111,14 @@ namespace Game
this.HasLock = false;
}
public void LoadScenePart (int partIndex)
{
var loadName = $"AutoSource/Part/part{partIndex}.prefab";
var scenePart = AssetManager.Instance.LoadAsset<GameObject> (loadName).GetComponent<ScenePart> ();
var instantiate = Object.Instantiate (scenePart, MapContent.Instance.transform, true);
MapContent.Instance.SetPart (instantiate);
}
#region
private void BindEvent ()
@@ -122,7 +139,7 @@ namespace Game
if (obj is GameEventDefine.OverlyCoin message)
{
AudioManager.Instance.PlaySoundEffect (SeAudio.Gaming_GetCoin);
this.RoomGlobalData.OverlyCoin (message.overlyCoin , message.hasEcho);
MapContent.Instance.OverlyCoin (message.overlyCoin);
GlobalEventDefine.RefreshView.SendMessage ();
}
}