상속: Unity.MeshSync.BaseJsonSettings
예제 #1
0
        void Reset()
        {
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateSettings();

            m_config     = new MeshSyncServerConfig(projectSettings.GetDefaultServerConfig());
            m_serverPort = projectSettings.GetDefaultServerPort();
        }
예제 #2
0
        void Reset()
        {
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateSettings();

            m_config     = MeshSyncProjectSettings.CreatePlayerConfig(MeshSyncPlayerType.SERVER);
            m_serverPort = projectSettings.GetDefaultServerPort();
        }
예제 #3
0
        /// <summary>
        /// Starts the server. If the server is already running, it will be restarted.
        /// </summary>
        public void StartServer()
        {
#if UNITY_STANDALONE
            StopServer();

#if UNITY_EDITOR
            //Deploy HTTP assets to StreamingAssets
            DeployStreamingAssets.Deploy();
#endif
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.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(projectSettings.GetServerPublicAccess());

            m_handler = HandleRecvMessage;

#if UNITY_EDITOR
            EditorApplication.update += PollServerEvents;
#endif
            if (m_config.Logging)
            {
                Debug.Log("[MeshSync] Server started (port: " + m_serverSettings.port + ")");
            }

            m_serverStarted = true;
#else
            Debug.LogWarning("[MeshSync] Server functions are not supported in non-Standalone platform");
#endif //UNITY_STANDALONE
        }
    internal static MeshSyncProjectSettings 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<MeshSyncProjectSettings>(PATH);
                m_instance.UpgradeVersionToLatest();
                m_instance.ValidatePlayerConfigs();
            }
            if (null != m_instance) {
                return m_instance;
            }            
#endif
            
            m_instance = new MeshSyncProjectSettings();
        }        

#if UNITY_EDITOR
        m_instance.Save();
#endif
        return m_instance;
        
    }
예제 #5
0
    internal static MeshSyncProjectSettings GetOrCreateSettings() {
        
        if (null != m_instance) {
            return m_instance;
        }

        const string PATH = MESHSYNC_PROJECT_SETTINGS_PATH;
        lock (m_instanceLock) {           
        
#if UNITY_EDITOR
            if (File.Exists(PATH)) {
                m_instance = FileUtility.DeserializeFromJson<MeshSyncProjectSettings>(PATH);                
            }
            if (null != m_instance) {
                return m_instance;
            }
#endif
            
            m_instance = new MeshSyncProjectSettings();
        }        

#if UNITY_EDITOR
        m_instance.SaveSettings();
#endif
        return m_instance;
        
    }
예제 #6
0
        void Reset()
        {
            m_cacheFilePath.isDirectory      = false;
            m_cacheFilePath.readOnly         = true;
            m_cacheFilePath.showRootSelector = true;

            m_config.Logging = false;
            m_config         = MeshSyncProjectSettings.CreatePlayerConfig(MeshSyncPlayerType.CACHE_PLAYER);
        }
예제 #7
0
//----------------------------------------------------------------------------------------------------------------------

        #region Events
#if UNITY_EDITOR
        void Reset()
        {
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateInstance();

            m_config = new SceneCachePlayerConfig(projectSettings.GetDefaultSceneCachePlayerConfig());
        }
예제 #8
0
 internal static MeshSyncPlayerConfig CreatePlayerConfig(MeshSyncPlayerType playerType) {
     MeshSyncProjectSettings settings = GetOrCreateSettings();
     return new MeshSyncPlayerConfig(settings.GetDefaultPlayerConfig(playerType));
 }