超大量的更新 修复很多问题,gameplay特效初步

This commit is contained in:
FloatGaming
2026-02-14 23:46:20 +08:00
parent ef8eb67259
commit 3a7a0b4669
360 changed files with 85670 additions and 4144 deletions
@@ -636,9 +636,9 @@ namespace DG.Tweening
#endregion
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// Documentation text normalized.
// Documentation text normalized.
// Documentation text normalized.
public static class Utils
{
@@ -304,9 +304,9 @@ namespace DG.Tweening
#endif
}
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// ███ CLASSES █████████████████████████████████████████████████████████████████████████████████████████████████████████
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// Documentation text normalized.
// Documentation text normalized.
// Documentation text normalized.
public static class DOTweenCYInstruction
{
@@ -20,8 +20,8 @@ namespace DG.Tweening
/// - DOTSPRITE
/// - DOTUI
/// Extra defines set and used for implementation of external assets:
/// - DOTWEEN_TMP ► TextMesh Pro
/// - DOTWEEN_TK2D ► 2D Toolkit
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
public static class DOTweenModuleUtils
{
@@ -78,9 +78,9 @@ namespace DG.Tweening
}
#endif
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
// Documentation text normalized.
// Documentation text normalized.
// Documentation text normalized.
public static class Physics
{
@@ -9,64 +9,64 @@ using UnityEngine;
namespace FancyScrollView
{
/// <summary>
/// <see cref="FancyScrollView{TItemData, TContext}"/> のセルを実装するための抽象基底クラス.
/// <see cref="FancyCell{TItemData, TContext}.Context"/> が不要な場合は
/// 代わりに <see cref="FancyCell{TItemData}"/> を使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// <typeparam name="TContext"><see cref="Context"/> の型.</typeparam>
/// Documentation text normalized.
/// Documentation text normalized.
public abstract class FancyCell<TItemData, TContext> : MonoBehaviour where TContext : class, new()
{
/// <summary>
/// このセルで表示しているデータのインデックス.
/// Documentation text normalized.
/// </summary>
public int Index { get; set; } = -1;
/// <summary>
/// このセルの可視状態.
/// Documentation text normalized.
/// </summary>
public virtual bool IsVisible => gameObject.activeSelf;
/// <summary>
/// <see cref="FancyScrollView{TItemData, TContext}.Context"/> の参照.
/// セルとスクロールビュー間で同じインスタンスが共有されます. 情報の受け渡しや状態の保持に使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
protected TContext Context { get; private set; }
/// <summary>
/// <see cref="Context"/> をセットします.
/// Documentation text normalized.
/// </summary>
/// <param name="context">コンテキスト.</param>
/// Documentation text normalized.
public virtual void SetContext(TContext context) => Context = context;
/// <summary>
/// 初期化を行います.
/// Documentation text normalized.
/// </summary>
public virtual void Initialize() { }
/// <summary>
/// このセルの可視状態を設定します.
/// Documentation text normalized.
/// </summary>
/// <param name="visible">可視状態なら <c>true</c>, 非可視状態なら <c>false</c>.</param>
/// Documentation text normalized.
public virtual void SetVisible(bool visible) => gameObject.SetActive(visible);
/// <summary>
/// アイテムデータに基づいてこのセルの表示内容を更新します.
/// Documentation text normalized.
/// </summary>
/// <param name="itemData">アイテムデータ.</param>
/// Documentation text normalized.
public abstract void UpdateContent(TItemData itemData);
/// <summary>
/// <c>0.0f</c> ~ <c>1.0f</c> の値に基づいてこのセルのスクロール位置を更新します.
/// Documentation text normalized.
/// </summary>
/// <param name="position">ビューポート範囲の正規化されたスクロール位置.</param>
/// Documentation text normalized.
public abstract void UpdatePosition(float position);
}
/// <summary>
/// <see cref="FancyScrollView{TItemData}"/> のセルを実装するための抽象基底クラス.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// Documentation text normalized.
/// <seealso cref="FancyCell{TItemData, TContext}"/>
public abstract class FancyCell<TItemData> : FancyCell<TItemData, NullContext>
{
@@ -10,82 +10,82 @@ using UnityEngine;
namespace FancyScrollView
{
/// <summary>
/// スクロールビューを実装するための抽象基底クラス.
/// 無限スクロールおよびスナップに対応しています.
/// <see cref="FancyScrollView{TItemData, TContext}.Context"/> が不要な場合は
/// 代わりに <see cref="FancyScrollView{TItemData}"/> を使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// <typeparam name="TContext"><see cref="Context"/> の型.</typeparam>
/// Documentation text normalized.
/// Documentation text normalized.
public abstract class FancyScrollView<TItemData, TContext> : MonoBehaviour where TContext : class, new()
{
/// <summary>
/// セル同士の間隔.
/// Documentation text normalized.
/// </summary>
[SerializeField, Range(1e-2f, 1f)] protected float cellInterval = 0.2f;
/// <summary>
/// スクロール位置の基準.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// たとえば、 <c>0.5</c> を指定してスクロール位置が <c>0</c> の場合, 中央に最初のセルが配置されます.
/// Documentation text normalized.
/// </remarks>
[SerializeField, Range(0f, 1f)] protected float scrollOffset = 0.5f;
/// <summary>
/// セルを循環して配置させるどうか.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// <c>true</c> にすると最後のセルの後に最初のセル, 最初のセルの前に最後のセルが並ぶようになります.
/// 無限スクロールを実装する場合は <c>true</c> を指定します.
/// Documentation text normalized.
/// Documentation text normalized.
/// </remarks>
[SerializeField] protected bool loop = false;
/// <summary>
/// セルの親要素となる <c>Transform</c>.
/// Documentation text normalized.
/// </summary>
[SerializeField] protected Transform cellContainer = default;
readonly IList<FancyCell<TItemData, TContext>> pool = new List<FancyCell<TItemData, TContext>>();
/// <summary>
/// 初期化済みかどうか.
/// Documentation text normalized.
/// </summary>
protected bool initialized;
/// <summary>
/// 現在のスクロール位置.
/// Documentation text normalized.
/// </summary>
protected float currentPosition;
/// <summary>
/// セルの Prefab.
/// Documentation text normalized.
/// </summary>
protected abstract GameObject CellPrefab { get; }
/// <summary>
/// アイテム一覧のデータ.
/// Documentation text normalized.
/// </summary>
protected IList<TItemData> ItemsSource { get; set; } = new List<TItemData>();
/// <summary>
/// <typeparamref name="TContext"/> のインスタンス.
/// セルとスクロールビュー間で同じインスタンスが共有されます. 情報の受け渡しや状態の保持に使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
protected TContext Context { get; } = new TContext();
/// <summary>
/// 初期化を行います.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// 最初にセルが生成される直前に呼び出されます.
/// Documentation text normalized.
/// </remarks>
protected virtual void Initialize() { }
/// <summary>
/// 渡されたアイテム一覧に基づいて表示内容を更新します.
/// Documentation text normalized.
/// </summary>
/// <param name="itemsSource">アイテム一覧.</param>
/// Documentation text normalized.
protected virtual void UpdateContents(IList<TItemData> itemsSource)
{
ItemsSource = itemsSource;
@@ -93,19 +93,19 @@ namespace FancyScrollView
}
/// <summary>
/// セルのレイアウトを強制的に更新します.
/// Documentation text normalized.
/// </summary>
protected virtual void Relayout() => UpdatePosition(currentPosition, false);
/// <summary>
/// セルのレイアウトと表示内容を強制的に更新します.
/// Documentation text normalized.
/// </summary>
protected virtual void Refresh() => UpdatePosition(currentPosition, true);
/// <summary>
/// スクロール位置を更新します.
/// Documentation text normalized.
/// </summary>
/// <param name="position">スクロール位置.</param>
/// Documentation text normalized.
protected virtual void UpdatePosition(float position) => UpdatePosition(position, false);
void UpdatePosition(float position, bool forceRefresh)
@@ -206,13 +206,13 @@ namespace FancyScrollView
}
/// <summary>
/// <see cref="FancyScrollView{TItemData}"/> のコンテキストクラス.
/// Documentation text normalized.
/// </summary>
public sealed class NullContext { }
/// <summary>
/// スクロールビューを実装するための抽象基底クラス.
/// 無限スクロールおよびスナップに対応しています.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData"></typeparam>
/// <seealso cref="FancyScrollView{TItemData, TContext}"/>
@@ -10,22 +10,22 @@ using System.Linq;
namespace FancyScrollView
{
/// <summary>
/// 複数の <see cref="FancyCell{TItemData, TContext}"/> を持つセルグループ実装するための抽象基底クラス.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// <typeparam name="TContext"><see cref="FancyCell{TItemData, TContext}.Context"/> の型.</typeparam>
/// Documentation text normalized.
/// Documentation text normalized.
public abstract class FancyCellGroup<TItemData, TContext> : FancyCell<TItemData[], TContext>
where TContext : class, IFancyCellGroupContext, new()
{
/// <summary>
/// このグループで表示するセルの配列.
/// Documentation text normalized.
/// </summary>
protected virtual FancyCell<TItemData, TContext>[] Cells { get; private set; }
/// <summary>
/// このグループで表示するセルの配列をインスタンス化します.
/// Documentation text normalized.
/// </summary>
/// <returns>このグループで表示するセルの配列.</returns>
/// Documentation text normalized.
protected virtual FancyCell<TItemData, TContext>[] InstantiateCells()
{
return Enumerable.Range(0, Context.GetGroupCount())
@@ -13,42 +13,42 @@ using EasingCore;
namespace FancyScrollView
{
/// <summary>
/// グリッドレイアウトのスクロールビューを実装するための抽象基底クラス.
/// 無限スクロールおよびスナップには対応していません.
/// <see cref="FancyScrollView{TItemData, TContext}.Context"/> が不要な場合は
/// 代わりに <see cref="FancyGridView{TItemData}"/> を使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// <typeparam name="TContext"><see cref="FancyScrollView{TItemData, TContext}.Context"/> の型.</typeparam>
/// Documentation text normalized.
/// Documentation text normalized.
public abstract class FancyGridView<TItemData, TContext> : FancyScrollRect<TItemData[], TContext>
where TContext : class, IFancyGridViewContext, new()
{
/// <summary>
/// デフォルトのセルグループクラス.
/// Documentation text normalized.
/// </summary>
protected abstract class DefaultCellGroup : FancyCellGroup<TItemData, TContext> { }
/// <summary>
/// 最初にセルを配置する軸方向のセル同士の余白.
/// Documentation text normalized.
/// </summary>
[SerializeField] protected float startAxisSpacing = 0f;
/// <summary>
/// 最初にセルを配置する軸方向のセル数.
/// Documentation text normalized.
/// </summary>
[SerializeField] protected int startAxisCellCount = 4;
/// <summary>
/// セルのサイズ.
/// Documentation text normalized.
/// </summary>
[SerializeField] protected Vector2 cellSize = new Vector2(100f, 100f);
/// <summary>
/// セルのグループ Prefab.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// <see cref="FancyGridView{TItemData, TContext}"/> では,
/// <see cref="FancyScrollView{TItemData, TContext}.CellPrefab"/> を最初にセルを配置する軸方向のセルコンテナとして使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// </remarks>
protected sealed override GameObject CellPrefab => cellGroupTemplate;
@@ -58,7 +58,7 @@ namespace FancyScrollView
: cellSize.y;
/// <summary>
/// アイテムの総数.
/// Documentation text normalized.
/// </summary>
public int DataCount { get; private set; }
@@ -82,8 +82,8 @@ namespace FancyScrollView
}
/// <summary>
/// 最初にセルが生成される直前に呼び出されます.
/// <see cref="Setup{TGroup}(FancyCell{TItemData, TContext})"/> メソッドを使用してセルテンプレートのセットアップを行ってください.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <example>
/// <code><![CDATA[
@@ -103,10 +103,10 @@ namespace FancyScrollView
protected abstract void SetupCellTemplate();
/// <summary>
/// セルテンプレートのセットアップを行います.
/// Documentation text normalized.
/// </summary>
/// <param name="cellTemplate">セルのテンプレート.</param>
/// <typeparam name="TGroup">セルグループの型.</typeparam>
/// Documentation text normalized.
/// Documentation text normalized.
protected virtual void Setup<TGroup>(FancyCell<TItemData, TContext> cellTemplate)
where TGroup : FancyCell<TItemData[], TContext>
{
@@ -118,9 +118,9 @@ namespace FancyScrollView
}
/// <summary>
/// 渡されたアイテム一覧に基づいて表示内容を更新します.
/// Documentation text normalized.
/// </summary>
/// <param name="items">アイテム一覧.</param>
/// Documentation text normalized.
public virtual void UpdateContents(IList<TItemData> items)
{
DataCount = items.Count;
@@ -137,10 +137,10 @@ namespace FancyScrollView
}
/// <summary>
/// 指定したアイテムの位置までジャンプします.
/// Documentation text normalized.
/// </summary>
/// <param name="itemIndex">アイテムのインデックス.</param>
/// <param name="alignment">ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾).</param>
/// Documentation text normalized.
/// Documentation text normalized.
protected override void JumpTo(int itemIndex, float alignment = 0.5f)
{
var groupIndex = itemIndex / startAxisCellCount;
@@ -148,12 +148,12 @@ namespace FancyScrollView
}
/// <summary>
/// 指定したアイテムの位置まで移動します.
/// Documentation text normalized.
/// </summary>
/// <param name="itemIndex">アイテムのインデックス.</param>
/// <param name="duration">移動にかける秒数.</param>
/// <param name="alignment">ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾).</param>
/// <param name="onComplete">移動が完了した際に呼び出されるコールバック.</param>
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
protected override void ScrollTo(int itemIndex, float duration, float alignment = 0.5f, Action onComplete = null)
{
var groupIndex = itemIndex / startAxisCellCount;
@@ -161,13 +161,13 @@ namespace FancyScrollView
}
/// <summary>
/// 指定したアイテムの位置まで移動します.
/// Documentation text normalized.
/// </summary>
/// <param name="itemIndex">アイテムのインデックス.</param>
/// <param name="duration">移動にかける秒数.</param>
/// <param name="easing">移動に使用するイージング.</param>
/// <param name="alignment">ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾).</param>
/// <param name="onComplete">移動が完了した際に呼び出されるコールバック.</param>
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
protected override void ScrollTo(int itemIndex, float duration, Ease easing, float alignment = 0.5f, Action onComplete = null)
{
var groupIndex = itemIndex / startAxisCellCount;
@@ -176,10 +176,10 @@ namespace FancyScrollView
}
/// <summary>
/// グリッドレイアウトのスクロールビューを実装するための抽象基底クラス.
/// 無限スクロールおよびスナップには対応していません.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// Documentation text normalized.
/// <seealso cref="FancyGridView{TItemData, TContext}"/>
public abstract class FancyGridView<TItemData> : FancyGridView<TItemData, FancyGridViewContext> { }
}
@@ -9,12 +9,12 @@ using UnityEngine;
namespace FancyScrollView
{
/// <summary>
/// <see cref="FancyGridView{TItemData, TContext}"/> のセルを実装するための抽象基底クラス.
/// <see cref="FancyCell{TItemData, TContext}.Context"/> が不要な場合は
/// 代わりに <see cref="FancyGridViewCell{TItemData}"/> を使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// <typeparam name="TContext"><see cref="FancyCell{TItemData, TContext}.Context"/> の型.</typeparam>
/// Documentation text normalized.
/// Documentation text normalized.
public abstract class FancyGridViewCell<TItemData, TContext> : FancyScrollRectCell<TItemData, TContext>
where TContext : class, IFancyGridViewContext, new()
{
@@ -35,9 +35,9 @@ namespace FancyScrollView
}
/// <summary>
/// <see cref="FancyGridView{TItemData}"/> のセルを実装するための抽象基底クラス.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// Documentation text normalized.
/// <seealso cref="FancyGridViewCell{TItemData, TContext}"/>
public abstract class FancyGridViewCell<TItemData> : FancyGridViewCell<TItemData, FancyGridViewContext>
{
@@ -10,7 +10,7 @@ using UnityEngine;
namespace FancyScrollView
{
/// <summary>
/// <see cref="FancyGridView{TItemData, TContext}"/> のコンテキスト基底クラス.
/// Documentation text normalized.
/// </summary>
public class FancyGridViewContext : IFancyGridViewContext
{
@@ -10,7 +10,7 @@ using UnityEngine;
namespace FancyScrollView
{
/// <summary>
/// <see cref="FancyCellGroup{TItemData, TContext}"/> のコンテキストインターフェース.
/// Documentation text normalized.
/// </summary>
public interface IFancyCellGroupContext
{
@@ -9,7 +9,7 @@ using System;
namespace FancyScrollView
{
/// <summary>
/// <see cref="FancyGridView{TItemData, TContext}"/> のコンテキストインターフェース.
/// Documentation text normalized.
/// </summary>
public interface IFancyGridViewContext : IFancyScrollRectContext, IFancyCellGroupContext
{
@@ -12,61 +12,61 @@ using EasingCore;
namespace FancyScrollView
{
/// <summary>
/// ScrollRect スタイルのスクロールビューを実装するための抽象基底クラス.
/// 無限スクロールおよびスナップには対応していません.
/// <see cref="FancyScrollView{TItemData, TContext}.Context"/> が不要な場合は
/// 代わりに <see cref="FancyScrollRect{TItemData}"/> を使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// <typeparam name="TContext"><see cref="FancyScrollView{TItemData, TContext}.Context"/> の型.</typeparam>
/// Documentation text normalized.
/// Documentation text normalized.
[RequireComponent(typeof(Scroller))]
public abstract class FancyScrollRect<TItemData, TContext> : FancyScrollView<TItemData, TContext>
where TContext : class, IFancyScrollRectContext, new()
{
/// <summary>
/// スクロール中にセルが再利用されるまでの余白のセル数.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// <c>0</c> を指定するとセルが完全に隠れた直後に再利用されます.
/// <c>1</c> 以上を指定すると, そのセル数だけ余分にスクロールしてから再利用されます.
/// Documentation text normalized.
/// Documentation text normalized.
/// </remarks>
[SerializeField] protected float reuseCellMarginCount = 0f;
/// <summary>
/// コンテンツ先頭の余白.
/// Documentation text normalized.
/// </summary>
[SerializeField] protected float paddingHead = 0f;
/// <summary>
/// コンテンツ末尾の余白.
/// Documentation text normalized.
/// </summary>
[SerializeField] protected float paddingTail = 0f;
/// <summary>
/// スクロール軸方向のセル同士の余白.
/// Documentation text normalized.
/// </summary>
[SerializeField] protected float spacing = 0f;
/// <summary>
/// セルのサイズ.
/// Documentation text normalized.
/// </summary>
protected abstract float CellSize { get; }
/// <summary>
/// スクロール可能かどうか.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// アイテム数が十分少なくビューポート内に全てのセルが収まっている場合は <c>false</c>, それ以外は <c>true</c> になります.
/// Documentation text normalized.
/// </remarks>
protected virtual bool Scrollable => MaxScrollPosition > 0f;
Scroller cachedScroller;
/// <summary>
/// スクロール位置を制御する <see cref="FancyScrollView.Scroller"/> のインスタンス.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// <see cref="Scroller"/> のスクロール位置を変更する際は必ず <see cref="ToScrollerPosition(float)"/> を使用して変換した位置を使用してください.
/// Documentation text normalized.
/// </remarks>
protected Scroller Scroller => cachedScroller ?? (cachedScroller = GetComponent<Scroller>());
@@ -100,9 +100,9 @@ namespace FancyScrollView
}
/// <summary>
/// <see cref="Scroller"/> のスクロール位置が変更された際の処理.
/// Documentation text normalized.
/// </summary>
/// <param name="p"><see cref="Scroller"/> のスクロール位置.</param>
/// Documentation text normalized.
void OnScrollerValueChanged(float p)
{
base.UpdatePosition(ToFancyScrollViewPosition(Scrollable ? p : 0f));
@@ -121,9 +121,9 @@ namespace FancyScrollView
}
/// <summary>
/// スクロール範囲を超えてスクロールされた量に基づいて, スクロールバーのサイズを縮小します.
/// Documentation text normalized.
/// </summary>
/// <param name="offset">スクロール範囲を超えてスクロールされた量.</param>
/// Documentation text normalized.
void ShrinkScrollbar(float offset)
{
var scale = 1f - ToFancyScrollViewPosition(offset) / (ViewportLength - PaddingHeadLength);
@@ -147,7 +147,7 @@ namespace FancyScrollView
}
/// <summary>
/// <see cref="Scroller"/> の各種状態を更新します.
/// Documentation text normalized.
/// </summary>
protected void RefreshScroller()
{
@@ -173,53 +173,53 @@ namespace FancyScrollView
}
/// <summary>
/// スクロール位置を更新します.
/// Documentation text normalized.
/// </summary>
/// <param name="position">スクロール位置.</param>
/// Documentation text normalized.
protected new void UpdatePosition(float position)
{
Scroller.Position = ToScrollerPosition(position, 0.5f);
}
/// <summary>
/// 指定したアイテムの位置までジャンプします.
/// Documentation text normalized.
/// </summary>
/// <param name="itemIndex">アイテムのインデックス.</param>
/// <param name="alignment">ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾).</param>
/// Documentation text normalized.
/// Documentation text normalized.
protected virtual void JumpTo(int itemIndex, float alignment = 0.5f)
{
Scroller.Position = ToScrollerPosition(itemIndex, alignment);
}
/// <summary>
/// 指定したアイテムの位置まで移動します.
/// Documentation text normalized.
/// </summary>
/// <param name="index">アイテムのインデックス.</param>
/// <param name="duration">移動にかける秒数.</param>
/// <param name="alignment">ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾).</param>
/// <param name="onComplete">移動が完了した際に呼び出されるコールバック.</param>
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
protected virtual void ScrollTo(int index, float duration, float alignment = 0.5f, Action onComplete = null)
{
Scroller.ScrollTo(ToScrollerPosition(index, alignment), duration, onComplete);
}
/// <summary>
/// 指定したアイテムの位置まで移動します.
/// Documentation text normalized.
/// </summary>
/// <param name="index">アイテムのインデックス.</param>
/// <param name="duration">移動にかける秒数.</param>
/// <param name="easing">移動に使用するイージング.</param>
/// <param name="alignment">ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾).</param>
/// <param name="onComplete">移動が完了した際に呼び出されるコールバック.</param>
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
protected virtual void ScrollTo(int index, float duration, Ease easing, float alignment = 0.5f, Action onComplete = null)
{
Scroller.ScrollTo(ToScrollerPosition(index, alignment), duration, easing, onComplete);
}
/// <summary>
/// ビューポートとコンテンツの長さに基づいてスクロールバーのサイズを更新します.
/// Documentation text normalized.
/// </summary>
/// <param name="viewportLength">ビューポートのサイズ.</param>
/// Documentation text normalized.
protected void UpdateScrollbarSize(float viewportLength)
{
var contentLength = Mathf.Max(ItemsSource.Count + (paddingHead + paddingTail - spacing) / (CellSize + spacing), 1);
@@ -227,31 +227,31 @@ namespace FancyScrollView
}
/// <summary>
/// <see cref="Scroller"/> が扱うスクロール位置を <see cref="FancyScrollRect{TItemData, TContext}"/> が扱うスクロール位置に変換します.
/// Documentation text normalized.
/// </summary>
/// <param name="position"><see cref="Scroller"/> が扱うスクロール位置.</param>
/// <returns><see cref="FancyScrollRect{TItemData, TContext}"/> が扱うスクロール位置.</returns>
/// Documentation text normalized.
/// Documentation text normalized.
protected float ToFancyScrollViewPosition(float position)
{
return position / Mathf.Max(ItemsSource.Count - 1, 1) * MaxScrollPosition - PaddingHeadLength;
}
/// <summary>
/// <see cref="FancyScrollRect{TItemData, TContext}"/> が扱うスクロール位置を <see cref="Scroller"/> が扱うスクロール位置に変換します.
/// Documentation text normalized.
/// </summary>
/// <param name="position"><see cref="FancyScrollRect{TItemData, TContext}"/> が扱うスクロール位置.</param>
/// <returns><see cref="Scroller"/> が扱うスクロール位置.</returns>
/// Documentation text normalized.
/// Documentation text normalized.
protected float ToScrollerPosition(float position)
{
return (position + PaddingHeadLength) / MaxScrollPosition * Mathf.Max(ItemsSource.Count - 1, 1);
}
/// <summary>
/// <see cref="FancyScrollRect{TItemData, TContext}"/> が扱うスクロール位置を <see cref="Scroller"/> が扱うスクロール位置に変換します.
/// Documentation text normalized.
/// </summary>
/// <param name="position"><see cref="FancyScrollRect{TItemData, TContext}"/> が扱うスクロール位置.</param>
/// <param name="alignment">ビューポート内におけるセル位置の基準. 0f(先頭) ~ 1f(末尾).</param>
/// <returns><see cref="Scroller"/> が扱うスクロール位置.</returns>
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
protected float ToScrollerPosition(float position, float alignment = 0.5f)
{
var offset = alignment * (ScrollLength - (1f + reuseCellMarginCount * 2f))
@@ -260,9 +260,9 @@ namespace FancyScrollView
}
/// <summary>
/// 指定された設定を実現するための
/// <see cref="FancyScrollView{TItemData,TContext}.cellInterval"/> と
/// <see cref="FancyScrollView{TItemData,TContext}.scrollOffset"/> を計算して適用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
protected void AdjustCellIntervalAndScrollOffset()
{
@@ -296,10 +296,10 @@ namespace FancyScrollView
}
/// <summary>
/// ScrollRect スタイルのスクロールビューを実装するための抽象基底クラス.
/// 無限スクロールおよびスナップには対応していません.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// Documentation text normalized.
/// <seealso cref="FancyScrollRect{TItemData, TContext}"/>
public abstract class FancyScrollRect<TItemData> : FancyScrollRect<TItemData, FancyScrollRectContext> { }
}
@@ -9,12 +9,12 @@ using UnityEngine;
namespace FancyScrollView
{
/// <summary>
/// <see cref="FancyScrollRect{TItemData, TContext}"/> のセルを実装するための抽象基底クラス.
/// <see cref="FancyCell{TItemData, TContext}.Context"/> が不要な場合は
/// 代わりに <see cref="FancyScrollRectCell{TItemData}"/> を使用します.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// <typeparam name="TContext"><see cref="FancyCell{TItemData, TContext}.Context"/> の型.</typeparam>
/// Documentation text normalized.
/// Documentation text normalized.
public abstract class FancyScrollRectCell<TItemData, TContext> : FancyCell<TItemData, TContext>
where TContext : class, IFancyScrollRectContext, new()
{
@@ -32,14 +32,14 @@ namespace FancyScrollView
}
/// <summary>
/// このセルの位置を更新します.
/// Documentation text normalized.
/// </summary>
/// <param name="normalizedPosition">
/// ビューポートの範囲で正規化されたスクロール位置.
/// <see cref="FancyScrollRect{TItemData, TContext}.reuseCellMarginCount"/> の値に基づいて
/// <c>0.0</c> ~ <c>1.0</c> の範囲を超えた値が渡されることがあります.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// </param>
/// <param name="localPosition">ローカル位置.</param>
/// Documentation text normalized.
protected virtual void UpdatePosition(float normalizedPosition, float localPosition)
{
transform.localPosition = Context.ScrollDirection == ScrollDirection.Horizontal
@@ -49,9 +49,9 @@ namespace FancyScrollView
}
/// <summary>
/// <see cref="FancyScrollRect{TItemData}"/> のセルを実装するための抽象基底クラス.
/// Documentation text normalized.
/// </summary>
/// <typeparam name="TItemData">アイテムのデータ型.</typeparam>
/// Documentation text normalized.
/// <seealso cref="FancyScrollRectCell{TItemData, TContext}"/>
public abstract class FancyScrollRectCell<TItemData> : FancyScrollRectCell<TItemData, FancyScrollRectContext>
{
@@ -9,7 +9,7 @@ using System;
namespace FancyScrollView
{
/// <summary>
/// <see cref="FancyScrollRect{TItemData, TContext}"/> のコンテキスト基底クラス.
/// Documentation text normalized.
/// </summary>
public class FancyScrollRectContext : IFancyScrollRectContext
{
@@ -9,7 +9,7 @@ using System;
namespace FancyScrollView
{
/// <summary>
/// <see cref="FancyScrollRect{TItemData, TContext}"/> のコンテキストインターフェース.
/// Documentation text normalized.
/// </summary>
public interface IFancyScrollRectContext
{
@@ -13,14 +13,14 @@ using EasingCore;
namespace FancyScrollView
{
/// <summary>
/// スクロール位置の制御を行うコンポーネント.
/// Documentation text normalized.
/// </summary>
public class Scroller : UIBehaviour, IPointerUpHandler, IPointerDownHandler, IBeginDragHandler, IEndDragHandler, IDragHandler, IScrollHandler
{
[SerializeField] RectTransform viewport = default;
/// <summary>
/// ビューポートのサイズ.
/// Documentation text normalized.
/// </summary>
public float ViewportSize => scrollDirection == ScrollDirection.Horizontal
? viewport.rect.size.x
@@ -29,14 +29,14 @@ namespace FancyScrollView
[SerializeField] ScrollDirection scrollDirection = ScrollDirection.Vertical;
/// <summary>
/// スクロール方向.
/// Documentation text normalized.
/// </summary>
public ScrollDirection ScrollDirection => scrollDirection;
[SerializeField] MovementType movementType = MovementType.Elastic;
/// <summary>
/// コンテンツがスクロール範囲を越えて移動するときに使用する挙動.
/// Documentation text normalized.
/// </summary>
public MovementType MovementType
{
@@ -47,7 +47,7 @@ namespace FancyScrollView
[SerializeField] float elasticity = 0.1f;
/// <summary>
/// コンテンツがスクロール範囲を越えて移動するときに使用する弾力性の量.
/// Documentation text normalized.
/// </summary>
public float Elasticity
{
@@ -58,7 +58,7 @@ namespace FancyScrollView
[SerializeField] float scrollSensitivity = 1f;
/// <summary>
/// <see cref="ViewportSize"/> の端から端まで Drag したときのスクロール位置の変化量.
/// Documentation text normalized.
/// </summary>
public float ScrollSensitivity
{
@@ -69,7 +69,7 @@ namespace FancyScrollView
[SerializeField] bool inertia = true;
/// <summary>
/// 慣性を使用するかどうか. <c>true</c> を指定すると慣性が有効に, <c>false</c> を指定すると慣性が無効になります.
/// Documentation text normalized.
/// </summary>
public bool Inertia
{
@@ -80,7 +80,7 @@ namespace FancyScrollView
[SerializeField] float decelerationRate = 0.03f;
/// <summary>
/// スクロールの減速率. <see cref="Inertia"/> が <c>true</c> の場合のみ有効です.
/// Documentation text normalized.
/// </summary>
public float DecelerationRate
{
@@ -96,10 +96,10 @@ namespace FancyScrollView
};
/// <summary>
/// <c>true</c> ならスナップし, <c>false</c>ならスナップしません.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// スナップを有効にすると, 慣性でスクロールが止まる直前に最寄りのセルへ移動します.
/// Documentation text normalized.
/// </remarks>
public bool SnapEnabled
{
@@ -110,7 +110,7 @@ namespace FancyScrollView
[SerializeField] bool draggable = true;
/// <summary>
/// Drag 入力を受付けるかどうか.
/// Documentation text normalized.
/// </summary>
public bool Draggable
{
@@ -121,12 +121,12 @@ namespace FancyScrollView
[SerializeField] Scrollbar scrollbar = default;
/// <summary>
/// スクロールバーのオブジェクト.
/// Documentation text normalized.
/// </summary>
public Scrollbar Scrollbar => scrollbar;
/// <summary>
/// 現在のスクロール位置.
/// Documentation text normalized.
/// </summary>
/// <value></value>
public float Position
@@ -210,50 +210,50 @@ namespace FancyScrollView
}
/// <summary>
/// スクロール位置が変化したときのコールバックを設定します.
/// Documentation text normalized.
/// </summary>
/// <param name="callback">スクロール位置が変化したときのコールバック.</param>
/// Documentation text normalized.
public void OnValueChanged(Action<float> callback) => onValueChanged = callback;
/// <summary>
/// 選択位置が変化したときのコールバックを設定します.
/// Documentation text normalized.
/// </summary>
/// <param name="callback">選択位置が変化したときのコールバック.</param>
/// Documentation text normalized.
public void OnSelectionChanged(Action<int> callback) => onSelectionChanged = callback;
/// <summary>
/// アイテムの総数を設定します.
/// Documentation text normalized.
/// </summary>
/// <remarks>
/// <paramref name="totalCount"/> を元に最大スクロール位置を計算します.
/// Documentation text normalized.
/// </remarks>
/// <param name="totalCount">アイテムの総数.</param>
/// Documentation text normalized.
public void SetTotalCount(int totalCount) => this.totalCount = totalCount;
/// <summary>
/// 指定した位置まで移動します.
/// Documentation text normalized.
/// </summary>
/// <param name="position">スクロール位置. <c>0f</c> ~ <c>totalCount - 1f</c> の範囲.</param>
/// <param name="duration">移動にかける秒数.</param>
/// <param name="onComplete">移動が完了した際に呼び出されるコールバック.</param>
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
public void ScrollTo(float position, float duration, Action onComplete = null) => ScrollTo(position, duration, Ease.OutCubic, onComplete);
/// <summary>
/// 指定した位置まで移動します.
/// Documentation text normalized.
/// </summary>
/// <param name="position">スクロール位置. <c>0f</c> ~ <c>totalCount - 1f</c> の範囲.</param>
/// <param name="duration">移動にかける秒数.</param>
/// <param name="easing">移動に使用するイージング.</param>
/// <param name="onComplete">移動が完了した際に呼び出されるコールバック.</param>
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
public void ScrollTo(float position, float duration, Ease easing, Action onComplete = null) => ScrollTo(position, duration, Easing.Get(easing), onComplete);
/// <summary>
/// 指定した位置まで移動します.
/// Documentation text normalized.
/// </summary>
/// <param name="position">スクロール位置. <c>0f</c> ~ <c>totalCount - 1f</c> の範囲.</param>
/// <param name="duration">移動にかける秒数.</param>
/// <param name="easingFunction">移動に使用するイージング関数.</param>
/// <param name="onComplete">移動が完了した際に呼び出されるコールバック.</param>
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
/// Documentation text normalized.
public void ScrollTo(float position, float duration, EasingFunction easingFunction, Action onComplete = null)
{
if (duration <= 0f)
@@ -278,9 +278,9 @@ namespace FancyScrollView
}
/// <summary>
/// 指定したインデックスの位置までジャンプします.
/// Documentation text normalized.
/// </summary>
/// <param name="index">アイテムのインデックス.</param>
/// Documentation text normalized.
public void JumpTo(int index)
{
if (index < 0 || index > totalCount - 1)
@@ -293,11 +293,11 @@ namespace FancyScrollView
}
/// <summary>
/// <paramref name="sourceIndex"/> から <paramref name="destIndex"/> に移動する際の移動方向を返します.
/// スクロール範囲が無制限に設定されている場合は, 最短距離の移動方向を返します.
/// Documentation text normalized.
/// Documentation text normalized.
/// </summary>
/// <param name="sourceIndex">移動元のインデックス.</param>
/// <param name="destIndex">移動先のインデックス.</param>
/// Documentation text normalized.
/// Documentation text normalized.
/// <returns></returns>
public MovementDirection GetMovementDirection(int sourceIndex, int destIndex)
{