//---------------------------------------------------------------------------------------------------------------------- private void UpdatePlayerConfigUIElements(MeshSyncPlayerType playerType) { MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateSettings(); MeshSyncPlayerConfig config = projectSettings.GetDefaultPlayerConfig(playerType); //sync m_syncVisibilityToggle.SetValueWithoutNotify(config.SyncVisibility); m_syncTransformToggle.SetValueWithoutNotify(config.SyncTransform); m_syncCamerasToggle.SetValueWithoutNotify(config.SyncCameras); m_syncLightsToggle.SetValueWithoutNotify(config.SyncLights); m_syncMeshesToggle.SetValueWithoutNotify(config.SyncMeshes); m_updateMeshCollidersToggle.SetValueWithoutNotify(config.UpdateMeshColliders); m_syncMaterialsToggle.SetValueWithoutNotify(config.SyncMaterials); m_findMaterialFromAssetsToggle.SetValueWithoutNotify(config.FindMaterialFromAssets); //Import m_animationInterpolationPopup.SetValueWithoutNotify(m_animationInterpolationEnums[config.AnimationInterpolation]); m_keyframeReductionToggle.SetValueWithoutNotify(config.KeyframeReduction); m_reductionThresholdField.SetValueWithoutNotify(config.ReductionThreshold); m_reductionEraseFlatCurves.SetValueWithoutNotify(config.ReductionEraseFlatCurves); m_zUpCorrectionPopup.SetValueWithoutNotify(m_zUpCorrectionEnums[config.ZUpCorrection]); //Misc m_syncMaterialListToggle.SetValueWithoutNotify(config.SyncMaterialList); m_progressiveDisplayToggle.SetValueWithoutNotify(config.ProgressiveDisplay); m_loggingToggle.SetValueWithoutNotify(config.Logging); m_profilingToggle.SetValueWithoutNotify(config.Profiling); //Animation Tweak AnimationTweakSettings animationTweakSettings = config.GetAnimationTweakSettings(); m_animationTweakTimeScaleField.SetValueWithoutNotify(animationTweakSettings.TimeScale); m_animationTweakTimeOffsetField.SetValueWithoutNotify(animationTweakSettings.TimeOffset); m_animationTweakDropStepField.SetValueWithoutNotify(animationTweakSettings.DropStep); m_animationTweakReductionThresholdField.SetValueWithoutNotify(animationTweakSettings.ReductionThreshold); m_animationTweakEraseFlatCurvesToggle.SetValueWithoutNotify(animationTweakSettings.EraseFlatCurves); //userData foreach (VisualElement uiElement in m_playerConfigUIElements) { uiElement.userData = config; } m_selectedPlayerType = playerType; }
//---------------------------------------------------------------------------------------------------------------------- private void OnPlayerTypePopupChanged(ChangeEvent <string> changeEvt) { PopupField <string> popup = changeEvt.target as PopupField <string>; if (null == popup) { Debug.LogError("[MeshSync] ChangeEvent wasn't passed correctly"); return; } MeshSyncPlayerType playerType = (MeshSyncPlayerType)popup.index; if (m_selectedPlayerType == playerType || popup.index >= (int)MeshSyncPlayerType.NUM_TYPES) { return; } UpdatePlayerConfigUIElements(playerType); }
//---------------------------------------------------------------------------------------------------------------------- private static TemplateContainer InstantiateContainer(MeshSyncPlayerType playerType) { VisualTreeAsset container = null; switch (playerType) { case MeshSyncPlayerType.SERVER: container = UIElementsEditorUtility.LoadVisualTreeAsset(Constants.SERVER_CONFIG_CONTAINER_PATH); break; case MeshSyncPlayerType.CACHE_PLAYER: container = UIElementsEditorUtility.LoadVisualTreeAsset(Constants.SCENE_CACHE_PLAYER_CONFIG_CONTAINER_PATH); break; default: Assert.Fail(); break; } return(container.CloneTree()); }
//---------------------------------------------------------------------------------------------------------------------- internal MeshSyncPlayerConfigSection(MeshSyncPlayerType playerType) { m_playerType = playerType; }
internal static MeshSyncPlayerConfig CreatePlayerConfig(MeshSyncPlayerType playerType) { MeshSyncRuntimeSettings settings = GetOrCreateSettings(); return new MeshSyncPlayerConfig(settings.GetDefaultPlayerConfig(playerType)); }
//---------------------------------------------------------------------------------------------------------------------- internal MeshSyncPlayerConfig GetDefaultPlayerConfig(MeshSyncPlayerType playerType) { return m_defaultPlayerConfigs[(int) playerType]; }