Ejemplo n.º 1
0
        // [MenuItem(path, false, 90)]
        public static void MenuCheckVuforiaMode()
        {
            bool flag = Menu.GetChecked(path);

            flag = !flag;
            Menu.SetChecked(path, flag);

            string data = NxrPluginEditor.Read("AndroidManifest.xml");

            string[] lines   = data.Split('\n');
            string   newdata = "";

            for (int i = 0, l = lines.Length; i < l; i++)
            {
                string lineContent = lines[i];
                if (flag && lineContent.Contains("category.NVR"))
                {
                    lineContent = lineContent + "\n        " + "<category android:name=\"com.nibiru.intent.category.NAR_VUFORIA\" />";
                    lineContent = lineContent + "\n        " + "<category android:name=\"com.nibiru.intent.category.NAR_VUFORIA_SPLASH\" />";
                }
                else if (!flag && lineContent.Contains("NAR_VUFORIA"))
                {
                    lineContent = "";
                }

                if (flag && lineContent.Contains("NIBIRU_PLUGIN_IDS"))
                {
                    lineContent = "    <meta-data android:value=\"\" android:name=\"NIBIRU_PLUGIN_IDS\"/>";
                }

                newdata = newdata + lineContent + "\n";
            }

            NxrPluginEditor.Write("AndroidManifest.xml", newdata);
        }
Ejemplo n.º 2
0
        static void Init()
        {
            // Get existing open window or if none, make a new one:
            NxrPluginEditor window = (NxrPluginEditor)EditorWindow.GetWindow(typeof(NxrPluginEditor));

            window.minSize = new Vector2(320, 300);
            string data = Read("AndroidManifest.xml");

            string[] lines = data.Split('\n');
            for (int i = 0, l = lines.Length; i < l; i++)
            {
                string lineContent = lines[i];
                if (lineContent.Contains("NIBIRU_PLUGIN_IDS"))
                {
                    if (lineContent.Contains("6DOF"))
                    {
                        window.mSixDofMode = NxrSDKApi.Instance.GetSettingsAssetConfig().mSixDofMode;
                    }
                    if (lineContent.Contains("RECORD"))
                    {
                        window.useRecord = true;
                    }
                    if (lineContent.Contains("MARKER"))
                    {
                        window.useMarker = true;
                    }
                    break;
                }
            }

            window.Show();
        }
Ejemplo n.º 3
0
        private void OnGUI()
        {
            if (!IsHasChecked)
            {
                IsHasChecked     = true;
                EnableEncryption = CheckEncryption();
            }
            GUILayout.Space(20);
            GUIStyle labelStyle = new GUIStyle();

            labelStyle.normal.textColor = new Color(220 / 255.0f, 20 / 255.0f, 60 / 255.0f, 1.0f);
            labelStyle.fontSize         = 13;
            GUILayout.Label("  APK  Encryption: \n\n  Step1: Use NibiruEncrypt Tool generate Encrypt Key file name is apkpass.txt.\n  Step2: Put apkpass.txt to Assets\\Plugins\\Android\\assets.",
                            labelStyle);
            GUILayout.Space(20);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Get the lastest version of Tool:");
            GUIStyle style = new GUIStyle();

            style.normal.textColor = new Color(0, 122f / 255f, 204f / 255f);
            if (GUILayout.Button(sdkurl, style, GUILayout.Width(200)))
            {
                Application.OpenURL(sdkurl);
            }
            GUILayout.Space(20);

            EnableEncryption = GUILayout.Toggle(EnableEncryption, "Enable APK Encryption");
            GUILayout.Space(20);
            bool ApkPassExist = NxrPluginEditor.IsFileExists("assets/apkpass.txt");

            if (!ApkPassExist)
            {
                GUILayout.Label("  [Warning] apkpass.txt is not exist. [Warning] ", labelStyle);
                GUILayout.Space(20);
            }

            if (GUILayout.Button("Confirm", GUILayout.Width(100), GUILayout.Height(30)))
            {
                {
                    string   data    = NxrPluginEditor.Read("AndroidManifest.xml");
                    string[] lines   = data.Split('\n');
                    string   newdata = "";
                    for (int i = 0, l = lines.Length; i < l; i++)
                    {
                        string lineContent = lines[i];
                        if (lineContent.Contains("NIBIRU_ENCRYPTION_MODE"))
                        {
                            lineContent = "    <meta-data android:value=\"" + (EnableEncryption ? 1 : 0) + "\" android:name=\"NIBIRU_ENCRYPTION_MODE\"/>";
                        }
                        newdata = newdata + lineContent + "\n";
                    }

                    NxrPluginEditor.Write("AndroidManifest.xml", newdata);
                }

                Close();
            }
        }
Ejemplo n.º 4
0
        private void OnGUI()
        {
            if (!IsFirstTrigger)
            {
                IsFirstTrigger = true;
                inputText      = GetSDKKey();
            }

            GUILayout.Space(20);
            GUIStyle labelStyle = new GUIStyle();

            labelStyle.normal.textColor = Color.black;
            labelStyle.fontSize         = 13;
            GUILayout.Label(" SDK Verify:", labelStyle);
            GUILayout.Space(5);

            inputText = EditorGUILayout.TextArea(inputText);
            GUILayout.Space(20);
            bool SDKKeyExist = NxrPluginEditor.IsFileExists("assets/NibiruSDKKey.bin");

            if (!SDKKeyExist)
            {
                GUILayout.Label("  [Warning] NibiruSDKKey.bin is not exist. [Warning] ", labelStyle);
                GUILayout.Space(20);
            }

            if (inputText != null && GUILayout.Button("Confirm", GUILayout.Width(100), GUILayout.Height(30)))
            {
                {
                    string   data    = NxrPluginEditor.Read("AndroidManifest.xml");
                    string[] lines   = data.Split('\n');
                    string   newdata = "";
                    for (int i = 0, l = lines.Length; i < l; i++)
                    {
                        string lineContent = lines[i];
                        if (lineContent.Contains("NIBIRU_SDK_KEY"))
                        {
                            lineContent = "    <meta-data android:value=\"" + inputText + "\" android:name=\"NIBIRU_SDK_KEY\"/>";
                        }
                        newdata = newdata + lineContent + "\n";
                    }

                    NxrPluginEditor.Write("AndroidManifest.xml", newdata);
                }

                Close();
            }
            if (GUI.changed)
            {
                Repaint();
            }
        }
Ejemplo n.º 5
0
        HMD_TYPE GetHmdType()
        {
            string data = NxrPluginEditor.Read("AndroidManifest.xml");

            string[] lines = data.Split('\n');
            for (int i = 0, l = lines.Length; i < l; i++)
            {
                string lineContent = lines[i];
                if (lineContent.Contains("HMD_TYPE"))
                {
                    return(lineContent.Contains("VR") ? HMD_TYPE.VR : (lineContent.Contains("AR") ? HMD_TYPE.AR : HMD_TYPE.NONE));
                }
            }
            return(HMD_TYPE.NONE);
        }
Ejemplo n.º 6
0
        // <!-- 当前APK为加密版本,需要进行验证设备唯一标识 -->
        //<meta-data android:value="1" android:name="NIBIRU_ENCRYPTION_MODE"/>
        bool CheckEncryption()
        {
            string data = NxrPluginEditor.Read("AndroidManifest.xml");

            string[] lines = data.Split('\n');
            for (int i = 0, l = lines.Length; i < l; i++)
            {
                string lineContent = lines[i];
                if (lineContent.Contains("NIBIRU_ENCRYPTION_MODE"))
                {
                    return(lineContent.Contains("1"));
                }
            }
            return(false);
        }
Ejemplo n.º 7
0
        string GetSDKKey()
        {
            string data = NxrPluginEditor.Read("AndroidManifest.xml");

            string[] lines = data.Split('\n');
            for (int i = 0, l = lines.Length; i < l; i++)
            {
                string lineContent = lines[i];
                if (lineContent.Contains("NIBIRU_SDK_KEY"))
                {
                    MatchCollection mc = Regex.Matches(lineContent, "(?<=\").*?(?=\")");
                    return(mc[0].Value);
                }
            }
            return(null);
        }
Ejemplo n.º 8
0
        void SaveHmdType()
        {
            string data = NxrPluginEditor.Read("AndroidManifest.xml");

            string[] lines   = data.Split('\n');
            string   newdata = "";

            for (int i = 0, l = lines.Length; i < l; i++)
            {
                string lineContent = lines[i];
                if (lineContent.Contains("HMD_TYPE"))
                {
                    lineContent = "    <meta-data android:value=\"" + hmdType + "\" android:name=\"HMD_TYPE\"/>";
                }
                newdata = newdata + lineContent + "\n";
            }

            NxrPluginEditor.Write("AndroidManifest.xml", newdata);
        }
Ejemplo n.º 9
0
        public static bool MenuCheckBefore()
        {
            string data = NxrPluginEditor.Read("AndroidManifest.xml");

            string[] lines = data.Split('\n');

            bool isChecked = false;

            for (int i = 0, l = lines.Length; i < l; i++)
            {
                string lineContent = lines[i];
                if (lineContent.Contains("NAR_VUFORIA"))
                {
                    isChecked = true;
                    break;
                }
            }
            Menu.SetChecked(path, isChecked);
            return(true);
        }
Ejemplo n.º 10
0
        private void OnGUI()
        {
            if (!IsFirstTrigger)
            {
                IsFirstTrigger = true;
                inputText      = GetSDKKey();
            }

            GUILayout.Space(20);
            GUIStyle labelStyle = new GUIStyle();

            labelStyle.normal.textColor = new Color(220 / 255.0f, 20 / 255.0f, 60 / 255.0f, 1.0f);
            labelStyle.fontSize         = 13;
            GUILayout.Label("  SDK Verify: \n\n  Step1: Use Nibiru Signature Tool generate NibiruSDKKey.bin.\n" +
                            "  Step2: Put NibiruSDKKey.bin to Assets\\Plugins\\Android\\assets.\n" +
                            "  Step3: Put Encryption Key String to Input Box.",
                            labelStyle);
            GUILayout.Space(20);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Get the lastest version of Tool:");
            GUIStyle style = new GUIStyle();

            style.normal.textColor = new Color(0, 122f / 255f, 204f / 255f);
            if (GUILayout.Button(sdkurl, style, GUILayout.Width(200)))
            {
                Application.OpenURL(sdkurl);
            }
            GUILayout.Space(20);

            inputText = TextField(inputText, null);// GUILayout.TextField(inputText);

            GUILayout.Space(20);
            bool SDKKeyExist = NxrPluginEditor.IsFileExists("assets/NibiruSDKKey.bin");

            if (!SDKKeyExist)
            {
                GUILayout.Label("  [Warning] NibiruSDKKey.bin is not exist. [Warning] ", labelStyle);
                GUILayout.Space(20);
            }

            if (inputText != null && GUILayout.Button("Confirm", GUILayout.Width(100), GUILayout.Height(30)))
            {
                {
                    string   data    = NxrPluginEditor.Read("AndroidManifest.xml");
                    string[] lines   = data.Split('\n');
                    string   newdata = "";
                    for (int i = 0, l = lines.Length; i < l; i++)
                    {
                        string lineContent = lines[i];
                        if (lineContent.Contains("NIBIRU_SDK_KEY"))
                        {
                            lineContent = "    <meta-data android:value=\"" + inputText + "\" android:name=\"NIBIRU_SDK_KEY\"/>";
                        }
                        newdata = newdata + lineContent + "\n";
                    }

                    NxrPluginEditor.Write("AndroidManifest.xml", newdata);
                }

                Close();
            }
        }
Ejemplo n.º 11
0
        void OnGUI()
        {
            GUILayout.Space(20);
            GUILayout.Label("Choose the plugin ids :", EditorStyles.boldLabel);

            //"VOICE", "6DOF", "GESTURE", "RECORD", "MARKER", "RECOGINIZE"
            //useVoice = EditorGUILayout.Toggle("VOICE", useVoice);
            mSixDofMode = (SixDofMode)EditorGUILayout.EnumPopup(new GUIContent("SixDof Mode", "Choose SixDofMode: position is absolute data"), mSixDofMode);
            //useGesture = EditorGUILayout.Toggle("GESTURE", useGesture);
            useRecord = EditorGUILayout.Toggle("RECORD", useRecord);
            useMarker = EditorGUILayout.Toggle("MARKER", useMarker);
            //useRecoginize = EditorGUILayout.Toggle("RECOGINIZE", useRecoginize);
            bool   use6DOF     = mSixDofMode != SixDofMode.Head_3Dof_Ctrl_3Dof;
            string declaredStr = //(useVoice ? "VOICE," : "") +
                                 (use6DOF ? "6DOF," : "") +
                                 //(useGesture ? "GESTURE," : "") +
                                 (useRecord ? "RECORD," : "") +
                                 (useMarker ? "MARKER," : "");

            //(useRecoginize ? "RECOGINIZE," : "");

            if (declaredStr.Length > 0 && declaredStr.LastIndexOf(',') == declaredStr.Length - 1)
            {
                declaredStr = declaredStr.Remove(declaredStr.Length - 1);
            }

            int useCameraPluginIds = 0;

            if (useMarker)
            {
                useCameraPluginIds++;
            }

            if (useRecord)
            {
                useCameraPluginIds++;
            }

            EditorGUILayout.TextField("Declared Plugin Ids",
                                      declaredStr
                                      , EditorStyles.boldLabel);


            if (GUILayout.Button("Confirm Choose", GUILayout.Width(200), GUILayout.Height(30)))
            {
                var asset = NxrSDKApi.Instance.GetSettingsAssetConfig();
                asset.mSixDofMode = mSixDofMode;
                EditorUtility.SetDirty(asset);
                AssetDatabase.SaveAssets();
                //must Refresh
                AssetDatabase.Refresh();

                if (useCameraPluginIds > 1)
                {
                    bool res = EditorUtility.DisplayDialog("Conflict Warning",
                                                           "Can not choose them at the same time : [GESTURE][RECORD] [MARKER] [RECOGINIZE], because they all use camera, choose only one is ok !!!",
                                                           "Force Use", "Cancel");
                    Debug.Log(res);
                    if (res)
                    {
                        NxrPluginEditor window = (NxrPluginEditor)EditorWindow.GetWindow(typeof(NxrPluginEditor));
                        window.Close();
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    NxrPluginEditor window = (NxrPluginEditor)EditorWindow.GetWindow(typeof(NxrPluginEditor));
                    window.Close();
                }

                string   data    = Read("AndroidManifest.xml");
                string[] lines   = data.Split('\n');
                string   newdata = "";
                for (int i = 0, l = lines.Length; i < l; i++)
                {
                    string lineContent = lines[i];
                    if (lineContent.Contains("NIBIRU_PLUGIN_IDS"))
                    {
                        lineContent = "    <meta-data android:value=\"" + declaredStr + "\" android:name=\"NIBIRU_PLUGIN_IDS\"/>";
                    }
                    newdata = newdata + lineContent + "\n";
                }

                Write("AndroidManifest.xml", newdata);
            }
        }