Merge pull request 'refactor-assembly' (#1) from refactor-assembly into GPU-Instancing
Reviewed-on: #1
This commit is contained in:
commit
117dd123de
|
|
@ -22,7 +22,10 @@ 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 =
|
||||||
|
|
@ -36,7 +39,11 @@ 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: 0
|
executionOrder: -20
|
||||||
icon: {instanceID: 0}
|
icon: {instanceID: 0}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ 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,7 +14,6 @@ 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,7 +13,6 @@ 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>1</Platforms>
|
<Platforms>33</Platforms>
|
||||||
<AssetBundleCompression>1</AssetBundleCompression>
|
<AssetBundleCompression>1</AssetBundleCompression>
|
||||||
<CompressionHelperTypeName>UnityGameFramework.Runtime.DefaultCompressionHelper</CompressionHelperTypeName>
|
<CompressionHelperTypeName>UnityGameFramework.Runtime.DefaultCompressionHelper</CompressionHelperTypeName>
|
||||||
<AdditionalCompressionSelected>False</AdditionalCompressionSelected>
|
<AdditionalCompressionSelected>False</AdditionalCompressionSelected>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,529 @@
|
||||||
|
#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
|
|
@ -0,0 +1,66 @@
|
||||||
|
%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
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 427f5be66b5f35b4a898d6e812a0e7bc
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 4890085278179872738
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: edd16bf2e418bec43bc774c7fc6c60d6
|
guid: 5ed0f22b675178e488a2cc585b6f78cb
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
timeCreated: 1528026145
|
|
||||||
licenseType: Pro
|
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
//------------------------------------------------------------
|
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 DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public static class BinaryReaderExtension
|
public static class BinaryReaderExtension
|
||||||
{
|
{
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.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 DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public class DREnemy : DataRowBase
|
public class DREnemy : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,18 +1,8 @@
|
||||||
//------------------------------------------------------------
|
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 DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实体表。
|
/// 实体表。
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
using Definition.Enum;
|
using SepCore.Definition;
|
||||||
using CustomUtility;
|
using SepCore.CustomUtility;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public class DRGoods : DataRowBase
|
public class DRGoods : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using CustomUtility;
|
using SepCore.CustomUtility;
|
||||||
using Definition.Enum;
|
using SepCore.Definition;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public class DRLevel : DataRowBase
|
public class DRLevel : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public class DRLevelRarity : DataRowBase
|
public class DRLevelRarity : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
using Definition.DataStruct;
|
using SepCore.Definition;
|
||||||
using Definition.Enum;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using CustomUtility;
|
using SepCore.CustomUtility;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public class DRLevelUpReward : DataRowBase
|
public class DRLevelUpReward : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,22 +1,8 @@
|
||||||
//------------------------------------------------------------
|
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 DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 音乐配置表。
|
/// 音乐配置表。
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
using Definition.DataStruct;
|
using SepCore.Definition;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using CustomUtility;
|
using SepCore.CustomUtility;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
using Definition.Enum;
|
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public class DRProp : DataRowBase
|
public class DRProp : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
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 StarForce;
|
using SepCore.Definition;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public class DRRole : DataRowBase
|
public class DRRole : DataRowBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,18 +1,8 @@
|
||||||
//------------------------------------------------------------
|
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 DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 场景配置表。
|
/// 场景配置表。
|
||||||
|
|
@ -1,22 +1,8 @@
|
||||||
//------------------------------------------------------------
|
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 DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 声音配置表。
|
/// 声音配置表。
|
||||||
|
|
@ -1,22 +1,8 @@
|
||||||
//------------------------------------------------------------
|
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 DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 界面配置表。
|
/// 界面配置表。
|
||||||
|
|
@ -1,22 +1,8 @@
|
||||||
//------------------------------------------------------------
|
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 DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 声音配置表。
|
/// 声音配置表。
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Definition.DataStruct;
|
|
||||||
using Definition.Enum;
|
|
||||||
using GameFramework;
|
using GameFramework;
|
||||||
using CustomUtility;
|
using SepCore.Definition;
|
||||||
|
using SepCore.CustomUtility;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using UnityEngine;
|
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 武器表。
|
/// 武器表。
|
||||||
|
|
@ -1,21 +1,14 @@
|
||||||
//------------------------------------------------------------
|
using GameFramework.DataTable;
|
||||||
// Game Framework
|
|
||||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
|
||||||
// Homepage: https://gameframework.cn/
|
|
||||||
// Feedback: mailto:ellan@gameframework.cn
|
|
||||||
//------------------------------------------------------------
|
|
||||||
|
|
||||||
using GameFramework.DataTable;
|
|
||||||
using System;
|
using System;
|
||||||
using Definition;
|
using SepCore.Definition;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace DataTable
|
namespace SepCore.DataTable
|
||||||
{
|
{
|
||||||
public static class DataTableExtension
|
public static class DataTableExtension
|
||||||
{
|
{
|
||||||
private const string DataRowClassPrefixName = "DataTable.DR";
|
private const string DataRowClassPrefixName = "SepCore.DataTable.DR";
|
||||||
internal static readonly char[] DataSplitSeparators = new char[] { '\t' };
|
internal static readonly char[] DataSplitSeparators = new char[] { '\t' };
|
||||||
internal static readonly char[] DataTrimSeparators = new char[] { '\"' };
|
internal static readonly char[] DataTrimSeparators = new char[] { '\"' };
|
||||||
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
// Feedback: mailto:ellan@gameframework.cn
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
namespace Definition
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public static partial class Constant
|
public static partial class Constant
|
||||||
{
|
{
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Definition
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public static partial class Constant
|
public static partial class Constant
|
||||||
{
|
{
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
// Feedback: mailto:ellan@gameframework.cn
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
namespace Definition
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public static partial class Constant
|
public static partial class Constant
|
||||||
{
|
{
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
// Feedback: mailto:ellan@gameframework.cn
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
namespace Definition.DataStruct
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public class BuildInfo
|
public class BuildInfo
|
||||||
{
|
{
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Definition.Enum;
|
using SepCore.Definition;
|
||||||
|
|
||||||
namespace Definition.DataStruct
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Auto)]
|
[StructLayout(LayoutKind.Auto)]
|
||||||
public struct ImpactData
|
public struct ImpactData
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
using Components;
|
using SepCore.DataTable;
|
||||||
using DataTable;
|
|
||||||
using Definition.Enum;
|
|
||||||
|
|
||||||
namespace Definition.DataStruct
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public class PropItem
|
public class PropItem
|
||||||
{
|
{
|
||||||
|
|
@ -34,23 +32,5 @@ namespace Definition.DataStruct
|
||||||
Rarity = rarity;
|
Rarity = rarity;
|
||||||
IconAssetName = iconAssetName;
|
IconAssetName = iconAssetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAttach(StatComponent statComponent)
|
|
||||||
{
|
|
||||||
if (_modifiers == null || statComponent == null) return;
|
|
||||||
foreach (var modifier in _modifiers)
|
|
||||||
{
|
|
||||||
statComponent.AddModifier(modifier);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnDetach(StatComponent statComponent)
|
|
||||||
{
|
|
||||||
if (_modifiers == null || statComponent == null) return;
|
|
||||||
foreach (var modifier in _modifiers)
|
|
||||||
{
|
|
||||||
statComponent.RemoveModifier(modifier);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using Definition.Enum;
|
using SepCore.Definition;
|
||||||
using CustomUtility;
|
using SepCore.CustomUtility;
|
||||||
using UnityGameFramework.Runtime;
|
using UnityGameFramework.Runtime;
|
||||||
|
|
||||||
namespace Definition.DataStruct
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public class StatModifier
|
public class StatModifier
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Definition.DataStruct
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public class StatProperty
|
public class StatProperty
|
||||||
{
|
{
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
// Feedback: mailto:ellan@gameframework.cn
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
namespace Definition.DataStruct
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public class VersionInfo
|
public class VersionInfo
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public enum BulletType : byte
|
public enum BulletType : byte
|
||||||
{
|
{
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
// Feedback: mailto:ellan@gameframework.cn
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 阵营类型。
|
/// 阵营类型。
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public enum EnemyType : byte
|
public enum EnemyType : byte
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public enum GoodsType
|
public enum GoodsType
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public enum ItemRarity
|
public enum ItemRarity
|
||||||
{
|
{
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
// Feedback: mailto:ellan@gameframework.cn
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关系类型。
|
/// 关系类型。
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Scene
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public enum SceneId : byte
|
public enum SceneId : byte
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public enum StatType
|
public enum StatType
|
||||||
{
|
{
|
||||||
|
|
@ -5,14 +5,14 @@
|
||||||
// Feedback: mailto:ellan@gameframework.cn
|
// Feedback: mailto:ellan@gameframework.cn
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 界面编号。
|
/// 界面编号。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum UIFormType : byte
|
public enum UIFormType : byte
|
||||||
{
|
{
|
||||||
TUIForm = 0,
|
Undefined = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 弹出框。
|
/// 弹出框。
|
||||||
|
|
@ -22,7 +22,7 @@ namespace Definition.Enum
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主菜单。
|
/// 主菜单。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MenuForm = 100,
|
MenuForm = 200,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置。
|
/// 设置。
|
||||||
|
|
@ -34,11 +34,6 @@ namespace Definition.Enum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AboutForm = 102,
|
AboutForm = 102,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 主菜单。
|
|
||||||
/// </summary>
|
|
||||||
StartMenuForm = 200,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 选择角色。
|
/// 选择角色。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Definition.Enum
|
namespace SepCore.Definition
|
||||||
{
|
{
|
||||||
public enum WeaponType : byte
|
public enum WeaponType : byte
|
||||||
{
|
{
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 7d69a94fcc50f4c4ca1dc45e4338560e
|
guid: cedb6e3c4b92edf4bbbe5fb34bb043ba
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
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,4 +1,4 @@
|
||||||
namespace Entity.EntityData
|
namespace SepCore.Entity
|
||||||
{
|
{
|
||||||
public class CoinData : EntityDataBase
|
public class CoinData : EntityDataBase
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
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,32 +1,22 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DataTable;
|
using SepCore.DataTable;
|
||||||
using Definition.Enum;
|
using SepCore.Definition;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Entity.EntityData
|
namespace SepCore.Entity
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class EnemyData : TargetableObjectData
|
public class EnemyData : TargetableObjectData
|
||||||
{
|
{
|
||||||
[SerializeField] private DREnemy _drEnemy;
|
private DREnemy _drEnemy;
|
||||||
|
|
||||||
public EnemyData(int entityId, EnemyType enemyType, int level) : base(
|
public EnemyData(int entityId, DREnemy drEnemy, int level) : base(
|
||||||
entityId, (int)enemyType, CampType.Enemy)
|
entityId, drEnemy.Id, CampType.Enemy)
|
||||||
{
|
{
|
||||||
DREnemy enemyRow = GameEntry.DataTable.GetDataTableRow<DREnemy>((int)enemyType);
|
_drEnemy = drEnemy;
|
||||||
|
|
||||||
if (enemyRow == null)
|
|
||||||
{
|
|
||||||
throw new Exception($"Enemy data table row is missing, EnemyType='{enemyType}'.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_drEnemy = enemyRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
int effectiveLevel = Mathf.Max(1, level);
|
int effectiveLevel = Mathf.Max(1, level);
|
||||||
MaxHealthBase = enemyRow.MaxHealth + enemyRow.HpAddPerLevel * (effectiveLevel - 1);
|
MaxHealthBase = _drEnemy.MaxHealth + _drEnemy.HpAddPerLevel * (effectiveLevel - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnemyType EnemyType => (EnemyType)_drEnemy.Id;
|
public EnemyType EnemyType => (EnemyType)_drEnemy.Id;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue