使用內容編輯器開發好的專案該如何使用在程式上?

我是使用Unity SDK開發凱比的,請問在內容編輯器裡開發好的專案該如何加入程式中?

@aas2854tw
您好,若您有購買RMS商務系統,可以透過RMS機制將開發好的專案匯入至機器人。
並且透過以下範例程式碼來呼叫撥放指定檔案

Intent intent = new Intent();
ComponentName comp = new ComponentName("com.nuwarobotics.app.nuwaplayer","com.nuwarobotics.app.nuwaplayer.PlayContentEditorActivity");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
intent.setAction("com.nuwarobotics.app.nuwaplayer.action.PLAY_MBTX"); 
intent.setComponent(comp); 
intent.putExtra("PlayId", "file name");//the file name put in  /sdcard/contenteditor/ 
context.startActivity(intent);

Step 1 : 完成內容編輯器專案
Step 2 : 連線機器人(透過序號),並將專案匯入至機器人
Step 3 : 參考上述程式碼,修改 "file name"字串

https://bj.bcebos.com/v1/nuwarobotics-files/sdk/NUWA_APP_Feature_Interface.html

謝謝你的回覆,不過以上的程式丟到UNITY內是不能使用的,想請問用UNITY的話程式應該要怎麼打才能使用呢?

@aas2854tw 您好,經過詢問較熟悉Unity開發的同仁,可以參考下面這個討論串

https://forum.unity.com/threads/redirect-to-app-settings.461140/
擷取內文的範例
Android Intent Example

String packageName = activity.getPackageName();
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", packageName, null));
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);

Unity 寫法

try
{
#if UNITY_ANDROID
    using (var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    using (AndroidJavaObject currentActivityObject = unityClass.GetStatic<AndroidJavaObject>("currentActivity"))
    {
        string packageName = currentActivityObject.Call<string>("getPackageName");
 
        using (var uriClass = new AndroidJavaClass("android.net.Uri"))
        using (AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("fromParts", "package", packageName, null))
        using (var intentObject = new AndroidJavaObject("android.content.Intent", "android.settings.APPLICATION_DETAILS_SETTINGS", uriObject))
        {
            intentObject.Call<AndroidJavaObject>("addCategory", "android.intent.category.DEFAULT");
            intentObject.Call<AndroidJavaObject>("setFlags", 0x10000000);
            currentActivityObject.Call("startActivity", intentObject);
        }
    }
#endif
}
catch (Exception ex)
{
    Debug.LogException(ex);
}

這部分給您參考看看

Log in to reply

Looks like your connection to NUWA robotics developer forum was lost, please wait while we try to reconnect.