ワンクリックで
omg-cocos-playable-async-utilities
AsyncTask and CancellationToken async utilities for Cocos Creator playable ads
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
AsyncTask and CancellationToken async utilities for Cocos Creator playable ads
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Unity engine adapter: .asmdef graph, Roslyn class diagrams with Unity stereotypes (MonoBehaviour, ScriptableObject, DOTS), UPM package deps, and C4 architecture views
Cocos Creator 3.8.7 playable-ad parameter discovery + implementation. Scans project config files (constant.ts, *Config.ts) AND all Canvas UI nodes via MCP, reads scene values for defaults, wires bindings, auto-assigns. Modes: --quick, --standard, --deep, --exhaustive, --auto.
Compare CK updates against GameKit baseline, suggest which changes to incorporate.
Answer technical questions with context-aware skill activation. Use for 'how does X work', 'what is the best way to', 'explain this pattern' queries.
Check context usage limits, monitor time remaining, optimize token consumption, debug context failures. Use when asking about context window, token budget, or agent context sizing.
Implement features end-to-end: plan, code, test, review via registry agents. Use for 'implement X', 'build Y feature', 'add Z functionality'. Handles full workflow.
| name | omg-cocos-playable-async-utilities |
| description | AsyncTask and CancellationToken async utilities for Cocos Creator playable ads |
This skill was ported from upstream reference material. Interpret command names, paths, and agent-routing guidance as Codex/Oh My Game Kit equivalents. Prefer active Codex tools and local project instructions over Codex-specific mechanics when they conflict.
UniTask-inspired async helpers for Cocos Creator. All methods are static on AsyncTask. See also: omg-cocos-playable-signalbus (for waitFor), omg-cocos-playable-lifecycle.
Import paths:
db://assets/PLAGameFoundation/async/AsyncTaskdb://assets/PLAGameFoundation/async/CancellationTokenawait AsyncTask.Delay(1000); // ms
await AsyncTask.DelaySeconds(1.5); // seconds (wraps Delay)
await AsyncTask.Yield(); // next rAF frame
await AsyncTask.WaitForFrames(3); // N frames
await AsyncTask.WaitForFixedUpdate(); // ~0.02s fixed step approximation
await AsyncTask.FromSchedule(this, 0.5); // uses Cocos scheduleOnce (seconds)
await AsyncTask.WaitUntil(() => this.isReady);
await AsyncTask.WaitWhile(() => this.isLoading); // inverse of WaitUntil
// All complete (typed overload for mixed types)
await AsyncTask.WhenAll([loadA(), loadB(), loadC()]);
await AsyncTask.WhenAllTyped([loadSprite(), loadAudio()] as const);
// First wins
await AsyncTask.WhenAny([attempt1(), attempt2()]);
// Sequential — one after another, collects results
const results = await AsyncTask.Sequence([() => step1(), () => step2()]);
// Parallel with concurrency cap (default 5)
const results = await AsyncTask.Parallel([() => fetch(a), () => fetch(b)], 3);
// Attempts: 0..maxRetries. Delays: 1s, 2s, 4s, ...
const data = await AsyncTask.Retry(() => this.fetchData(), 3, 1000, cts.token);
// External resolve/reject — useful as an async gate
const deferred = AsyncTask.Deferred<boolean>();
someCallback = () => deferred.resolve(true);
const result = await deferred.promise;
const cts = new CancellationTokenSource();
// Pass token into cancellable ops
await AsyncTask.Delay(5000, cts.token);
await AsyncTask.WaitUntil(() => ready, cts.token);
await AsyncTask.Retry(() => load(), 3, 1000, cts.token);
// Cancel from anywhere
cts.cancel(); // triggers rejection in all registered ops
cts.dispose(); // same as cancel(), call when done
// Manual check inside a loop
for (const item of items) {
cts.token.throwIfCancelled(); // throws if cancelled
if (cts.token.isCancelled) break;
await process(item);
}
// Register teardown callback
cts.token.register(() => cleanupResources());
Loading gate — wait for parameters then animate in:
async onLoad() {
await AsyncTask.WaitUntil(() => PlayableConfig.isReady);
await AsyncTask.DelaySeconds(0.3);
this.playIntroAnimation();
}
Cancellable tutorial sequence:
private _cts: CancellationTokenSource;
async startTutorial() {
this._cts = new CancellationTokenSource();
try {
await AsyncTask.DelaySeconds(1, this._cts.token);
this.showHand();
await AsyncTask.DelaySeconds(2, this._cts.token);
this.hideHand();
} catch { /* cancelled */ }
}
onFirstInteraction() {
this._cts?.cancel();
}
Component-safe delay (avoids rAF after destroy):
// Prefer FromSchedule inside Cocos Components — respects component lifecycle
await AsyncTask.FromSchedule(this, 1.0);
Delay/WaitUntil inside a destroyed Component — rAF keeps running. Use FromSchedule or cancel via CancellationToken.Delay rejects with "Operation was cancelled". Wrap in try/catch.WaitUntil with an expensive condition — runs every frame. Keep the lambda fast.Parallel default concurrency is 5 — lower it for network-bound operations.setTimeout/Promise callbacks fire after the scene is gone unless explicitly cancelled. Tie all timers to a CancellationToken bound to component lifecycle.async/await in Cocos update() deopts — use coroutine-like primitives (Tween chains) for per-frame work..catch(reportToHost).