[M] new call back

[wip]
This commit is contained in:
2025-12-03 11:11:56 +08:00
parent 9d6b5ae895
commit 8cc0a67f03
16 changed files with 4028 additions and 308 deletions

114
sdk-intergration/CLAUDE.md Normal file
View File

@@ -0,0 +1,114 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is a Unity 2022.3.53f1c1 mobile game SDK integration testing project for "Fishing Travel" (com.arkgame.ft). The project focuses on validating and testing various mobile SDK integrations including authentication, payments, analytics, and advertising networks.
## Build Commands
### Android Builds
```bash
# Command-line build (CI/CD)
/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -quit -projectPath . -executeMethod BuildTool.CIBuildAndroid --out ../Bin/tysdkTest.apk --bundle-type FirstPack --build-type New
# Manual build via Unity Editor
Tools > Build Android
```
### iOS Builds
```bash
# Command-line build (CI/CD)
/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -quit -projectPath . -executeMethod BuildTool.CIBuildIOS --out ../Bin --bundle-type FirstPack --build-type New
# Manual build via Unity Editor
Tools > Build iOS
```
### Build Parameters
- `--out`: Output path for build
- `--bundle-type`: None, FirstPack, or ALL
- `--build-type`: Build type (default: "New")
- `--define-symbol`: Custom compilation defines
- `--patch`: Enable patch build
- `--split`: Enable split APKs
- `--aab`: Build Android App Bundle instead of APK
## Architecture
### Core SDK Structure
- **TYSdkFacade** (`Packages/tysdk/Runtime/TYSdkFacade.cs`): Main SDK interface using facade pattern
- Account management with persistent storage
- Multiple social login providers (Google, Facebook, Apple, Guest)
- JWT token handling and linked account tracking
- Singleton pattern with DontDestroyOnLoad
- **UnityBridgeFunc** (`Assets/CoreLib/Data/sdk/base/UnityBridgeFunc.cs`): Platform-specific native bridge
- Android/iOS native method calls
- ATT (App Tracking Transparency) handling
- Social sharing functionality
### Test Infrastructure
- **SDKTest.cs** (`Assets/Scripts/SDKTest.cs`): Comprehensive SDK testing UI
- Tests all login methods and account linking
- Payment testing and ad display
- Integrates AppsFlyer, Max SDK, Thinking Analytics
- **UnbindTest.cs**: Account unbinding functionality test
- **Test Scenes**: SampleScene, UnbindTest, OneLinkTest
### Package Dependencies
Key Unity packages and third-party SDKs:
- **UniRx**: Reactive Extensions for Unity
- **tysdk**: Custom Tuyoo SDK wrapper (v0.0.1)
- **AppsFlyer SDK**: Attribution tracking
- **Max SDK**: Ad mediation platform
- **Thinking Analytics**: Custom analytics
- **Facebook SDK**: Social login and sharing
- **Firebase Analytics**: Google analytics
- **Google Play Services**: Auth, Billing, Review
## Platform-Specific Configuration
### Android
- **Target SDK**: 35 (configurable via gradle template)
- **Package Name**: com.arkgame.ft
- **Deep Linking**: OneLink support and custom URI scheme `zzft://mainactivity`
- **Key Files**:
- `Assets/Plugins/Android/AndroidManifest.xml`
- `Assets/Plugins/Android/mainTemplate.gradle`
- `Assets/Plugins/Android/gradleTemplate.properties`
### iOS
- **Build Output**: `../Bin` directory
- **Keystore**: Located in `keystore/` directory
- **Apple Sign-In**: Supported for iOS platform
## Development Workflow
### Testing SDK Features
1. Open `SampleScene` or test scenes
2. Use SDKTest UI to test:
- Initialization
- Login methods (Guest, Google, Facebook, Apple, Token)
- Account linking/unlinking
- Payments and ad display
- Analytics events
### Adding New SDK Tests
1. Create test methods in SDKTest.cs
2. Add UI buttons in the corresponding scene
3. Hook up button listeners in Start() method
### Modifying Build Configuration
1. Edit BuildTool.cs for new build parameters
2. Modify mainTemplate.gradle for Android dependencies
3. Update AndroidManifest.xml for permissions/activities
## Important Notes
- The project uses a custom TYApp/TYUnityActivity for Android
- Multiple ad network adapters integrated via Max SDK mediation
- Server URLs can be configured for test/production environments
- Uses PlayerPrefs for account persistence
- Implements comprehensive callback management for async operations