internal void StartServer() { StopServer(); #if UNITY_EDITOR //Deploy HTTP assets to StreamingAssets DeployStreamingAssets.Deploy(); #endif MeshSyncRuntimeSettings runtimeSettings = MeshSyncRuntimeSettings.GetOrCreateSettings(); m_serverSettings.port = (ushort)m_serverPort; m_serverSettings.zUpCorrectionMode = (ZUpCorrectionMode)m_config.ZUpCorrection; m_server = Server.Start(ref m_serverSettings); m_server.fileRootPath = GetServerDocRootPath(); m_server.AllowPublicAccess(runtimeSettings.GetServerPublicAccess()); m_handler = OnServerMessage; #if UNITY_EDITOR EditorApplication.update += PollServerEvents; #endif if (m_config.Logging) { Debug.Log("MeshSync: server started (port: " + m_serverSettings.port + ")"); } m_serverStarted = true; }
void Reset() { MeshSyncRuntimeSettings runtimeSettings = MeshSyncRuntimeSettings.GetOrCreateSettings(); m_config = MeshSyncRuntimeSettings.CreatePlayerConfig(MeshSyncPlayerType.SERVER); m_serverPort = runtimeSettings.GetDefaultServerPort(); }
internal static MeshSyncRuntimeSettings GetOrCreateSettings() { if (null != m_instance) { return m_instance; } lock (m_instanceLock) { #if UNITY_EDITOR const string PATH = MESHSYNC_RUNTIME_SETTINGS_PATH; if (File.Exists(PATH)) { m_instance = FileUtility.DeserializeFromJson<MeshSyncRuntimeSettings>(PATH); } if (null != m_instance) { return m_instance; } #endif m_instance = new MeshSyncRuntimeSettings(); } #if UNITY_EDITOR m_instance.SaveSettings(); #endif return m_instance; }
void Reset() { m_cacheFilePath.isDirectory = false; m_cacheFilePath.readOnly = true; m_cacheFilePath.showRootSelector = true; m_config.Logging = false; m_config = MeshSyncRuntimeSettings.CreatePlayerConfig(MeshSyncPlayerType.CACHE_PLAYER); }
//---------------------------------------------------------------------------------------------------------------------- #region Events #if UNITY_EDITOR void Reset() { m_config = MeshSyncRuntimeSettings.CreatePlayerConfig(MeshSyncPlayerType.CACHE_PLAYER); }
internal static MeshSyncPlayerConfig CreatePlayerConfig(MeshSyncPlayerType playerType) { MeshSyncRuntimeSettings settings = GetOrCreateSettings(); return new MeshSyncPlayerConfig(settings.GetDefaultPlayerConfig(playerType)); }