/* * Event Handlers. */ private static void OnSomethingChangedHandler(bool deviceOrientationChanged, bool screenResolutionChanged) { var interfaceTypeChanged = false; if (screenResolutionChanged) { var interfaceType = _agent.GetInterfaceType(); if (interfaceType != CurrentInterfaceType) { CurrentInterfaceType = interfaceType; interfaceTypeChanged = true; } } if (deviceOrientationChanged) { OnDeviceOrientationChanged?.Invoke(); } if (screenResolutionChanged) { OnScreenResolutionChanged?.Invoke(); } if (interfaceTypeChanged) { OnInterfaceTypeChanged?.Invoke(CurrentInterfaceType); } if (deviceOrientationChanged || screenResolutionChanged) { OnSomethingChanged?.Invoke(); } }
/// <summary> /// Draws a scene variable element of the lsit /// </summary> /// <param name="rect">The rectangle to render the variable in</param> /// <param name="index">The index of the property</param> /// <param name="isActive">True if the element is active, false if not</param> /// <param name="isSelected">True if the element is selected, false if not</param> private void DrawElement(Rect rect, int index, bool isActive, bool isSelected) { if (IsFilteredOut(index)) { return; } SerializedSceneVariable serializedVar = serializedVariables.GetSerializedVariableAt(index); rect.yMin += (elementMargin * 0.5f); rect.height -= (elementMargin * 0.5f); EditorGUI.BeginChangeCheck(); if (IsBuiltInVariable(serializedVar.ValueProp)) { RenderBuiltInVariable(serializedVar, rect, index, isSelected); } else { RenderCustomVariable(serializedVar, rect, index, isActive, isSelected); } if (EditorGUI.EndChangeCheck()) { serializedVariables.SerializedContainer.ApplyModifiedProperties(); if (!EditorApplication.isPlaying) { serializedVariables.SceneVariablesContainer.ResetVariables(); } OnSomethingChanged.SafeInvoke(this, EventArgs.Empty); } }
private void Update() { var deviceOrientationChanged = false; var screenResolutionChanged = false; var safeAreaChanged = false; if (DeviceOrientation != Screen.orientation) { DeviceOrientation = Screen.orientation; deviceOrientationChanged = true; } if (ScreenWidth != Screen.width || ScreenHeight != Screen.height) { ScreenWidth = Screen.width; ScreenHeight = Screen.height; screenResolutionChanged = true; } if (deviceOrientationChanged || screenResolutionChanged || safeAreaChanged) { OnSomethingChanged?.Invoke(deviceOrientationChanged, screenResolutionChanged); } }