feat(lucky-dice): 添加可运行演示场景
This commit is contained in:
8
FishDice/Assets/FishDice/Demo.meta
Normal file
8
FishDice/Assets/FishDice/Demo.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d89dd98ef2bb4e969dd1893901bdfd32
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
FishDice/Assets/FishDice/Demo/FishDice.Demo.asmdef
Normal file
16
FishDice/Assets/FishDice/Demo/FishDice.Demo.asmdef
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "FishDice.Demo",
|
||||
"rootNamespace": "FishDice.Demo",
|
||||
"references": [
|
||||
"FishDice.Runtime"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
FishDice/Assets/FishDice/Demo/FishDice.Demo.asmdef.meta
Normal file
7
FishDice/Assets/FishDice/Demo/FishDice.Demo.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ff9a6f514f84e348b98d13800b3dc71
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
142
FishDice/Assets/FishDice/Demo/LuckyDiceDemoController.cs
Normal file
142
FishDice/Assets/FishDice/Demo/LuckyDiceDemoController.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FishDice.Demo
|
||||
{
|
||||
public sealed class LuckyDiceDemoController : MonoBehaviour
|
||||
{
|
||||
private static readonly LuckyDiceDemoScenario[] Scenarios =
|
||||
{
|
||||
new LuckyDiceDemoScenario("Normal Reward", "Numbers pay the base reward.", 0, 1),
|
||||
new LuckyDiceDemoScenario("Clover Bonus", "A number plus Clover grants reward and bonus.", 0, 5),
|
||||
new LuckyDiceDemoScenario("Lucky Dice: Rocket", "Two Clovers enter Lucky Dice and resolve Slap Down.", 5, 5, 0),
|
||||
new LuckyDiceDemoScenario("Lucky Dice: Thief", "Two Clovers enter Lucky Dice and resolve Treasure Heist.", 5, 5, 1)
|
||||
};
|
||||
|
||||
private readonly List<LuckyDiceDemoSnapshot> _history = new List<LuckyDiceDemoSnapshot>();
|
||||
private Vector2 _scroll;
|
||||
private LuckyDiceDemoSnapshot _current;
|
||||
private GUIStyle _titleStyle;
|
||||
private GUIStyle _labelStyle;
|
||||
private GUIStyle _summaryStyle;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
RunScenario(Scenarios[0]);
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
EnsureStyles();
|
||||
|
||||
var margin = 24f;
|
||||
var width = Mathf.Min(780f, Screen.width - margin * 2f);
|
||||
var height = Mathf.Min(620f, Screen.height - margin * 2f);
|
||||
GUILayout.BeginArea(new Rect(margin, margin, width, height), GUI.skin.box);
|
||||
GUILayout.Label("FishDice Lucky Dice Demo", _titleStyle);
|
||||
GUILayout.Label("Runtime path: normal roll -> combo facts -> rule actions -> optional Lucky Dice target mode.", _labelStyle);
|
||||
GUILayout.Space(10f);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Random Roll", GUILayout.Height(34f)))
|
||||
{
|
||||
RunRandom();
|
||||
}
|
||||
|
||||
foreach (var scenario in Scenarios)
|
||||
{
|
||||
if (GUILayout.Button(scenario.Title, GUILayout.Height(34f)))
|
||||
{
|
||||
RunScenario(scenario);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(12f);
|
||||
DrawSnapshot(_current);
|
||||
GUILayout.Space(12f);
|
||||
DrawHistory();
|
||||
GUILayout.EndArea();
|
||||
}
|
||||
|
||||
private void RunScenario(LuckyDiceDemoScenario scenario)
|
||||
{
|
||||
SetCurrent(LuckyDiceDemoRunner.RunScenario(scenario));
|
||||
}
|
||||
|
||||
private void RunRandom()
|
||||
{
|
||||
SetCurrent(LuckyDiceDemoRunner.RunRandom());
|
||||
}
|
||||
|
||||
private void SetCurrent(LuckyDiceDemoSnapshot snapshot)
|
||||
{
|
||||
_current = snapshot;
|
||||
_history.Insert(0, snapshot);
|
||||
if (_history.Count > 8)
|
||||
{
|
||||
_history.RemoveAt(_history.Count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSnapshot(LuckyDiceDemoSnapshot snapshot)
|
||||
{
|
||||
if (snapshot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GUILayout.Label(snapshot.Title, _summaryStyle);
|
||||
GUILayout.Label(snapshot.Description, _labelStyle);
|
||||
GUILayout.Space(6f);
|
||||
GUILayout.Label(snapshot.FaceLine, _labelStyle);
|
||||
GUILayout.Label(snapshot.ComboLine, _labelStyle);
|
||||
GUILayout.Label(snapshot.RuleLine, _labelStyle);
|
||||
GUILayout.Label(snapshot.EffectLine, _labelStyle);
|
||||
GUILayout.Label(snapshot.LuckyDiceLine, _labelStyle);
|
||||
GUILayout.Label(snapshot.TargetModeLine, _labelStyle);
|
||||
GUILayout.Space(6f);
|
||||
GUILayout.Label(snapshot.Summary, _summaryStyle);
|
||||
}
|
||||
|
||||
private void DrawHistory()
|
||||
{
|
||||
GUILayout.Label("Recent Rolls", _summaryStyle);
|
||||
_scroll = GUILayout.BeginScrollView(_scroll, GUILayout.Height(180f));
|
||||
foreach (var snapshot in _history)
|
||||
{
|
||||
GUILayout.Label($"{snapshot.Title} | {snapshot.FaceLine} | {snapshot.Summary}", _labelStyle);
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
private void EnsureStyles()
|
||||
{
|
||||
if (_titleStyle != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_titleStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 26,
|
||||
fontStyle = FontStyle.Bold,
|
||||
normal = { textColor = Color.white },
|
||||
wordWrap = true
|
||||
};
|
||||
_labelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 15,
|
||||
normal = { textColor = new Color(0.86f, 0.9f, 0.95f) },
|
||||
wordWrap = true
|
||||
};
|
||||
_summaryStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 18,
|
||||
fontStyle = FontStyle.Bold,
|
||||
normal = { textColor = new Color(1f, 0.86f, 0.35f) },
|
||||
wordWrap = true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09f4d9942ff946b48ad7604ded5452cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
95
FishDice/Assets/FishDice/Demo/LuckyDiceDemoRunner.cs
Normal file
95
FishDice/Assets/FishDice/Demo/LuckyDiceDemoRunner.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FishDice.LuckyDice;
|
||||
|
||||
namespace FishDice.Demo
|
||||
{
|
||||
public static class LuckyDiceDemoRunner
|
||||
{
|
||||
public static LuckyDiceDemoSnapshot RunScenario(LuckyDiceDemoScenario scenario)
|
||||
{
|
||||
if (scenario == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(scenario));
|
||||
}
|
||||
|
||||
return Run(scenario, new ScriptedRandomSource(scenario.RandomValues));
|
||||
}
|
||||
|
||||
public static LuckyDiceDemoSnapshot RunRandom()
|
||||
{
|
||||
var scenario = new LuckyDiceDemoScenario(
|
||||
"Random Roll",
|
||||
"Uses the default FishDice runtime config and System.Random.");
|
||||
|
||||
return Run(scenario, new SystemRandomSource());
|
||||
}
|
||||
|
||||
private static LuckyDiceDemoSnapshot Run(LuckyDiceDemoScenario scenario, IRandomSource random)
|
||||
{
|
||||
var flow = LuckyDiceRuntimeFactory.CreateDefault(random).CreateDefaultFlow();
|
||||
var result = flow.Execute(new RollFlowRequest(
|
||||
$"demo-{DateTime.UtcNow:yyyyMMddHHmmssfff}",
|
||||
LuckyDiceKeys.NormalDiceSetId,
|
||||
LuckyDiceKeys.NormalRollTriggerSource,
|
||||
playerLevel: 0,
|
||||
isTutorial: false));
|
||||
|
||||
var faceLine = "Faces: " + string.Join(" + ", result.RollResult.Faces.Select(face => face.Key));
|
||||
var comboLine = "Combo: " + result.ComboFacts.NormalizedKey;
|
||||
var ruleLine = "Rules: " + JoinOrDash(result.MatchedRules.Select(rule => rule.RuleId));
|
||||
var effectLine = "Effects: " + JoinOrDash(result.Effects.Select(effect => effect.EffectType));
|
||||
var luckyDiceLine = FormatLuckyDice(result.LuckyDiceResult);
|
||||
var targetModeLine = "Target Mode: " + (result.TargetMode == null ? "-" : result.TargetMode.ModeKey);
|
||||
var summary = FormatSummary(result);
|
||||
|
||||
return new LuckyDiceDemoSnapshot(
|
||||
scenario.Title,
|
||||
scenario.Description,
|
||||
faceLine,
|
||||
comboLine,
|
||||
ruleLine,
|
||||
effectLine,
|
||||
luckyDiceLine,
|
||||
targetModeLine,
|
||||
summary);
|
||||
}
|
||||
|
||||
private static string FormatLuckyDice(LuckyDiceSelectionResult result)
|
||||
{
|
||||
if (result == null || result.Selected == null)
|
||||
{
|
||||
return "Lucky Dice: -";
|
||||
}
|
||||
|
||||
return $"Lucky Dice: {result.Selected.ResultKey} x{result.SlotCount}";
|
||||
}
|
||||
|
||||
private static string FormatSummary(RollFlowResult result)
|
||||
{
|
||||
if (result.TargetMode != null)
|
||||
{
|
||||
return $"Entered {result.TargetMode.TargetKey} via {result.TargetMode.ModeKey}.";
|
||||
}
|
||||
|
||||
if (result.Effects.OfType<MultiplierEffect>().Any())
|
||||
{
|
||||
return "Granted reward with Clover bonus multiplier.";
|
||||
}
|
||||
|
||||
if (result.Effects.OfType<RewardEffect>().Any())
|
||||
{
|
||||
return "Granted normal reward.";
|
||||
}
|
||||
|
||||
return "No configured outcome.";
|
||||
}
|
||||
|
||||
private static string JoinOrDash(IEnumerable<string> values)
|
||||
{
|
||||
var materialized = values.Where(value => !string.IsNullOrEmpty(value)).ToArray();
|
||||
return materialized.Length == 0 ? "-" : string.Join(", ", materialized);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
FishDice/Assets/FishDice/Demo/LuckyDiceDemoRunner.cs.meta
Normal file
11
FishDice/Assets/FishDice/Demo/LuckyDiceDemoRunner.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64a5be15da414c25b59030d655e96f3f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
21
FishDice/Assets/FishDice/Demo/LuckyDiceDemoScenario.cs
Normal file
21
FishDice/Assets/FishDice/Demo/LuckyDiceDemoScenario.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FishDice.Demo
|
||||
{
|
||||
public sealed class LuckyDiceDemoScenario
|
||||
{
|
||||
public LuckyDiceDemoScenario(string title, string description, params int[] randomValues)
|
||||
{
|
||||
Title = string.IsNullOrWhiteSpace(title) ? "Untitled Scenario" : title;
|
||||
Description = description ?? string.Empty;
|
||||
RandomValues = randomValues == null ? Array.Empty<int>() : randomValues.ToArray();
|
||||
}
|
||||
|
||||
public string Title { get; }
|
||||
|
||||
public string Description { get; }
|
||||
|
||||
public int[] RandomValues { get; }
|
||||
}
|
||||
}
|
||||
11
FishDice/Assets/FishDice/Demo/LuckyDiceDemoScenario.cs.meta
Normal file
11
FishDice/Assets/FishDice/Demo/LuckyDiceDemoScenario.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 465ffdfae4414c3a83b4d4af21ec22f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
45
FishDice/Assets/FishDice/Demo/LuckyDiceDemoSnapshot.cs
Normal file
45
FishDice/Assets/FishDice/Demo/LuckyDiceDemoSnapshot.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
namespace FishDice.Demo
|
||||
{
|
||||
public sealed class LuckyDiceDemoSnapshot
|
||||
{
|
||||
public LuckyDiceDemoSnapshot(
|
||||
string title,
|
||||
string description,
|
||||
string faceLine,
|
||||
string comboLine,
|
||||
string ruleLine,
|
||||
string effectLine,
|
||||
string luckyDiceLine,
|
||||
string targetModeLine,
|
||||
string summary)
|
||||
{
|
||||
Title = title;
|
||||
Description = description;
|
||||
FaceLine = faceLine;
|
||||
ComboLine = comboLine;
|
||||
RuleLine = ruleLine;
|
||||
EffectLine = effectLine;
|
||||
LuckyDiceLine = luckyDiceLine;
|
||||
TargetModeLine = targetModeLine;
|
||||
Summary = summary;
|
||||
}
|
||||
|
||||
public string Title { get; }
|
||||
|
||||
public string Description { get; }
|
||||
|
||||
public string FaceLine { get; }
|
||||
|
||||
public string ComboLine { get; }
|
||||
|
||||
public string RuleLine { get; }
|
||||
|
||||
public string EffectLine { get; }
|
||||
|
||||
public string LuckyDiceLine { get; }
|
||||
|
||||
public string TargetModeLine { get; }
|
||||
|
||||
public string Summary { get; }
|
||||
}
|
||||
}
|
||||
11
FishDice/Assets/FishDice/Demo/LuckyDiceDemoSnapshot.cs.meta
Normal file
11
FishDice/Assets/FishDice/Demo/LuckyDiceDemoSnapshot.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8dcfb7ac4fa54a4d98d3f2bfb0164821
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
FishDice/Assets/FishDice/Demo/ScriptedRandomSource.cs
Normal file
40
FishDice/Assets/FishDice/Demo/ScriptedRandomSource.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FishDice.LuckyDice;
|
||||
|
||||
namespace FishDice.Demo
|
||||
{
|
||||
public sealed class ScriptedRandomSource : IRandomSource
|
||||
{
|
||||
private readonly Queue<int> _values;
|
||||
|
||||
public ScriptedRandomSource(IEnumerable<int> values)
|
||||
{
|
||||
if (values == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(values));
|
||||
}
|
||||
|
||||
_values = new Queue<int>(values);
|
||||
}
|
||||
|
||||
public int Next(int minInclusive, int maxExclusive)
|
||||
{
|
||||
if (_values.Count == 0)
|
||||
{
|
||||
throw new InvalidOperationException("Scripted demo random values were exhausted.");
|
||||
}
|
||||
|
||||
var value = _values.Dequeue();
|
||||
if (value < minInclusive || value >= maxExclusive)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
nameof(value),
|
||||
value,
|
||||
$"Expected scripted random value in [{minInclusive}, {maxExclusive}).");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
FishDice/Assets/FishDice/Demo/ScriptedRandomSource.cs.meta
Normal file
11
FishDice/Assets/FishDice/Demo/ScriptedRandomSource.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69b2b28319df4fd5ad423f70af3544fe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
FishDice/Assets/FishDice/DemoEditor.meta
Normal file
8
FishDice/Assets/FishDice/DemoEditor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5261611b82ad472a98db8ba5871b1185
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "FishDice.Demo.Editor",
|
||||
"rootNamespace": "FishDice.Demo.Editor",
|
||||
"references": [
|
||||
"FishDice.Demo"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fd0d92ac67e4db1abfb5d96ebbf72c7
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace FishDice.Demo.Editor
|
||||
{
|
||||
public static class LuckyDiceDemoSceneBuilder
|
||||
{
|
||||
private const string ScenePath = "Assets/Scenes/LuckyDiceDemo.unity";
|
||||
|
||||
[MenuItem("FishDice/Build Lucky Dice Demo Scene")]
|
||||
public static void BuildScene()
|
||||
{
|
||||
var scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
|
||||
scene.name = "LuckyDiceDemo";
|
||||
|
||||
CreateCamera();
|
||||
CreateDemoRoot();
|
||||
|
||||
EditorSceneManager.SaveScene(scene, ScenePath);
|
||||
AddSceneToBuildSettings();
|
||||
AssetDatabase.Refresh();
|
||||
Debug.Log($"Lucky Dice demo scene saved to {ScenePath}");
|
||||
}
|
||||
|
||||
private static void CreateCamera()
|
||||
{
|
||||
var cameraObject = new GameObject("Main Camera");
|
||||
var camera = cameraObject.AddComponent<Camera>();
|
||||
camera.clearFlags = CameraClearFlags.SolidColor;
|
||||
camera.backgroundColor = new Color(0.08f, 0.11f, 0.16f);
|
||||
camera.orthographic = true;
|
||||
camera.orthographicSize = 5f;
|
||||
cameraObject.AddComponent<AudioListener>();
|
||||
cameraObject.transform.position = new Vector3(0f, 0f, -10f);
|
||||
}
|
||||
|
||||
private static void CreateDemoRoot()
|
||||
{
|
||||
var root = new GameObject("Lucky Dice Demo");
|
||||
root.AddComponent<LuckyDiceDemoController>();
|
||||
}
|
||||
|
||||
private static void AddSceneToBuildSettings()
|
||||
{
|
||||
var scenes = EditorBuildSettings.scenes.ToList();
|
||||
if (scenes.Any(scene => scene.path == ScenePath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
scenes.Add(new EditorBuildSettingsScene(ScenePath, true));
|
||||
EditorBuildSettings.scenes = scenes.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c1a151a15db424fa8bbd4514d411448
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,36 @@
|
||||
using FishDice.Demo;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace FishDice.Tests.LuckyDice
|
||||
{
|
||||
public sealed class LuckyDiceDemoTests
|
||||
{
|
||||
[Test]
|
||||
public void DemoRunner_formats_normal_reward_flow()
|
||||
{
|
||||
var snapshot = LuckyDiceDemoRunner.RunScenario(
|
||||
new LuckyDiceDemoScenario("Normal Reward", "Numbers pay the base reward.", 0, 1));
|
||||
|
||||
Assert.That(snapshot.Title, Is.EqualTo("Normal Reward"));
|
||||
Assert.That(snapshot.FaceLine, Is.EqualTo("Faces: 2 + 3"));
|
||||
Assert.That(snapshot.ComboLine, Is.EqualTo("Combo: 2_3"));
|
||||
Assert.That(snapshot.RuleLine, Is.EqualTo("Rules: normal_all_numbers_reward"));
|
||||
Assert.That(snapshot.EffectLine, Is.EqualTo("Effects: Reward"));
|
||||
Assert.That(snapshot.TargetModeLine, Is.EqualTo("Target Mode: -"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DemoRunner_formats_lucky_dice_target_mode_flow()
|
||||
{
|
||||
var snapshot = LuckyDiceDemoRunner.RunScenario(
|
||||
new LuckyDiceDemoScenario("Lucky Dice", "Clover pair enters the special dice flow.", 5, 5, 0));
|
||||
|
||||
Assert.That(snapshot.FaceLine, Is.EqualTo("Faces: clover + clover"));
|
||||
Assert.That(snapshot.ComboLine, Is.EqualTo("Combo: clover_clover"));
|
||||
Assert.That(snapshot.RuleLine, Is.EqualTo("Rules: normal_clover_clover_lucky_dice"));
|
||||
Assert.That(snapshot.EffectLine, Is.EqualTo("Effects: LuckyDiceRequested, EnterTargetMode"));
|
||||
Assert.That(snapshot.LuckyDiceLine, Is.EqualTo("Lucky Dice: rocket x3"));
|
||||
Assert.That(snapshot.TargetModeLine, Is.EqualTo("Target Mode: slap_down_normal"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dd4c86fc35d4a9db7e3e8fbfcbf08fb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
FishDice/Assets/Scenes.meta
Normal file
8
FishDice/Assets/Scenes.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c6e956b12f60a34383edf957924923e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
306
FishDice/Assets/Scenes/LuckyDiceDemo.unity
Normal file
306
FishDice/Assets/Scenes/LuckyDiceDemo.unity
Normal file
@@ -0,0 +1,306 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 705507994}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 0}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 705507995}
|
||||
- component: {fileID: 705507994}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &705507994
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 8
|
||||
m_Type: 1
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &705507995
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &963194225
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 963194228}
|
||||
- component: {fileID: 963194227}
|
||||
- component: {fileID: 963194226}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &963194226
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &963194227
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 2
|
||||
m_BackGroundColor: {r: 0.08, g: 0.11, b: 0.16, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_GateFitMode: 2
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &963194228
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &180000001
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 180000002}
|
||||
- component: {fileID: 180000003}
|
||||
m_Layer: 0
|
||||
m_Name: Lucky Dice Demo
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &180000002
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 180000001}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &180000003
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 180000001}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 09f4d9942ff946b48ad7604ded5452cf, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
7
FishDice/Assets/Scenes/LuckyDiceDemo.unity.meta
Normal file
7
FishDice/Assets/Scenes/LuckyDiceDemo.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b98f810db9dc423aa31423fa5d89d155
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user