Files
tech aa5ce1ff5a [U] add PlayFab SDK and SNS login improvements
- Add PlayFabSDK as local package dependency
- Add PlayFabTool.cs for PlayFab API integration
- Implement LoginBySns method in TYSdkFacade
- Add Android SNS login support in SDKManager and UnityBridgeFunc
- Add Build Android With Debug menu option
- Improve exception handling and timeout management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 16:12:17 +08:00

126 lines
4.8 KiB
Markdown

# 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
#### Unity Packages (Packages/)
- **tysdk** (v0.0.1): Custom Tuyoo SDK wrapper - embedded package
- Contains iOS native plugins for Facebook and Firebase
- TYSdkFacade: Main SDK interface for account management and social logins
- **com.thinkingdata.analytics**: Thinking Analytics SDK - embedded package
- **com.neuecc.unirx**: UniRx - Reactive Extensions for Unity - local package
- **com.playfab**: PlayFab SDK - local package
- **com.github.skistua.unity-vimeditor**: Vim editor integration - git package
- **Unity packages**: Addressables, URP, TextMeshPro, Timeline, Test Framework, etc.
#### Native SDKs (Assets/)
- **AppsFlyer** (v6.14.0): Attribution tracking (`Assets/AppsFlyer/`)
- **MaxSdk**: Ad mediation platform with multiple network adapters (`Assets/MaxSdk/`)
- **GoogleMobileAds**: AdMob SDK (`Assets/GoogleMobileAds/`)
- **ExternalDependencyManager**: Google dependencies resolver (`Assets/ExternalDependencyManager/`)
#### Integration Details
- **Facebook SDK**: Integrated via MaxSdk mediation and tysdk iOS plugins
- **Firebase Analytics**: Native frameworks bundled in tysdk iOS plugins
- **Google Play Services**: Auth, Billing, Review - resolved via ExternalDependencyManager
## 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