Пример #1
0
    public SpellAction()
    {
        protoEvents = new List<PrototypeInterface>();
        showSpellAction = new AnimBool(false);

        runes = new List<RuneManager.Rune>();
    }
	static SkeletonUtilityInspector () {
		#if UNITY_4_3
		showSlots = false;
		#else
		showSlots = new AnimBool(false);
		#endif
	}
Пример #3
0
 protected override void OnEnable()
 {
   base.OnEnable();
   this.m_SpriteContent = new GUIContent("Source Image");
   this.m_SpriteTypeContent = new GUIContent("Image Type");
   this.m_ClockwiseContent = new GUIContent("Clockwise");
   this.m_Sprite = this.serializedObject.FindProperty("m_Sprite");
   this.m_Type = this.serializedObject.FindProperty("m_Type");
   this.m_FillCenter = this.serializedObject.FindProperty("m_FillCenter");
   this.m_FillMethod = this.serializedObject.FindProperty("m_FillMethod");
   this.m_FillOrigin = this.serializedObject.FindProperty("m_FillOrigin");
   this.m_FillClockwise = this.serializedObject.FindProperty("m_FillClockwise");
   this.m_FillAmount = this.serializedObject.FindProperty("m_FillAmount");
   this.m_PreserveAspect = this.serializedObject.FindProperty("m_PreserveAspect");
   this.m_ShowType = new AnimBool(this.m_Sprite.objectReferenceValue != (UnityEngine.Object) null);
   this.m_ShowType.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
   Image.Type enumValueIndex = (Image.Type) this.m_Type.enumValueIndex;
   this.m_ShowSlicedOrTiled = new AnimBool(!this.m_Type.hasMultipleDifferentValues && enumValueIndex == Image.Type.Sliced);
   this.m_ShowSliced = new AnimBool(!this.m_Type.hasMultipleDifferentValues && enumValueIndex == Image.Type.Sliced);
   this.m_ShowFilled = new AnimBool(!this.m_Type.hasMultipleDifferentValues && enumValueIndex == Image.Type.Filled);
   this.m_ShowSlicedOrTiled.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
   this.m_ShowSliced.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
   this.m_ShowFilled.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
   this.SetShowNativeSize(true);
 }
 private void SetAnimBool(AnimBool a, bool value, bool instant)
 {
   if (instant)
     a.value = value;
   else
     a.target = value;
 }
Пример #5
0
        protected override void OnEnable()
        {
            base.OnEnable();
            m_TextComponent = serializedObject.FindProperty("m_TextComponent");
            m_Text = serializedObject.FindProperty("m_Text");
            m_ContentType = serializedObject.FindProperty("m_ContentType");
            m_LineType = serializedObject.FindProperty("m_LineType");
            m_InputType = serializedObject.FindProperty("m_InputType");
            m_CharacterValidation = serializedObject.FindProperty("m_CharacterValidation");
            m_KeyboardType = serializedObject.FindProperty("m_KeyboardType");
            m_CharacterLimit = serializedObject.FindProperty("m_CharacterLimit");
            m_CaretBlinkRate = serializedObject.FindProperty("m_CaretBlinkRate");
            m_CaretWidth = serializedObject.FindProperty("m_CaretWidth");
            m_CaretColor = serializedObject.FindProperty("m_CaretColor");
            m_CustomCaretColor = serializedObject.FindProperty("m_CustomCaretColor");
            m_SelectionColor = serializedObject.FindProperty("m_SelectionColor");
            m_HideMobileInput = serializedObject.FindProperty("m_HideMobileInput");
            m_Placeholder = serializedObject.FindProperty("m_Placeholder");
            m_OnValueChanged = serializedObject.FindProperty("m_OnValueChanged");
            m_OnEndEdit = serializedObject.FindProperty("m_OnEndEdit");
            m_ReadOnly = serializedObject.FindProperty("m_ReadOnly");

            m_CustomColor = new AnimBool(m_CustomCaretColor.boolValue);
            m_CustomColor.valueChanged.AddListener(Repaint);
        }
    protected override void OnAlloyShaderEnable() {
        m_openCloseAnim = new Dictionary<string, AnimBool>();
        m_propInfo = new Dictionary<MaterialProperty, AlloyFieldDrawer>();
        
        foreach (var property in MaterialProperties) {
            var drawer = AlloyFieldDrawerFactory.GetFieldDrawer(this, property);
            m_propInfo.Add(property, drawer);
        }

        var allTabs = new List<string>();

        foreach (var drawerProp in m_propInfo) {
            var drawer = drawerProp.Value;

            if (drawer is AlloyTabDrawer) {

                bool isOpenCur = TabGroup.IsOpen(drawer.DisplayName + MatInst);
                
                var anim = new AnimBool(isOpenCur) {speed = 6.0f, value = isOpenCur};
                m_openCloseAnim.Add(drawerProp.Key.name, anim);

                allTabs.Add(drawer.DisplayName);
            }


        }

        

        m_allTabs = allTabs.ToArray();
        //m_menu = new GenericMenu();
        Undo.undoRedoPerformed += OnUndo;
    }
Пример #7
0
        protected override void OnEnable()
        {
            base.OnEnable();

            m_SpriteContent = new GUIContent("Source Image");
            m_SpriteTypeContent     = new GUIContent("Image Type");
            m_ClockwiseContent      = new GUIContent("Clockwise");

            m_Sprite                = serializedObject.FindProperty("m_Sprite");
            m_Type                  = serializedObject.FindProperty("m_Type");
            m_FillCenter            = serializedObject.FindProperty("m_FillCenter");
            m_FillMethod            = serializedObject.FindProperty("m_FillMethod");
            m_FillOrigin            = serializedObject.FindProperty("m_FillOrigin");
            m_FillClockwise         = serializedObject.FindProperty("m_FillClockwise");
            m_FillAmount            = serializedObject.FindProperty("m_FillAmount");
            m_PreserveAspect        = serializedObject.FindProperty("m_PreserveAspect");

            m_ShowType = new AnimBool(m_Sprite.objectReferenceValue != null);
            m_ShowType.valueChanged.AddListener(Repaint);

            var typeEnum = (Image.Type)m_Type.enumValueIndex;

            m_ShowSlicedOrTiled = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Sliced);
            m_ShowSliced = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Sliced);
            m_ShowFilled = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == Image.Type.Filled);
            m_ShowSlicedOrTiled.valueChanged.AddListener(Repaint);
            m_ShowSliced.valueChanged.AddListener(Repaint);
            m_ShowFilled.valueChanged.AddListener(Repaint);

            SetShowNativeSize(true);
        }
Пример #8
0
        void OnEnable()
        {
            image = (SVGImage)target;

            m_Type = serializedObject.FindProperty("m_Type");
            m_Color = serializedObject.FindProperty("m_Color");
            m_Material = serializedObject.FindProperty("m_Material");
            
            m_ShowNativeSize = new AnimBool(false);
            m_ShowNativeSize.valueChanged.AddListener(Repaint);

            m_VectorGraphics = serializedObject.FindProperty("_vectorGraphics");
            m_PreserveAspect = serializedObject.FindProperty("m_PreserveAspect");
            m_UsePivot = serializedObject.FindProperty("m_UsePivot");

            m_VectorContent = new GUIContent("Vector Graphics");
            m_CorrectButtonContent = new GUIContent("Set Native Size", "Sets the size to match the content.");

            m_ShowType = new AnimBool(m_VectorGraphics.objectReferenceValue != null);
            m_ShowType.valueChanged.AddListener(Repaint);

            var typeEnum = (SVGImage.Type)m_Type.enumValueIndex;
            
            m_ShowSlicedOrTiled = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == SVGImage.Type.Sliced);
            m_ShowSliced = new AnimBool(!m_Type.hasMultipleDifferentValues && typeEnum == SVGImage.Type.Sliced);
            m_ShowSlicedOrTiled.valueChanged.AddListener(Repaint);
            m_ShowSliced.valueChanged.AddListener(Repaint);

            SetShowNativeSize(true);
        }       
    void OnEnable()
    {
        m_showCheckpoints = new AnimBool(true);
        //m_showCheckpoints.valueChanged.AddListener(Repaint);

        m_showWays = new AnimBool(true);
        //m_showWays.valueChanged.AddListener(Repaint);
    }
Пример #10
0
		private void OnEnable()
		{
			this.m_RenderMode = base.serializedObject.FindProperty("m_RenderMode");
			this.m_Camera = base.serializedObject.FindProperty("m_Camera");
			this.m_PixelPerfect = base.serializedObject.FindProperty("m_PixelPerfect");
			this.m_PlaneDistance = base.serializedObject.FindProperty("m_PlaneDistance");
			this.m_SortingLayerID = base.serializedObject.FindProperty("m_SortingLayerID");
			this.m_SortingOrder = base.serializedObject.FindProperty("m_SortingOrder");
			this.m_OverrideSorting = base.serializedObject.FindProperty("m_OverrideSorting");
			this.m_PixelPerfectOverride = base.serializedObject.FindProperty("m_OverridePixelPerfect");
			this.m_OverlayMode = new AnimBool(this.m_RenderMode.intValue == 0);
			this.m_OverlayMode.valueChanged.AddListener(new UnityAction(base.Repaint));
			this.m_CameraMode = new AnimBool(this.m_RenderMode.intValue == 1);
			this.m_CameraMode.valueChanged.AddListener(new UnityAction(base.Repaint));
			this.m_WorldMode = new AnimBool(this.m_RenderMode.intValue == 2);
			this.m_WorldMode.valueChanged.AddListener(new UnityAction(base.Repaint));
			this.m_SortingOverride = new AnimBool(this.m_OverrideSorting.boolValue);
			this.m_SortingOverride.valueChanged.AddListener(new UnityAction(base.Repaint));
			if (this.m_PixelPerfectOverride.boolValue)
			{
				this.pixelPerfect = ((!this.m_PixelPerfect.boolValue) ? CanvasEditor.PixelPerfect.Off : CanvasEditor.PixelPerfect.On);
			}
			else
			{
				this.pixelPerfect = CanvasEditor.PixelPerfect.Inherit;
			}
			this.m_AllNested = true;
			this.m_AllRoot = true;
			this.m_AllOverlay = true;
			this.m_NoneOverlay = true;
			for (int i = 0; i < base.targets.Length; i++)
			{
				Canvas canvas = base.targets[i] as Canvas;
				if (canvas.transform.parent == null)
				{
					this.m_AllNested = false;
				}
				else
				{
					if (canvas.transform.parent.GetComponentInParent<Canvas>() == null)
					{
						this.m_AllNested = false;
					}
					else
					{
						this.m_AllRoot = false;
					}
				}
				if (canvas.renderMode == RenderMode.ScreenSpaceOverlay)
				{
					this.m_NoneOverlay = false;
				}
				else
				{
					this.m_AllOverlay = false;
				}
			}
		}
        private void OnEnable()
        {
            executeOnStart = serializedObject.FindProperty("executeOnStart");
            loop = serializedObject.FindProperty("loop");
            destroyOnComplete = serializedObject.FindProperty("destroyOnComplete");

            isFoldout = new AnimBool(false);
            isFoldout.valueChanged.AddListener(Repaint);
        }
Пример #12
0
 protected virtual void OnEnable()
 {
   this.m_CorrectButtonContent = new GUIContent("Set Native Size", "Sets the size to match the content.");
   this.m_Script = this.serializedObject.FindProperty("m_Script");
   this.m_Color = this.serializedObject.FindProperty("m_Color");
   this.m_Material = this.serializedObject.FindProperty("m_Material");
   this.m_RaycastTarget = this.serializedObject.FindProperty("m_RaycastTarget");
   this.m_ShowNativeSize = new AnimBool(false);
   this.m_ShowNativeSize.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
 }
Пример #13
0
        protected virtual void OnEnable()
        {
            m_CorrectButtonContent = new GUIContent("Set Native Size", "Sets the size to match the content.");

            m_Script = serializedObject.FindProperty("m_Script");
            m_Color = serializedObject.FindProperty("m_Color");
            m_Material = serializedObject.FindProperty("m_Material");

            m_ShowNativeSize = new AnimBool(false);
            m_ShowNativeSize.valueChanged.AddListener(Repaint);
        }
Пример #14
0
 public LightingWindowObjectTab()
 {
     GITextureType[] typeArray1 = new GITextureType[7];
     typeArray1[1] = GITextureType.Albedo;
     typeArray1[2] = GITextureType.Emissive;
     typeArray1[3] = GITextureType.Irradiance;
     typeArray1[4] = GITextureType.Directionality;
     typeArray1[5] = GITextureType.Baked;
     typeArray1[6] = GITextureType.BakedDirectional;
     this.kObjectPreviewTextureTypes = typeArray1;
     this.m_ShowClampedSize = new AnimBool();
 }
	void OnEnable ()
	{
		/* --------------------- > ASSIGNED COMPONENTS < --------------------- */
		statusBarText = serializedObject.FindProperty( "statusBarText" );
		statusBarIcon = serializedObject.FindProperty( "statusBarIcon" );
		/* ------------------- > END ASSIGNED COMPONENTS < ------------------- */

		/* -------------------- > SCALE AND POSITIONING < -------------------- */
		usePositioning = serializedObject.FindProperty( "usePositioning" );
		scalingAxis = serializedObject.FindProperty( "scalingAxis" );
		statusBarSize = serializedObject.FindProperty( "statusBarSize" );
		spacingX = serializedObject.FindProperty( "spacingX" );
		spacingY = serializedObject.FindProperty( "spacingY" );
		preserveAspect = serializedObject.FindProperty( "preserveAspect" );
		targetImage = serializedObject.FindProperty( "targetImage" );
		xRatio = serializedObject.FindProperty( "xRatio" );
		yRatio = serializedObject.FindProperty( "yRatio" );
		/* ------------------ > END SCALE AND POSITIONING < ------------------ */

		/* ----------------------- > TIMEOUT OPTIONS < ----------------------- */
		enableIdleTimeout = serializedObject.FindProperty( "enableIdleTimeout" );
		idleTimeout = serializedObject.FindProperty( "idleTimeout" );
		statusBarEnabled = serializedObject.FindProperty( "statusBarEnabled" );
		enabledSpeed = serializedObject.FindProperty( "enabledSpeed" );
		statusBarDisabled = serializedObject.FindProperty( "statusBarDisabled" );
		disabledSpeed = serializedObject.FindProperty( "disabledSpeed" );
		/* --------------------- > END TIMEOUT OPTIONS < --------------------- */

		defaultState = serializedObject.FindProperty( "defaultState" );

		UltimateStatusBarController cont = ( UltimateStatusBarController )target;
		if( cont.statusBarText != null && cont.statusBarText.text != "New Text" && cont.statusBarText.text != string.Empty )
			statusBarName = cont.statusBarText.text;

		StoreChildBars();

		AssignedVariables = new AnimBool( EditorPrefs.GetBool( "UUI_Variables" ) );
		SizeAndPlacement = new AnimBool( EditorPrefs.GetBool( "UUI_SizeAndPlacement" ) );
		StyleAndOptions = new AnimBool( EditorPrefs.GetBool( "UUI_StyleAndOptions" ) );
		UltimateStatusBars = new AnimBool( EditorPrefs.GetBool( "UUI_ExtraOption_01" ) );

		customAspectRatio = new AnimBool( cont.preserveAspect == true ? false : true );

		// Find parent canvas and add update script
		GameObject myParent = GetParentCanvas();
		if( myParent != null && !myParent.GetComponent<UltimateStatusBarUpdater>() )
			myParent.AddComponent( typeof( UltimateStatusBarUpdater ) );
	}
Пример #16
0
 public LightingWindow()
 {
     int[] numArray1 = new int[3];
     numArray1[1] = 1;
     numArray1[2] = 2;
     this.kConcurrentJobsTypeValues = numArray1;
     this.kButtonWidth = 120f;
     this.kModeStrings = new GUIContent[] { new GUIContent("Non-Directional"), new GUIContent("Directional"), new GUIContent("Directional Specular (deprecated)") };
     int[] numArray2 = new int[3];
     numArray2[1] = 1;
     numArray2[2] = 2;
     this.kModeValues = numArray2;
     this.kMaxAtlasSizeStrings = new GUIContent[] { new GUIContent("32"), new GUIContent("64"), new GUIContent("128"), new GUIContent("256"), new GUIContent("512"), new GUIContent("1024"), new GUIContent("2048"), new GUIContent("4096") };
     this.kMaxAtlasSizeValues = new int[] { 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000 };
     this.m_Mode = Mode.BakeSettings;
     this.m_ScrollPosition = Vector2.zero;
     this.m_ShowIndirectResolution = new AnimBool();
     this.m_ShowDevOptions = false;
     this.m_PreviewResizer = new PreviewResizer();
     this.m_ToolbarPadding = -1f;
 }
Пример #17
0
        void OnEnable()
        {
            OnBaseEnable();

            m_TabView = (TabView)target;

            m_AutoTrackPages = serializedObject.FindProperty("m_AutoTrackPages");
            m_Pages = serializedObject.FindProperty("m_Pages");
            m_OnlyShowSelectedPage = serializedObject.FindProperty("m_OnlyShowSelectedPage");
            m_TabItemTemplate = serializedObject.FindProperty("m_TabItemTemplate");
            m_TabsContainer = serializedObject.FindProperty("m_TabsContainer");
            m_PagesContainer = serializedObject.FindProperty("m_PagesContainer");
            m_PagesRect = serializedObject.FindProperty("m_PagesRect");
            m_Indicator = serializedObject.FindProperty("m_Indicator");
            m_ShrinkTabsToFitThreshold = serializedObject.FindProperty("m_ShrinkTabsToFitThreshold");
            m_ForceStretchTabsOnLanscape = serializedObject.FindProperty("m_ForceStretchTabsOnLanscape");
            m_LowerUnselectedTabAlpha = serializedObject.FindProperty("m_LowerUnselectedTabAlpha");
            m_CanScrollBetweenTabs = serializedObject.FindProperty("m_CanScrollBetweenTabs");

            m_PagesAnimBool = new AnimBool { value = !m_AutoTrackPages.boolValue };
            m_PagesAnimBool.valueChanged.AddListener(Repaint);
        }
 private void TierSettingsGUI()
 {
     if (this.tierSettingsAnimator == null)
     {
         this.tierSettingsAnimator = new AnimBool(this.showTierSettingsUI, new UnityAction(this.Repaint));
     }
     bool enabled = GUI.enabled;
     GUI.enabled = true;
     EditorGUILayout.BeginVertical(GUI.skin.box, new GUILayoutOption[0]);
     Rect position = GUILayoutUtility.GetRect((float) 20f, (float) 18f);
     position.x += 3f;
     position.width += 6f;
     this.showTierSettingsUI = GUI.Toggle(position, this.showTierSettingsUI, Styles.tierSettings, EditorStyles.inspectorTitlebarText);
     this.tierSettingsAnimator.target = this.showTierSettingsUI;
     GUI.enabled = enabled;
     if (EditorGUILayout.BeginFadeGroup(this.tierSettingsAnimator.faded))
     {
         this.tierSettingsEditor.OnInspectorGUI();
     }
     EditorGUILayout.EndFadeGroup();
     EditorGUILayout.EndVertical();
 }
 protected virtual void OnEnable()
 {
   this.m_Content = this.serializedObject.FindProperty("m_Content");
   this.m_Horizontal = this.serializedObject.FindProperty("m_Horizontal");
   this.m_Vertical = this.serializedObject.FindProperty("m_Vertical");
   this.m_MovementType = this.serializedObject.FindProperty("m_MovementType");
   this.m_Elasticity = this.serializedObject.FindProperty("m_Elasticity");
   this.m_Inertia = this.serializedObject.FindProperty("m_Inertia");
   this.m_DecelerationRate = this.serializedObject.FindProperty("m_DecelerationRate");
   this.m_ScrollSensitivity = this.serializedObject.FindProperty("m_ScrollSensitivity");
   this.m_Viewport = this.serializedObject.FindProperty("m_Viewport");
   this.m_HorizontalScrollbar = this.serializedObject.FindProperty("m_HorizontalScrollbar");
   this.m_VerticalScrollbar = this.serializedObject.FindProperty("m_VerticalScrollbar");
   this.m_HorizontalScrollbarVisibility = this.serializedObject.FindProperty("m_HorizontalScrollbarVisibility");
   this.m_VerticalScrollbarVisibility = this.serializedObject.FindProperty("m_VerticalScrollbarVisibility");
   this.m_HorizontalScrollbarSpacing = this.serializedObject.FindProperty("m_HorizontalScrollbarSpacing");
   this.m_VerticalScrollbarSpacing = this.serializedObject.FindProperty("m_VerticalScrollbarSpacing");
   this.m_OnValueChanged = this.serializedObject.FindProperty("m_OnValueChanged");
   this.m_ShowElasticity = new AnimBool(new UnityAction(((Editor) this).Repaint));
   this.m_ShowDecelerationRate = new AnimBool(new UnityAction(((Editor) this).Repaint));
   this.SetAnimBools(true);
 }
Пример #20
0
 private void OnEnable()
 {
   this.m_RenderMode = this.serializedObject.FindProperty("m_RenderMode");
   this.m_Camera = this.serializedObject.FindProperty("m_Camera");
   this.m_PixelPerfect = this.serializedObject.FindProperty("m_PixelPerfect");
   this.m_PlaneDistance = this.serializedObject.FindProperty("m_PlaneDistance");
   this.m_SortingLayerID = this.serializedObject.FindProperty("m_SortingLayerID");
   this.m_SortingOrder = this.serializedObject.FindProperty("m_SortingOrder");
   this.m_TargetDisplay = this.serializedObject.FindProperty("m_TargetDisplay");
   this.m_OverrideSorting = this.serializedObject.FindProperty("m_OverrideSorting");
   this.m_PixelPerfectOverride = this.serializedObject.FindProperty("m_OverridePixelPerfect");
   this.m_OverlayMode = new AnimBool(this.m_RenderMode.intValue == 0);
   this.m_OverlayMode.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
   this.m_CameraMode = new AnimBool(this.m_RenderMode.intValue == 1);
   this.m_CameraMode.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
   this.m_WorldMode = new AnimBool(this.m_RenderMode.intValue == 2);
   this.m_WorldMode.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
   this.m_SortingOverride = new AnimBool(this.m_OverrideSorting.boolValue);
   this.m_SortingOverride.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
   this.pixelPerfect = !this.m_PixelPerfectOverride.boolValue ? CanvasEditor.PixelPerfect.Inherit : (!this.m_PixelPerfect.boolValue ? CanvasEditor.PixelPerfect.Off : CanvasEditor.PixelPerfect.On);
   this.m_AllNested = true;
   this.m_AllRoot = true;
   this.m_AllOverlay = true;
   this.m_NoneOverlay = true;
   for (int index = 0; index < this.targets.Length; ++index)
   {
     Canvas target = this.targets[index] as Canvas;
     if ((UnityEngine.Object) target.transform.parent == (UnityEngine.Object) null)
       this.m_AllNested = false;
     else if ((UnityEngine.Object) target.transform.parent.GetComponentInParent<Canvas>() == (UnityEngine.Object) null)
       this.m_AllNested = false;
     else
       this.m_AllRoot = false;
     if (target.renderMode == UnityEngine.RenderMode.ScreenSpaceOverlay)
       this.m_NoneOverlay = false;
     else
       this.m_AllOverlay = false;
   }
 }
Пример #21
0
        protected virtual void OnEnable()
        {
            m_Content               = serializedObject.FindProperty("m_Content");
            m_Horizontal            = serializedObject.FindProperty("m_Horizontal");
            m_Vertical              = serializedObject.FindProperty("m_Vertical");
            m_MovementType          = serializedObject.FindProperty("m_MovementType");
            m_Elasticity            = serializedObject.FindProperty("m_Elasticity");
            m_Inertia               = serializedObject.FindProperty("m_Inertia");
            m_DecelerationRate      = serializedObject.FindProperty("m_DecelerationRate");
            m_ScrollSensitivity     = serializedObject.FindProperty("m_ScrollSensitivity");
            m_Viewport              = serializedObject.FindProperty("m_Viewport");
            m_HorizontalScrollbar   = serializedObject.FindProperty("m_HorizontalScrollbar");
            m_VerticalScrollbar     = serializedObject.FindProperty("m_VerticalScrollbar");
            m_HorizontalScrollbarVisibility = serializedObject.FindProperty("m_HorizontalScrollbarVisibility");
            m_VerticalScrollbarVisibility   = serializedObject.FindProperty("m_VerticalScrollbarVisibility");
            m_HorizontalScrollbarSpacing    = serializedObject.FindProperty("m_HorizontalScrollbarSpacing");
            m_VerticalScrollbarSpacing      = serializedObject.FindProperty("m_VerticalScrollbarSpacing");
            m_OnValueChanged        = serializedObject.FindProperty("m_OnValueChanged");

            m_ShowElasticity = new AnimBool(Repaint);
            m_ShowDecelerationRate = new AnimBool(Repaint);
            SetAnimBools(true);
        }
Пример #22
0
    //Works as a constructor
    void OnEnable()
    {
        //Set tooltips
        biasTooltip = new GUIContent("Bias Value", "Positive values bias towards horizontal, negative towards vertical");
        wallRemovalTT = new GUIContent("Remove Selected Walls",
            "Remove the walls of a base layout that are selected in the scene window. \nCells either side of the wall can't be connected to the rest of the maze");
        doorwayTT = new GUIContent("Designate Doorway",
            "Remove the walls of a base layout that are selected in the scene window. \nCells either side of the wall are able to be connected to the maze");
        genWRoomsTT = new GUIContent("Generate With Rooms",
            "Generate a maze that includes user defined rooms. \nRequires Base Layout.\nUses width and depth defined during base layout creation");
        generateTT = new GUIContent("Generate New Maze", "Creates a new maze, does not require a base layout to be created.");

        headerStyle = new GUIStyle();
        showBiasFields = new AnimBool();
        generator = new MazeGeneration();
        param = new stats()
        {
            dBCurve = defineCurve(),
            useBias = false,
            wallMat = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat"),
            floorMat = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat")
        };
    }
    private void OnGUI()
    {
        GUILayout.Label("Forest generator", EditorStyles.boldLabel);
        GUILayout.Space(20);

        _triangle = EditorGUILayout.ObjectField("Forest Outline", _triangle, typeof(Triangle), true) as Triangle;
        _prefab = EditorGUILayout.ObjectField("Tree Prefab", _prefab, typeof(GameObject), true) as GameObject;

        GUILayout.Space(10);

        if (_triangle && _prefab)
            _showGeneration = new AnimBool(true);
        else
            _showGeneration = new AnimBool(false);

        if (EditorGUILayout.BeginFadeGroup(_showGeneration.faded)) {
            _amount = EditorGUILayout.IntField("Amount", _amount);

            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("GENERATE", GUILayout.ExpandWidth(false)))
                GenerateObjects();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        EditorGUILayout.EndFadeGroup();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Cleanup", GUILayout.ExpandWidth(false)))
            CleanUp();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
    }
	// Function called to display an interactive header.
	void DisplayHeader ( string headerName, string editorPref, AnimBool targetAnim )
	{
		EditorGUILayout.BeginVertical( "Toolbar" );
		GUILayout.BeginHorizontal();
		EditorGUILayout.LabelField( headerName, EditorStyles.boldLabel );
		if( GUILayout.Button( EditorPrefs.GetBool( editorPref ) == true ? "Hide" : "Show", EditorStyles.miniButton, GUILayout.Width( 50 ), GUILayout.Height( 14f ) ) )
		{
			EditorPrefs.SetBool( editorPref, EditorPrefs.GetBool( editorPref ) == true ? false : true );
			targetAnim.target = EditorPrefs.GetBool( editorPref );
		}
		GUILayout.EndHorizontal();
		EditorGUILayout.EndVertical();
	}
Пример #25
0
        public static float GetObjectFoldOutFaded(object o)
        {
            AnimBool fold = null;

            return(foldOutStates.TryGetValue(o, out fold) ? fold.faded : (foldOutStates[o] = new AnimBool(false)).faded);
        }
    void OnEnable()
    {
        // Setup the SerializedProperties.
        NearPlane           = serializedObject.FindProperty("NearPlane");
        NoiseContrast       = serializedObject.FindProperty("NoiseContrast");
        CustomNoiseContrast = serializedObject.FindProperty("CustomNoiseContrast");

        MaxLightDistance       = serializedObject.FindProperty("MaxLightDistance");
        CustomMaxLightDistance = serializedObject.FindProperty("CustomMaxLightDistance");
        CustomMieScatter       = serializedObject.FindProperty("CustomMieScatter");
        CustomExtinction       = serializedObject.FindProperty("CustomExtinction");
        CustomDensity          = serializedObject.FindProperty("CustomDensity");
        CustomSampleCount      = serializedObject.FindProperty("CustomSampleCount");
        CustomIntensity        = serializedObject.FindProperty("CustomIntensity");
        CustomColor            = serializedObject.FindProperty("CustomColor");
        CustomNoiseEnabled     = serializedObject.FindProperty("CustomNoiseEnabled");
        CustomNoiseScale       = serializedObject.FindProperty("CustomNoiseScale");
        CustomNoiseVelocity    = serializedObject.FindProperty("CustomNoiseVelocity");

        CustomSunSize  = serializedObject.FindProperty("CustomSunSize");
        CustomSunBleed = serializedObject.FindProperty("CustomSunBleed");
        CustomStrength = serializedObject.FindProperty("CustomStrength");


        CustomFogHeightEnabled  = serializedObject.FindProperty("CustomFogHeightEnabled");
        CustomFogHeight         = serializedObject.FindProperty("CustomFogHeight");
        CustomFogTransitionSize = serializedObject.FindProperty("CustomFogTransitionSize");
        CustomAboveFogPercent   = serializedObject.FindProperty("CustomAboveFogPercent");

        FogHeightEnabled  = serializedObject.FindProperty("FogHeightEnabled");
        FogHeight         = serializedObject.FindProperty("FogHeight");
        FogTransitionSize = serializedObject.FindProperty("FogTransitionSize");
        AboveFogPercent   = serializedObject.FindProperty("AboveFogPercent");

        NoiseEnabled       = serializedObject.FindProperty("NoiseEnabled");
        NoiseScale         = serializedObject.FindProperty("NoiseScale");
        NoiseVelocity      = serializedObject.FindProperty("NoiseVelocity");
        CustomNoiseTexture = serializedObject.FindProperty("CustomNoiseTexture");



        noiseTexture  = serializedObject.FindProperty("NoiseTexture3D");
        Color         = serializedObject.FindProperty("Color");
        MieScattering = serializedObject.FindProperty("MieScattering");
        Extinction    = serializedObject.FindProperty("Extinction");
        Density       = serializedObject.FindProperty("Density");
        ExtraDensity  = serializedObject.FindProperty("ExtraDensity");
        SampleCount   = serializedObject.FindProperty("SampleCount");
        Shadows       = serializedObject.FindProperty("Shadows");
        Strength      = serializedObject.FindProperty("Strength");

        SunSize  = serializedObject.FindProperty("SunSize");
        SunBleed = serializedObject.FindProperty("SunBleed");

        Intensity = serializedObject.FindProperty("Intensity");

        CustomTintMode      = serializedObject.FindProperty("CustomTintMode");
        CustomTintColor     = serializedObject.FindProperty("CustomTintColor");
        CustomTintColor2    = serializedObject.FindProperty("CustomTintColor2");
        CustomTintIntensity = serializedObject.FindProperty("CustomTintIntensity");
        CustomTintGradient  = serializedObject.FindProperty("CustomTintGradient");

        TintMode      = serializedObject.FindProperty("TintMode");
        TintColor     = serializedObject.FindProperty("TintColor");
        TintColor2    = serializedObject.FindProperty("TintColor2");
        TintIntensity = serializedObject.FindProperty("TintIntensity");
        TintGradient  = serializedObject.FindProperty("TintGradient");

        if (m_ShowLightSettings == null)
        {
            m_ShowLightSettings = new AnimBool(EditorPrefs.GetBool("Hxc_ShowLightSettings", false));
            m_ShowLightSettings.valueChanged.AddListener(Repaint);
        }

        if (m_ShowAmbient == null)
        {
            m_ShowAmbient = new AnimBool(EditorPrefs.GetBool("Hxc_ShowAmbient", false));
            m_ShowAmbient.valueChanged.AddListener(Repaint);
        }

        if (m_ShowGeneral == null)
        {
            m_ShowGeneral = new AnimBool(EditorPrefs.GetBool("Hxc_ShowGeneral", false));
            m_ShowGeneral.valueChanged.AddListener(Repaint);
        }

        if (m_ShowLighting == null)
        {
            m_ShowLighting = new AnimBool(EditorPrefs.GetBool("Hxc_ShowLighting", false));
            m_ShowLighting.valueChanged.AddListener(Repaint);
        }

        if (m_ShowFog == null)
        {
            m_ShowFog = new AnimBool(EditorPrefs.GetBool("Hxc_ShowFog", false));
            m_ShowFog.valueChanged.AddListener(Repaint);
        }


        if (m_ShowNoise == null)
        {
            m_ShowNoise = new AnimBool(EditorPrefs.GetBool("Hxc_ShowNoise", false));
            m_ShowNoise.valueChanged.AddListener(Repaint);
        }

        if (m_ShowDensity == null)
        {
            m_ShowDensity = new AnimBool(EditorPrefs.GetBool("Hxc_ShowDensity", false));
            m_ShowDensity.valueChanged.AddListener(Repaint);
        }

        if (m_ShowTransparency == null)
        {
            m_ShowTransparency = new AnimBool(EditorPrefs.GetBool("Hxc_ShowTransparency", false));
            m_ShowTransparency.valueChanged.AddListener(Repaint);
        }

        if (m_ShowAdvanced == null)
        {
            m_ShowAdvanced = new AnimBool(EditorPrefs.GetBool("Hxc_ShowAdvanced", false));
            m_ShowAdvanced.valueChanged.AddListener(Repaint);
        }
    }
        protected virtual void OnEnable()
        {
            if (target == null)
            {
                return;
            }

            this.m_DrawInspectors = new List <System.Action>();
            m_ClassProperties     = new Dictionary <Type, string[]>();

            this.m_Script                     = serializedObject.FindProperty("m_Script");
            this.m_ItemName                   = serializedObject.FindProperty("m_ItemName");
            this.m_ItemDisplayName            = serializedObject.FindProperty("m_DisplayName");
            this.m_UseItemNameAsDisplayName   = serializedObject.FindProperty("m_UseItemNameAsDisplayName");
            this.m_ShowItemDisplayNameOptions = new AnimBool(!this.m_UseItemNameAsDisplayName.boolValue);
            this.m_ShowItemDisplayNameOptions.valueChanged.AddListener(new UnityAction(Repaint));

            this.m_Icon        = serializedObject.FindProperty("m_Icon");
            this.m_Prefab      = serializedObject.FindProperty("m_Prefab");
            this.m_Description = serializedObject.FindProperty("m_Description");

            //this.m_Rarity = serializedObject.FindProperty("m_Rarity");
            //this.m_PossibleRarity = serializedObject.FindProperty("m_PossibleRarity");

            this.m_Category = serializedObject.FindProperty("m_Category");

            #region BuySell
            this.m_IsSellable      = serializedObject.FindProperty("m_IsSellable");
            this.m_ShowSellOptions = new AnimBool(this.m_IsSellable.boolValue);
            this.m_ShowSellOptions.valueChanged.AddListener(new UnityAction(Repaint));
            this.m_CanBuyBack   = serializedObject.FindProperty("m_CanBuyBack");
            this.m_BuyPrice     = serializedObject.FindProperty("m_BuyPrice");
            this.m_BuyCurrency  = serializedObject.FindProperty("m_BuyCurrency");
            this.m_SellPrice    = serializedObject.FindProperty("m_SellPrice");
            this.m_SellCurrency = serializedObject.FindProperty("m_SellCurrency");
            #endregion

            this.m_Stack    = serializedObject.FindProperty("m_Stack");
            this.m_MaxStack = serializedObject.FindProperty("m_MaxStack");

            #region Drop
            this.m_IsDroppable     = serializedObject.FindProperty("m_IsDroppable");
            this.m_DropSound       = serializedObject.FindProperty("m_DropSound");
            this.m_OverridePrefab  = serializedObject.FindProperty("m_OverridePrefab");
            this.m_IsDroppable     = serializedObject.FindProperty("m_IsDroppable");
            this.m_ShowDropOptions = new AnimBool(this.m_IsDroppable.boolValue);
            this.m_ShowDropOptions.valueChanged.AddListener(new UnityAction(Repaint));
            #endregion

            this.m_Properties = serializedObject.FindProperty("properties");

            this.m_PropertyList = new ReorderableList(serializedObject, this.m_Properties, true, true, true, true);
            this.m_PropertyList.elementHeight      = (EditorGUIUtility.singleLineHeight + 4f) * 3;
            this.m_PropertyList.drawHeaderCallback = (Rect rect) => {
                EditorGUI.LabelField(rect, "Item Properties");
                Event ev = Event.current;
                if (ev.type == EventType.MouseDown && ev.button == 1 && rect.Contains(ev.mousePosition))
                {
                    GenericMenu menu = new GenericMenu();
                    menu.AddItem(new GUIContent("Copy"), false, delegate {
                        ObjectProperty[] properties = (target as Item).GetProperties();
                        foreach (ObjectProperty property in properties)
                        {
                            ObjectProperty clone = new ObjectProperty();
                            FieldInfo[] fields   = typeof(ObjectProperty).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                            foreach (FieldInfo field in fields)
                            {
                                field.SetValue(clone, field.GetValue(property));
                            }
                            copy.Add(clone);
                        }
                    });
                    if (copy != null && copy.Count > 0)
                    {
                        menu.AddItem(new GUIContent("Paste"), false, delegate {
                            (target as Item).SetProperties(copy.ToArray());
                        });
                    }
                    else
                    {
                        menu.AddDisabledItem(new GUIContent("Paste"));
                    }
                    menu.ShowAsContext();
                }
            };

            this.m_PropertyList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => {
                Rect mRect   = new Rect(rect);
                var  element = m_PropertyList.serializedProperty.GetArrayElementAtIndex(index);
                rect.y     += 2;
                rect.height = EditorGUIUtility.singleLineHeight;
                rect.width -= 17;
                EditorGUI.PropertyField(rect, element.FindPropertyRelative("name"));
                rect.x += rect.width + 2;
                rect.y -= 2f;
                EditorGUI.PropertyField(rect, element.FindPropertyRelative("show"), GUIContent.none);
                rect.y     += 2f;
                rect.x     -= rect.width + 2;
                rect.width += 17;
                rect.y     += EditorGUIUtility.singleLineHeight + 2;
                float width = rect.width;
                rect.width = EditorGUIUtility.labelWidth - 2f;                //148f;
                SerializedProperty typeIndex = element.FindPropertyRelative("typeIndex");
                typeIndex.intValue = EditorGUI.Popup(rect, typeIndex.intValue, ObjectProperty.DisplayNames);
                rect.x            += rect.width + 2f;
                rect.width         = width - EditorGUIUtility.labelWidth;

                EditorGUI.PropertyField(rect, element.FindPropertyRelative(ObjectProperty.GetPropertyName(ObjectProperty.SupportedTypes [typeIndex.intValue])), GUIContent.none);
                rect.y    += EditorGUIUtility.singleLineHeight + 2;
                rect.x     = mRect.x;
                rect.width = mRect.width;
                EditorGUI.PropertyField(rect, element.FindPropertyRelative("color"));
            };


            #region Crafting
            this.m_IsCraftable           = serializedObject.FindProperty("m_IsCraftable");
            this.m_CraftingDuration      = serializedObject.FindProperty("m_CraftingDuration");
            this.m_CraftingAnimatorState = serializedObject.FindProperty("m_CraftingAnimatorState");

            this.m_ShowCraftOptions = new AnimBool(this.m_IsCraftable.boolValue);
            this.m_ShowCraftOptions.valueChanged.AddListener(new UnityAction(Repaint));

            this.m_UseCraftingSkill            = serializedObject.FindProperty("m_UseCraftingSkill");
            this.m_ShowSkillOptions            = new AnimBool(this.m_UseCraftingSkill.boolValue);
            this.m_SkillWindow                 = serializedObject.FindProperty("m_SkillWindow");
            this.m_CraftingSkill               = serializedObject.FindProperty("m_CraftingSkill");
            this.m_MinCraftingSkillValue       = serializedObject.FindProperty("m_MinCraftingSkillValue");
            this.m_RemoveIngredientsWhenFailed = serializedObject.FindProperty("m_RemoveIngredientsWhenFailed");

            this.m_CraftingModifier = serializedObject.FindProperty("m_CraftingModifier");
            CreateModifierList("Crafting Item Modifers", serializedObject, this.m_CraftingModifier);

            this.m_Ingredients    = serializedObject.FindProperty("ingredients");
            this.m_IngredientList = new ReorderableList(serializedObject, this.m_Ingredients, true, true, true, true);
            this.m_IngredientList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => {
                var element = this.m_IngredientList.serializedProperty.GetArrayElementAtIndex(index);
                SerializedProperty itemProperty = element.FindPropertyRelative("item");
                rect.y     += 2;
                rect.height = EditorGUIUtility.singleLineHeight;
                rect.width -= 55f;
                EditorGUI.PropertyField(rect, itemProperty, GUIContent.none);
                rect.x    += rect.width + 5;
                rect.width = 50f;
                SerializedProperty amount = element.FindPropertyRelative("amount");
                EditorGUI.PropertyField(rect, amount, GUIContent.none);
                amount.intValue = Mathf.Clamp(amount.intValue, 1, int.MaxValue);
            };
            this.m_IngredientList.drawHeaderCallback = (Rect rect) => {
                EditorGUI.LabelField(rect, "Ingredients (Item, Amount)");
            };
            #endregion

            List <string> propertiesToExclude = new List <string>()
            {
                this.m_Script.propertyPath,
                this.m_ItemName.propertyPath,
                this.m_ItemDisplayName.propertyPath,
                this.m_UseItemNameAsDisplayName.propertyPath,
                this.m_Icon.propertyPath,
                this.m_Prefab.propertyPath,
                this.m_Description.propertyPath,
                this.m_Category.propertyPath,
                this.m_BuyPrice.propertyPath,
                this.m_BuyCurrency.propertyPath,
                this.m_SellPrice.propertyPath,
                this.m_SellCurrency.propertyPath,
                this.m_Stack.propertyPath,
                this.m_MaxStack.propertyPath,
                this.m_IsDroppable.propertyPath,
                this.m_DropSound.propertyPath,
                this.m_OverridePrefab.propertyPath,
                this.m_IsCraftable.propertyPath,
                this.m_CraftingDuration.propertyPath,
                this.m_CraftingAnimatorState.propertyPath,
                this.m_Ingredients.propertyPath,
                this.m_Properties.propertyPath,
                this.m_IsSellable.propertyPath,
                this.m_CraftingModifier.propertyPath,
                this.m_CraftingSkill.propertyPath,
                this.m_UseCraftingSkill.propertyPath,
                this.m_SkillWindow.propertyPath,
                this.m_RemoveIngredientsWhenFailed.propertyPath,
                this.m_MinCraftingSkillValue.propertyPath,
                this.m_CanBuyBack.propertyPath,
            };


            Type[] subInspectors = Utility.BaseTypesAndSelf(GetType()).Where(x => x.IsSubclassOf(typeof(ItemInspector))).ToArray();
            Array.Reverse(subInspectors);
            for (int i = 0; i < subInspectors.Length; i++)
            {
                MethodInfo  method          = subInspectors[i].GetMethod("DrawInspector", BindingFlags.NonPublic | BindingFlags.Instance);
                Type        inspectedType   = typeof(CustomEditor).GetField("m_InspectedType", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(subInspectors[i].GetCustomAttribute <CustomEditor>()) as Type;
                FieldInfo[] fields          = inspectedType.GetAllSerializedFields().Where(x => !x.HasAttribute(typeof(HideInInspector))).ToArray();
                string[]    classProperties = fields.Where(x => x.DeclaringType == inspectedType).Select(x => x.Name).ToArray();
                if (!this.m_ClassProperties.ContainsKey(inspectedType))
                {
                    this.m_ClassProperties.Add(inspectedType, classProperties);
                }
                propertiesToExclude.AddRange(classProperties);
                if (method != null)
                {
                    m_DrawInspectors.Add(delegate { method.Invoke(this, null); });
                }
                else
                {
                    m_DrawInspectors.Add(delegate() {
                        for (int j = 0; j < classProperties.Length; j++)
                        {
                            SerializedProperty property = serializedObject.FindProperty(classProperties[j]);
                            EditorGUILayout.PropertyField(property);
                        }
                    });
                }
            }

            this.m_PropertiesToExcludeForChildClasses = propertiesToExclude.ToArray();
        }
Пример #28
0
 private void SetAnimBool(string contentID, bool target)
 {
     AnimBool @bool;
     if (!this.m_AnimBools.ContainsKey(contentID))
     {
         @bool = new AnimBool();
         this.m_AnimBools.Add(contentID, @bool);
     }
     else
     {
         @bool = this.m_AnimBools[contentID];
     }
     @bool.target = target;
 }
Пример #29
0
 void DrawAnimatedPopup(SerializedProperty prop, GUIContent content, string[] options, AnimBool animation)
 {
     using (var group = new EditorGUILayout.FadeGroupScope(animation.faded))
         if (group.visible)
         {
             CoreEditorUtils.DrawPopup(content, prop, options);
         }
 }
        private void DrawPropertyIndex(Guid id, ThemeTargetEditorUtils.SelectionState selectionState, AnimBool animBool)
        {
            GUILayout.Space(DGUI.Properties.Space(2));
            int  propertyIndex    = m_theme.GetSpritePropertyIndex(id);
            bool propertyNotFound = id == Guid.Empty || propertyIndex == -1;

            DGUI.Bar.Draw(selectionState + (propertyNotFound
                                              ? ""
                                              : ": " + m_theme.SpriteLabels[propertyIndex].Label),
                          Size.L, DGUI.Bar.Caret.CaretType.Caret, ComponentColorName, animBool);

            if (DGUI.FoldOut.Begin(animBool))
            {
                GUILayout.Space(DGUI.Properties.Space(2));
                if (propertyNotFound)
                {
                    ThemeTargetEditorUtils.DrawLabelNoPropertyFound();
                }
                else
                {
                    DrawSpriteProperties(m_theme, propertyIndex, selectionState);
                }
            }

            DGUI.FoldOut.End(animBool);
        }
        public override void OnEnable()
        {
            useSceneSettings = FindParameterOverride(x => x.useSceneSettings);
            fogMode          = FindParameterOverride(x => x.fogMode);
            fogDensity       = FindParameterOverride(x => x.globalDensity);
            fogStartDistance = FindParameterOverride(x => x.fogStartDistance);
            fogDensity       = FindParameterOverride(x => x.globalDensity);
            fogEndDistance   = FindParameterOverride(x => x.fogEndDistance);
            colorMode        = FindParameterOverride(x => x.colorSource);
#if SCPE_DEV
            skyboxMipLevel = FindParameterOverride(x => x.skyboxMipLevel);
#endif
            fogColor                = FindParameterOverride(x => x.fogColor);
            fogColorGradient        = FindParameterOverride(x => x.fogColorGradient);
            gradientDistance        = FindParameterOverride(x => x.gradientDistance);
            gradientUseFarClipPlane = FindParameterOverride(x => x.gradientUseFarClipPlane);
            distanceFog             = FindParameterOverride(x => x.distanceFog);
            distanceDensity         = FindParameterOverride(x => x.distanceDensity);
            useRadialDistance       = FindParameterOverride(x => x.useRadialDistance);
            heightFog               = FindParameterOverride(x => x.heightFog);
            height              = FindParameterOverride(x => x.height);
            heightDensity       = FindParameterOverride(x => x.heightDensity);
            heightFogNoise      = FindParameterOverride(x => x.heightFogNoise);
            heightNoiseTex      = FindParameterOverride(x => x.heightNoiseTex);
            heightNoiseSize     = FindParameterOverride(x => x.heightNoiseSize);
            heightNoiseStrength = FindParameterOverride(x => x.heightNoiseStrength);
            heightNoiseSpeed    = FindParameterOverride(x => x.heightNoiseSpeed);

            skyboxInfluence = FindParameterOverride(x => x.skyboxInfluence);

            enableDirectionalLight = FindParameterOverride(x => x.enableDirectionalLight);
            useLightDirection      = FindParameterOverride(x => x.useLightDirection);
            useLightColor          = FindParameterOverride(x => x.useLightColor);
            useLightIntensity      = FindParameterOverride(x => x.useLightIntensity);
            lightColor             = FindParameterOverride(x => x.lightColor);
            lightDirection         = FindParameterOverride(x => x.lightDirection);
            lightIntensity         = FindParameterOverride(x => x.lightIntensity);


            lightScattering  = FindParameterOverride(x => x.lightScattering);
            scatterIntensity = FindParameterOverride(x => x.scatterIntensity);
            scatterDiffusion = FindParameterOverride(x => x.scatterDiffusion);
            scatterThreshold = FindParameterOverride(x => x.scatterThreshold);
            scatterSoftKnee  = FindParameterOverride(x => x.scatterSoftKnee);


            m_showControls = new AnimBool(true);
            m_showControls.valueChanged.AddListener(Repaint);
            m_showControls.speed = animSpeed;

            m_showHeight = new AnimBool(true);
            m_showHeight.valueChanged.AddListener(Repaint);
            m_showHeight.speed = animSpeed;

            m_showSun = new AnimBool(true);
            m_showSun.valueChanged.AddListener(Repaint);
            m_showSun.speed = animSpeed;

            m_showScattering = new AnimBool(true);
            m_showScattering.valueChanged.AddListener(Repaint);
            m_showScattering.speed = animSpeed;
        }
 private void DrawUnityEvent(AnimBool expanded, SerializedProperty property, string propertyName, int eventsCount)
 {
     DGUI.Bar.Draw(propertyName, NORMAL_BAR_SIZE, DGUI.Bar.Caret.CaretType.Caret, ComponentColorName, expanded);
     DGUI.Property.UnityEventWithFade(property, expanded, propertyName, ComponentColorName, eventsCount, true, true);
 }
Пример #33
0
 private bool defalutTitle(string Title, GUIStyle style, GUILayoutOption[] options, AnimBool extend)
 {
     extend.target = GUILayout.Toggle(extend.target, Title, style, options);
     return(extend.target);
 }
Пример #34
0
 void OnEnable()
 {
     m_ShowExtraFields = new AnimBool(true);
     m_ShowExtraFields.valueChanged.AddListener(new UnityAction(base.Repaint));
 }
Пример #35
0
    void printSettingsGUI(SerializedObject serializedObject, string prefix = PiXYZSettings.serializePrefix, string fileExt = "", GameObject gameObject = null)
    {
        serializedObject.Update();

        int  winId       = serializedObject.FindProperty("windowId").intValue;
        bool isInspector = serializedObject.FindProperty("isInspector") != null?serializedObject.FindProperty("isInspector").boolValue : false;

        string  tt = "";
        Vector2 scrollViewPosition;

        int focusId = EditorWindow.focusedWindow != null?EditorWindow.focusedWindow.GetInstanceID() : lastFocusedId;

        if (winId != focusId)
        {
            winId = 0;
        }
        if (!g_scrollViewPosition.ContainsKey(winId))   //winId = 0 is shared
        {
            scrollViewPosition          = new Vector2(0, 0);
            g_scrollViewPosition[winId] = scrollViewPosition;
        }
        else
        {
            scrollViewPosition = g_scrollViewPosition[winId];
        }
        if (!UvAnim.ContainsKey(winId) && winId != 0)
        {
            UvAnim[winId] = new AnimBool(false);
            UvAnim[winId].valueChanged.AddListener(EditorWindow.focusedWindow.Repaint);
        }
        if (!lodAnim.ContainsKey(winId) && winId != 0)
        {
            lodAnim[winId] = new AnimBool(false);
            lodAnim[winId].valueChanged.AddListener(EditorWindow.focusedWindow.Repaint);
        }
        if (!advancedToggle.ContainsKey(winId))
        {
            advancedToggle[winId] = false;
        }

        SerializedProperty serializedProperty = serializedObject.FindProperty(prefix);

        int lastShown = 0;

        scrollViewPosition = GUILayout.BeginScrollView(scrollViewPosition, GUILayout.MaxHeight(Screen.height - 30));
        {
            g_scrollViewPosition[winId] = scrollViewPosition;
            EditorGUI.indentLevel       = 0;
            EditorGUILayout.BeginVertical();
            {
                GUILayout.Space(10);
                tt = "Use the following settings to adapt the imported model’s units/transforms to Unity3D’s units/coordinate system (meters/left-handed).\n\nDefault settings change a millimeters / Z-up axis scene to Unity configuration.";
                beginGroupBox("Coordinate System", isInspector, tt);
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.BeginHorizontal();
                    {
                        tt = PiXYZUtils.getTooltipText <PiXYZSettings>("scaleFactor");
                        EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("scaleFactor"), new GUIContent("Scale", tt));
                        GUILayout.Space(10);
                    }
                    EditorGUILayout.EndHorizontal();
                    tt = PiXYZUtils.getTooltipText <PiXYZSettings>("isRightHanded");
                    EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("isRightHanded"), new GUIContent("Right Handed", tt));
                    tt = PiXYZUtils.getTooltipText <PiXYZSettings>("isZUp");
                    EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("isZUp"), new GUIContent("Z-up", tt));
                    EditorGUILayout.Space();
                }
                endGroupBox();

                if (!isPiXYZExt(fileExt))
                {
                    GUILayout.Space(10);
                    tt = "Choose one of the following mode to optimize the imported model’s hierarchy (or tree)\n\n\nNone: No modification of the hierarchy (default mode)\n\nClean-up intermediary nodes: Compresses the hierarchy by removing empty nodes, or any node containing only one sub-node.\n\nTransfer all objects under root: Simplifies the hierarchy by transferring all imported 3D objects (or GameObject) under the root node.";
                    beginGroupBox("Hierarchy Optimization", isInspector, tooltip: tt);
                    {
                        tt = PiXYZUtils.getTooltipText <PiXYZSettings>("treeProcess");
                        EditorGUILayout.Space();
                        EditorGUILayout.BeginHorizontal();
                        {
                            GUILayout.Space(20);
                            float width = GUI.skin.label.CalcSize(new GUIContent("Quality")).x;
                            GUILayout.Label("Mode", GUILayout.Width(width));
                            List <string> propertyNames = new List <string>(3);
                            propertyNames.Add("None");
                            propertyNames.Add("Clean-up intermediary nodes");
                            propertyNames.Add("Transfer all objects under root");
                            propertyNames.Add("Merge all objects");
                            propertyNames.Add("Merge objects by material");
                            List <int> intValue = new List <int>(3);
                            intValue.Add(0);
                            intValue.Add(1);
                            intValue.Add(2);
                            intValue.Add(3);
                            intValue.Add(4);
                            width = (float)Math.Truncate(Screen.width * 0.6);
                            Rect rect = EditorGUILayout.GetControlRect();
                            rect.width = width;
                            GUILayout.FlexibleSpace();
                            serializedProperty.FindPropertyRelative("treeProcess").intValue = EditorGUI.IntPopup(rect, serializedProperty.FindPropertyRelative("treeProcess").intValue, propertyNames.ToArray(), intValue.ToArray());
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }
                    endGroupBox();
                    GUILayout.Space(10);
                    if (!serializedObject.FindProperty("settings.useLods").boolValue)
                    {
                        tt = "Choose the quality level (preset) for the imported model.\nQuality defines the density of the mesh that PiXYZ creates.\nDepending if you import a CAD model (exact geometry) or a mesh model (tessellated geometry), PiXYZ will either perform a Tessellation or a Decimation on the model (see documentation for more information and presets details).";
                        beginGroupBox("Mesh Quality", isInspector, tooltip: tt);
                        {
                            EditorGUILayout.Space();
                            EditorGUILayout.BeginHorizontal();
                            {
                                GUILayout.Space(20);
                                tt = PiXYZUtils.getTooltipText <PiXYZLODSettings>("preset");
                                GUILayout.Label(new GUIContent("Quality", tt));
                                int width = (int)(Math.Truncate(Screen.width * 0.5));
                                EditorGUILayout.PropertyField(serializedObject.FindProperty("settings.lodSettings").GetArrayElementAtIndex(0).FindPropertyRelative("preset"), GUIContent.none, GUILayout.Width(width));
                                EditorGUILayout.BeginHorizontal();
                                {
                                    GUILayout.Space(5);
                                    GUILayout.Label("Use LODs");
                                    EditorGUILayout.PropertyField(serializedObject.FindProperty("settings.useLods"), GUIContent.none, GUILayout.Width(40));
                                }
                                EditorGUILayout.EndHorizontal();
                                GUILayout.FlexibleSpace();
                            }
                            EditorGUILayout.EndHorizontal();
                            EditorGUILayout.Space();
                        }
                        endGroupBox();
                    }
                    else
                    {
                        pixyzLods.printLoDSlider(serializedObject, prefix, winId, serializedProperty.FindPropertyRelative("treeProcess").intValue < 3, gameObject);
                    }
                    GUILayout.Space(10);
                    beginGroupBox("Post Process", isInspector, tooltip: "Generate UV : Use this setting to add a new primary UV set (channel #0). Set the size of the projection box used to create UVs.\n\nCaution: PiXYZ will override the existing UV set, do not Use this setting if you wish to preserve the UVs embedded in the imported model.\n\nOrient… : Use this setting for PiXYZ to perform a unification of all triangles orientation.\n\nCaution: Do not Use this setting if the imported model is a mesh (tessellated geometry) and is already correctly oriented.");
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            tt = PiXYZUtils.getTooltipText <PiXYZSettings>("mapUV");
                            EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("mapUV"), GUIContent.none, true, GUILayout.Width(40));
                            GUILayout.Label(new GUIContent("Generate UV (size)", tt));
                            //GUILayout.FlexibleSpace();
                            EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("mapUV3dSize"), GUIContent.none, true, GUILayout.Width(100));
                            GUILayout.Label(new GUIContent("millimeters", tt));
                            serializedProperty.FindPropertyRelative("mapUV3dSize").floatValue = Mathf.Clamp(serializedProperty.FindPropertyRelative("mapUV3dSize").floatValue, 1.0f, 1000f);
                            GUILayout.Space(10);
                        }
                        EditorGUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        {
                            tt = PiXYZUtils.getTooltipText <PiXYZSettings>("orient");
                            EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("orient"), GUIContent.none, true, GUILayout.Width(40));
                            GUILayout.Label(new GUIContent("Orient normals of adjacent faces consistently", tt), GUILayout.ExpandWidth(true));
                            GUILayout.FlexibleSpace();
                        }
                        GUILayout.EndHorizontal();
                    }
                    endGroupBox();

                    GUILayout.Space(10);
                    bool before = advancedToggle[winId];
                    advancedToggle[winId] = EditorGUILayout.Foldout(advancedToggle[winId], "Advanced", true);
                    if (advancedToggle[winId])
                    {
                        if (!before)
                        {
                            g_scrollViewPosition[winId] = new Vector2(0, Screen.height);
                        }
                        GUILayout.Space(10);
                        EditorGUI.indentLevel++;
                        string version = InternalEditorUtility.GetFullUnityVersion();
                        version = version.Substring(0, version.LastIndexOf('.'));
                        if (float.Parse(version) >= 2017.3)    //Cannot change before 2017.3
                        {
                            EditorGUI.BeginDisabledGroup(isInspector);
                            {
                                EditorGUILayout.BeginHorizontal();
                                {
                                    GUILayout.Space(10);
                                    tt = PiXYZUtils.getTooltipText <PiXYZSettings>("useMergeFinalAssemblies");
                                    serializedProperty.FindPropertyRelative("useMergeFinalAssemblies").boolValue = EditorGUILayout.Toggle(serializedProperty.FindPropertyRelative("useMergeFinalAssemblies").boolValue, GUILayout.Width(40));
                                    GUILayout.Label(new GUIContent("Stitch unconnected surfaces", tt));
                                    GUILayout.FlexibleSpace();
                                }
                                EditorGUILayout.EndHorizontal();
                                EditorGUILayout.BeginHorizontal();
                                {
                                    GUILayout.Space(10);
                                    tt = PiXYZUtils.getTooltipText <PiXYZSettings>("splitTo16BytesIndex");
                                    serializedProperty.FindPropertyRelative("splitTo16BytesIndex").boolValue = EditorGUILayout.Toggle(serializedProperty.FindPropertyRelative("splitTo16BytesIndex").boolValue, GUILayout.Width(40));
                                    GUILayout.Label(new GUIContent("Split to limit vertex count per mesh", tt));
                                    GUILayout.FlexibleSpace();
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            EditorGUI.EndDisabledGroup();
                        }
                        EditorGUILayout.Space();
                    }
                    EditorGUILayout.EndFadeGroup();
                    Rect boxRect = GUILayoutUtility.GetLastRect();
                    lastShown = (int)(boxRect.y + boxRect.height);
                }
            }
            EditorGUILayout.EndVertical();
        }
        GUILayout.EndScrollView();
        Rect scrollRect     = GUILayoutUtility.GetLastRect();
        int  gradientHeight = 15;

        //up
        if (scrollViewPosition.y > 0f)
        {
            PiXYZUtils.gradientBox(new Rect(scrollRect.x, scrollRect.y, scrollRect.width, gradientHeight), new Vector2(0.5f, 1f));
        }
        //down
        if (scrollViewPosition.y < (lastShown - scrollRect.height))
        {
            PiXYZUtils.gradientBox(new Rect(scrollRect.x, scrollRect.y + scrollRect.height - gradientHeight, scrollRect.width, gradientHeight), new Vector2(0.5f, 0f));
        }
    }
Пример #36
0
        protected override void InitAnimBool()
        {
            base.InitAnimBool();

            m_animateValueExpanded = GetAnimBool(m_animateValue.propertyPath, m_animateValue.boolValue);
        }
Пример #37
0
        private void OnEnable()
        {
            scrollSnap = (DirectionalScrollSnap)target;

            content              = serializedObject.FindProperty("m_Content");
            movementDirection    = serializedObject.FindProperty("m_MovementDirection");
            lockOtherDirection   = serializedObject.FindProperty("m_LockOtherDirection");
            movementType         = serializedObject.FindProperty("m_MovementType");
            simulateFlings       = serializedObject.FindProperty("m_SimulateFlings");
            friction             = serializedObject.FindProperty("m_Friction");
            snapType             = serializedObject.FindProperty("m_SnapType");
            interpolator         = serializedObject.FindProperty("m_InterpolatorType");
            tension              = serializedObject.FindProperty("m_Tension");
            scrollSensitivity    = serializedObject.FindProperty("m_ScrollSensitivity");
            scrollDelay          = serializedObject.FindProperty("m_ScrollDelay");
            minDuration          = serializedObject.FindProperty("m_MinDuration");
            maxDuration          = serializedObject.FindProperty("m_MaxDuration");
            addToCalculateFilter = serializedObject.FindProperty("m_AddInactiveChildrenToCalculatingFilter");
            calculateFilterMode  = serializedObject.FindProperty("m_FilterModeForCalculatingSize");
            calculateFilter      = serializedObject.FindProperty("m_CalculatingFilter");
            addToSnapFilter      = serializedObject.FindProperty("m_AddInactiveChildrenToSnapPositionsFilter");
            snapFilterMode       = serializedObject.FindProperty("m_FilterModeForSnapPositions");
            snapFilter           = serializedObject.FindProperty("m_SnapPositionsFilter");
            viewPort             = serializedObject.FindProperty("m_Viewport");
            horizScrollBar       = serializedObject.FindProperty("m_HorizontalScrollbar");
            vertScrollBar        = serializedObject.FindProperty("m_VerticalScrollbar");
            backButton           = serializedObject.FindProperty("m_BackButton");
            forwardButton        = serializedObject.FindProperty("m_ForwardButton");
            loop                    = serializedObject.FindProperty("m_Loop");
            endSpacing              = serializedObject.FindProperty("m_EndSpacing");
            onValueChanged          = serializedObject.FindProperty("m_OnValueChanged");
            startMovement           = serializedObject.FindProperty("m_StartMovementEvent");
            closestItemChanged      = serializedObject.FindProperty("m_ClosestSnapPositionChanged");
            snappedToItem           = serializedObject.FindProperty("m_SnappedToItem");
            targetItemSelected      = serializedObject.FindProperty("m_TargetItemSelected");
            drawGizmos              = serializedObject.FindProperty("m_DrawGizmos");
            buttonAnimationDuration = serializedObject.FindProperty("m_ButtonAnimationDuration");
            buttonItemsToMoveBy     = serializedObject.FindProperty("m_ButtonItemsToMoveBy");
            buttonInterpolator      = serializedObject.FindProperty("m_ButtonInterpolator");
            scrollFriction          = serializedObject.FindProperty("m_ScrollFriction");
            scrollInterpolator      = serializedObject.FindProperty("m_ScrollInterpolator");
            scrollBarFriction       = serializedObject.FindProperty("m_ScrollBarFriction");
            scrollBarInterpolator   = serializedObject.FindProperty("m_ScrollBarInterpolator");
            buttonTension           = serializedObject.FindProperty("m_ButtonTension");
            scrollBarTension        = serializedObject.FindProperty("m_ScrollBarTension");
            scrollTension           = serializedObject.FindProperty("m_ScrollTension");
            allowTouch              = serializedObject.FindProperty("m_AllowTouchInput");
            startItem               = serializedObject.FindProperty("m_StartItem");
            alwaysGoToEnd           = serializedObject.FindProperty("m_ButtonAlwaysGoToEnd");

            showScrollDelay = new AnimBool(scrollSensitivity.floatValue != 0);
            showScrollDelay.valueChanged.AddListener(Repaint);
            showCalculateError = new AnimBool(calculateFilterMode.enumValueIndex == (int)DirectionalScrollSnap.FilterMode.WhiteList && calculateFilter.arraySize == 0);
            showCalculateError.valueChanged.AddListener(Repaint);
            showSnapError = new AnimBool(snapFilterMode.enumValueIndex == (int)DirectionalScrollSnap.FilterMode.WhiteList && snapFilter.arraySize == 0);
            showSnapError.valueChanged.AddListener(Repaint);
            showTension = new AnimBool(ShowTension(interpolator.enumValueIndex));
            showTension.valueChanged.AddListener(Repaint);
            showButtonTension = new AnimBool(ShowTension(buttonInterpolator.enumValueIndex));
            showButtonTension.valueChanged.AddListener(Repaint);
            showScrollBarTension = new AnimBool(ShowTension(scrollBarInterpolator.enumValueIndex));
            showScrollBarTension.valueChanged.AddListener(Repaint);
            showScrollTension = new AnimBool(ShowTension(scrollInterpolator.enumValueIndex));
            showScrollTension.valueChanged.AddListener(Repaint);
            showDrawGizmos = new AnimBool(scrollSnap.content != null);
            showDrawGizmos.valueChanged.AddListener(Repaint);
            showEndSpacing = new AnimBool(loop.boolValue);
            showEndSpacing.valueChanged.AddListener(Repaint);

            CheckMatching();
        }
Пример #38
0
            public static float Draw(Rect rect, List <Button> buttons, GUIStyle backgroundStyle, Color backgroundColor, Color defaultIconColor, AnimBool expanded, Vector2 mousePosition, bool leftMouseButtonDown)
            {
                Color initialColor = GUI.color;

                GUI.color = backgroundColor;
                GUI.Box(rect, GUIContent.none, backgroundStyle);
                GUI.color = initialColor;

                float toolbarWidth = DoozyWindowSettings.Instance.DynamicToolbarPadding;

                foreach (Button button in buttons)
                {
                    var buttonRect = new Rect(rect.x + toolbarWidth,
                                              rect.y,
                                              DoozyWindowSettings.Instance.DynamicToolbarButtonWidth,
                                              DoozyWindowSettings.Instance.DynamicToolbarButtonHeight);

                    DrawButton(buttonRect, button, defaultIconColor, expanded, mousePosition, leftMouseButtonDown);
                    toolbarWidth += DoozyWindowSettings.Instance.DynamicToolbarButtonWidth;
                    toolbarWidth += DoozyWindowSettings.Instance.DynamicToolbarButtonSpacing;
                }

                toolbarWidth -= DoozyWindowSettings.Instance.DynamicToolbarButtonSpacing;
                toolbarWidth += DoozyWindowSettings.Instance.DynamicToolbarPadding;

                GUI.color = initialColor;
                return(toolbarWidth);
            }
Пример #39
0
    private void Init()
    {
        networkingFoldout   = new AnimBool(true);
        easyControls        = new AnimBool(true);
        easyControls.target = true;

        _editorStyle = new GUIStyle();
        _editorStyle.normal.textColor = Color.white;
        _editorStyle.fontStyle        = FontStyle.Bold;
        _editorStyle.alignment        = TextAnchor.UpperCenter;

        Texture2D btnUp = Resources.Load <Texture2D>("HoverIdle");

        var dummy = Target;

        if (dummy.TweenData == null)
        {
            dummy.TweenData = new Tweens();
            //  Debug.Log("Hey Target is null");
        }
        _editorButtons = new List <EditorDisplayButton>();

        CustomButtonStyle buttonStyle = new CustomButtonStyle("Position Tween", btnUp, btnUp, null, 175);

        PositionTweenButton positionButton = new PositionTweenButton(buttonStyle);

        positionButton.Initialize(ActingType.Position, Target, Target.TweenData.IsPosition, Target.TweenData.sPosition.Time, "",
                                  (val) =>
        {
            Target.TweenData.IsPosition = val;
        },
                                  (val) =>
        {
            Target.TweenData.sPosition.Time = val;
        });


        _editorButtons.Add(positionButton);



        CustomButtonStyle sbuttonStyle = new CustomButtonStyle("Scale Tween", btnUp, btnUp, null, 175);

        PositionTweenButton scaleButton = new PositionTweenButton(sbuttonStyle);

        scaleButton.Initialize(ActingType.Scale, Target, Target.TweenData.IsScale, Target.TweenData.sScale.Time, string.Empty,
                               (val) =>
        {
            Target.TweenData.IsScale = val;
        },
                               (val) =>
        {
            Target.TweenData.sScale.Time = val;
        });


        _editorButtons.Add(scaleButton);



        CustomButtonStyle rbuttonStyle = new CustomButtonStyle("Rotation Tween", btnUp, btnUp, null, 175);

        PositionTweenButton rotationButton = new PositionTweenButton(rbuttonStyle);

        rotationButton.Initialize(ActingType.Rotation, Target, Target.TweenData.IsRotation, Target.TweenData.sRotation.Time, string.Empty,
                                  (val) =>
        {
            Target.TweenData.IsRotation = val;
        },
                                  (val) =>
        {
            Target.TweenData.sRotation.Time = val;
        });


        _editorButtons.Add(rotationButton);
    }
Пример #40
0
            private static void DrawButton(Rect rect, Button button, Color defaultIconColor, AnimBool expanded, Vector2 mousePosition, bool leftMouseButtonDown)
            {
                Color initialColor = GUI.color;
                Color buttonColor  = defaultIconColor.WithAlpha(expanded.faded * 0.8f); //normal button color

                rect.y = rect.y - rect.height * (1 - expanded.faded);

                const float padding = 8;


                if (rect.Contains(mousePosition))
                {
                    buttonColor = button.HoverColor.WithAlpha(expanded.faded * (leftMouseButtonDown ? 0.7f : 1f)); //hover button color

                    if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
                    {
                        if (button.Callback == null)
                        {
                            DDebug.LogError("Dynamic Toolbar button has no callback set!");
                        }
                        else
                        {
                            button.Callback.Invoke();
                            Event.current.Use();
                        }
                    }
                }

                var iconRect = new Rect(rect.x + rect.width / 2 - DoozyWindowSettings.Instance.DynamicToolbarButtonIconSize / 2 * expanded.faded,
                                        rect.y + padding,
                                        DoozyWindowSettings.Instance.DynamicToolbarButtonIconSize * expanded.faded,
                                        DoozyWindowSettings.Instance.DynamicToolbarButtonIconSize * expanded.faded);

                var buttonNameRect = new Rect(rect.x + padding,
                                              iconRect.y + iconRect.height,
                                              rect.width - padding * 2,
                                              rect.height - padding - iconRect.height);

                GUI.color = buttonColor;
                GUI.Box(iconRect, GUIContent.none, button.ButtonStyle);
                GUI.color = initialColor;

                GUI.Label(buttonNameRect, new GUIContent(button.ButtonName), new GUIStyle(GUI.skin.label)
                {
                    normal    = { textColor = buttonColor },
                    alignment = TextAnchor.MiddleCenter,
                    fontSize  = 9
                });
            }
Пример #41
0
        void OnEnable()
        {
            m_RenderMode    = serializedObject.FindProperty("m_RenderMode");
            m_Camera        = serializedObject.FindProperty("m_Camera");
            m_PixelPerfect  = serializedObject.FindProperty("m_PixelPerfect");
            m_PlaneDistance = serializedObject.FindProperty("m_PlaneDistance");

            m_SortingLayerID                   = serializedObject.FindProperty("m_SortingLayerID");
            m_SortingOrder                     = serializedObject.FindProperty("m_SortingOrder");
            m_TargetDisplay                    = serializedObject.FindProperty("m_TargetDisplay");
            m_OverrideSorting                  = serializedObject.FindProperty("m_OverrideSorting");
            m_PixelPerfectOverride             = serializedObject.FindProperty("m_OverridePixelPerfect");
            m_ShaderChannels                   = serializedObject.FindProperty("m_AdditionalShaderChannelsFlag");
            m_UpdateRectTransformForStandalone = serializedObject.FindProperty("m_UpdateRectTransformForStandalone");

            m_OverlayMode = new AnimBool(m_RenderMode.intValue == 0);
            m_OverlayMode.valueChanged.AddListener(Repaint);

            m_CameraMode = new AnimBool(m_RenderMode.intValue == 1);
            m_CameraMode.valueChanged.AddListener(Repaint);

            m_WorldMode = new AnimBool(m_RenderMode.intValue == 2);
            m_WorldMode.valueChanged.AddListener(Repaint);

            m_SortingOverride = new AnimBool(m_OverrideSorting.boolValue);
            m_SortingOverride.valueChanged.AddListener(Repaint);

            if (m_PixelPerfectOverride.boolValue)
            {
                pixelPerfect = m_PixelPerfect.boolValue ? PixelPerfect.On : PixelPerfect.Off;
            }
            else
            {
                pixelPerfect = PixelPerfect.Inherit;
            }

            m_AllNested   = true;
            m_AllRoot     = true;
            m_AllOverlay  = true;
            m_NoneOverlay = true;

            for (int i = 0; i < targets.Length; i++)
            {
                Canvas   canvas       = targets[i] as Canvas;
                Canvas[] parentCanvas = canvas.transform.parent != null?canvas.transform.parent.GetComponentsInParent <Canvas>(true) : null;

                if (canvas.transform.parent == null || (parentCanvas != null && parentCanvas.Length == 0))
                {
                    m_AllNested = false;
                }
                else
                {
                    m_AllRoot = false;
                }

                RenderMode renderMode = canvas.renderMode;

                if (parentCanvas != null && parentCanvas.Length > 0)
                {
                    renderMode = parentCanvas[parentCanvas.Length - 1].renderMode;
                }

                if (renderMode == RenderMode.ScreenSpaceOverlay)
                {
                    m_NoneOverlay = false;
                }
                else
                {
                    m_AllOverlay = false;
                }
            }
        }
Пример #42
0
 private void OnEnable()
 {
     m_UseTextData = new AnimBool(false);
     m_UseTextData.valueChanged.AddListener(Repaint);
 }
Пример #43
0
 public ModuleGroup(GUIContent label, UnityAction callback)
 {
     _prefsKey = "ModuleGroup_" + label.text;
     _label    = label;
     _anim     = new AnimBool(EditorPrefs.GetBool(_prefsKey, true), callback);
 }
Пример #44
0
        void InitDefineSymbols()
        {
            defineSymbolsNewPreset = new AnimBool(false, Repaint);

            selectedBuildTargetGroup           = QUtils.GetActiveBuildTargetGroup();
            previouslySelectedBuildTargetGroup = selectedBuildTargetGroup;

            selectedBuildTargetGroupIsTheActivePlatform = new AnimBool(selectedBuildTargetGroup == QUtils.GetActiveBuildTargetGroup(), Repaint);

            if (symbols == null)
            {
                symbols = new List <string>();
            }
            else
            {
                symbols.Clear();
            }
            symbols = QUtils.GetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup);
            if (presetSymbols == null)
            {
                presetSymbols = new List <string>();
            }
            else
            {
                presetSymbols.Clear();
            }
            presetSymbols.AddRange(symbols);

            presetSymbolsReordableList = new ReorderableList(presetSymbols, typeof(string), true, false, false, false)
            {
                showDefaultBackground         = false,
                drawElementBackgroundCallback = (rect, index, active, focused) => { }
            };
            presetSymbolsReordableList.drawElementCallback = (rect, index, active, focused) =>
            {
                if (index == presetSymbolsReordableList.list.Count)
                {
                    return;
                }
                float width          = WindowSettings.CurrentPageContentWidth / 2;
                int   dragBumbWidth  = 0;
                int   buttonWidth    = 16;
                int   textFieldWidth = (int)width - 20 - buttonWidth - 2 - buttonWidth;
                rect.x += dragBumbWidth;
                QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color);
                presetSymbolsReordableList.list[index] = EditorGUI.TextField(new Rect(rect.x, rect.y, textFieldWidth, EditorGUIUtility.singleLineHeight), (string)presetSymbolsReordableList.list[index]);
                QUI.ResetColors();
                rect.x += textFieldWidth;
                rect.x += 2;
                rect.y -= 1;
                if (QUI.ButtonMinus(rect))
                {
                    if (index == 0 && presetSymbolsReordableList.list.Count == 1) //is this the last list entry?
                    {
                        presetSymbolsReordableList.list[index] = "";              //yes --> add an empty entry
                    }
                    else
                    {
                        presetSymbolsReordableList.list.Remove(presetSymbolsReordableList.list[index]); //no --> remove the entry
                    }
                }
                rect.x += buttonWidth;
                rect.x += 2;
                if (QUI.ButtonPlus(rect))
                {
                    presetSymbolsReordableList.list.Insert(index, ""); //add a new empty entry
                }
            };

            selectedPresetName = DEFAULT_PRESET_NAME;
            loadedPresetName   = selectedPresetName;
            RefreshPresetNames();
        }
Пример #45
0
        protected override void OnEnable()

        {
            base.OnEnable();



            m_TextViewport = serializedObject.FindProperty("m_TextViewport");

            m_TextComponent = serializedObject.FindProperty("m_TextComponent");

            m_Text = serializedObject.FindProperty("m_Text");

            m_ContentType = serializedObject.FindProperty("m_ContentType");

            m_LineType = serializedObject.FindProperty("m_LineType");

            m_InputType = serializedObject.FindProperty("m_InputType");

            m_CharacterValidation = serializedObject.FindProperty("m_CharacterValidation");

            m_KeyboardType = serializedObject.FindProperty("m_KeyboardType");

            m_CharacterLimit = serializedObject.FindProperty("m_CharacterLimit");

            m_CaretBlinkRate = serializedObject.FindProperty("m_CaretBlinkRate");

            m_CaretWidth = serializedObject.FindProperty("m_CaretWidth");

            m_CaretColor = serializedObject.FindProperty("m_CaretColor");

            m_CustomCaretColor = serializedObject.FindProperty("m_CustomCaretColor");

            m_SelectionColor = serializedObject.FindProperty("m_SelectionColor");

            m_HideMobileInput = serializedObject.FindProperty("m_HideMobileInput");

            m_Placeholder = serializedObject.FindProperty("m_Placeholder");

            m_OnValueChanged = serializedObject.FindProperty("m_OnValueChanged");

            m_OnEndEdit = serializedObject.FindProperty("m_OnEndEdit");

            m_OnFocusLost = serializedObject.FindProperty("m_OnFocusLost");

            m_ReadOnly = serializedObject.FindProperty("m_ReadOnly");

            m_RichText = serializedObject.FindProperty("m_RichText");



            m_CustomColor = new AnimBool(m_CustomCaretColor.boolValue);

            m_CustomColor.valueChanged.AddListener(Repaint);



            // Get the UI Skin and Styles for the various Editors

            TMP_UIStyleManager.GetUIStyles();
        }
Пример #46
0
 public TextureAssistant()
 {
     extra = new AnimBool(true);
     SceneView.onSceneGUIDelegate += this.OnSceneGUI;
 }
Пример #47
0
 void OnEnable()
 {
     m_showExtraFields = new AnimBool(false);
     m_showExtraFields.valueChanged.AddListener(Repaint);
 }
Пример #48
0
        protected override void InitAnimBools()
        {
            base.InitAnimBools();

            showEnergyBars = new AnimBool(true, Repaint);
        }
Пример #49
0
 private void SetOptions(AnimBool animBool, bool initialize, bool targetValue)
 {
     if (initialize)
     {
         animBool.value = targetValue;
         animBool.valueChanged.AddListener(new UnityAction(this.Repaint));
     }
     else
     {
         animBool.target = targetValue;
     }
 }
Пример #50
0
 public InteractionSettingsPanel(SettingsWindow window)
 {
     fadePhysicsPassthroughWarning = new AnimBool(SKSGlobalRenderSettings.PhysicsPassthrough, window.Repaint);
 }
Пример #51
0
        public static bool GetObjectFoldOut(object o)
        {
            AnimBool fold = null;

            return(foldOutStates.TryGetValue(o, out fold) ? fold.target : (foldOutStates[o] = new AnimBool(false)).target);
        }
Пример #52
0
 public ImageSettingsPanel(SettingsWindow window)
 {
     fadeAggressiveRecursionWarning = new AnimBool(SKSGlobalRenderSettings.AggressiveRecursionOptimization, window.Repaint);
     fadeRecursionNumberWarning     = new AnimBool(SKSGlobalRenderSettings.RecursionNumber > 1, window.Repaint);
 }
	// This function stores the references to the variables of the target.
	void StoreReferences ()
	{
		/* -----< ASSIGNED VARIABLES >----- */
		sizeFolder = serializedObject.FindProperty( "sizeFolder" );
		buttonHighlight = serializedObject.FindProperty( "buttonHighlight" );
		tensionAccent = serializedObject.FindProperty( "tensionAccent" );
		buttonAnimator = serializedObject.FindProperty( "buttonAnimator" );
		/* ---< END ASSIGNED VARIABLES >--- */

		/* -----< SIZE AND PLACEMENT >----- */
		scalingAxis = serializedObject.FindProperty( "scalingAxis" );
		anchor = serializedObject.FindProperty( "anchor" );
		touchSize = serializedObject.FindProperty( "touchSize" );
		buttonSize = serializedObject.FindProperty( "buttonSize" );
		customSpacing_X = serializedObject.FindProperty( "customSpacing_X" );
		customSpacing_Y = serializedObject.FindProperty( "customSpacing_Y" );
		/* ---< END SIZE AND PLACEMENT >--- */

		/* -----< STYLES AND OPTIONS >----- */
		showHighlight = serializedObject.FindProperty( "showHighlight" );
		showTension = serializedObject.FindProperty( "showTension" );
		highlightColor = serializedObject.FindProperty( "highlightColor" );
		tensionColorNone = serializedObject.FindProperty( "tensionColorNone" );
		tensionColorFull = serializedObject.FindProperty( "tensionColorFull" );
		tensionFadeInDuration = serializedObject.FindProperty( "tensionFadeInDuration" );
		tensionFadeOutDuration = serializedObject.FindProperty( "tensionFadeOutDuration" );
		/* ---< END STYLES AND OPTIONS >--- */

		/* --------< TOUCH ACTION >-------- */
		tapCountOption = serializedObject.FindProperty( "tapCountOption" );
		tapCountDuration = serializedObject.FindProperty( "tapCountDuration" );
		targetTapCount = serializedObject.FindProperty( "targetTapCount" );
		tapCountEvent = serializedObject.FindProperty( "tapCountEvent" );
		useAnimation = serializedObject.FindProperty( "useAnimation" );
		useFade = serializedObject.FindProperty( "useFade" );
		fadeUntouched = serializedObject.FindProperty( "fadeUntouched" );
		fadeTouched = serializedObject.FindProperty( "fadeTouched" );
		fadeInDuration = serializedObject.FindProperty( "fadeInDuration" );
		fadeOutDuration = serializedObject.FindProperty( "fadeOutDuration" );
		/* ------< END TOUCH ACTION >------ */

		/* ------< SCRIPT REFERENCE >------ */
		referenceOption = serializedObject.FindProperty( "referenceOption" );
		buttonName = serializedObject.FindProperty( "buttonName" );
		onButtonDown = serializedObject.FindProperty( "onButtonDown" );
		onButtonUp = serializedObject.FindProperty( "onButtonUp" );
		/* ----< END SCRIPT REFERENCE >---- */

		/* // ----< ANIMATED SECTIONS >---- \\ */
		AssignedVariables = new AnimBool( EditorPrefs.GetBool( "UUI_Variables" ) );
		SizeAndPlacement = new AnimBool( EditorPrefs.GetBool( "UUI_SizeAndPlacement" ) );
		StyleAndOptions = new AnimBool( EditorPrefs.GetBool( "UUI_StyleAndOptions" ) );
		TouchActions = new AnimBool( EditorPrefs.GetBool( "UUI_TouchActions" ) );
		ScriptReference = new AnimBool( EditorPrefs.GetBool( "UUI_ScriptReference" ) );
		/* \\ --< END ANIMATED SECTIONS >-- // */

		/* // ----< ANIMATED VARIABLES >---- \\ */
		UltimateButton ult = ( UltimateButton ) target;
		highlightOption = new AnimBool( ult.showHighlight );
		tensionOption = new AnimBool( ult.showTension );
		animationOption = new AnimBool( ult.useAnimation );
		fadeOption = new AnimBool( ult.useFade );
		tapOption = new AnimBool( ult.tapCountOption != UltimateButton.TapCountOption.NoCount ? true : false );
		/* // --< END ANIMATED VARIABLES >-- \\ */

		SetHighlight( ult );
		SetAnimation( ult );
		SetTensionAccent( ult );

		if( !ult.GetComponent<CanvasGroup>() )
			ult.gameObject.AddComponent<CanvasGroup>();

		if( ult.useFade == true )
			ult.gameObject.GetComponent<CanvasGroup>().alpha = ult.fadeUntouched;
		else
			ult.gameObject.GetComponent<CanvasGroup>().alpha = 1.0f;
	}
Пример #54
0
 public static void DrawWithFade(SerializedProperty property, AnimBool expanded, ColorName colorName, string emptyMessage = EMPTY_MESSAGE, float extraLineSpacing = 0, params GUILayoutOption[] options)
 {
     DrawWithFade(property, expanded.faded, colorName, emptyMessage, extraLineSpacing, options);
 }
	void OnEnable()
	{
		//lerpFoldout = new AnimBool(true);
		//authoritativeFoldout = new AnimBool(true);
		networkingFoldout = new AnimBool(true);
		easyControls = new AnimBool(true);
		easyControls.target = true;

		_editorStyle = new GUIStyle();
		_editorStyle.normal.textColor = Color.white;
		_editorStyle.fontStyle = FontStyle.Bold;
		_editorStyle.alignment = TextAnchor.UpperCenter;

		Texture2D btnUp = Resources.Load<Texture2D>("HoverIdle");

		// TODO:  Implement
		//Texture2D btnDwn = Resources.Load<Texture2D>("HoverOver");
		//Texture2D btnIcon = Resources.Load<Texture2D>("ForgeAnvil");

		_editorButtons = new List<ForgeEditorDisplayButton>();

		ForgeButtonStyle buttonStyle = new ForgeButtonStyle("Server Is Authority", btnUp, btnUp, null, 75);
		//ForgeSubmitButtonStyle submitButtonStyle = new ForgeSubmitButtonStyle(() =>
		//{
		//	Debug.Log("Submit success");
		//}, "Toggle");

		ServerAuthorityButton serverAuthorityButton = new ServerAuthorityButton(buttonStyle);
		serverAuthorityButton.Initialize(Target.serverIsAuthority, Target.clientSidePrediction, string.Empty,
		(authorityValue)=>
		{
			Target.serverIsAuthority = authorityValue;
		},
		(clientSidePredictionValue)=>
		{
			Target.clientSidePrediction = clientSidePredictionValue;
		});

		_editorButtons.Add(serverAuthorityButton);

		buttonStyle = new ForgeButtonStyle("Networking Throttle", btnUp, btnUp, null, 100);

		NetworkThrottleButton networkingThrottleButton = new NetworkThrottleButton(buttonStyle);
		networkingThrottleButton.Initialize(Target.networkTimeDelay, "This controls how long (in seconds) to wait before updating across the network (priority can be emulated here), this includes [NetSync] vars.",
		(throttle)=>
		{
			Target.networkTimeDelay = throttle;
		});

		_editorButtons.Add(networkingThrottleButton);

		buttonStyle = new ForgeButtonStyle("Interpolation", btnUp, btnUp, null, 175);

		InterpolationButton interpolationButton = new InterpolationButton(buttonStyle);
		interpolationButton.Initialize(Target.interpolateFloatingValues, Target.lerpT, Target.lerpStopOffset, Target.lerpAngleStopOffset, "",
		(interpolation)=>
		{
			Target.interpolateFloatingValues = interpolation;
		},
		(lerpSpeed)=>
		{
			Target.lerpT = lerpSpeed;
		},
		(distanceStop)=>
		{
			Target.lerpStopOffset = distanceStop;
		},
		(angleStop)=>
		{
			Target.lerpAngleStopOffset = angleStop;
		});

		_editorButtons.Add(interpolationButton);

		buttonStyle = new ForgeButtonStyle("Easy Controls", btnUp, btnUp, null, 150);

		EasyControlsButton easyControlsButton = new EasyControlsButton(buttonStyle);
		easyControlsButton.Initialize(Target.lerpPosition,
			Target.serializePosition,
			Target.lerpRotation, 
			Target.serializeRotation,
			Target.lerpScale,
			Target.serializeScale,
		(lerpPositionChanged) =>
		{
			Target.lerpPosition = lerpPositionChanged;
		},
		(serializePositionChanged) =>
		{
			Target.serializePosition = serializePositionChanged;
		},
		(lerpRotationChanged) =>
		{
			Target.lerpRotation = lerpRotationChanged;
		},
		(serializeRotationChanged) =>
		{
			Target.serializeRotation = serializeRotationChanged;
		},
		(lerpScaleChanged) =>
		{
			Target.lerpScale = lerpScaleChanged;
		},
		(serializeScaleChanged) =>
		{
			Target.serializeScale = serializeScaleChanged;
		});

		_editorButtons.Add(easyControlsButton);

		buttonStyle = new ForgeButtonStyle("Miscellanous", btnUp, btnUp, null, 200);

		MiscellaneousButton miscButton = new MiscellaneousButton(buttonStyle);
		miscButton.Initialize("For things that constantly update like position and rotation you would normally not turn on reliable.",
			Target.isReliable,
			Target.isPlayer,
			Target.destroyOnDisconnect,
			Target.teleportToInitialPositions,
		(udpReliable)=>
		{
			Target.isReliable = udpReliable;
		},
		(isPlayer)=>
		{
			Target.isPlayer = isPlayer;
		},
		(destroyOnDisconnect)=>
		{
			Target.destroyOnDisconnect = destroyOnDisconnect;
		},
		(teleportToInitialPosition)=>
		{
			Target.teleportToInitialPositions = teleportToInitialPosition;
		});

		_editorButtons.Add(miscButton);

		//lerpFoldout.valueChanged.AddListener(Repaint);
		//networkingFoldout.valueChanged.AddListener(Repaint);
		//easyControls.valueChanged.AddListener(Repaint);
	}
 private void InitAnimBool(out AnimBool animBool)
 {
     animBool = new AnimBool();
     animBool.valueChanged.AddListener(Repaint);
 }
	public override void OnInspectorGUI () {
		if (isPrefab) {
			GUILayout.Label(new GUIContent("Cannot edit Prefabs", SpineEditorUtilities.Icons.warning));
			return;
		}

		skeletonUtility.boneRoot = (Transform)EditorGUILayout.ObjectField("Bone Root", skeletonUtility.boneRoot, typeof(Transform), true);

		GUILayout.BeginHorizontal();
		EditorGUI.BeginDisabledGroup(skeletonUtility.boneRoot != null);
		{
			if (GUILayout.Button(new GUIContent("Spawn Hierarchy", SpineEditorUtilities.Icons.skeleton), GUILayout.Width(150), GUILayout.Height(24)))
				SpawnHierarchyContextMenu();
		}
		EditorGUI.EndDisabledGroup();

		if (GUILayout.Button(new GUIContent("Spawn Submeshes", SpineEditorUtilities.Icons.subMeshRenderer), GUILayout.Width(150), GUILayout.Height(24)))
			skeletonUtility.SpawnSubRenderers(true);
		GUILayout.EndHorizontal();

		EditorGUI.BeginChangeCheck();
		skeleton.FlipX = EditorGUILayout.ToggleLeft("Flip X", skeleton.FlipX);
		skeleton.FlipY = EditorGUILayout.ToggleLeft("Flip Y", skeleton.FlipY);
		if (EditorGUI.EndChangeCheck()) {
			skeletonRenderer.LateUpdate();
			SceneView.RepaintAll();
		}

#if UNITY_4_3
		showSlots = EditorGUILayout.Foldout(showSlots, "Slots");
#else
		showSlots.target = EditorGUILayout.Foldout(showSlots.target, "Slots");
		if (EditorGUILayout.BeginFadeGroup(showSlots.faded)) {
#endif
			foreach (KeyValuePair<Slot, List<Attachment>> pair in attachmentTable) {

				Slot slot = pair.Key;

				EditorGUILayout.BeginHorizontal();
				EditorGUI.indentLevel = 1;
				EditorGUILayout.LabelField(new GUIContent(slot.Data.Name, SpineEditorUtilities.Icons.slot), GUILayout.ExpandWidth(false));

				EditorGUI.BeginChangeCheck();
				Color c = EditorGUILayout.ColorField(new Color(slot.R, slot.G, slot.B, slot.A), GUILayout.Width(60));

				if (EditorGUI.EndChangeCheck()) {
					slot.SetColor(c);
					skeletonRenderer.LateUpdate();
				}

				EditorGUILayout.EndHorizontal();



				foreach (Attachment attachment in pair.Value) {

					if (slot.Attachment == attachment) {
						GUI.contentColor = Color.white;
					} else {
						GUI.contentColor = Color.grey;
					}

					EditorGUI.indentLevel = 2;
					bool isAttached = attachment == slot.Attachment;

					Texture2D icon = null;

					if (attachment is MeshAttachment || attachment is SkinnedMeshAttachment)
						icon = SpineEditorUtilities.Icons.mesh;
					else
						icon = SpineEditorUtilities.Icons.image;

					bool swap = EditorGUILayout.ToggleLeft(new GUIContent(attachment.Name, icon), attachment == slot.Attachment);

					if (!isAttached && swap) {
						slot.Attachment = attachment;
						skeletonRenderer.LateUpdate();
					} else if (isAttached && !swap) {
							slot.Attachment = null;
							skeletonRenderer.LateUpdate();
						}

					GUI.contentColor = Color.white;
				}
			}
			#if UNITY_4_3

#else
		}
		EditorGUILayout.EndFadeGroup();
		if (showSlots.isAnimating)
			Repaint();
#endif
	}
Пример #58
0
 public virtual void OnEnable()
 {
     showAutoComplete = new AnimBool(true);
     showAutoComplete.valueChanged.AddListener(Repaint);
 }
Пример #59
0
        private void OnEnable()
        {
            title    = serializedObject.FindProperty("title");
            bundleId = serializedObject.FindProperty("bundleId");
            //bundleVersion = serializedObject.FindProperty("bundleVersion");
            //buildNumber = serializedObject.FindProperty("buildNumber");
            size = serializedObject.FindProperty("size");

            signing                      = serializedObject.FindProperty("Signing");
            automaticSigning             = signing.FindPropertyRelative("AutomaticSigning");
            automaticSigningAnimated     = new AnimBool(Repaint);
            provisioningProfile          = signing.FindPropertyRelative("ProvisioningProfile");
            provisioningProfileSpecifier = signing.FindPropertyRelative("ProvisioningProfileSpecifier");

            var icons    = serializedObject.FindProperty("Icons");
            var settings = icons.FindPropertyRelative("Settings");

            backgroundColor = settings.FindPropertyRelative("BackgroundColor");
            fillPercentage  = settings.FindPropertyRelative("FillPercentage");
            filterMode      = settings.FindPropertyRelative("FilterMode");
            scaleMode       = settings.FindPropertyRelative("ScaleMode");

            overrideIcon = icons.FindPropertyRelative("Override");

            iconProperties = new[]
            {
                icons.FindPropertyRelative("appStore"),
                icons.FindPropertyRelative("messagesiPadPro2"),
                icons.FindPropertyRelative("messagesiPad2"),
                icons.FindPropertyRelative("messagesiPhone2"),
                icons.FindPropertyRelative("messagesiPhone3"),
                icons.FindPropertyRelative("messagesSmall2"),
                icons.FindPropertyRelative("messagesSmall3"),
                icons.FindPropertyRelative("messages2"),
                icons.FindPropertyRelative("messages3"),
                icons.FindPropertyRelative("iPhoneSettings2"),
                icons.FindPropertyRelative("iPhoneSettings3"),
                icons.FindPropertyRelative("iPadSettings2")
            };

            iconTextureLabels = new[]
            {
                new GUIContent("AppStore"),
                new GUIContent("Messages iPad Pro @2x"),
                new GUIContent("Messages iPad @2x"),
                new GUIContent("Messages iPhone @2x"),
                new GUIContent("Messages iPhone @3x"),
                new GUIContent("Messages Small @2x"),
                new GUIContent("Messages Small @3x"),
                new GUIContent("Messages @2x"),
                new GUIContent("Messages @3x"),
                new GUIContent("iPhone Settings @2x"),
                new GUIContent("iPhone Settings @3x"),
                new GUIContent("iPad Settings @2x")
            };

            stickers = serializedObject.FindProperty("Stickers");
            list     = new ReorderableList(serializedObject, stickers, true, true, true, true);
            list.drawElementBackgroundCallback += DrawElementBackgroundCallback;
            list.showDefaultBackground          = false;
            list.elementHeightCallback         += ElementHeight;
            list.drawHeaderCallback            += DrawHeaderCallback;
            list.drawElementCallback           += DrawStickerElement;
            list.onAddDropdownCallback         += OnAddDropdownCallback;
            list.onRemoveCallback  += OnRemoveCallback;
            list.onReorderCallback += OnReorderCallback;
            for (int index = 0; index < sectionAnimators.Length; ++index)
            {
                sectionAnimators[index] = new AnimBool(SelectedSection == index, Repaint);
            }
        }
Пример #60
0
        void DoNoiseTextureSettingsArea()
        {
            if (noiseTexture.textureValue == null)
            {
                return;
            }

            if (showNoiseTextureSettingsArea == null)
            {
                showNoiseTextureSettingsArea = new AnimBool(false);
                showNoiseTextureSettingsArea.valueChanged.AddListener(materialEditor.Repaint);
            }

            EditorGUI.indentLevel++;
            showNoiseTextureSettingsArea.target = EditorGUILayout.Foldout(showNoiseTextureSettingsArea.target, Styles.NoiseTextureSettings, true);
            if (EditorGUILayout.BeginFadeGroup(showNoiseTextureSettingsArea.faded))
            {
                EditorGUI.indentLevel++;
                Texture2D noiseTex  = noiseTexture.textureValue as Texture2D;
                int       noiseSize = noiseTex.width;
                NoiseTextureDataTypePrecision noisePrecision;

                if (noiseTex.format == TextureFormat.RGBA32)
                {
                    noisePrecision = NoiseTextureDataTypePrecision.Low;
                }
                else if (noiseTex.format == TextureFormat.RGBAHalf)
                {
                    noisePrecision = NoiseTextureDataTypePrecision.Medium;
                }
                else
                {
                    noisePrecision = NoiseTextureDataTypePrecision.High;
                }

                EditorGUI.BeginChangeCheck();
                int selectedIndex = (int)Mathf.Log(noiseSize, 2) - 5;
                int newNoiseSize  = (int)Mathf.Pow(2, (EditorGUILayout.Popup(Styles.NoiseTextureSizeLabel.text, selectedIndex, noiseTextureSizes) + 5));
                NoiseTextureDataTypePrecision newNoiseTextureDataTypePrecision = (NoiseTextureDataTypePrecision)EditorGUILayout.EnumPopup(Styles.NoiseTexturePrecision, noisePrecision);
                //Mirror Texture Wrap Mode is only supported in Unity 2017 and newer
                                #if UNITY_2017_1_OR_NEWER
                NoiseTextureWrapMode newNoiseTextureWrapMode = (NoiseTextureWrapMode)EditorGUILayout.EnumPopup(Styles.NoiseTextureWrapMode, noiseTex.wrapMode == TextureWrapMode.Repeat ? NoiseTextureWrapMode.Repeat : NoiseTextureWrapMode.Mirror);
                                #endif
                FilterMode newNoiseTextureFilterMode = (FilterMode)EditorGUILayout.EnumPopup(Styles.NoiseTextureFilterMode, noiseTex.filterMode);
                if (EditorGUI.EndChangeCheck())
                {
                    TextureFormat format;
                    if (newNoiseTextureDataTypePrecision == NoiseTextureDataTypePrecision.Low)
                    {
                        format = TextureFormat.RGBA32;
                    }
                    else if (newNoiseTextureDataTypePrecision == NoiseTextureDataTypePrecision.Medium)
                    {
                        format = TextureFormat.RGBAHalf;
                    }
                    else
                    {
                        format = TextureFormat.RGBAFloat;
                    }

                    Texture2D newNoiseTexture = new Texture2D(newNoiseSize, newNoiseSize, format, false, true);
                                        #if UNITY_2017_1_OR_NEWER
                    newNoiseTexture.wrapMode = newNoiseTextureWrapMode == NoiseTextureWrapMode.Repeat ? TextureWrapMode.Repeat : TextureWrapMode.Mirror;
                                        #else
                    newNoiseTexture.wrapMode = TextureWrapMode.Repeat;
                                        #endif
                    newNoiseTexture.filterMode = newNoiseTextureFilterMode;
                    noiseTexture.textureValue  = newNoiseTexture;
                    noiseTexturePreviews       = new Texture2D[4];

                    GenerateNoise(NoiseTextureImageChannel.Water, waterNoiseScaleOffset, waterNoiseStrength);
                    GenerateNoise(NoiseTextureImageChannel.Surface, surfaceNoiseScaleOffset, surfaceNoiseStrength);
                    GenerateNoise(NoiseTextureImageChannel.Reflective, reflectionNoiseScaleOffset, reflectionNoiseStrength);
                    GenerateNoise(NoiseTextureImageChannel.Refractive, refractionNoiseScaleOffset, refractionNoiseStrength, refractionAmountOfBending);
                }
                EditorGUILayout.LabelField(string.Format("{0} , {1} KB", ((Texture2D)noiseTexture.textureValue).format, Profiler.GetRuntimeMemorySizeLong(noiseTexture.textureValue) / 1024));
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUI.indentLevel--;
        }