Compare commits

...

3 Commits

Author SHA1 Message Date
TORISOUP c615850ecd
Merge b02876e1df into cc3c70af90 2025-03-11 14:49:34 +00:00
TORISOUP b02876e1df chore(docs): update TOC 2025-01-06 12:09:26 +00:00
TORISOUP 17bbb168b4 add TMP_Dropdown extension 2025-01-06 21:08:39 +09:00
3 changed files with 48 additions and 2 deletions

View File

@ -18,7 +18,7 @@ UniTask
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## 目录
## Table of Contents
- [入门](#%E5%85%A5%E9%97%A8)
- [UniTask 和 AsyncOperation 的基础知识](#unitask-%E5%92%8C-asyncoperation-%E7%9A%84%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86)
@ -43,7 +43,7 @@ UniTask
- [UniTaskSynchronizationContext](#unitasksynchronizationcontext)
- [API 文档](#api-%E6%96%87%E6%A1%A3)
- [UPM 包](#upm-%E5%8C%85)
- [通过 git URL 安装](#%E9%80%9A%E8%BF%87-git-url-%E5%AE%89%E8%A3%85)
- [通过 git URL 安装](#%E9%80%9A%E8%BF%87-git-url-%E5%AE%89%E8%A3%85)
- [关于 .NET Core](#%E5%85%B3%E4%BA%8E-net-core)
- [许可证](#%E8%AE%B8%E5%8F%AF%E8%AF%81)

View File

@ -0,0 +1,43 @@
#if UNITASK_TEXTMESHPRO_SUPPORT
using System;
using System.Threading;
using TMPro;
namespace Cysharp.Threading.Tasks
{
public static partial class TextMeshProAsyncExtensions
{
public static IAsyncValueChangedEventHandler<int> GetAsyncValueChangedEventHandler(this TMP_Dropdown dropdown)
{
return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy(), false);
}
public static IAsyncValueChangedEventHandler<int> GetAsyncValueChangedEventHandler(this TMP_Dropdown dropdown, CancellationToken cancellationToken)
{
return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, cancellationToken, false);
}
public static UniTask<int> OnValueChangedAsync(this TMP_Dropdown dropdown)
{
return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();
}
public static UniTask<int> OnValueChangedAsync(this TMP_Dropdown dropdown, CancellationToken cancellationToken)
{
return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, cancellationToken, true).OnInvokeAsync();
}
public static IUniTaskAsyncEnumerable<int> OnValueChangedAsAsyncEnumerable(this TMP_Dropdown dropdown)
{
return new UnityEventHandlerAsyncEnumerable<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy());
}
public static IUniTaskAsyncEnumerable<int> OnValueChangedAsAsyncEnumerable(this TMP_Dropdown dropdown, CancellationToken cancellationToken)
{
return new UnityEventHandlerAsyncEnumerable<int>(dropdown.onValueChanged, cancellationToken);
}
}
}
#endif

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b858132b120c42b99cac55fd06dd32d3
timeCreated: 1736165018