This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity | |
android:name="com.DefaultCompany.MagicGathering.UnityPlayerActivity" | |
android:process=":UnityProcess"> | |
<intent-filter> | |
<action android:name="android.intent.action.VIEW"/> | |
<category android:name="android.intent.category.DEFAULT"/> | |
</intent-filter> | |
</activity> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.magic_gathering | |
import androidx.annotation.NonNull | |
import io.flutter.embedding.engine.FlutterEngine | |
import io.flutter.plugin.common.MethodChannel | |
class MainActivity: FlutterActivity() { | |
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { | |
super.configureFlutterEngine(flutterEngine) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/services.dart'; | |
class HomeState extends State<Home> { | |
static const platform = const MethodChannel('magicgathering/bridge'); | |
void startUnityActivity() async { | |
Map<String, dynamic> parameters = { | |
'cardBase64Image': inViewPortBase64, | |
'cardsBase64Image': _cardsBase64Image | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.magic_gathering | |
import com.DefaultCompany.MagicGathering.UnityPlayerActivity | |
val intent = Intent(this, UnityPlayerActivity::class.java).apply { | |
putExtra("cardBase64Image", "<string base64 da carta em exibiao>") | |
putExtra("cardsBase64Image", "<array de todas as cartas>") | |
} | |
startActivity(intent) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ToggleImage(Renderer renderer, string base64String) | |
{ | |
Texture2D texture2D = new Texture2D(1, 1); | |
byte[] bytes = Convert.FromBase64String(base64String); | |
texture2D.LoadImage(bytes); | |
texture2D.Apply(); | |
renderer.material.mainTexture = texture2D; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Start is called before the first frame update | |
void Start() | |
{ | |
// configure android | |
AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | |
AndroidJavaObject currentActivity = UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity"); | |
if (currentActivity != null) | |
{ | |
AndroidJavaObject intent = currentActivity.Call<AndroidJavaObject>("getIntent"); | |
cardsBase64Image = GetStringArrayExtraParams(intent, "cardsBase64Image"); |