Compare commits
No commits in common. "117dd123defb4850601644def0ef159ce6e29d63" and "56f74eee9a577150022e897fd329dc62d0a055cd" have entirely different histories.
117dd123de
...
56f74eee9a
|
|
@ -22,10 +22,7 @@ namespace UnityGameFramework.Editor
|
||||||
"UnityGameFramework.Runtime",
|
"UnityGameFramework.Runtime",
|
||||||
#endif
|
#endif
|
||||||
"Assembly-CSharp",
|
"Assembly-CSharp",
|
||||||
"VampireLike",
|
"VampireLike"
|
||||||
"SepCore.Base",
|
|
||||||
"SepCore.Runtime",
|
|
||||||
"SepCore.Procedure"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly string[] RuntimeOrEditorAssemblyNames =
|
private static readonly string[] RuntimeOrEditorAssemblyNames =
|
||||||
|
|
@ -39,11 +36,7 @@ namespace UnityGameFramework.Editor
|
||||||
#endif
|
#endif
|
||||||
"Assembly-CSharp-Editor",
|
"Assembly-CSharp-Editor",
|
||||||
"VampireLike",
|
"VampireLike",
|
||||||
"VampireLike.Editor",
|
"VampireLike.Editor"
|
||||||
"SepCore.Base",
|
|
||||||
"SepCore.Runtime",
|
|
||||||
"SepCore.Procedure",
|
|
||||||
"SepCore.Editor"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: -20
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {instanceID: 0}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ using UnityEngine.Networking;
|
||||||
#else
|
#else
|
||||||
using UnityEngine.Experimental.Networking;
|
using UnityEngine.Experimental.Networking;
|
||||||
#endif
|
#endif
|
||||||
|
using Utility = GameFramework.Utility;
|
||||||
|
|
||||||
namespace UnityGameFramework.Runtime
|
namespace UnityGameFramework.Runtime
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
#endif
|
#endif
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using Utility = GameFramework.Utility;
|
||||||
|
|
||||||
namespace UnityGameFramework.Runtime
|
namespace UnityGameFramework.Runtime
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ using UnityEngine.Networking;
|
||||||
#else
|
#else
|
||||||
using UnityEngine.Experimental.Networking;
|
using UnityEngine.Experimental.Networking;
|
||||||
#endif
|
#endif
|
||||||
|
using Utility = GameFramework.Utility;
|
||||||
|
|
||||||
namespace UnityGameFramework.Runtime
|
namespace UnityGameFramework.Runtime
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<ResourceBuilder>
|
<ResourceBuilder>
|
||||||
<Settings>
|
<Settings>
|
||||||
<InternalResourceVersion>1</InternalResourceVersion>
|
<InternalResourceVersion>1</InternalResourceVersion>
|
||||||
<Platforms>33</Platforms>
|
<Platforms>1</Platforms>
|
||||||
<AssetBundleCompression>1</AssetBundleCompression>
|
<AssetBundleCompression>1</AssetBundleCompression>
|
||||||
<CompressionHelperTypeName>UnityGameFramework.Runtime.DefaultCompressionHelper</CompressionHelperTypeName>
|
<CompressionHelperTypeName>UnityGameFramework.Runtime.DefaultCompressionHelper</CompressionHelperTypeName>
|
||||||
<AdditionalCompressionSelected>False</AdditionalCompressionSelected>
|
<AdditionalCompressionSelected>False</AdditionalCompressionSelected>
|
||||||
|
|
|
||||||
|
|
@ -1,529 +0,0 @@
|
||||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using SepCore.Event;
|
|
||||||
using SepCore.DataTable;
|
|
||||||
using SepCore.Definition;
|
|
||||||
using SepCore.Entity;
|
|
||||||
using SepCore.Components;
|
|
||||||
using SepCore.CustomUtility;
|
|
||||||
using SepCore.Simulation;
|
|
||||||
using SepCore.EnemyManager;
|
|
||||||
using SepCore.Procedure;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityGameFramework.Runtime;
|
|
||||||
#if ENABLE_INPUT_SYSTEM
|
|
||||||
using UnityEngine.InputSystem;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
public class RuntimeDebugPanelComponent : MonoBehaviour
|
|
||||||
|
|
||||||
{
|
|
||||||
private const float MinSpawnRate = 0.1f;
|
|
||||||
private const float CornerTapWindow = 0.6f;
|
|
||||||
private const int RequiredCornerTapCount = 3;
|
|
||||||
private const int DebugHealAmount = 200;
|
|
||||||
|
|
||||||
[Header("Window Content")] [SerializeField]
|
|
||||||
private bool _showBuffSection = true;
|
|
||||||
|
|
||||||
[SerializeField] private bool _showBattleOverview = true;
|
|
||||||
[SerializeField] private bool _showCollisionStats = true;
|
|
||||||
[SerializeField] private bool _showSpawnControls = true;
|
|
||||||
[SerializeField] private bool _showBattleDurationControls = true;
|
|
||||||
[SerializeField] private bool _showPlayerWeaponControls = true;
|
|
||||||
[SerializeField] private bool _showPlayerHealthControls = true;
|
|
||||||
[SerializeField] private bool _showTips = true;
|
|
||||||
|
|
||||||
private Rect _windowRect = new Rect(20f, 60f, 460f, 800f);
|
|
||||||
private bool _isPanelVisible;
|
|
||||||
private int _windowId;
|
|
||||||
|
|
||||||
private string _searchText = string.Empty;
|
|
||||||
private int _selectedIndex;
|
|
||||||
private int _addCount = 1;
|
|
||||||
private Vector2 _buffScroll;
|
|
||||||
|
|
||||||
private float _spawnRateScaleInput = 1f;
|
|
||||||
private float _extendDurationSeconds = 30f;
|
|
||||||
|
|
||||||
private DRProp[] _allProps = Array.Empty<DRProp>();
|
|
||||||
private DRProp[] _filteredProps = Array.Empty<DRProp>();
|
|
||||||
private string[] _displayNames = Array.Empty<string>();
|
|
||||||
|
|
||||||
private int _cornerTapCount;
|
|
||||||
private float _lastCornerTapTime = -10f;
|
|
||||||
private bool _lockPlayerHealthToMax;
|
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
_windowId = GetInstanceID();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
if (IsTogglePressed())
|
|
||||||
{
|
|
||||||
_isPanelVisible = !_isPanelVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
HandleCornerTapGesture();
|
|
||||||
if (_lockPlayerHealthToMax)
|
|
||||||
{
|
|
||||||
KeepPlayerHealthAtMax();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnGUI()
|
|
||||||
{
|
|
||||||
DrawToggleButton();
|
|
||||||
if (!_isPanelVisible) return;
|
|
||||||
|
|
||||||
_windowRect = GUI.Window(_windowId, _windowRect, DrawWindow, "Runtime Debug Panel");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawToggleButton()
|
|
||||||
{
|
|
||||||
const float width = 64f;
|
|
||||||
const float height = 30f;
|
|
||||||
Rect buttonRect = new Rect(Screen.width - width - 12f, 10f, width, height);
|
|
||||||
if (GUI.Button(buttonRect, "DEBUG"))
|
|
||||||
{
|
|
||||||
_isPanelVisible = !_isPanelVisible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawWindow(int windowId)
|
|
||||||
{
|
|
||||||
if (_showBuffSection)
|
|
||||||
{
|
|
||||||
EnsurePropList();
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.BeginVertical();
|
|
||||||
|
|
||||||
bool hasPreviousSection = false;
|
|
||||||
if (_showBuffSection)
|
|
||||||
{
|
|
||||||
DrawBuffSection();
|
|
||||||
hasPreviousSection = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasVisibleBattleSection())
|
|
||||||
{
|
|
||||||
if (hasPreviousSection)
|
|
||||||
{
|
|
||||||
GUILayout.Space(8f);
|
|
||||||
GUILayout.Label(string.Empty, GUI.skin.horizontalSlider);
|
|
||||||
GUILayout.Space(8f);
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawBattleSection();
|
|
||||||
hasPreviousSection = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_showTips)
|
|
||||||
{
|
|
||||||
if (hasPreviousSection)
|
|
||||||
{
|
|
||||||
GUILayout.Space(8f);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.Label("Tips: press `F8` or tap top-left corner 3 times to toggle.", GUILayout.Height(20f));
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.EndVertical();
|
|
||||||
GUI.DragWindow(new Rect(0, 0, 10000, 22));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawBuffSection()
|
|
||||||
{
|
|
||||||
GUILayout.Label("Buff Debug");
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
GUILayout.Label("Search", GUILayout.Width(52f));
|
|
||||||
_searchText = GUILayout.TextField(_searchText);
|
|
||||||
if (GUILayout.Button("Refresh", GUILayout.Width(80f)))
|
|
||||||
{
|
|
||||||
EnsurePropList(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
|
|
||||||
ApplyFilter(_searchText);
|
|
||||||
if (_displayNames.Length == 0)
|
|
||||||
{
|
|
||||||
GUILayout.Label("No Buff data. Enter battle and try again.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_selectedIndex = Mathf.Clamp(_selectedIndex, 0, _displayNames.Length - 1);
|
|
||||||
_buffScroll = GUILayout.BeginScrollView(_buffScroll, GUILayout.Height(120f));
|
|
||||||
_selectedIndex = GUILayout.SelectionGrid(_selectedIndex, _displayNames, 1);
|
|
||||||
GUILayout.EndScrollView();
|
|
||||||
|
|
||||||
DRProp selectedProp = GetSelectedProp();
|
|
||||||
if (selectedProp == null) return;
|
|
||||||
|
|
||||||
GUILayout.Label($"Selected: {selectedProp.Title} ({selectedProp.Rarity})");
|
|
||||||
GUILayout.Label(ItemDescUtility.CreatePropDescription(selectedProp.Modifiers), GUILayout.Height(40f));
|
|
||||||
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
GUILayout.Label("Count", GUILayout.Width(52f));
|
|
||||||
string addCountText = GUILayout.TextField(_addCount.ToString(), GUILayout.Width(60f));
|
|
||||||
if (!int.TryParse(addCountText, out _addCount)) _addCount = 1;
|
|
||||||
_addCount = Mathf.Clamp(_addCount, 1, 99);
|
|
||||||
|
|
||||||
if (GUILayout.Button("Add Buff To Player", GUILayout.Height(24f)))
|
|
||||||
{
|
|
||||||
AddSelectedBuffToPlayer(selectedProp, _addCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawBattleSection()
|
|
||||||
{
|
|
||||||
GUILayout.Label("Battle Debug");
|
|
||||||
ProcedureGame procedure = GameEntry.Procedure.CurrentProcedure as ProcedureGame;
|
|
||||||
EnemyManagerComponent enemyManager = GameEntry.EnemyManager;
|
|
||||||
Player player = FindPlayer();
|
|
||||||
HealthComponent playerHealth = player != null ? player.GetComponent<HealthComponent>() : null;
|
|
||||||
|
|
||||||
if (enemyManager == null)
|
|
||||||
{
|
|
||||||
GUILayout.Label("EnemyManager unavailable.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (procedure == null)
|
|
||||||
{
|
|
||||||
GUILayout.Label("ProcedureGame unavailable.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_showBattleOverview)
|
|
||||||
{
|
|
||||||
GUILayout.Label($"Spawn Rate: {enemyManager.SpawnRateScale:F2}");
|
|
||||||
GUILayout.Label(
|
|
||||||
$"Battle Time: {enemyManager.ElapsedBattleTime:F1}s / {enemyManager.BattleDuration:F1}s");
|
|
||||||
GUILayout.Label($"Enemy Count: {enemyManager.CurrentEnemyCount}");
|
|
||||||
}
|
|
||||||
|
|
||||||
SimulationWorld simulationWorld = GameEntry.SimulationWorld;
|
|
||||||
if (_showCollisionStats && simulationWorld != null)
|
|
||||||
{
|
|
||||||
GUILayout.Space(4f);
|
|
||||||
GUILayout.Label(
|
|
||||||
$"Collision Queries: total {simulationWorld.LastCollisionQueryCount} (Projectile {simulationWorld.LastProjectileCollisionQueryCount} / Area {simulationWorld.LastAreaCollisionQueryCount})");
|
|
||||||
GUILayout.Label(
|
|
||||||
$"Collision Candidates: total {simulationWorld.LastCollisionCandidateCount} (Projectile {simulationWorld.LastProjectileCollisionCandidateCount} / Area {simulationWorld.LastAreaCollisionCandidateCount})");
|
|
||||||
GUILayout.Label(
|
|
||||||
$"Area Resolve: hits {simulationWorld.LastResolvedAreaHitCount}");
|
|
||||||
GUILayout.Label(
|
|
||||||
$"Broad Phase: cell {simulationWorld.LastCollisionCellSize:F2}, hasEnemyTargets {(simulationWorld.LastCollisionHasEnemyTargets ? "Yes" : "No")}");
|
|
||||||
if (simulationWorld.LastCollisionCandidateCount != 0)
|
|
||||||
{
|
|
||||||
Log.Info($"LastCollisionCandidateCount:{simulationWorld.LastCollisionCandidateCount}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (simulationWorld.LastResolvedAreaHitCount != 0)
|
|
||||||
{
|
|
||||||
Log.Info($"LastResolvedAreaHitCount:{simulationWorld.LastResolvedAreaHitCount}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_showSpawnControls)
|
|
||||||
{
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
GUILayout.Label("Rate", GUILayout.Width(52f));
|
|
||||||
string rateText = GUILayout.TextField(_spawnRateScaleInput.ToString("F2"), GUILayout.Width(60f));
|
|
||||||
if (float.TryParse(rateText, out float parsedRate))
|
|
||||||
{
|
|
||||||
_spawnRateScaleInput = Mathf.Clamp(parsedRate, MinSpawnRate, 50f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUILayout.Button("Apply", GUILayout.Width(70f)))
|
|
||||||
{
|
|
||||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUILayout.Button("x0.5", GUILayout.Width(60f)))
|
|
||||||
{
|
|
||||||
_spawnRateScaleInput = Mathf.Max(MinSpawnRate, enemyManager.SpawnRateScale * 0.5f);
|
|
||||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUILayout.Button("x2", GUILayout.Width(60f)))
|
|
||||||
{
|
|
||||||
_spawnRateScaleInput = enemyManager.SpawnRateScale * 2f;
|
|
||||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_showBattleDurationControls)
|
|
||||||
{
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
GUILayout.Label("Add Sec", GUILayout.Width(52f));
|
|
||||||
string durationText = GUILayout.TextField(_extendDurationSeconds.ToString("F0"), GUILayout.Width(60f));
|
|
||||||
if (float.TryParse(durationText, out float parsedDuration))
|
|
||||||
{
|
|
||||||
_extendDurationSeconds = Mathf.Clamp(parsedDuration, 1f, 3600f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUILayout.Button("Extend Battle", GUILayout.Height(24f)))
|
|
||||||
{
|
|
||||||
if (procedure.CurrentGameState is GameStateBattle gameState)
|
|
||||||
{
|
|
||||||
gameState.AddBattleDuration(_extendDurationSeconds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_showPlayerWeaponControls)
|
|
||||||
{
|
|
||||||
GUILayout.Label(
|
|
||||||
$"Player Weapon: {(player == null ? "Player not found" : (player.WeaponEnabled ? "Enabled" : "Disabled"))}");
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
GUI.enabled = player != null;
|
|
||||||
if (GUILayout.Button("Disable Weapons", GUILayout.Height(24f)))
|
|
||||||
{
|
|
||||||
player.SetWeaponEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUILayout.Button("Enable Weapons", GUILayout.Height(24f)))
|
|
||||||
{
|
|
||||||
player.SetWeaponEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUI.enabled = true;
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_showPlayerHealthControls)
|
|
||||||
{
|
|
||||||
GUILayout.Space(4f);
|
|
||||||
GUILayout.Label(
|
|
||||||
$"Player HP: {(playerHealth == null ? "Unavailable" : $"{playerHealth.CurrentHealth}/{playerHealth.MaxHealth}")}");
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
GUI.enabled = playerHealth != null;
|
|
||||||
if (GUILayout.Button($"+{DebugHealAmount} HP", GUILayout.Height(24f)))
|
|
||||||
{
|
|
||||||
AddPlayerHealth(playerHealth, DebugHealAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUILayout.Button(_lockPlayerHealthToMax ? "GodMode: ON" : "GodMode: OFF", GUILayout.Height(24f)))
|
|
||||||
{
|
|
||||||
_lockPlayerHealthToMax = !_lockPlayerHealthToMax;
|
|
||||||
if (_lockPlayerHealthToMax)
|
|
||||||
{
|
|
||||||
RestorePlayerHealthToMax(playerHealth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GUI.enabled = true;
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool HasVisibleBattleSection()
|
|
||||||
{
|
|
||||||
return _showBattleOverview ||
|
|
||||||
_showCollisionStats ||
|
|
||||||
_showSpawnControls ||
|
|
||||||
_showBattleDurationControls ||
|
|
||||||
_showPlayerWeaponControls ||
|
|
||||||
_showPlayerHealthControls;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EnsurePropList(bool force = false)
|
|
||||||
{
|
|
||||||
if (!force && _allProps != null && _allProps.Length > 0) return;
|
|
||||||
|
|
||||||
if (GameEntry.DataTable == null)
|
|
||||||
{
|
|
||||||
_allProps = Array.Empty<DRProp>();
|
|
||||||
_filteredProps = Array.Empty<DRProp>();
|
|
||||||
_displayNames = Array.Empty<string>();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var table = GameEntry.DataTable.GetDataTable<DRProp>();
|
|
||||||
_allProps = table != null ? table.ToArray() : Array.Empty<DRProp>();
|
|
||||||
_selectedIndex = Mathf.Clamp(_selectedIndex, 0, Mathf.Max(0, _allProps.Length - 1));
|
|
||||||
ApplyFilter(_searchText);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyFilter(string keyword)
|
|
||||||
{
|
|
||||||
if (_allProps == null || _allProps.Length == 0)
|
|
||||||
{
|
|
||||||
_filteredProps = Array.Empty<DRProp>();
|
|
||||||
_displayNames = Array.Empty<string>();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(keyword))
|
|
||||||
{
|
|
||||||
_filteredProps = _allProps;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string search = keyword.Trim();
|
|
||||||
_filteredProps = _allProps.Where(p =>
|
|
||||||
p != null &&
|
|
||||||
(p.Title?.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0 ||
|
|
||||||
p.Id.ToString().Contains(search))).ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
_displayNames = _filteredProps.Select(p => $"[{p.Id}] {p.Title} ({p.Rarity})").ToArray();
|
|
||||||
if (_displayNames.Length == 0) _selectedIndex = 0;
|
|
||||||
else _selectedIndex = Mathf.Clamp(_selectedIndex, 0, _displayNames.Length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private DRProp GetSelectedProp()
|
|
||||||
{
|
|
||||||
if (_filteredProps == null || _filteredProps.Length == 0) return null;
|
|
||||||
_selectedIndex = Mathf.Clamp(_selectedIndex, 0, _filteredProps.Length - 1);
|
|
||||||
return _filteredProps[_selectedIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Player FindPlayer()
|
|
||||||
{
|
|
||||||
return UnityEngine.Object.FindObjectOfType<Player>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void KeepPlayerHealthAtMax()
|
|
||||||
{
|
|
||||||
Player player = FindPlayer();
|
|
||||||
if (player == null) return;
|
|
||||||
|
|
||||||
HealthComponent playerHealth = player.GetComponent<HealthComponent>();
|
|
||||||
if (playerHealth == null) return;
|
|
||||||
|
|
||||||
RestorePlayerHealthToMax(playerHealth);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void AddPlayerHealth(HealthComponent playerHealth, int amount)
|
|
||||||
{
|
|
||||||
if (playerHealth == null || amount <= 0) return;
|
|
||||||
if (playerHealth.CurrentHealth <= 0) return;
|
|
||||||
|
|
||||||
int maxHealth = playerHealth.MaxHealth;
|
|
||||||
if (maxHealth <= 0) return;
|
|
||||||
|
|
||||||
int nextHealth = Mathf.Clamp(playerHealth.CurrentHealth + amount, 0, maxHealth);
|
|
||||||
if (nextHealth == playerHealth.CurrentHealth) return;
|
|
||||||
|
|
||||||
playerHealth.CurrentHealth = nextHealth;
|
|
||||||
PublishPlayerHealthChanged(playerHealth);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RestorePlayerHealthToMax(HealthComponent playerHealth)
|
|
||||||
{
|
|
||||||
if (playerHealth == null) return;
|
|
||||||
if (playerHealth.CurrentHealth <= 0) return;
|
|
||||||
|
|
||||||
int maxHealth = playerHealth.MaxHealth;
|
|
||||||
if (maxHealth <= 0 || playerHealth.CurrentHealth >= maxHealth) return;
|
|
||||||
|
|
||||||
playerHealth.CurrentHealth = maxHealth;
|
|
||||||
PublishPlayerHealthChanged(playerHealth);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void PublishPlayerHealthChanged(HealthComponent playerHealth)
|
|
||||||
{
|
|
||||||
if (playerHealth == null || GameEntry.Event == null) return;
|
|
||||||
|
|
||||||
GameEntry.Event.Fire(null,
|
|
||||||
PlayerHealthChangeEventArgs.Create(0, playerHealth.CurrentHealth, playerHealth.MaxHealth));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void AddSelectedBuffToPlayer(DRProp prop, int count)
|
|
||||||
{
|
|
||||||
Player player = FindPlayer();
|
|
||||||
if (player == null || prop == null || prop.Modifiers == null) return;
|
|
||||||
|
|
||||||
int applyCount = Mathf.Clamp(count, 1, 99);
|
|
||||||
for (int i = 0; i < applyCount; i++)
|
|
||||||
{
|
|
||||||
player.AddProp(new PropItem(prop.Modifiers, prop.Rarity, prop.Title, prop.IconAssetName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleCornerTapGesture()
|
|
||||||
{
|
|
||||||
if (!TryGetTouchReleased(out Vector2 touchPosition)) return;
|
|
||||||
if (touchPosition.x > 80f || touchPosition.y < Screen.height - 80f) return;
|
|
||||||
|
|
||||||
float now = Time.unscaledTime;
|
|
||||||
if (now - _lastCornerTapTime > CornerTapWindow)
|
|
||||||
{
|
|
||||||
_cornerTapCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_lastCornerTapTime = now;
|
|
||||||
_cornerTapCount++;
|
|
||||||
|
|
||||||
if (_cornerTapCount >= RequiredCornerTapCount)
|
|
||||||
{
|
|
||||||
_cornerTapCount = 0;
|
|
||||||
_isPanelVisible = !_isPanelVisible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsTogglePressed()
|
|
||||||
{
|
|
||||||
#if ENABLE_INPUT_SYSTEM
|
|
||||||
Keyboard keyboard = Keyboard.current;
|
|
||||||
if (keyboard == null) return false;
|
|
||||||
return keyboard.backquoteKey.wasPressedThisFrame || keyboard.f8Key.wasPressedThisFrame;
|
|
||||||
#else
|
|
||||||
return Input.GetKeyDown(KeyCode.BackQuote) || Input.GetKeyDown(KeyCode.F8);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool TryGetTouchReleased(out Vector2 touchPosition)
|
|
||||||
{
|
|
||||||
#if ENABLE_INPUT_SYSTEM
|
|
||||||
Touchscreen touchscreen = Touchscreen.current;
|
|
||||||
if (touchscreen == null)
|
|
||||||
{
|
|
||||||
touchPosition = default;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var touch = touchscreen.primaryTouch;
|
|
||||||
if (!touch.press.wasReleasedThisFrame)
|
|
||||||
{
|
|
||||||
touchPosition = default;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
touchPosition = touch.position.ReadValue();
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
if (Input.touchCount <= 0)
|
|
||||||
{
|
|
||||||
touchPosition = default;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Touch touch = Input.GetTouch(0);
|
|
||||||
if (touch.phase != TouchPhase.Ended)
|
|
||||||
{
|
|
||||||
touchPosition = default;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
touchPosition = touch.position;
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,66 +0,0 @@
|
||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!850595691 &4890085278179872738
|
|
||||||
LightingSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_Name: MenuSettings
|
|
||||||
serializedVersion: 6
|
|
||||||
m_GIWorkflowMode: 1
|
|
||||||
m_EnableBakedLightmaps: 1
|
|
||||||
m_EnableRealtimeLightmaps: 0
|
|
||||||
m_RealtimeEnvironmentLighting: 1
|
|
||||||
m_BounceScale: 1
|
|
||||||
m_AlbedoBoost: 1
|
|
||||||
m_IndirectOutputScale: 1
|
|
||||||
m_UsingShadowmask: 0
|
|
||||||
m_BakeBackend: 0
|
|
||||||
m_LightmapMaxSize: 1024
|
|
||||||
m_BakeResolution: 50
|
|
||||||
m_Padding: 2
|
|
||||||
m_LightmapCompression: 0
|
|
||||||
m_AO: 0
|
|
||||||
m_AOMaxDistance: 1
|
|
||||||
m_CompAOExponent: 0
|
|
||||||
m_CompAOExponentDirect: 0
|
|
||||||
m_ExtractAO: 0
|
|
||||||
m_MixedBakeMode: 1
|
|
||||||
m_LightmapsBakeMode: 1
|
|
||||||
m_FilterMode: 1
|
|
||||||
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
|
|
||||||
m_ExportTrainingData: 0
|
|
||||||
m_TrainingDataDestination: TrainingData
|
|
||||||
m_RealtimeResolution: 1
|
|
||||||
m_ForceWhiteAlbedo: 0
|
|
||||||
m_ForceUpdates: 0
|
|
||||||
m_FinalGather: 0
|
|
||||||
m_FinalGatherRayCount: 1024
|
|
||||||
m_FinalGatherFiltering: 1
|
|
||||||
m_PVRCulling: 1
|
|
||||||
m_PVRSampling: 1
|
|
||||||
m_PVRDirectSampleCount: 32
|
|
||||||
m_PVRSampleCount: 512
|
|
||||||
m_PVREnvironmentSampleCount: 512
|
|
||||||
m_PVREnvironmentReferencePointCount: 2048
|
|
||||||
m_LightProbeSampleCountMultiplier: 4
|
|
||||||
m_PVRBounces: 2
|
|
||||||
m_PVRMinBounces: 2
|
|
||||||
m_PVREnvironmentImportanceSampling: 0
|
|
||||||
m_PVRFilteringMode: 0
|
|
||||||
m_PVRDenoiserTypeDirect: 0
|
|
||||||
m_PVRDenoiserTypeIndirect: 0
|
|
||||||
m_PVRDenoiserTypeAO: 0
|
|
||||||
m_PVRFilterTypeDirect: 0
|
|
||||||
m_PVRFilterTypeIndirect: 0
|
|
||||||
m_PVRFilterTypeAO: 0
|
|
||||||
m_PVRFilteringGaussRadiusDirect: 1
|
|
||||||
m_PVRFilteringGaussRadiusIndirect: 5
|
|
||||||
m_PVRFilteringGaussRadiusAO: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
|
||||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
|
||||||
m_PVRTiledBaking: 0
|
|
||||||
m_NumRaysToShootPerTexel: -1
|
|
||||||
m_RespectSceneVisibilityWhenBakingGI: 0
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 427f5be66b5f35b4a898d6e812a0e7bc
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 4890085278179872738
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5ed0f22b675178e488a2cc585b6f78cb
|
guid: edd16bf2e418bec43bc774c7fc6c60d6
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
|
timeCreated: 1528026145
|
||||||
|
licenseType: Pro
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
using System;
|
|
||||||
using SepCore.Definition;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace SepCore.Entity
|
|
||||||
{
|
|
||||||
[Serializable]
|
|
||||||
public abstract class AccessoryObjectData : EntityDataBase
|
|
||||||
{
|
|
||||||
[SerializeField] private int _ownerId = 0;
|
|
||||||
|
|
||||||
[SerializeField] private CampType _ownerCamp = CampType.Unknown;
|
|
||||||
|
|
||||||
public AccessoryObjectData(int entityId, int typeId, int ownerId, CampType ownerCamp)
|
|
||||||
: base(entityId, typeId)
|
|
||||||
{
|
|
||||||
_ownerId = ownerId;
|
|
||||||
_ownerCamp = ownerCamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 拥有者编号。
|
|
||||||
/// </summary>
|
|
||||||
public int OwnerId => _ownerId;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 拥有者阵营。
|
|
||||||
/// </summary>
|
|
||||||
public CampType OwnerCamp => _ownerCamp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace SepCore.Entity
|
|
||||||
{
|
|
||||||
[Serializable]
|
|
||||||
public class EffectData : EntityDataBase
|
|
||||||
{
|
|
||||||
[SerializeField]
|
|
||||||
private float _keepTime = 0f;
|
|
||||||
|
|
||||||
public EffectData(int entityId, int typeId)
|
|
||||||
: base(entityId, typeId)
|
|
||||||
{
|
|
||||||
_keepTime = 3f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float KeepTime => _keepTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace SepCore.Entity
|
|
||||||
{
|
|
||||||
[Serializable]
|
|
||||||
public abstract class EntityDataBase
|
|
||||||
{
|
|
||||||
[SerializeField] private int _id = 0;
|
|
||||||
|
|
||||||
[SerializeField] private int _typeId = 0;
|
|
||||||
|
|
||||||
[SerializeField] private Vector3 _position = Vector3.zero;
|
|
||||||
|
|
||||||
[SerializeField] private Quaternion _rotation = Quaternion.identity;
|
|
||||||
|
|
||||||
public EntityDataBase(int entityId, int typeId)
|
|
||||||
{
|
|
||||||
_id = entityId;
|
|
||||||
_typeId = typeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 实体编号。
|
|
||||||
/// </summary>
|
|
||||||
public int Id => _id;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 实体类型编号。
|
|
||||||
/// </summary>
|
|
||||||
public int TypeId => _typeId;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 实体位置。
|
|
||||||
/// </summary>
|
|
||||||
public Vector3 Position
|
|
||||||
{
|
|
||||||
get => _position;
|
|
||||||
set => _position = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 实体朝向。
|
|
||||||
/// </summary>
|
|
||||||
public Quaternion Rotation
|
|
||||||
{
|
|
||||||
get => _rotation;
|
|
||||||
set => _rotation = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
using System;
|
|
||||||
using SepCore.Definition;
|
|
||||||
|
|
||||||
namespace SepCore.Entity
|
|
||||||
{
|
|
||||||
[Serializable]
|
|
||||||
public abstract class TargetableObjectData : EntityDataBase
|
|
||||||
{
|
|
||||||
private CampType _camp;
|
|
||||||
|
|
||||||
public TargetableObjectData(int entityId, int typeId, CampType camp)
|
|
||||||
: base(entityId, typeId)
|
|
||||||
{
|
|
||||||
_camp = camp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 角色阵营。
|
|
||||||
/// </summary>
|
|
||||||
public CampType Camp => _camp;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 最大生命。
|
|
||||||
/// </summary>
|
|
||||||
public abstract int MaxHealthBase { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
using GameFramework;
|
|
||||||
using GameFramework.Event;
|
|
||||||
|
|
||||||
namespace SepCore.Event
|
|
||||||
{
|
|
||||||
public class DialogEventArgs : GameEventArgs
|
|
||||||
{
|
|
||||||
public static readonly int EventId = typeof(DialogEventArgs).GetHashCode();
|
|
||||||
|
|
||||||
public override int Id => EventId;
|
|
||||||
|
|
||||||
public int ButtonId { get; private set; }
|
|
||||||
|
|
||||||
public object UserData { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建 DialogEventArgs 事件示例
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="buttonId">
|
|
||||||
/// <list type="buttet">
|
|
||||||
/// <item>1 为 ConfirmButton</item>
|
|
||||||
/// <item>2 为 CancelButton</item>
|
|
||||||
/// <item>3 为 OtherButton</item>
|
|
||||||
/// </list>
|
|
||||||
/// </param>
|
|
||||||
/// <param name="userData">用户自定义数据</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DialogEventArgs Create(int buttonId, object userData)
|
|
||||||
{
|
|
||||||
DialogEventArgs dialogEventArgs = ReferencePool.Acquire<DialogEventArgs>();
|
|
||||||
dialogEventArgs.ButtonId = buttonId;
|
|
||||||
dialogEventArgs.UserData = userData;
|
|
||||||
return dialogEventArgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Clear()
|
|
||||||
{
|
|
||||||
UserData = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
using GameFramework;
|
|
||||||
using GameFramework.Event;
|
|
||||||
|
|
||||||
namespace SepCore.Event
|
|
||||||
{
|
|
||||||
public class SelectRoleConfirmEventArgs : GameEventArgs
|
|
||||||
{
|
|
||||||
public static readonly int EventId = typeof(SelectRoleConfirmEventArgs).GetHashCode();
|
|
||||||
|
|
||||||
public override int Id => EventId;
|
|
||||||
|
|
||||||
public static SelectRoleConfirmEventArgs Create()
|
|
||||||
{
|
|
||||||
return ReferencePool.Acquire<SelectRoleConfirmEventArgs>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Clear()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
using GameFramework;
|
|
||||||
using GameFramework.Event;
|
|
||||||
|
|
||||||
namespace SepCore.Event
|
|
||||||
{
|
|
||||||
public class SelectRoleHoverEventArgs : GameEventArgs
|
|
||||||
{
|
|
||||||
public static readonly int EventId = typeof(SelectRoleHoverEventArgs).GetHashCode();
|
|
||||||
|
|
||||||
public override int Id => EventId;
|
|
||||||
|
|
||||||
public int RoleId { get; private set; } = -1;
|
|
||||||
|
|
||||||
public static SelectRoleHoverEventArgs Create(int roleId)
|
|
||||||
{
|
|
||||||
var args = ReferencePool.Acquire<SelectRoleHoverEventArgs>();
|
|
||||||
args.RoleId = roleId;
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Clear()
|
|
||||||
{
|
|
||||||
RoleId = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +1,18 @@
|
||||||
using UnityGameFramework.Runtime;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏入口。
|
/// 游戏入口。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class GameEntry
|
public partial class GameEntry : MonoBehaviour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取游戏基础组件。
|
/// 获取游戏基础组件。
|
||||||
|
|
@ -1,15 +1,20 @@
|
||||||
using SepCore.BuiltinData;
|
//------------------------------------------------------------
|
||||||
using SepCore.DamageText;
|
// Game Framework
|
||||||
using SepCore.EnemyManager;
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
using SepCore.HPBar;
|
// Homepage: https://gameframework.cn/
|
||||||
using SepCore.SpriteCache;
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
using SepCore.UIRouter;
|
//------------------------------------------------------------
|
||||||
using SepCore.Simulation;
|
|
||||||
|
using CustomComponent;
|
||||||
|
using Simulation;
|
||||||
|
using StarForce;
|
||||||
|
using UI;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏入口。
|
/// 游戏入口。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class GameEntry
|
public partial class GameEntry : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static BuiltinDataComponent BuiltinData { get; private set; }
|
public static BuiltinDataComponent BuiltinData { get; private set; }
|
||||||
|
|
||||||
|
|
@ -17,6 +22,10 @@ public partial class GameEntry
|
||||||
|
|
||||||
public static DamageTextComponent DamageText { get; private set; }
|
public static DamageTextComponent DamageText { get; private set; }
|
||||||
|
|
||||||
|
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||||
|
public static RuntimeDebugPanelComponent RuntimeDebugPanel { get; private set; }
|
||||||
|
#endif
|
||||||
|
|
||||||
public static EnemyManagerComponent EnemyManager { get; private set; }
|
public static EnemyManagerComponent EnemyManager { get; private set; }
|
||||||
|
|
||||||
public static SimulationWorld SimulationWorld { get; private set; }
|
public static SimulationWorld SimulationWorld { get; private set; }
|
||||||
|
|
@ -30,8 +39,17 @@ public partial class GameEntry
|
||||||
BuiltinData = UnityGameFramework.Runtime.GameEntry.GetComponent<BuiltinDataComponent>();
|
BuiltinData = UnityGameFramework.Runtime.GameEntry.GetComponent<BuiltinDataComponent>();
|
||||||
HPBar = UnityGameFramework.Runtime.GameEntry.GetComponent<HPBarComponent>();
|
HPBar = UnityGameFramework.Runtime.GameEntry.GetComponent<HPBarComponent>();
|
||||||
DamageText = UnityGameFramework.Runtime.GameEntry.GetComponent<DamageTextComponent>();
|
DamageText = UnityGameFramework.Runtime.GameEntry.GetComponent<DamageTextComponent>();
|
||||||
|
|
||||||
|
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||||
|
RuntimeDebugPanel = UnityGameFramework.Runtime.GameEntry.GetComponent<RuntimeDebugPanelComponent>();
|
||||||
|
#endif
|
||||||
|
|
||||||
EnemyManager = UnityGameFramework.Runtime.GameEntry.GetComponent<EnemyManagerComponent>();
|
EnemyManager = UnityGameFramework.Runtime.GameEntry.GetComponent<EnemyManagerComponent>();
|
||||||
SimulationWorld = UnityGameFramework.Runtime.GameEntry.GetComponent<SimulationWorld>();
|
SimulationWorld = UnityGameFramework.Runtime.GameEntry.GetComponent<SimulationWorld>();
|
||||||
|
if (SimulationWorld == null && Base != null)
|
||||||
|
{
|
||||||
|
SimulationWorld = Base.gameObject.AddComponent<SimulationWorld>();
|
||||||
|
}
|
||||||
SpriteCache = UnityGameFramework.Runtime.GameEntry.GetComponent<SpriteCacheComponent>();
|
SpriteCache = UnityGameFramework.Runtime.GameEntry.GetComponent<SpriteCacheComponent>();
|
||||||
UIRouter = UnityGameFramework.Runtime.GameEntry.GetComponent<UIRouterComponent>();
|
UIRouter = UnityGameFramework.Runtime.GameEntry.GetComponent<UIRouterComponent>();
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏入口。
|
||||||
|
/// </summary>
|
||||||
|
public partial class GameEntry : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
InitBuiltinComponents();
|
||||||
|
InitCustomComponents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"name": "SepCore.Base",
|
|
||||||
"rootNamespace": "SepCore.Base",
|
|
||||||
"references": [
|
|
||||||
"GUID:363c5eb08ff8e6a439b85e37b8c20d96"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
using GameFramework;
|
|
||||||
|
|
||||||
namespace SepCore.CustomUtility
|
|
||||||
{
|
|
||||||
public static class AssetUtility
|
|
||||||
{
|
|
||||||
public static string GetConfigAsset(string assetName, bool fromBytes)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/Configs/{0}.{1}", assetName, fromBytes ? "bytes" : "txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetDataTableAsset(string assetName, bool fromBytes)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/DataTables/{0}.{1}", assetName, fromBytes ? "bytes" : "txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetFontAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/Fonts/{0}.ttf", assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetTMPFontAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/Fonts/{0}.asset", assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetSceneAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/Scenes/{0}.unity", assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetMusicAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/Music/{0}.mp3", assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetSoundAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/Sounds/{0}.wav", assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetEntityAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/Entities/{0}.prefab", assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetUIFormAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/UI/UIForms/{0}.prefab", assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetUISoundAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/UI/UISounds/{0}.wav", assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetUITextureIconAsset(string assetName)
|
|
||||||
{
|
|
||||||
return Utility.Text.Format("Assets/GameMain/UI/UISprites/Icons/{0}.png", assetName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using SepCore.Definition;
|
using Definition.DataStruct;
|
||||||
using SepCore.Entity;
|
using Definition.Enum;
|
||||||
|
using Entity;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.Components
|
namespace Components
|
||||||
{
|
{
|
||||||
public class AbsorbComponent : MonoBehaviour
|
public class AbsorbComponent : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using SepCore.Entity;
|
using Entity;
|
||||||
using SepCore.Entity.Weapon;
|
using Entity.Weapon;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.Components
|
namespace Components
|
||||||
{
|
{
|
||||||
public class AttackComponent : MonoBehaviour
|
public class AttackComponent : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using SepCore.Definition;
|
using Definition.DataStruct;
|
||||||
using SepCore.Entity.Weapon;
|
using Entity.Weapon;
|
||||||
using SepCore.Entity;
|
using Entity;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.Components
|
namespace Components
|
||||||
{
|
{
|
||||||
public class BackpackComponent : MonoBehaviour
|
public class BackpackComponent : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -81,21 +81,14 @@ namespace SepCore.Components
|
||||||
public bool AttachProp(PropItem prop)
|
public bool AttachProp(PropItem prop)
|
||||||
{
|
{
|
||||||
_props.Add(prop);
|
_props.Add(prop);
|
||||||
foreach (var modifier in prop.Modifiers)
|
prop.OnAttach(_statComponent);
|
||||||
{
|
|
||||||
_statComponent.AddModifier(modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DetachProp(PropItem prop)
|
public bool DetachProp(PropItem prop)
|
||||||
{
|
{
|
||||||
_props.Remove(prop);
|
_props.Remove(prop);
|
||||||
foreach (var modifier in prop.Modifiers)
|
prop.OnDetach(_statComponent);
|
||||||
{
|
|
||||||
_statComponent.RemoveModifier(modifier);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using SepCore.Event;
|
using CustomEvent;
|
||||||
using SepCore.Definition;
|
using Definition.DataStruct;
|
||||||
|
using Definition.Enum;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.Components
|
namespace Components
|
||||||
{
|
{
|
||||||
public class HealthComponent : MonoBehaviour
|
public class HealthComponent : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.Components
|
namespace Components
|
||||||
{
|
{
|
||||||
public class InputComponent : MonoBehaviour
|
public class InputComponent : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using SepCore.Definition;
|
using CustomUtility;
|
||||||
using SepCore.Entity;
|
using Definition.DataStruct;
|
||||||
using SepCore.Simulation;
|
using Definition.Enum;
|
||||||
|
using Entity;
|
||||||
|
using Simulation;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using SepCore.Debugger;
|
using CustomDebugger;
|
||||||
|
|
||||||
namespace SepCore.Components
|
namespace Components
|
||||||
{
|
{
|
||||||
public class MovementComponent : MonoBehaviour
|
public class MovementComponent : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using SepCore.Definition;
|
using Definition.DataStruct;
|
||||||
|
using Definition.Enum;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.Components
|
namespace Components
|
||||||
{
|
{
|
||||||
public class StatComponent : MonoBehaviour
|
public class StatComponent : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using Definition.DataStruct;
|
||||||
|
using GameFramework;
|
||||||
|
using StarForce;
|
||||||
|
using UI;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
|
namespace CustomComponent
|
||||||
|
{
|
||||||
|
public class BuiltinDataComponent : GameFrameworkComponent
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private TextAsset m_BuildInfoTextAsset = null;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private TextAsset m_DefaultDictionaryTextAsset = null;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private UpdateResourceForm m_UpdateResourceFormTemplate = null;
|
||||||
|
|
||||||
|
private BuildInfo m_BuildInfo = null;
|
||||||
|
|
||||||
|
public BuildInfo BuildInfo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_BuildInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UpdateResourceForm UpdateResourceFormTemplate
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_UpdateResourceFormTemplate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitBuildInfo()
|
||||||
|
{
|
||||||
|
if (m_BuildInfoTextAsset == null || string.IsNullOrEmpty(m_BuildInfoTextAsset.text))
|
||||||
|
{
|
||||||
|
Log.Info("Build info can not be found or empty.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_BuildInfo = Utility.Json.ToObject<BuildInfo>(m_BuildInfoTextAsset.text);
|
||||||
|
if (m_BuildInfo == null)
|
||||||
|
{
|
||||||
|
Log.Warning("Parse build info failure.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitDefaultDictionary()
|
||||||
|
{
|
||||||
|
if (m_DefaultDictionaryTextAsset == null || string.IsNullOrEmpty(m_DefaultDictionaryTextAsset.text))
|
||||||
|
{
|
||||||
|
Log.Info("Default dictionary can not be found or empty.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GameEntry.Localization.ParseData(m_DefaultDictionaryTextAsset.text))
|
||||||
|
{
|
||||||
|
Log.Warning("Parse default dictionary failure.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GameFramework.ObjectPool;
|
using GameFramework.ObjectPool;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DamageText
|
namespace CustomComponent
|
||||||
{
|
{
|
||||||
public class DamageTextComponent : GameFrameworkComponent
|
public class DamageTextComponent : GameFrameworkComponent
|
||||||
{
|
{
|
||||||
|
|
@ -3,7 +3,7 @@ using DG.Tweening;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.DamageText
|
namespace CustomComponent
|
||||||
{
|
{
|
||||||
public class DamageTextItem : MonoBehaviour
|
public class DamageTextItem : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -2,7 +2,7 @@ using GameFramework;
|
||||||
using GameFramework.ObjectPool;
|
using GameFramework.ObjectPool;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.DamageText
|
namespace CustomComponent
|
||||||
{
|
{
|
||||||
public class DamageTextItemObject : ObjectBase
|
public class DamageTextItemObject : ObjectBase
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,527 @@
|
||||||
|
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Components;
|
||||||
|
using CustomEvent;
|
||||||
|
using DataTable;
|
||||||
|
using Definition.DataStruct;
|
||||||
|
using Entity;
|
||||||
|
using CustomUtility;
|
||||||
|
using Procedure;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityGameFramework.Runtime;
|
||||||
|
#if ENABLE_INPUT_SYSTEM
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace CustomComponent
|
||||||
|
{
|
||||||
|
public class RuntimeDebugPanelComponent : GameFrameworkComponent
|
||||||
|
{
|
||||||
|
private const float MinSpawnRate = 0.1f;
|
||||||
|
private const float CornerTapWindow = 0.6f;
|
||||||
|
private const int RequiredCornerTapCount = 3;
|
||||||
|
private const int DebugHealAmount = 200;
|
||||||
|
|
||||||
|
[Header("Window Content")]
|
||||||
|
[SerializeField] private bool _showBuffSection = true;
|
||||||
|
[SerializeField] private bool _showBattleOverview = true;
|
||||||
|
[SerializeField] private bool _showCollisionStats = true;
|
||||||
|
[SerializeField] private bool _showSpawnControls = true;
|
||||||
|
[SerializeField] private bool _showBattleDurationControls = true;
|
||||||
|
[SerializeField] private bool _showPlayerWeaponControls = true;
|
||||||
|
[SerializeField] private bool _showPlayerHealthControls = true;
|
||||||
|
[SerializeField] private bool _showTips = true;
|
||||||
|
|
||||||
|
private Rect _windowRect = new Rect(20f, 60f, 460f, 800f);
|
||||||
|
private bool _isPanelVisible;
|
||||||
|
private int _windowId;
|
||||||
|
|
||||||
|
private string _searchText = string.Empty;
|
||||||
|
private int _selectedIndex;
|
||||||
|
private int _addCount = 1;
|
||||||
|
private Vector2 _buffScroll;
|
||||||
|
|
||||||
|
private float _spawnRateScaleInput = 1f;
|
||||||
|
private float _extendDurationSeconds = 30f;
|
||||||
|
|
||||||
|
private DRProp[] _allProps = Array.Empty<DRProp>();
|
||||||
|
private DRProp[] _filteredProps = Array.Empty<DRProp>();
|
||||||
|
private string[] _displayNames = Array.Empty<string>();
|
||||||
|
|
||||||
|
private int _cornerTapCount;
|
||||||
|
private float _lastCornerTapTime = -10f;
|
||||||
|
private bool _lockPlayerHealthToMax;
|
||||||
|
|
||||||
|
protected override void Awake()
|
||||||
|
{
|
||||||
|
base.Awake();
|
||||||
|
|
||||||
|
_windowId = GetInstanceID();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (IsTogglePressed())
|
||||||
|
{
|
||||||
|
_isPanelVisible = !_isPanelVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
HandleCornerTapGesture();
|
||||||
|
if (_lockPlayerHealthToMax)
|
||||||
|
{
|
||||||
|
KeepPlayerHealthAtMax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGUI()
|
||||||
|
{
|
||||||
|
DrawToggleButton();
|
||||||
|
if (!_isPanelVisible) return;
|
||||||
|
|
||||||
|
_windowRect = GUI.Window(_windowId, _windowRect, DrawWindow, "Runtime Debug Panel");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawToggleButton()
|
||||||
|
{
|
||||||
|
const float width = 64f;
|
||||||
|
const float height = 30f;
|
||||||
|
Rect buttonRect = new Rect(Screen.width - width - 12f, 10f, width, height);
|
||||||
|
if (GUI.Button(buttonRect, "DEBUG"))
|
||||||
|
{
|
||||||
|
_isPanelVisible = !_isPanelVisible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawWindow(int windowId)
|
||||||
|
{
|
||||||
|
if (_showBuffSection)
|
||||||
|
{
|
||||||
|
EnsurePropList();
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.BeginVertical();
|
||||||
|
|
||||||
|
bool hasPreviousSection = false;
|
||||||
|
if (_showBuffSection)
|
||||||
|
{
|
||||||
|
DrawBuffSection();
|
||||||
|
hasPreviousSection = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HasVisibleBattleSection())
|
||||||
|
{
|
||||||
|
if (hasPreviousSection)
|
||||||
|
{
|
||||||
|
GUILayout.Space(8f);
|
||||||
|
GUILayout.Label(string.Empty, GUI.skin.horizontalSlider);
|
||||||
|
GUILayout.Space(8f);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawBattleSection();
|
||||||
|
hasPreviousSection = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_showTips)
|
||||||
|
{
|
||||||
|
if (hasPreviousSection)
|
||||||
|
{
|
||||||
|
GUILayout.Space(8f);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.Label("Tips: press `F8` or tap top-left corner 3 times to toggle.", GUILayout.Height(20f));
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
GUI.DragWindow(new Rect(0, 0, 10000, 22));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawBuffSection()
|
||||||
|
{
|
||||||
|
GUILayout.Label("Buff Debug");
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("Search", GUILayout.Width(52f));
|
||||||
|
_searchText = GUILayout.TextField(_searchText);
|
||||||
|
if (GUILayout.Button("Refresh", GUILayout.Width(80f)))
|
||||||
|
{
|
||||||
|
EnsurePropList(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
ApplyFilter(_searchText);
|
||||||
|
if (_displayNames.Length == 0)
|
||||||
|
{
|
||||||
|
GUILayout.Label("No Buff data. Enter battle and try again.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_selectedIndex = Mathf.Clamp(_selectedIndex, 0, _displayNames.Length - 1);
|
||||||
|
_buffScroll = GUILayout.BeginScrollView(_buffScroll, GUILayout.Height(120f));
|
||||||
|
_selectedIndex = GUILayout.SelectionGrid(_selectedIndex, _displayNames, 1);
|
||||||
|
GUILayout.EndScrollView();
|
||||||
|
|
||||||
|
DRProp selectedProp = GetSelectedProp();
|
||||||
|
if (selectedProp == null) return;
|
||||||
|
|
||||||
|
GUILayout.Label($"Selected: {selectedProp.Title} ({selectedProp.Rarity})");
|
||||||
|
GUILayout.Label(ItemDescUtility.CreatePropDescription(selectedProp.Modifiers), GUILayout.Height(40f));
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("Count", GUILayout.Width(52f));
|
||||||
|
string addCountText = GUILayout.TextField(_addCount.ToString(), GUILayout.Width(60f));
|
||||||
|
if (!int.TryParse(addCountText, out _addCount)) _addCount = 1;
|
||||||
|
_addCount = Mathf.Clamp(_addCount, 1, 99);
|
||||||
|
|
||||||
|
if (GUILayout.Button("Add Buff To Player", GUILayout.Height(24f)))
|
||||||
|
{
|
||||||
|
AddSelectedBuffToPlayer(selectedProp, _addCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawBattleSection()
|
||||||
|
{
|
||||||
|
GUILayout.Label("Battle Debug");
|
||||||
|
ProcedureGame procedure = GameEntry.Procedure.CurrentProcedure as ProcedureGame;
|
||||||
|
EnemyManagerComponent enemyManager = GameEntry.EnemyManager;
|
||||||
|
Player player = FindPlayer();
|
||||||
|
HealthComponent playerHealth = player != null ? player.GetComponent<HealthComponent>() : null;
|
||||||
|
|
||||||
|
if (enemyManager == null)
|
||||||
|
{
|
||||||
|
GUILayout.Label("EnemyManager unavailable.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (procedure == null)
|
||||||
|
{
|
||||||
|
GUILayout.Label("ProcedureGame unavailable.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_showBattleOverview)
|
||||||
|
{
|
||||||
|
GUILayout.Label($"Spawn Rate: {enemyManager.SpawnRateScale:F2}");
|
||||||
|
GUILayout.Label($"Battle Time: {enemyManager.ElapsedBattleTime:F1}s / {enemyManager.BattleDuration:F1}s");
|
||||||
|
GUILayout.Label($"Enemy Count: {enemyManager.CurrentEnemyCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
Simulation.SimulationWorld simulationWorld = GameEntry.SimulationWorld;
|
||||||
|
if (_showCollisionStats && simulationWorld != null)
|
||||||
|
{
|
||||||
|
GUILayout.Space(4f);
|
||||||
|
GUILayout.Label(
|
||||||
|
$"Collision Queries: total {simulationWorld.LastCollisionQueryCount} (Projectile {simulationWorld.LastProjectileCollisionQueryCount} / Area {simulationWorld.LastAreaCollisionQueryCount})");
|
||||||
|
GUILayout.Label(
|
||||||
|
$"Collision Candidates: total {simulationWorld.LastCollisionCandidateCount} (Projectile {simulationWorld.LastProjectileCollisionCandidateCount} / Area {simulationWorld.LastAreaCollisionCandidateCount})");
|
||||||
|
GUILayout.Label(
|
||||||
|
$"Area Resolve: hits {simulationWorld.LastResolvedAreaHitCount}");
|
||||||
|
GUILayout.Label(
|
||||||
|
$"Broad Phase: cell {simulationWorld.LastCollisionCellSize:F2}, hasEnemyTargets {(simulationWorld.LastCollisionHasEnemyTargets ? "Yes" : "No")}");
|
||||||
|
if (simulationWorld.LastCollisionCandidateCount != 0)
|
||||||
|
{
|
||||||
|
Log.Info($"LastCollisionCandidateCount:{simulationWorld.LastCollisionCandidateCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (simulationWorld.LastResolvedAreaHitCount != 0)
|
||||||
|
{
|
||||||
|
Log.Info($"LastResolvedAreaHitCount:{simulationWorld.LastResolvedAreaHitCount}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_showSpawnControls)
|
||||||
|
{
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("Rate", GUILayout.Width(52f));
|
||||||
|
string rateText = GUILayout.TextField(_spawnRateScaleInput.ToString("F2"), GUILayout.Width(60f));
|
||||||
|
if (float.TryParse(rateText, out float parsedRate))
|
||||||
|
{
|
||||||
|
_spawnRateScaleInput = Mathf.Clamp(parsedRate, MinSpawnRate, 50f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("Apply", GUILayout.Width(70f)))
|
||||||
|
{
|
||||||
|
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("x0.5", GUILayout.Width(60f)))
|
||||||
|
{
|
||||||
|
_spawnRateScaleInput = Mathf.Max(MinSpawnRate, enemyManager.SpawnRateScale * 0.5f);
|
||||||
|
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("x2", GUILayout.Width(60f)))
|
||||||
|
{
|
||||||
|
_spawnRateScaleInput = enemyManager.SpawnRateScale * 2f;
|
||||||
|
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_showBattleDurationControls)
|
||||||
|
{
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("Add Sec", GUILayout.Width(52f));
|
||||||
|
string durationText = GUILayout.TextField(_extendDurationSeconds.ToString("F0"), GUILayout.Width(60f));
|
||||||
|
if (float.TryParse(durationText, out float parsedDuration))
|
||||||
|
{
|
||||||
|
_extendDurationSeconds = Mathf.Clamp(parsedDuration, 1f, 3600f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("Extend Battle", GUILayout.Height(24f)))
|
||||||
|
{
|
||||||
|
if (procedure.CurrentGameState is GameStateBattle gameState)
|
||||||
|
{
|
||||||
|
gameState.AddBattleDuration(_extendDurationSeconds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_showPlayerWeaponControls)
|
||||||
|
{
|
||||||
|
GUILayout.Label(
|
||||||
|
$"Player Weapon: {(player == null ? "Player not found" : (player.WeaponEnabled ? "Enabled" : "Disabled"))}");
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUI.enabled = player != null;
|
||||||
|
if (GUILayout.Button("Disable Weapons", GUILayout.Height(24f)))
|
||||||
|
{
|
||||||
|
player.SetWeaponEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("Enable Weapons", GUILayout.Height(24f)))
|
||||||
|
{
|
||||||
|
player.SetWeaponEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.enabled = true;
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_showPlayerHealthControls)
|
||||||
|
{
|
||||||
|
GUILayout.Space(4f);
|
||||||
|
GUILayout.Label(
|
||||||
|
$"Player HP: {(playerHealth == null ? "Unavailable" : $"{playerHealth.CurrentHealth}/{playerHealth.MaxHealth}")}");
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUI.enabled = playerHealth != null;
|
||||||
|
if (GUILayout.Button($"+{DebugHealAmount} HP", GUILayout.Height(24f)))
|
||||||
|
{
|
||||||
|
AddPlayerHealth(playerHealth, DebugHealAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button(_lockPlayerHealthToMax ? "GodMode: ON" : "GodMode: OFF", GUILayout.Height(24f)))
|
||||||
|
{
|
||||||
|
_lockPlayerHealthToMax = !_lockPlayerHealthToMax;
|
||||||
|
if (_lockPlayerHealthToMax)
|
||||||
|
{
|
||||||
|
RestorePlayerHealthToMax(playerHealth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.enabled = true;
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool HasVisibleBattleSection()
|
||||||
|
{
|
||||||
|
return _showBattleOverview ||
|
||||||
|
_showCollisionStats ||
|
||||||
|
_showSpawnControls ||
|
||||||
|
_showBattleDurationControls ||
|
||||||
|
_showPlayerWeaponControls ||
|
||||||
|
_showPlayerHealthControls;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EnsurePropList(bool force = false)
|
||||||
|
{
|
||||||
|
if (!force && _allProps != null && _allProps.Length > 0) return;
|
||||||
|
|
||||||
|
if (GameEntry.DataTable == null)
|
||||||
|
{
|
||||||
|
_allProps = Array.Empty<DRProp>();
|
||||||
|
_filteredProps = Array.Empty<DRProp>();
|
||||||
|
_displayNames = Array.Empty<string>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var table = GameEntry.DataTable.GetDataTable<DRProp>();
|
||||||
|
_allProps = table != null ? table.ToArray() : Array.Empty<DRProp>();
|
||||||
|
_selectedIndex = Mathf.Clamp(_selectedIndex, 0, Mathf.Max(0, _allProps.Length - 1));
|
||||||
|
ApplyFilter(_searchText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyFilter(string keyword)
|
||||||
|
{
|
||||||
|
if (_allProps == null || _allProps.Length == 0)
|
||||||
|
{
|
||||||
|
_filteredProps = Array.Empty<DRProp>();
|
||||||
|
_displayNames = Array.Empty<string>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(keyword))
|
||||||
|
{
|
||||||
|
_filteredProps = _allProps;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string search = keyword.Trim();
|
||||||
|
_filteredProps = _allProps.Where(p =>
|
||||||
|
p != null &&
|
||||||
|
(p.Title?.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0 ||
|
||||||
|
p.Id.ToString().Contains(search))).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
_displayNames = _filteredProps.Select(p => $"[{p.Id}] {p.Title} ({p.Rarity})").ToArray();
|
||||||
|
if (_displayNames.Length == 0) _selectedIndex = 0;
|
||||||
|
else _selectedIndex = Mathf.Clamp(_selectedIndex, 0, _displayNames.Length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DRProp GetSelectedProp()
|
||||||
|
{
|
||||||
|
if (_filteredProps == null || _filteredProps.Length == 0) return null;
|
||||||
|
_selectedIndex = Mathf.Clamp(_selectedIndex, 0, _filteredProps.Length - 1);
|
||||||
|
return _filteredProps[_selectedIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Player FindPlayer()
|
||||||
|
{
|
||||||
|
return UnityEngine.Object.FindObjectOfType<Player>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void KeepPlayerHealthAtMax()
|
||||||
|
{
|
||||||
|
Player player = FindPlayer();
|
||||||
|
if (player == null) return;
|
||||||
|
|
||||||
|
HealthComponent playerHealth = player.GetComponent<HealthComponent>();
|
||||||
|
if (playerHealth == null) return;
|
||||||
|
|
||||||
|
RestorePlayerHealthToMax(playerHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddPlayerHealth(HealthComponent playerHealth, int amount)
|
||||||
|
{
|
||||||
|
if (playerHealth == null || amount <= 0) return;
|
||||||
|
if (playerHealth.CurrentHealth <= 0) return;
|
||||||
|
|
||||||
|
int maxHealth = playerHealth.MaxHealth;
|
||||||
|
if (maxHealth <= 0) return;
|
||||||
|
|
||||||
|
int nextHealth = Mathf.Clamp(playerHealth.CurrentHealth + amount, 0, maxHealth);
|
||||||
|
if (nextHealth == playerHealth.CurrentHealth) return;
|
||||||
|
|
||||||
|
playerHealth.CurrentHealth = nextHealth;
|
||||||
|
PublishPlayerHealthChanged(playerHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RestorePlayerHealthToMax(HealthComponent playerHealth)
|
||||||
|
{
|
||||||
|
if (playerHealth == null) return;
|
||||||
|
if (playerHealth.CurrentHealth <= 0) return;
|
||||||
|
|
||||||
|
int maxHealth = playerHealth.MaxHealth;
|
||||||
|
if (maxHealth <= 0 || playerHealth.CurrentHealth >= maxHealth) return;
|
||||||
|
|
||||||
|
playerHealth.CurrentHealth = maxHealth;
|
||||||
|
PublishPlayerHealthChanged(playerHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PublishPlayerHealthChanged(HealthComponent playerHealth)
|
||||||
|
{
|
||||||
|
if (playerHealth == null || GameEntry.Event == null) return;
|
||||||
|
|
||||||
|
GameEntry.Event.Fire(null,
|
||||||
|
PlayerHealthChangeEventArgs.Create(0, playerHealth.CurrentHealth, playerHealth.MaxHealth));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddSelectedBuffToPlayer(DRProp prop, int count)
|
||||||
|
{
|
||||||
|
Player player = FindPlayer();
|
||||||
|
if (player == null || prop == null || prop.Modifiers == null) return;
|
||||||
|
|
||||||
|
int applyCount = Mathf.Clamp(count, 1, 99);
|
||||||
|
for (int i = 0; i < applyCount; i++)
|
||||||
|
{
|
||||||
|
player.AddProp(new PropItem(prop.Modifiers, prop.Rarity, prop.Title, prop.IconAssetName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleCornerTapGesture()
|
||||||
|
{
|
||||||
|
if (!TryGetTouchReleased(out Vector2 touchPosition)) return;
|
||||||
|
if (touchPosition.x > 80f || touchPosition.y < Screen.height - 80f) return;
|
||||||
|
|
||||||
|
float now = Time.unscaledTime;
|
||||||
|
if (now - _lastCornerTapTime > CornerTapWindow)
|
||||||
|
{
|
||||||
|
_cornerTapCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastCornerTapTime = now;
|
||||||
|
_cornerTapCount++;
|
||||||
|
|
||||||
|
if (_cornerTapCount >= RequiredCornerTapCount)
|
||||||
|
{
|
||||||
|
_cornerTapCount = 0;
|
||||||
|
_isPanelVisible = !_isPanelVisible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsTogglePressed()
|
||||||
|
{
|
||||||
|
#if ENABLE_INPUT_SYSTEM
|
||||||
|
Keyboard keyboard = Keyboard.current;
|
||||||
|
if (keyboard == null) return false;
|
||||||
|
return keyboard.backquoteKey.wasPressedThisFrame || keyboard.f8Key.wasPressedThisFrame;
|
||||||
|
#else
|
||||||
|
return Input.GetKeyDown(KeyCode.BackQuote) || Input.GetKeyDown(KeyCode.F8);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool TryGetTouchReleased(out Vector2 touchPosition)
|
||||||
|
{
|
||||||
|
#if ENABLE_INPUT_SYSTEM
|
||||||
|
Touchscreen touchscreen = Touchscreen.current;
|
||||||
|
if (touchscreen == null)
|
||||||
|
{
|
||||||
|
touchPosition = default;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var touch = touchscreen.primaryTouch;
|
||||||
|
if (!touch.press.wasReleasedThisFrame)
|
||||||
|
{
|
||||||
|
touchPosition = default;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
touchPosition = touch.position.ReadValue();
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
if (Input.touchCount <= 0)
|
||||||
|
{
|
||||||
|
touchPosition = default;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Touch touch = Input.GetTouch(0);
|
||||||
|
if (touch.phase != TouchPhase.Ended)
|
||||||
|
{
|
||||||
|
touchPosition = default;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
touchPosition = touch.position;
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using SepCore.DataTable;
|
using DataTable;
|
||||||
using SepCore.Definition;
|
using Definition.Enum;
|
||||||
using SepCore.Entity;
|
using Entity;
|
||||||
|
using Entity.EntityData;
|
||||||
using GameFramework.Event;
|
using GameFramework.Event;
|
||||||
using SepCore.CustomUtility;
|
using Procedure;
|
||||||
|
using StarForce;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
namespace SepCore.EnemyManager
|
namespace CustomComponent
|
||||||
{
|
{
|
||||||
public class EnemyManagerComponent : GameFrameworkComponent
|
public class EnemyManagerComponent : GameFrameworkComponent
|
||||||
{
|
{
|
||||||
|
|
@ -136,8 +138,10 @@ namespace SepCore.EnemyManager
|
||||||
|
|
||||||
if (_currentEnemyCount >= _spawnEnemyMaxCount) return;
|
if (_currentEnemyCount >= _spawnEnemyMaxCount) return;
|
||||||
int entityPoolId = _currentSpawnEnemyId % _spawnEnemyMaxCount;
|
int entityPoolId = _currentSpawnEnemyId % _spawnEnemyMaxCount;
|
||||||
var enemyData = EntityDataFactory.Create(entityPoolId, enemyType, _currentLevel);
|
var enemyData = new EnemyData(entityPoolId, enemyType, _currentLevel)
|
||||||
enemyData.Position = GetRandomPosition();
|
{
|
||||||
|
Position = GetRandomPosition()
|
||||||
|
};
|
||||||
_entity.ShowEnemy(enemyData);
|
_entity.ShowEnemy(enemyData);
|
||||||
_currentSpawnEnemyId++;
|
_currentSpawnEnemyId++;
|
||||||
}
|
}
|
||||||
|
|
@ -1,10 +1,19 @@
|
||||||
using GameFramework.ObjectPool;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using GameFramework.ObjectPool;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using SepCore.Entity;
|
using Entity;
|
||||||
|
using StarForce;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.HPBar
|
namespace CustomComponent
|
||||||
{
|
{
|
||||||
public class HPBarComponent : GameFrameworkComponent
|
public class HPBarComponent : GameFrameworkComponent
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using Entity;
|
||||||
|
using UI;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
|
namespace StarForce
|
||||||
|
{
|
||||||
|
public class HPBarItem : MonoBehaviour
|
||||||
|
{
|
||||||
|
private const float AnimationSeconds = 0.3f;
|
||||||
|
private const float KeepSeconds = 0.4f;
|
||||||
|
private const float FadeOutSeconds = 0.3f;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private Slider m_HPBar = null;
|
||||||
|
|
||||||
|
private Canvas m_ParentCanvas = null;
|
||||||
|
private RectTransform m_CachedTransform = null;
|
||||||
|
private CanvasGroup m_CachedCanvasGroup = null;
|
||||||
|
private EntityBase m_Owner = null;
|
||||||
|
private int m_OwnerId = 0;
|
||||||
|
|
||||||
|
public EntityBase Owner
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_Owner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(EntityBase owner, Canvas parentCanvas, float fromHPRatio, float toHPRatio)
|
||||||
|
{
|
||||||
|
if (owner == null)
|
||||||
|
{
|
||||||
|
Log.Error("Owner is invalid.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ParentCanvas = parentCanvas;
|
||||||
|
|
||||||
|
gameObject.SetActive(true);
|
||||||
|
StopAllCoroutines();
|
||||||
|
|
||||||
|
m_CachedCanvasGroup.alpha = 1f;
|
||||||
|
if (m_Owner != owner || m_OwnerId != owner.Id)
|
||||||
|
{
|
||||||
|
m_HPBar.value = fromHPRatio;
|
||||||
|
m_Owner = owner;
|
||||||
|
m_OwnerId = owner.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
|
||||||
|
StartCoroutine(HPBarCo(toHPRatio, AnimationSeconds, KeepSeconds, FadeOutSeconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Refresh()
|
||||||
|
{
|
||||||
|
if (m_CachedCanvasGroup.alpha <= 0f)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Owner != null && Owner.Available && Owner.Id == m_OwnerId)
|
||||||
|
{
|
||||||
|
Vector3 worldPosition = m_Owner.CachedTransform.position + Vector3.forward;
|
||||||
|
Vector3 screenPosition = GameEntry.Scene.MainCamera.WorldToScreenPoint(worldPosition);
|
||||||
|
|
||||||
|
Vector2 position;
|
||||||
|
if (RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)m_ParentCanvas.transform, screenPosition,
|
||||||
|
m_ParentCanvas.worldCamera, out position))
|
||||||
|
{
|
||||||
|
m_CachedTransform.localPosition = position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
StopAllCoroutines();
|
||||||
|
m_CachedCanvasGroup.alpha = 1f;
|
||||||
|
m_HPBar.value = 1f;
|
||||||
|
m_Owner = null;
|
||||||
|
gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
m_CachedTransform = GetComponent<RectTransform>();
|
||||||
|
if (m_CachedTransform == null)
|
||||||
|
{
|
||||||
|
Log.Error("RectTransform is invalid.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_CachedCanvasGroup = GetComponent<CanvasGroup>();
|
||||||
|
if (m_CachedCanvasGroup == null)
|
||||||
|
{
|
||||||
|
Log.Error("CanvasGroup is invalid.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator HPBarCo(float value, float animationDuration, float keepDuration, float fadeOutDuration)
|
||||||
|
{
|
||||||
|
yield return m_HPBar.SmoothValue(value, animationDuration);
|
||||||
|
yield return new WaitForSeconds(keepDuration);
|
||||||
|
yield return m_CachedCanvasGroup.FadeToAlpha(0f, fadeOutDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
using GameFramework;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using GameFramework;
|
||||||
using GameFramework.ObjectPool;
|
using GameFramework.ObjectPool;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.HPBar
|
namespace StarForce
|
||||||
{
|
{
|
||||||
public class HPBarItemObject : ObjectBase
|
public class HPBarItemObject : ObjectBase
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Definition.Enum;
|
||||||
|
using UnityGameFramework.Runtime;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace CustomComponent
|
||||||
|
{
|
||||||
|
public class UIRouterComponent : GameFrameworkComponent
|
||||||
|
{
|
||||||
|
private readonly Dictionary<UIFormType, IUIFormController> _routeControllers = new();
|
||||||
|
|
||||||
|
public void BindUIUseCase(UIFormType uiFormType, IUIUseCase useCase)
|
||||||
|
{
|
||||||
|
IUIFormController controller = GetOrCreateController(uiFormType);
|
||||||
|
controller.BindUseCase(useCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int? OpenUI(UIFormType uiFormType, object userData = null)
|
||||||
|
{
|
||||||
|
IUIFormController controller = GetOrCreateController(uiFormType);
|
||||||
|
return controller.OpenUI(userData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CloseUI(UIFormType uiFormType)
|
||||||
|
{
|
||||||
|
IUIFormController controller = GetOrCreateController(uiFormType);
|
||||||
|
controller.CloseUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IUIFormController GetOrCreateController(UIFormType uiFormType)
|
||||||
|
{
|
||||||
|
if (_routeControllers.TryGetValue(uiFormType, out IUIFormController controller))
|
||||||
|
{
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
string typename = $"UI.{uiFormType}Controller";
|
||||||
|
Type controllerType = Type.GetType(typename);
|
||||||
|
if (controllerType == null)
|
||||||
|
{
|
||||||
|
controller = new DefaultUIFormController(uiFormType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
controller = (IUIFormController)Activator.CreateInstance(controllerType);
|
||||||
|
}
|
||||||
|
|
||||||
|
_routeControllers.Add(uiFormType, controller);
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<UIFormType, IUIFormController> pair in _routeControllers)
|
||||||
|
{
|
||||||
|
pair.Value.CloseUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
_routeControllers.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DefaultUIFormController : IUIFormController
|
||||||
|
{
|
||||||
|
private readonly UIFormType _uiFormType;
|
||||||
|
private int? _lastSerialId;
|
||||||
|
|
||||||
|
public DefaultUIFormController(UIFormType uiFormType)
|
||||||
|
{
|
||||||
|
_uiFormType = uiFormType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int? OpenUI(object userData = null)
|
||||||
|
{
|
||||||
|
_lastSerialId = GameEntry.UI.OpenUIForm(_uiFormType, userData);
|
||||||
|
return _lastSerialId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CloseUI()
|
||||||
|
{
|
||||||
|
if (_lastSerialId.HasValue)
|
||||||
|
{
|
||||||
|
GameEntry.UI.CloseUIForm(_lastSerialId.Value);
|
||||||
|
_lastSerialId = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UGuiForm uiForm = GameEntry.UI.GetUIForm(_uiFormType);
|
||||||
|
if (uiForm != null)
|
||||||
|
{
|
||||||
|
GameEntry.UI.CloseUIForm(uiForm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BindUseCase(IUIUseCase useCase)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8e8c4ca7b7a670745a789c67ac6c8e40
|
guid: b3695ff420be99d44ab812d7e1863044
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
using System;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
public static class BinaryReaderExtension
|
public static class BinaryReaderExtension
|
||||||
{
|
{
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bullet config table.
|
/// Bullet config table.
|
||||||
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
public class DREnemy : DataRowBase
|
public class DREnemy : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,8 +1,18 @@
|
||||||
using System.IO;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// 此文件由工具自动生成,请勿直接修改。
|
||||||
|
// 生成时间:2021-06-16 21:54:35.576
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实体表。
|
/// 实体表。
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
using SepCore.Definition;
|
using Definition.Enum;
|
||||||
using SepCore.CustomUtility;
|
using CustomUtility;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
public class DRGoods : DataRowBase
|
public class DRGoods : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using SepCore.CustomUtility;
|
using CustomUtility;
|
||||||
using SepCore.Definition;
|
using Definition.Enum;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
public class DRLevel : DataRowBase
|
public class DRLevel : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
public class DRLevelRarity : DataRowBase
|
public class DRLevelRarity : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
using SepCore.Definition;
|
using Definition.DataStruct;
|
||||||
|
using Definition.Enum;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SepCore.CustomUtility;
|
using CustomUtility;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
public class DRLevelUpReward : DataRowBase
|
public class DRLevelUpReward : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,8 +1,22 @@
|
||||||
using System.IO;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// 此文件由工具自动生成,请勿直接修改。
|
||||||
|
// 生成时间:2021-06-16 21:54:35.591
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using GameFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 音乐配置表。
|
/// 音乐配置表。
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
using SepCore.Definition;
|
using Definition.DataStruct;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SepCore.CustomUtility;
|
using CustomUtility;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
using Definition.Enum;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
public class DRProp : DataRowBase
|
public class DRProp : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using Definition.DataStruct;
|
||||||
|
using Definition.Enum;
|
||||||
using GameFramework;
|
using GameFramework;
|
||||||
using SepCore.Definition;
|
using StarForce;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
public class DRRole : DataRowBase
|
public class DRRole : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,8 +1,18 @@
|
||||||
using System.IO;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// 此文件由工具自动生成,请勿直接修改。
|
||||||
|
// 生成时间:2021-06-16 21:54:35.610
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 场景配置表。
|
/// 场景配置表。
|
||||||
|
|
@ -1,8 +1,22 @@
|
||||||
using System.IO;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// 此文件由工具自动生成,请勿直接修改。
|
||||||
|
// 生成时间:2021-06-16 21:54:35.625
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using GameFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 声音配置表。
|
/// 声音配置表。
|
||||||
|
|
@ -1,8 +1,22 @@
|
||||||
using System.IO;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// 此文件由工具自动生成,请勿直接修改。
|
||||||
|
// 生成时间:2021-06-16 21:54:35.652
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using GameFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 界面配置表。
|
/// 界面配置表。
|
||||||
|
|
@ -1,8 +1,22 @@
|
||||||
using System.IO;
|
//------------------------------------------------------------
|
||||||
|
// Game Framework
|
||||||
|
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||||
|
// Homepage: https://gameframework.cn/
|
||||||
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// 此文件由工具自动生成,请勿直接修改。
|
||||||
|
// 生成时间:2021-06-16 21:54:35.666
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
using GameFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 声音配置表。
|
/// 声音配置表。
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Definition.DataStruct;
|
||||||
|
using Definition.Enum;
|
||||||
using GameFramework;
|
using GameFramework;
|
||||||
using SepCore.Definition;
|
using CustomUtility;
|
||||||
using SepCore.CustomUtility;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using UnityEngine;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace SepCore.DataTable
|
namespace DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 武器表。
|
/// 武器表。
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue