void Start() { #if UNITY_EDITOR_OSX Process p = new Process(); p.StartInfo.FileName = "osascript"; p.StartInfo.Arguments = @"-e 'tell application """ + UnityEditor.PlayerSettings.productName + @""" activate end tell'"; p.Start(); #endif BoltRuntimeSettings settings = BoltRuntimeSettings.instance; _serverEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, (ushort)settings.debugStartPort); _clientEndPoint = new UdpEndPoint(UdpIPv4Address.Localhost, 0); BoltConfig cfg; cfg = settings.GetConfigCopy(); cfg.connectionTimeout = 60000000; cfg.connectionRequestTimeout = 500; cfg.connectionRequestAttempts = 1000; if (string.IsNullOrEmpty(settings.debugStartMapName) == false) { if (BoltDebugStartSettings.DebugStartIsServer) { BoltLog.Warn("Starting as SERVER"); BoltLauncher.StartServer(_serverEndPoint, cfg); } else if (BoltDebugStartSettings.DebugStartIsClient) { BoltLog.Warn("Starting as CLIENT"); BoltLauncher.StartClient(_clientEndPoint, cfg); } else if (BoltDebugStartSettings.DebugStartIsSinglePlayer) { BoltLog.Warn("Starting as SINGLE PLAYER"); BoltLauncher.StartSinglePlayer(cfg); } BoltDebugStartSettings.PositionWindow(); } else { BoltLog.Error("No map found to start from"); } }
void InitialSetup() { string SETTINGS_PATH = Path.Combine(BoltPathUtility.ResourcesPath, "BoltRuntimeSettings.asset"); string PREFABDB_PATH = Path.Combine(BoltPathUtility.ResourcesPath, "BoltPrefabDatabase.asset"); if (!AssetDatabase.LoadAssetAtPath(SETTINGS_PATH, typeof(BoltRuntimeSettings))) { BoltRuntimeSettings settings = CreateInstance <BoltRuntimeSettings>(); AssetDatabase.CreateAsset(settings, SETTINGS_PATH); AssetDatabase.ImportAsset(SETTINGS_PATH, ImportAssetOptions.Default); } if (!AssetDatabase.LoadAssetAtPath(PREFABDB_PATH, typeof(PrefabDatabase))) { AssetDatabase.CreateAsset(CreateInstance <PrefabDatabase>(), PREFABDB_PATH); AssetDatabase.ImportAsset(PREFABDB_PATH, ImportAssetOptions.Default); } BoltMenuItems.RunCompiler(); }
static void InitialSetup() { const string SETTINGS_PATH = "Assets/bolt/resources/BoltRuntimeSettings.asset"; const string PREFABDB_PATH = "Assets/bolt/resources/BoltPrefabDatabase.asset"; if (!AssetDatabase.LoadAssetAtPath(SETTINGS_PATH, typeof(BoltRuntimeSettings))) { BoltRuntimeSettings settings = BoltRuntimeSettings.CreateInstance <BoltRuntimeSettings>(); settings.masterServerGameId = Guid.NewGuid().ToString().ToUpperInvariant(); AssetDatabase.CreateAsset(settings, SETTINGS_PATH); AssetDatabase.ImportAsset(SETTINGS_PATH, ImportAssetOptions.Default); } if (!AssetDatabase.LoadAssetAtPath(PREFABDB_PATH, typeof(Bolt.PrefabDatabase))) { AssetDatabase.CreateAsset(Bolt.PrefabDatabase.CreateInstance <Bolt.PrefabDatabase>(), PREFABDB_PATH); AssetDatabase.ImportAsset(PREFABDB_PATH, ImportAssetOptions.Default); } BoltMenuItems.RunCompiler(); }
protected void InitialSetup() { string SETTINGS_PATH = Path.Combine(BoltPathUtility.ResourcesPath, "BoltRuntimeSettings.asset"); string PREFABDB_PATH = Path.Combine(BoltPathUtility.ResourcesPath, "BoltPrefabDatabase.asset"); if (!AssetDatabase.LoadAssetAtPath(SETTINGS_PATH, typeof(BoltRuntimeSettings))) { BoltRuntimeSettings settings = CreateInstance <BoltRuntimeSettings>(); settings.masterServerGameId = Guid.NewGuid().ToString().ToUpperInvariant(); AssetDatabase.CreateAsset(settings, SETTINGS_PATH); AssetDatabase.ImportAsset(SETTINGS_PATH, ImportAssetOptions.Default); } if (!AssetDatabase.LoadAssetAtPath(PREFABDB_PATH, typeof(Bolt.PrefabDatabase))) { AssetDatabase.CreateAsset(CreateInstance <Bolt.PrefabDatabase>(), PREFABDB_PATH); AssetDatabase.ImportAsset(PREFABDB_PATH, ImportAssetOptions.Default); } BoltMenuItems.RunCompiler(); }
private void DrawSetupPhoton() { DrawInputWithLabel("Photon Cloud Setup", () => { GUILayout.BeginVertical(); GUILayout.Space(5); GUILayout.Label(BoltWizardText.PHOTON, textLabel); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(BoltWizardText.PHOTON_DASH, textLabel); if (GUILayout.Button("Visit Dashboard", minimalButton)) { OpenURL("https://dashboard.photonengine.com/")(); } GUILayout.EndHorizontal(); }, false); GUILayout.Space(15); BoltRuntimeSettings settings = BoltRuntimeSettings.instance; DrawInputWithLabel("Photon Bolt App ID or Email", () => { GUILayout.BeginVertical(); AppIdOrEmail = EditorGUILayout.TextField(AppIdOrEmail, centerInputText); GUILayout.EndVertical(); }, false, true, 300); DrawInputWithLabel("Region", () => { settings.photonCloudRegionIndex = EditorGUILayout.Popup(settings.photonCloudRegionIndex, BoltRuntimeSettings.photonCloudRegions); }, true, true); DrawInputWithLabel("NAT Punchthrough Enabled", () => { settings.photonUsePunch = BoltEditorGUI.Toggle(settings.photonUsePunch); }, true, true); // Action if (beforeNextCallback == null) { beforeNextCallback = () => { if (requestingAppId) { BoltLog.Info("Please, wait until your request for a new AppID finishes."); return(false); } if (AccountService.IsValidEmail(AppIdOrEmail)) { try { EditorUtility.DisplayProgressBar(BoltWizardText.CONNECTION_TITLE, BoltWizardText.CONNECTION_INFO, 0.5f); BoltLog.Info("Starting request"); requestingAppId = new AccountService().RegisterByEmail( AppIdOrEmail, new List <ServiceTypes>() { ServiceTypes.Bolt }, (response) => { if (response.ReturnCode == AccountServiceReturnCodes.Success) { var appKey = response.ApplicationIds[((int)ServiceTypes.Bolt).ToString()]; settings.photonAppId = appKey; AppIdOrEmail = appKey; BoltLog.Info("You new App ID: {0}", AppIdOrEmail); } else { BoltLog.Warn( "It was not possible to process your request, please go to the Photon Cloud Dashboard."); BoltLog.Warn("Return Code: {0}", AccountServiceReturnCodes.ReturnCodes[response.ReturnCode]); } requestingAppId = false; EditorUtility.ClearProgressBar(); }, (err) => { BoltLog.Error(err); requestingAppId = false; EditorUtility.ClearProgressBar(); }); if (requestingAppId) { BoltLog.Info("Requesting your new App ID"); } else { BoltLog.Warn( "It was not possible to process your request, please go to the Photon Cloud Dashboard."); EditorUtility.ClearProgressBar(); } } catch (Exception ex) { EditorUtility.DisplayDialog("Error", ex.Message, "ok"); } } else if (IsAppId(AppIdOrEmail)) { settings.photonAppId = AppIdOrEmail; return(true); } else { ShowNotification(new GUIContent("Please specify a valid Photon Bolt App ID or Email.")); } return(false); }; } }
private void DrawSetupPhoton() { DrawInputWithLabel("Photon Cloud Setup", () => { GUILayout.BeginVertical(); GUILayout.Space(5); GUILayout.Label(BoltWizardText.PHOTON, textLabel); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(BoltWizardText.PHOTON_DASH, textLabel); if (GUILayout.Button("Visit Dashboard", minimalButton)) { OpenURL("https://dashboard.photonengine.com/")(); } GUILayout.EndHorizontal(); }, false); GUILayout.Space(15); BoltRuntimeSettings settings = BoltRuntimeSettings.instance; DrawInputWithLabel("Photon Bolt App ID", () => { GUILayout.BeginVertical(); settings.photonAppId = EditorGUILayout.TextField(settings.photonAppId, centerInputText); GUILayout.EndVertical(); }, false, true); DrawInputWithLabel("Connection Mode", () => { settings.photonUseOnPremise = BoltEditorGUI.ToggleDropdown("Custom Hosted", "Photon Cloud", settings.photonUseOnPremise); }, true, true); if (settings.photonUseOnPremise) { DrawInputWithLabel("Master Server IP Address", () => { GUILayout.BeginVertical(); settings.photonOnPremiseIpAddress = EditorGUILayout.TextField(settings.photonOnPremiseIpAddress); GUILayout.EndVertical(); }, true, true); } else { DrawInputWithLabel("Region", () => { settings.photonCloudRegionIndex = EditorGUILayout.Popup(settings.photonCloudRegionIndex, BoltRuntimeSettings.photonCloudRegions); }, true, true); } DrawInputWithLabel("NAT Punchthrough Enabled", () => { settings.photonUsePunch = BoltEditorGUI.Toggle(settings.photonUsePunch); }, true, true); // Action if (beforeNextCallback == null) { beforeNextCallback = () => { if (!IsAppId(settings.photonAppId)) { ShowNotification(new GUIContent("Please specify a valid Bolt App ID.")); return(false); } return(true); }; } }
private void DrawSetupPhoton() { DrawInputWithLabel("Photon Cloud Setup", () => { GUILayout.BeginVertical(); GUILayout.Space(5); GUILayout.Label(BoltWizardText.PHOTON, textLabel); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(BoltWizardText.PHOTON_DASH, textLabel); if (GUILayout.Button("Visit Dashboard", minimalButton)) { OpenURL("https://dashboard.photonengine.com/")(); } GUILayout.EndHorizontal(); }, false); GUILayout.Space(15); BoltRuntimeSettings settings = BoltRuntimeSettings.instance; DrawInputWithLabel("Photon Bolt App ID or Email", () => { GUILayout.BeginVertical(); AppIdOrEmail = EditorGUILayout.TextField(AppIdOrEmail, centerInputText); GUILayout.EndVertical(); }, false, true, 300); DrawInputWithLabel("Connection Mode", () => { settings.photonUseOnPremise = BoltEditorGUI.ToggleDropdown("Custom Hosted", "Photon Cloud", settings.photonUseOnPremise); }, true, true); if (settings.photonUseOnPremise) { DrawInputWithLabel("Master Server IP Address", () => { GUILayout.BeginVertical(); settings.photonOnPremiseIpAddress = EditorGUILayout.TextField(settings.photonOnPremiseIpAddress); GUILayout.EndVertical(); }, true, true); } else { DrawInputWithLabel("Region", () => { settings.photonCloudRegionIndex = EditorGUILayout.Popup(settings.photonCloudRegionIndex, BoltRuntimeSettings.photonCloudRegions); }, true, true); } DrawInputWithLabel("NAT Punchthrough Enabled", () => { settings.photonUsePunch = BoltEditorGUI.Toggle(settings.photonUsePunch); }, true, true); // Action if (beforeNextCallback == null) { beforeNextCallback = () => { if (IsEmail(AppIdOrEmail)) { try { EditorUtility.DisplayProgressBar(BoltWizardText.CONNECTION_TITLE, BoltWizardText.CONNECTION_INFO, 0.5f); BoltLog.Info("Starting request"); string result = new AccountService().RegisterByEmail(AppIdOrEmail); if (!string.IsNullOrEmpty(result) && IsAppId(result)) { settings.photonAppId = result; AppIdOrEmail = result; BoltLog.Info("You new App ID: {0}", settings.photonAppId); return(true); } } catch (Exception ex) { EditorUtility.DisplayDialog("Error", ex.Message, "ok"); //ShowNotification(new GUIContent(ex.Message)); } finally { EditorUtility.ClearProgressBar(); BoltLog.Info("Finished request"); } } else if (IsAppId(AppIdOrEmail)) { settings.photonAppId = AppIdOrEmail; return(true); } else { ShowNotification(new GUIContent("Please specify a valid Bolt App ID or Email.")); } return(false); }; } }