mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 02:47:12 +08:00
(client) feat:添加基地界面到游玩界面的过程,添加存档管理,技能树变得可用 (#58)
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/58
This commit is contained in:
@@ -4,9 +4,12 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Base;
|
||||
using Data;
|
||||
using Entity;
|
||||
using Managers;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Utils;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
/// <summary>
|
||||
/// Program 类作为单例模式的核心管理器,负责维护和管理游戏或应用中的维度(Dimension)实例和焦点状态。
|
||||
@@ -91,7 +94,17 @@ public class Program : Singleton<Program>
|
||||
|
||||
|
||||
public bool CanOpenRightMenu => Setting.Instance.CurrentSettings.developerMode && !OnPlay;
|
||||
public bool CanMoveCamera => CanOpenRightMenu;
|
||||
public bool CanMoveCamera => CanOpenRightMenu && !UIInputControl.Instance.HasWindowOpen;
|
||||
|
||||
public DimensionDef OutsidePlayDimension { get; private set; } = null;
|
||||
|
||||
public int CoinCount
|
||||
{
|
||||
get => KeyValueArchiveManager.Instance.Get<int>("coinCount");
|
||||
set => KeyValueArchiveManager.Instance.Set("coinCount", value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -231,15 +244,36 @@ public class Program : Singleton<Program>
|
||||
OnFocusedEntityChanged?.Invoke(FocusedEntity);
|
||||
}
|
||||
|
||||
public void PlayGame(CharacterDef character)
|
||||
public void SelectCharacterPlayGame(CharacterDef character)
|
||||
{
|
||||
CurrentCharacter = character;
|
||||
if (character == null)
|
||||
return;
|
||||
PutPlayer();
|
||||
}
|
||||
|
||||
public void PutPlayer()
|
||||
{
|
||||
if (FocusedEntity != null || CurrentCharacter == null)
|
||||
return;
|
||||
var pos = CameraControl.CameraControl.Instance.Position;
|
||||
var player = EntityManager.Instance.GenerateEntity(FocusedDimensionId, character, new Vector3(pos.x, pos.y));
|
||||
if(!player)
|
||||
var player =
|
||||
EntityManager.Instance.GenerateCharacterEntity(FocusedDimensionId, CurrentCharacter,
|
||||
new Vector3(pos.x, pos.y));
|
||||
if (!player)
|
||||
return;
|
||||
player.entity.PlayerControlled = true;
|
||||
}
|
||||
|
||||
public void StartPlayGame(DimensionDef dimension)
|
||||
{
|
||||
OutsidePlayDimension=dimension;
|
||||
PerlinNoise.Instance.Reinitialize(Random.Range(int.MinValue, int.MaxValue));
|
||||
SceneManager.LoadScene("Play");
|
||||
}
|
||||
|
||||
public void EndPlayGame()
|
||||
{
|
||||
OutsidePlayDimension = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user