File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,25 @@ public static class BlankOperationClipboard
2323 /// <returns></returns>
2424 public static string GetValue ( )
2525 {
26- #if UNITY_ANDROID
26+ #if UNITY_EDITOR || UNITY_STANDALONE
27+ TextEditor textEditor = new TextEditor ( ) ;
28+ textEditor . OnFocus ( ) ;
29+ textEditor . Paste ( ) ;
30+ var content = textEditor . text ;
31+ return content ;
32+ #elif UNITY_WEBGL
33+ #if ENABLE_DOUYIN_MINI_GAME
34+ string content = string . Empty ;
35+ TTSDK . TT . GetClipboardData ( ( b , text ) =>
36+ {
37+ if ( b )
38+ {
39+ content = text ;
40+ }
41+ } ) ;
42+ return content ;
43+ #endif
44+ #elif UNITY_ANDROID
2745 using ( AndroidJavaClass androidJavaClass = new AndroidJavaClass ( "com.alianhome.operationclipboard.MainActivity" ) )
2846 {
2947 return androidJavaClass . CallStatic < string > ( "GetClipBoard" ) ;
@@ -46,6 +64,10 @@ public static void SetValue(string text)
4664 textEditor . text = text ;
4765 textEditor . OnFocus ( ) ;
4866 textEditor . Copy ( ) ;
67+ #elif UNITY_WEBGL
68+ #if ENABLE_DOUYIN_MINI_GAME
69+ TTSDK . TT . SetClipboardData ( text ) ;
70+ #endif
4971#elif UNITY_ANDROID
5072 using ( AndroidJavaClass androidJavaClass = new AndroidJavaClass ( "com.alianhome.operationclipboard.MainActivity" ) )
5173 {
You can’t perform that action at this time.
0 commit comments