gameplay refine
1. 优化 ResolutionAdapter 的分辨率适配问题 2. 调整 SpriteCache 的资源路径拼接 3. 引入 StoryDirector 做各玩法的胶水 4. 导入和改名资源便于代码查询路径
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CustomComponent
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Story/Directive/Change Background", fileName = "Directive_ChangeBackground")]
|
||||
public sealed class StoryChangeBackgroundDirectiveAsset : StoryDirectiveAsset
|
||||
{
|
||||
[SerializeField] private string _backgroundAssetName = string.Empty;
|
||||
|
||||
public override string ActionName => "ChangeBackground";
|
||||
|
||||
public override void Execute(StoryDirectorComponent director)
|
||||
{
|
||||
if (director == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
director.ExecuteChangeBackground(_backgroundAssetName);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d4b16a5d76140a1b952ad48774dd89a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UI;
|
||||
|
||||
namespace CustomComponent
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class StoryCombineConfig
|
||||
{
|
||||
public bool AutoStart = true;
|
||||
public List<CombineSlotContext> Slots = new List<CombineSlotContext>();
|
||||
public List<CombinePartContext> Parts = new List<CombinePartContext>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c53bd314c194677b10a2e7fa754fdbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CustomComponent
|
||||
{
|
||||
public abstract class StoryDirectiveAsset : ScriptableObject
|
||||
{
|
||||
[SerializeField] private bool _enabled = true;
|
||||
|
||||
[SerializeField] private StoryTriggerType _triggerType = StoryTriggerType.DialogCompleted;
|
||||
|
||||
[SerializeField] [Tooltip("DialogCompleted 时为对话 Id;<=0 表示该触发类型下的任意 Id。")]
|
||||
private int _triggerId = 0;
|
||||
|
||||
public bool IsEnabled => _enabled;
|
||||
|
||||
public StoryTriggerType TriggerType => _triggerType;
|
||||
|
||||
public int TriggerId => _triggerId;
|
||||
|
||||
public virtual string ActionName => GetType().Name;
|
||||
|
||||
public bool IsMatch(StoryTriggerType triggerType, int triggerId)
|
||||
{
|
||||
if (!_enabled || _triggerType != triggerType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (triggerType == StoryTriggerType.DialogCompleted && _triggerId > 0 && _triggerId != triggerId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void Execute(StoryDirectorComponent director);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2deed2f965a04cbab1c18d2e9b5d5845
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CustomComponent
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Story/Directive/End Chapter", fileName = "Directive_EndChapter")]
|
||||
public sealed class StoryEndChapterDirectiveAsset : StoryDirectiveAsset
|
||||
{
|
||||
[SerializeField] [Tooltip("<=0 则使用当前章节。")] private int _chapterId = 0;
|
||||
|
||||
public override string ActionName => "EndChapter";
|
||||
|
||||
public override void Execute(StoryDirectorComponent director)
|
||||
{
|
||||
if (director == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
director.ExecuteEndChapter(_chapterId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b63fb6eb96e4d3193dd26b443f856c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CustomComponent
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Story/Directive/Start Combine", fileName = "Directive_StartCombine")]
|
||||
public sealed class StoryStartCombineDirectiveAsset : StoryDirectiveAsset
|
||||
{
|
||||
[SerializeField] private bool _useDefaultConfig = true;
|
||||
|
||||
[SerializeField] private StoryCombineConfig _combineConfig = new StoryCombineConfig();
|
||||
|
||||
public override string ActionName => "StartCombine";
|
||||
|
||||
public override void Execute(StoryDirectorComponent director)
|
||||
{
|
||||
if (director == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StoryCombineConfig config = _useDefaultConfig ? null : _combineConfig;
|
||||
director.ExecuteStartCombine(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19a1150cd0fb4b648ad8232de4e38baa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CustomComponent
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Story/Directive/Start Dialog", fileName = "Directive_StartDialog")]
|
||||
public sealed class StoryStartDialogDirectiveAsset : StoryDirectiveAsset
|
||||
{
|
||||
[SerializeField] private int _dialogId = 0;
|
||||
|
||||
public override string ActionName => "StartDialog";
|
||||
|
||||
public override void Execute(StoryDirectorComponent director)
|
||||
{
|
||||
if (director == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
director.ExecuteStartDialog(_dialogId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e4367863f5042e1b5b0b3b3b7f62f5e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace CustomComponent
|
||||
{
|
||||
public enum StoryTriggerType
|
||||
{
|
||||
DialogCompleted = 0,
|
||||
CombineCompleted = 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b9d79013962410681f2f29343902599
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user