// [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); }
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(); } }
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(); } }
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); }
// <!-- 当前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); }
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); }
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); }
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); }
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(); } }