Ejemplo n.º 1
0
        void OnEnable()
        {
            titleContent = new GUIContent("Profiling");

            m_AllSnippets = ProfilingSnippetUtils.FetchAllSnippets();
            m_History     = new List <HistoryItem>();
            m_Actions     = GetProfilingSnippetActions().ToList();

            foreach (var action in m_Actions)
            {
                action.defaultSet = EditorPrefs.GetBool(GetKeyName($"action_{action.name}_default_set"), false);
            }

            if (!Directory.Exists(ProfilerHelpers.k_DefaultProfileSaveDirectory))
            {
                Directory.CreateDirectory(ProfilerHelpers.k_DefaultProfileSaveDirectory);
            }
            if (!File.Exists(k_LogFile))
            {
                CreateLogFile();
            }

            m_SnippetListView = new SnippetListView(m_AllSnippets);
            m_SnippetListView.doubleClicked += HandleSnippetListDoubleClick;

            m_Options = new ProfilingSnippetOptions()
            {
                logFile = k_LogFile,
                count   = 1
            };

            m_Options.warmup           = EditorPrefs.GetBool(GetKeyName($"options_{nameof(m_Options.warmup)}"), m_Options.warmup);
            m_Options.maximizeWindow   = EditorPrefs.GetBool(GetKeyName($"options_{nameof(m_Options.maximizeWindow)}"), m_Options.maximizeWindow);
            m_Options.standaloneWindow = EditorPrefs.GetBool(GetKeyName($"options_{nameof(m_Options.standaloneWindow)}"), m_Options.standaloneWindow);
            m_Options.count            = EditorPrefs.GetInt(GetKeyName($"options_{nameof(m_Options.count)}"), m_Options.count);
            m_Options.csvLog           = EditorPrefs.GetBool(GetKeyName($"options_{nameof(m_Options.csvLog)}"), m_Options.csvLog);

            m_SearchValue = EditorPrefs.GetString(GetKeyName(nameof(m_SearchValue)));
            var currentSnippetIdStr = EditorPrefs.GetString(GetKeyName("CurrentSnippetId"));

            SetCurrentFromId(currentSnippetIdStr);

            var historyStr = EditorPrefs.GetString(GetKeyName(nameof(m_History)));

            if (!string.IsNullOrEmpty(historyStr))
            {
                var historyItemTokens = historyStr.Split(';');
                foreach (var historyItemToken in historyItemTokens)
                {
                    var itemTokens = historyItemToken.Split(':');
                    if (itemTokens.Length != 2)
                    {
                        continue;
                    }
                    var possibleSnippetId = itemTokens[1];
                    var possibleSnippet   = m_AllSnippets.FirstOrDefault(snippet => snippet.idStr == possibleSnippetId);
                    if (possibleSnippet != null)
                    {
                        PushHistory(itemTokens[0], possibleSnippet);
                    }
                }
            }
        }
    public static void CheckNewVersionAvailable()
    {
        if (EditorPrefs.HasKey(lastVersionKey))
        {
            lastVersionID = EditorPrefs.GetString(lastVersionKey);

            if (CompareVersions())
            {
                hasNewVersion = true;
                return;
            }
        }

        const long ticksInHour = 36000000000;

        if (EditorPrefs.HasKey(lastVersionCheckKey))
        {
            long lastVersionCheck = EditorPrefs.GetInt(lastVersionCheckKey) * ticksInHour;
            if (DateTime.Now.Ticks - lastVersionCheck < 24 * ticksInHour)
            {
                return;
            }
        }

        EditorPrefs.SetInt(lastVersionCheckKey, (int)(DateTime.Now.Ticks / ticksInHour));

        if (EditorPrefs.HasKey(channelKey))
        {
            channel = (OnlineMapsUpdateChannel)EditorPrefs.GetInt(channelKey);
        }
        else
        {
            channel = OnlineMapsUpdateChannel.stable;
        }

        if (channel == OnlineMapsUpdateChannel.stablePrevious)
        {
            channel = OnlineMapsUpdateChannel.stable;
        }

        WebClient client = new WebClient();

        client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
        client.UploadDataCompleted += delegate(object sender, UploadDataCompletedEventArgs response)
        {
            if (response.Error != null)
            {
                Debug.Log(response.Error.Message);
                return;
            }

            string version = Encoding.UTF8.GetString(response.Result);

            try
            {
                string[] vars  = version.Split(new[] { '.' });
                string[] vars2 = new string[4];
                while (vars[1].Length < 8)
                {
                    vars[1] += "0";
                }
                vars2[0] = vars[0];
                vars2[1] = int.Parse(vars[1].Substring(0, 2)).ToString();
                vars2[2] = int.Parse(vars[1].Substring(2, 2)).ToString();
                vars2[3] = int.Parse(vars[1].Substring(4)).ToString();

                version = string.Join(".", vars2);
            }
            catch (Exception)
            {
                Debug.Log("Automatic check for Online Maps updates: Bad response.");
                return;
            }

            lastVersionID = version;

            hasNewVersion             = CompareVersions();
            EditorApplication.update += SetLastVersion;
        };
        client.UploadDataAsync(new Uri("http://infinity-code.com/products_update/getlastversion.php"), "POST", Encoding.UTF8.GetBytes("c=" + (int)channel + "&package=" + WWW.EscapeURL(packageID)));
    }
        private void OnEnable()
        {
            if (!enabled)
            {
                enabled = true;

                if (target == null)
                {
                    return;
                }

                if (animation == null)
                {
                    animation = (SpriteAnimation)target;
                    animation.Setup();
                }

                EditorApplication.update += Update;

                // Load last used settings
                loadedFPS = framesPerSecond = EditorPrefs.GetInt(FPS_EDITOR_PREFS, 30);

                // Setup preview object and camera
                go       = EditorUtility.CreateGameObjectWithHideFlags("previewGO", HideFlags.HideAndDontSave, typeof(SpriteRenderer));
                cameraGO = EditorUtility.CreateGameObjectWithHideFlags("cameraGO", HideFlags.HideAndDontSave, typeof(Camera));
                sr       = go.GetComponent <SpriteRenderer>();
                pc       = cameraGO.GetComponent <Camera>();

#if !UNITY_5
                // Colorspace correction is only needed after Unity 5 for some reasons
                linearMaterial  = Resources.Load <Material>("Spritedow");
                defaultMaterial = sr.sharedMaterial;
                if (PlayerSettings.colorSpace == ColorSpace.Linear)
                {
                    sr.sharedMaterial = linearMaterial;
                }
                else
                {
                    sr.sharedMaterial = defaultMaterial;
                }
#endif


                // Set camera
                pc.cameraType       = CameraType.Preview;
                pc.clearFlags       = CameraClearFlags.Depth;
                pc.backgroundColor  = Color.clear;
                pc.orthographic     = true;
                pc.orthographicSize = 3;
                pc.nearClipPlane    = -10;
                pc.farClipPlane     = 10;
                pc.targetDisplay    = -1;
                pc.depth            = -999;

                // Set renderer
                if (animation != null && animation.FramesCount > 0)
                {
                    sr.sprite = animation.Frames[0];
                    cameraGO.transform.position = Vector2.zero;
                }

                // Get preview culling layer in order to render only the preview object and nothing more
                pc.cullingMask = -2147483648;
                go.layer       = 0x1f;

                // Also, disable the object to prevent render on scene/game views
                go.SetActive(false);
            }
        }
Ejemplo n.º 4
0
 public override bool GetBool(string _key)
 {
     return((EditorPrefs.GetInt(_key) == 1) ? true : false);
 }
Ejemplo n.º 5
0
 public Ignore(Type toolType) : base(toolType)
 {
     ignorePrefabs   = EditorPrefs.GetBool($"[Prefabshop] {toolType.Name}.{this.GetType().Name} PrefabsIgnore", ignorePrefabs);
     layer           = EditorPrefs.GetInt($"[Prefabshop] {toolType.Name}.{this.GetType().Name} Layer", layer);
     ignorePrefabsId = EditorPrefs.GetInt($"[Prefabshop] {toolType.Name}.{this.GetType().Name} IgnoreId", ignorePrefabsId);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates a new preset and adds it to a new state in the list.
        /// </summary>
        private void CreateEquipAnimatorAudioStateSetStatePreset()
        {
            var animatorAudioState = m_Item.EquipAnimatorAudioStateSet.States[EditorPrefs.GetInt(SelectedEquipAnimatorAudioStateSetIndexKey)];
            var states             = StateInspector.CreatePreset(animatorAudioState, animatorAudioState.States, m_ReorderableEquipAnimatorAudioStateSetStateList, GetSelectedEquipAnimatorAudioStateSetStateIndexKey(EditorPrefs.GetInt(SelectedEquipAnimatorAudioStateSetIndexKey)));

            if (animatorAudioState.States.Length != states.Length)
            {
                InspectorUtility.SynchronizePropertyCount(states, m_ReorderableEquipAnimatorAudioStateSetStateList.serializedProperty);
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                animatorAudioState.States = states;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Returns the actions to draw before the State list is drawn.
        /// </summary>
        /// <returns>The actions to draw before the State list is drawn.</returns>
        protected override Action GetDrawCallback()
        {
            var baseCallback = base.GetDrawCallback();

            baseCallback += () =>
            {
                var itemDefinition = PropertyFromName("m_ItemDefinition");
                EditorGUILayout.PropertyField(itemDefinition);
                if (itemDefinition == null)
                {
                    EditorGUILayout.HelpBox("An Item Definition is required.", MessageType.Error);
                }
                else
                {
                    // Ensure the Item Definition exists within the collection set by the Item Set Manager.
                    var itemSetManager = (target as Item).GetComponentInParent <ItemSetManager>();
                    if (itemSetManager != null && itemSetManager.ItemCollection != null)
                    {
                        if (AssetDatabase.GetAssetPath(itemDefinition.objectReferenceValue) != AssetDatabase.GetAssetPath(itemSetManager.ItemCollection))
                        {
                            EditorGUILayout.HelpBox("The Item Definition must exist within the Item Collection specified on the character's Item Set Manager.", MessageType.Error);
                        }
                    }
                }
                if (Application.isPlaying)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.LabelField("Item Identifier", m_Item.ItemIdentifier == null ? "(none)" : m_Item.ItemIdentifier.ToString());
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.PropertyField(PropertyFromName("m_SlotID"));
                EditorGUILayout.PropertyField(PropertyFromName("m_AnimatorItemID"));
                EditorGUILayout.PropertyField(PropertyFromName("m_AnimatorMovementSetID"));
                EditorGUILayout.PropertyField(PropertyFromName("m_DominantItem"));
                EditorGUILayout.PropertyField(PropertyFromName("m_UniqueItemSet"));
                EditorGUILayout.PropertyField(PropertyFromName("m_AllowCameraZoom"));
                EditorGUILayout.PropertyField(PropertyFromName("m_DropPrefab"));
                if (PropertyFromName("m_DropPrefab").objectReferenceValue != null)
                {
                    EditorGUI.indentLevel++;
#if ULTIMATE_CHARACTER_CONTROLLER_VR
                    EditorGUILayout.PropertyField(PropertyFromName("m_DropVelocityMultiplier"));
#endif
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.PropertyField(PropertyFromName("m_FullInventoryDrop"));
                EditorGUILayout.PropertyField(PropertyFromName("m_DropConsumableItems"));
                if (Foldout("Equip"))
                {
                    EditorGUI.indentLevel++;
                    InspectorUtility.DrawAnimationEventTrigger(target, "Equip Event", PropertyFromName("m_EquipEvent"));
                    InspectorUtility.DrawAnimationEventTrigger(target, "Equip Complete Event", PropertyFromName("m_EquipCompleteEvent"));
                    if (Foldout("Animator Audio"))
                    {
                        EditorGUI.indentLevel++;
                        AnimatorAudioStateSetInspector.DrawAnimatorAudioStateSet(m_Item, m_Item.EquipAnimatorAudioStateSet, "m_EquipAnimatorAudioStateSet", true,
                                                                                 ref m_ReorderableEquipAnimatorAudioStateSetList, OnEquipAnimatorAudioStateListDraw, OnEquipAnimatorAudioStateListSelect,
                                                                                 OnEquipAnimatorAudioStateListAdd, OnEquipAnimatorAudioStateListRemove, SelectedEquipAnimatorAudioStateSetIndexKey,
                                                                                 ref m_ReorderableEquipAnimatorAudioStateSetAudioList,
                                                                                 OnEquipAudioListElementDraw, OnEquipAudioListAdd, OnEquipAudioListRemove, ref m_ReorderableEquipAnimatorAudioStateSetStateList,
                                                                                 OnEquipAnimatorAudioStateSetStateListDraw, OnEquipAnimatorAudioStateSetStateListAdd, OnEquipAnimatorAudioStateSetStateListReorder, OnEquipAnimatorAudioStateSetStateListRemove,
                                                                                 GetSelectedEquipAnimatorAudioStateSetStateIndexKey(EditorPrefs.GetInt(SelectedEquipAnimatorAudioStateSetIndexKey)));
                        EditorGUI.indentLevel--;
                    }
                    EditorGUI.indentLevel--;
                }
                if (Foldout("Unequip"))
                {
                    EditorGUI.indentLevel++;
                    InspectorUtility.DrawAnimationEventTrigger(target, "Unequip Event", PropertyFromName("m_UnequipEvent"));
                    InspectorUtility.DrawAnimationEventTrigger(target, "Unequip Complete Event", PropertyFromName("m_UnequipCompleteEvent"));
                    if (Foldout("Animator Audio"))
                    {
                        EditorGUI.indentLevel++;
                        AnimatorAudioStateSetInspector.DrawAnimatorAudioStateSet(m_Item, m_Item.UnequipAnimatorAudioStateSet, "m_UnequipAnimatorAudioStateSet", true,
                                                                                 ref m_ReorderableUnequipAnimatorAudioStateSetList, OnUnequipAnimatorAudioStateListDraw, OnUnequipAnimatorAudioStateListSelect,
                                                                                 OnUnequipAnimatorAudioStateListAdd, OnUnequipAnimatorAudioStateListRemove, SelectedUnequipAnimatorAudioStateSetIndexKey,
                                                                                 ref m_ReorderableUnequipAnimatorAudioStateSetAudioList,
                                                                                 OnUnequipAudioListElementDraw, OnUnequipAudioListAdd, OnUnequipAudioListRemove, ref m_ReorderableUnequipAnimatorAudioStateSetStateList,
                                                                                 OnUnequipAnimatorAudioStateSetStateListDraw, OnUnequipAnimatorAudioStateSetStateListAdd, OnUnequipAnimatorAudioStateSetStateListReorder, OnUnequipAnimatorAudioStateSetStateListRemove,
                                                                                 GetSelectedUnequipAnimatorAudioStateSetStateIndexKey(EditorPrefs.GetInt(SelectedUnequipAnimatorAudioStateSetIndexKey)));
                        EditorGUI.indentLevel--;
                    }
                    EditorGUI.indentLevel--;
                }
                if (Foldout("UI"))
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(PropertyFromName("m_UIMonitorID"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_Icon"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_ShowCrosshairsOnAim"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_CenterCrosshairs"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_QuadrantOffset"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_MaxQuadrantSpread"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_QuadrantSpreadDamping"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_LeftCrosshairs"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_TopCrosshairs"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_RightCrosshairs"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_BottomCrosshairs"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_ShowFullScreenUI"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_FullScreenUIID"));
                    EditorGUI.indentLevel--;
                }
                if (Foldout("Events"))
                {
                    EditorGUI.indentLevel++;
                    Shared.Editor.Inspectors.Utility.InspectorUtility.UnityEventPropertyField(PropertyFromName("m_PickupItemEvent"));
                    Shared.Editor.Inspectors.Utility.InspectorUtility.UnityEventPropertyField(PropertyFromName("m_EquipItemEvent"));
                    Shared.Editor.Inspectors.Utility.InspectorUtility.UnityEventPropertyField(PropertyFromName("m_UnequipItemEvent"));
                    Shared.Editor.Inspectors.Utility.InspectorUtility.UnityEventPropertyField(PropertyFromName("m_DropItemEvent"));
                    EditorGUI.indentLevel--;
                }
            };

            return(baseCallback);
        }
Ejemplo n.º 8
0
 public static int GetInt(string key, int defaultValue)
 {
     return(EditorPrefs.GetInt(key, defaultValue));
 }
Ejemplo n.º 9
0
    /// <summary>
    /// Get the previously saved integer value.
    /// </summary>

    static public int GetInt(string name, int defaultValue)
    {
        return(EditorPrefs.GetInt(name, defaultValue));
    }
Ejemplo n.º 10
0
        static T GetEnum <T>(string name, T defaultValue) where T : struct, IConvertible
        {
            var result = EditorPrefs.GetInt(name, Convert.ToInt32(defaultValue));

            return((T)(object)result);
        }
Ejemplo n.º 11
0
        public static void Reload()
        {
            LockAxisX = EditorPrefs.GetBool("LockAxisX", false);
            LockAxisY = EditorPrefs.GetBool("LockAxisY", false);
            LockAxisZ = EditorPrefs.GetBool("LockAxisZ", false);

            UniformGrid = EditorPrefs.GetBool("UniformGrid", true);
            EditMode    = GetEnum("EditMode", ToolEditMode.Generate);

            SnapVector          = GetVector3("MoveSnap", Vector3.one);
            DefaultMoveOffset   = GetVector3("DefaultMoveOffset", Vector3.zero);
            DefaultRotateOffset = GetVector3("DefaultRotateOffset", Vector3.zero);

            ShapeBuildMode     = GetEnum("ShapeBuildMode", ShapeMode.Box);
            DefaultTexGenFlags = GetEnum("DefaultTexGenFlags", defaultTextGenFlagsState);

            GridVisible = EditorPrefs.GetBool("ShowGrid", true);
            SnapMode    = (SnapMode)EditorPrefs.GetInt("SnapMode", (int)(EditorPrefs.GetBool("ForceSnapToGrid", true) ? SnapMode.GridSnapping : SnapMode.None));

            VisibleHelperSurfaces = GetEnum("HelperSurfaces", DefaultHelperSurfaceFlags);

            ClipMode          = GetEnum("ClipMode", ClipMode.RemovePositive);
            EnableRealtimeCSG = EditorPrefs.GetBool("EnableRealtimeCSG", true);

            DefaultMaterial = GetMaterial("DefaultMaterial", MaterialUtility.WallMaterial);


            SnapScale          = EditorPrefs.GetFloat("ScaleSnap", 0.1f);
            SnapRotation       = EditorPrefs.GetFloat("RotationSnap", 15.0f);
            DefaultShapeHeight = EditorPrefs.GetFloat("DefaultShapeHeight", 1.0f);
            CurveSides         = (uint)EditorPrefs.GetInt("CurveSides", 10);

            SelectionVertex  = EditorPrefs.GetBool("SelectionVertex", true);
            SelectionEdge    = EditorPrefs.GetBool("SelectionEdge", true);
            SelectionSurface = EditorPrefs.GetBool("SelectionSurface", true);

            HiddenSurfacesNotSelectable = EditorPrefs.GetBool("HiddenSurfacesNotSelectable", true);
//			HiddenSurfacesOrthoSelectable	= EditorPrefs.GetBool("HiddenSurfacesOrthoSelectable", true);
            ShowTooltips       = EditorPrefs.GetBool("ShowTooltips", true);
            DefaultPreserveUVs = EditorPrefs.GetBool("DefaultPreserveUVs", (CSGModel.DefaultSettings & ModelSettingsFlags.PreserveUVs) == ModelSettingsFlags.PreserveUVs);
            SnapNonCSGObjects  = EditorPrefs.GetBool("SnapNonCSGObjects", true);

            AutoCommitExtrusion = EditorPrefs.GetBool("AutoCommitExtrusion", false);

            MaxSphereSplits = Mathf.Max(3, EditorPrefs.GetInt("MaxSphereSplits", 9));

            CircleSides             = Mathf.Max(3, EditorPrefs.GetInt("CircleSides", 18));
            MaxCircleSides          = Mathf.Max(3, EditorPrefs.GetInt("MaxCircleSides", 144));
            CircleOffset            = EditorPrefs.GetFloat("CircleOffset", 0);
            CircleSmoothShading     = EditorPrefs.GetBool("CircleSmoothShading", true);
            CircleSingleSurfaceEnds = EditorPrefs.GetBool("CircleSingleSurfaceEnds", true);
            CircleDistanceToSide    = EditorPrefs.GetBool("CircleDistanceToSide", true);
            CircleRecenter          = EditorPrefs.GetBool("CircleRecenter", true);


            SphereSplits         = Mathf.Max(1, EditorPrefs.GetInt("SphereSplits", 1));
            SphereOffset         = EditorPrefs.GetFloat("SphereOffset", 0);
            SphereSmoothShading  = EditorPrefs.GetBool("SphereSmoothShading", true);
            SphereDistanceToSide = EditorPrefs.GetBool("SphereDistanceToSide", true);
            HemiSphereMode       = EditorPrefs.GetBool("HemiSphereMode", false);

            LinearStairsStepLength = EditorPrefs.GetFloat("LinearStairsStepLength", 0.30f);
            LinearStairsStepHeight = EditorPrefs.GetFloat("LinearStairsStepHeight", 0.20f);
            LinearStairsStepWidth  = EditorPrefs.GetFloat("LinearStairsStepWidth", 1.0f);
            LinearStairsTotalSteps = EditorPrefs.GetInt("LinearStairsTotalSteps", 4);

            LinearStairsLength       = EditorPrefs.GetFloat("LinearStairsLength", 16.0f);
            LinearStairsHeight       = EditorPrefs.GetFloat("LinearStairsHeight", 16.0f);
            LinearStairsLengthOffset = EditorPrefs.GetFloat("LinearStairsLengthOffset", 0.0f);
            LinearStairsHeightOffset = EditorPrefs.GetFloat("LinearStairsHeightOffset", 0.0f);

            DistanceUnit = GetEnum("DistanceUnit", DistanceUnit.Meters);


            var sceneViews = SortedSceneViews();

            EnsureValidSceneviewNames(sceneViews);
            var arrayString = EditorPrefs.GetString("Wireframe", string.Empty);

            if (arrayString.Contains(','))
            {
                LegacyLoadWireframeSettings(sceneViews, arrayString);
            }
            else
            {
                LoadWireframeSettings(sceneViews, arrayString);
            }

            UpdateSnapSettings();
        }
Ejemplo n.º 12
0
 //被创建出来调用
 private void OnEnable()
 {
     //一开始调用参数
     changeHealthValue    = EditorPrefs.GetInt(changeHealthValueKey, changeHealthValue);
     changeSinkSpeedValue = EditorPrefs.GetInt(changeSinkSpeedValueKey, changeSinkSpeedValue);
 }
Ejemplo n.º 13
0
 public int this[EditorEnhancement pFor, string pName, int pDefault = 0]
 {
     get { return(EditorPrefs.GetInt("EE_" + pFor.Prefix + "_" + pName, pDefault)); }
     set { EditorPrefs.SetInt("EE_" + pFor.Prefix + "_" + pName, value); }
 }
Ejemplo n.º 14
0
 protected override int GetValue(string key)
 {
     return(EditorPrefs.GetInt(key));
 }
Ejemplo n.º 15
0
        private void StickSpawnToGround()
        {
            RaycastHit hitInfo;

            for (int i = 0; i < 10; i++)
            {
                if (Physics.Raycast(m_SpawnPoint.transform.position + (Vector3.up * i), Vector3.down, out hitInfo, 10f, EditorPrefs.GetInt("Spawn.GroundLayer", 0)))
                {
                    m_SpawnPoint.transform.position = hitInfo.point;
                    m_SpawnPoint.transform.rotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal.normalized);
                    return;
                }
            }
        }
Ejemplo n.º 16
0
 protected int LoadInt(string variableName, int defaultValue = 0)
 {
     return(EditorPrefs.GetInt(GetType().ToString() + "." + variableName, defaultValue));
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Draws all of the added states.
        /// </summary>
        private void OnUnequipAnimatorAudioStateSetStateListDraw(Rect rect, int index, bool isActive, bool isFocused)
        {
            EditorGUI.BeginChangeCheck();
            var animatorAudioState = m_Item.UnequipAnimatorAudioStateSet.States[EditorPrefs.GetInt(SelectedUnequipAnimatorAudioStateSetIndexKey)];

            // The index may be out of range if the component was copied.
            if (index >= animatorAudioState.States.Length)
            {
                m_ReorderableUnequipAnimatorAudioStateSetStateList.index = -1;
                EditorPrefs.SetInt(GetSelectedUnequipAnimatorAudioStateSetStateIndexKey(EditorPrefs.GetInt(SelectedUnequipAnimatorAudioStateSetIndexKey)), m_ReorderableUnequipAnimatorAudioStateSetStateList.index);
                return;
            }

            StateInspector.OnStateListDraw(animatorAudioState, animatorAudioState.States, rect, index);
            if (EditorGUI.EndChangeCheck())
            {
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                StateInspector.UpdateDefaultStateValues(animatorAudioState.States);
            }
        }
        // Init
        //------------------------------------------------------------------
        public void Init()
        {
            _language = (apEditor.LANGUAGE)EditorPrefs.GetInt("AnyPortrait_Language", (int)apEditor.LANGUAGE.English);

            GetText();
        }
Ejemplo n.º 19
0
        /// <summary>
        /// The ReordableList remove button has been pressed. Remove the selected state.
        /// </summary>
        private void OnUnequipAnimatorAudioStateSetStateListRemove(ReorderableList list)
        {
            var animatorAudioState = m_Item.UnequipAnimatorAudioStateSet.States[EditorPrefs.GetInt(SelectedUnequipAnimatorAudioStateSetIndexKey)];
            var states             = StateInspector.OnStateListRemove(animatorAudioState.States, GetSelectedUnequipAnimatorAudioStateSetStateIndexKey(EditorPrefs.GetInt(SelectedUnequipAnimatorAudioStateSetIndexKey)), list);

            if (animatorAudioState.States.Length != states.Length)
            {
                InspectorUtility.SynchronizePropertyCount(states, m_ReorderableUnequipAnimatorAudioStateSetStateList.serializedProperty);
                Shared.Editor.Utility.EditorUtility.RecordUndoDirtyObject(target, "Change Value");
                animatorAudioState.States = states;
            }
        }
Ejemplo n.º 20
0
 private static void Init()
 {
     _TextureType = (TextureType)EditorPrefs.GetInt(TextureTypeKey, 0);
 }
Ejemplo n.º 21
0
 protected override int OnRetrieveValue()
 {
     return(EditorPrefs.GetInt(key, 0));
 }
Ejemplo n.º 22
0
    public override void OnInspectorGUI()
    {
        MoogSynth parent = target as MoogSynth;

        //serializedObject.Update();

        DrawDefaultInspector();

        GUILayout.Space(8);
        GUILayout.Label("Visualization", EditorStyles.boldLabel);
        int modeInt = EditorPrefs.GetInt("MoogSynth:oscMode");

        oscilloscopeMode = (OscilloscopeMode)EditorGUILayout.EnumPopup("Oscilloscope", (OscilloscopeMode)modeInt);
        if (((int)oscilloscopeMode) != modeInt)
        {
            EditorPrefs.SetInt("MoogSynth:oscMode", (int)oscilloscopeMode);
        }
        parent.SetDebugBufferEnabled(oscilloscopeMode != OscilloscopeMode.None);

        if (oscilloscopeMode != OscilloscopeMode.None)
        {
            if (Event.current.type == EventType.Repaint)
            {
                int oscHeight = 256;
                int oscWidth  = 512;
                if (oscilloscopeMode == OscilloscopeMode.Small)
                {
                    oscHeight = 64;
                }

                float[] buf = null;
                if (Application.isPlaying)
                {
                    if (bufCopy == null)
                    {
                        bufCopy = new float[bufSize];
                    }
                    lock (parent.GetBufferMutex())
                    {
                        System.Array.Copy(parent.GetLastBuffer(), bufCopy, bufSize);
                    }
                    buf = bufCopy;
                }
                else
                {
                    if (testBuf == null || testBuf.Length < bufSize)
                    {
                        testBuf = new float[bufSize];
                        for (int x = 0; x < bufSize; ++x)
                        {
                            testBuf[x] = 0.0f; // Mathf.Sin(((float)x) / oscWidth * Mathf.PI * 2.0f);
                        }
                    }
                    buf = testBuf;
                }

                RenderBuffer(buf, ref tex, oscWidth, oscHeight, 1);
            }

            GUILayout.Box(tex);
        }

        if (targetNames == null)
        {
            targetNames = System.Enum.GetNames(typeof(MoogSynth.Parameters));
            sourceNames = System.Enum.GetNames(typeof(MoogSynth.Modulators));
        }
        int matrixsize = targetNames.Length * sourceNames.Length;

        if (parent.modulationMatrix == null)
        {
            parent.modulationMatrix = new float[matrixsize];
        }
        else if (parent.modulationMatrix.Length < matrixsize)
        {
            System.Array.Resize(ref parent.modulationMatrix, matrixsize);
        }
        //ModulationMatrix(parent.modulationMatrix, sourceNames, targetNames);

        if (GUILayout.Button("Reset Cache"))
        {
            tex = null;
        }
    }
Ejemplo n.º 23
0
 public override long GetLong(string _key)
 {
     return(EditorPrefs.GetInt(_key));
 }
Ejemplo n.º 24
0
    static Object GetObject(string name)
    {
        int assetID = EditorPrefs.GetInt(name, -1);

        return((assetID != -1) ? EditorUtility.InstanceIDToObject(assetID) : null);
    }
Ejemplo n.º 25
0
        static void HierarchyWindowItemOnGUI(int instanceID, Rect selectionRect)
        {
            UnityEngine.Object obj = EditorUtility.InstanceIDToObject(instanceID);
            if (obj == false)
            {
                return;
            }
            GameObject go   = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
            Rect       rect = new Rect(selectionRect);

            //  - NEEDS ATTENTION.  DUCT TAPED TOGETHER.
            //  Highlight GameObject
            if (EditorPrefs.GetInt(go.GetInstanceID() + "Highlight") == 1)
            {
                GUIStyle style = new GUIStyle();
                style.normal.textColor = Color.black;

                Rect highlightRect = new Rect(selectionRect);
                highlightRect.x      = 1;
                highlightRect.width  = EditorGUIUtility.currentViewWidth - 4;
                highlightRect.height = EditorGUIUtility.singleLineHeight;

                Color oldColor = GUI.color;
                GUI.color = Color.magenta;
                EditorGUI.LabelField(highlightRect, GUIContent.none, EditorStyles.helpBox);
                GUI.color       = oldColor;
                highlightRect.x = selectionRect.x;
                highlightRect.y = selectionRect.y + 1.5f;
                EditorGUI.LabelField(highlightRect, new GUIContent(go.name), style);
            }


            //  -- Icon
            rect.x     = 2;
            rect.width = rect.height = 18;

            var components = go.GetComponents <Component>();

            if (components != null)
            {
                //  If game object has more than transform
                if (components.Length > 1)
                {
                    //  See if a gameobject contains a certain type from componentTypes.
                    Type type = null;;
                    foreach (Component c in components)
                    {
                        if (componentTypes.Contains(c.GetType()))
                        {
                            type = c.GetType();
                            continue;
                        }
                    }
                    if (type == null)
                    {
                        type = components[1].GetType();
                    }

                    Texture icon = AssetPreview.GetMiniTypeThumbnail(type);
                    bool    isInComponentTypesList = Array.Exists(componentTypes, x => x == type);

                    if (type == typeof(Canvas))
                    {
                        GUI.Label(rect, EditorGUIUtility.IconContent("Canvas Icon"));
                    }
                    else if (IsDisconnectedPrefabInstance(go))
                    {
                        GUI.Label(rect, EditorGUIUtility.IconContent("Prefab Icon"));
                    }
                    else if (CanShowAsPrefab(go))
                    {
                        GUI.Label(rect, EditorGUIUtility.IconContent("PrefabNormal Icon"));
                    }
                    else if (isInComponentTypesList)
                    {
                        GUI.Label(rect, new GUIContent(icon));
                    }
                    else
                    {
                        GUI.Label(rect, new GUIContent(AssetPreview.GetMiniTypeThumbnail(typeof(GameObject))));
                    }
                }
                //  If object is empty object.
                else
                {
                    if (CanShowAsPrefab(go))
                    {
                        GUI.Label(rect, EditorGUIUtility.IconContent("PrefabNormal Icon"));
                    }
                    else
                    {
                        GUI.Label(rect, new GUIContent(AssetPreview.GetMiniTypeThumbnail(typeof(GameObject))));
                    }
                }
            }



            //  -- Warning Icon if something is missing. ** Need to add a way to check for missing dependencies.
            if (IsDisconnectedPrefabInstance(go) && IsRootTransform(go))
            {
                rect.x     = EditorGUIUtility.labelWidth + EditorGUIUtility.currentViewWidth / 15;
                rect.y    -= 2;
                rect.width = rect.height = 24;
                GUI.Label(rect, EditorGUIUtility.IconContent("console.warnicon.sml"));
            }



            //  -- Set the Enable/Disable of the gameobject to GUI Toggle.
            rect.x     = EditorGUIUtility.currentViewWidth - 28;
            rect.y     = selectionRect.y;
            rect.width = rect.height = 18;

            EditorGUI.BeginChangeCheck();

            bool toggleValue = GUI.Toggle(rect, go.activeSelf, string.Empty);

            //  If alt key is also pressed.
            if (toggleActiveAllChildInheritToggleObject && Event.current.alt)
            {
                if (EditorGUI.EndChangeCheck())
                {
                    if (allChildGOsForToggle == null)
                    {
                        allChildGOsForToggle = new List <GameObject>();
                    }
                    allChildGOsForToggle.Clear();
                    allChildGOsForToggle.Add(go);
                    FetchAllChildGameObjects(go.transform);
                    Undo.RecordObjects(allChildGOsForToggle.ToArray(), "Toggle GameObject Active");
                    allChildGOsForToggle.ForEach(child => child.SetActive(toggleValue));
                }
            }
            else if (EditorGUI.EndChangeCheck())
            {
                go.SetActive(toggleValue);
                Undo.RecordObject(obj, "Toggle " + obj.name + " Active");
            }


            //  - NEEDS ATTENTION.
            //  --  Special component buttons (ParticleSystem, Audio, MeshRender)
            // if(go.GetComponent<MeshRenderer>()){
            //  rect.x -= 15;
            //  Texture icon = AssetPreview.GetMiniTypeThumbnail(typeof(MeshRenderer));
            //  bool toggleMesh = GUI.Toggle(rect, go.GetComponent<MeshRenderer>().enabled, new GUIContent(icon));
            // }


            //  Markers
            if (EditorPrefs.GetInt(go.GetInstanceID() + "G") == 1)
            {
                rect.x -= 15;
                GUI.Label(rect, "G");
            }
        }
Ejemplo n.º 26
0
        private void OnEnable()
        {
            rt = new RenderTexture(16, 16, 0);
            rt.Create();

            m_startup = (Preferences.ShowOption)EditorPrefs.GetInt(Preferences.PrefStartUp, 0);

            if (textIcon == null)
            {
                Texture icon  = EditorGUIUtility.IconContent("TextAsset Icon").image;
                var     cache = RenderTexture.active;
                RenderTexture.active = rt;
                Graphics.Blit(icon, rt);
                RenderTexture.active = cache;
                textIcon             = rt;

                Manualbutton    = new GUIContent(" Manual", textIcon);
                Basicbutton     = new GUIContent(" Basic use tutorials", textIcon);
                Beginnerbutton  = new GUIContent(" Beginner Series", textIcon);
                Nodesbutton     = new GUIContent(" Node List", textIcon);
                SRPusebutton    = new GUIContent(" SRP HD/URP/LW use", textIcon);
                Functionsbutton = new GUIContent(" Shader Functions", textIcon);
                Templatesbutton = new GUIContent(" Shader Templates", textIcon);
                APIbutton       = new GUIContent(" Node API", textIcon);
            }

            if (packageIcon == null)
            {
                packageIcon   = EditorGUIUtility.IconContent("BuildSettings.Editor.Small").image;
                HDRPbutton    = new GUIContent(" HDRP Samples", packageIcon);
                HDRPOLDbutton = new GUIContent(" HDRP Samples 6.X.X", packageIcon);
                URPbutton     = new GUIContent(" URP Samples", packageIcon);
                LWRPbutton    = new GUIContent(" LWRP Samples 6.X.X", packageIcon);
                LWRPOLDbutton = new GUIContent(" LWRP Samples 3.X.X", packageIcon);
                BuiltInbutton = new GUIContent(" Built-In Samples", packageIcon);
            }

            if (webIcon == null)
            {
                webIcon       = EditorGUIUtility.IconContent("BuildSettings.Web.Small").image;
                DiscordButton = new GUIContent(" Discord", webIcon);
                ForumButton   = new GUIContent(" Unity Forum", webIcon);
            }

            if (m_changeLog == null)
            {
                var    changelog  = AssetDatabase.LoadAssetAtPath <TextAsset>(AssetDatabase.GUIDToAssetPath(ChangeLogGUID));
                string lastUpdate = string.Empty;
                if (changelog != null)
                {
                    lastUpdate = changelog.text.Substring(0, changelog.text.IndexOf("\nv", 50));                        // + "\n...";
                    lastUpdate = lastUpdate.Replace("    *", "    \u25CB");
                    lastUpdate = lastUpdate.Replace("* ", "\u2022 ");
                }
                m_changeLog = new ChangeLogInfo(VersionInfo.FullNumber, lastUpdate);
            }

            if (ASEIcon == null)
            {
                ASEIcon = new GUIContent(AssetDatabase.LoadAssetAtPath <Texture2D>(AssetDatabase.GUIDToAssetPath(IconGUID)));
            }
        }
Ejemplo n.º 27
0
 private void OnEnable()
 {
     m_ScriptPrescription.m_Lang = (Language)EditorPrefs.GetInt(kLanguageEditorPrefName, 0);
     UpdateTemplateNamesAndTemplate();
     OnSelectionChange();
 }
Ejemplo n.º 28
0
        private void ShowEnvironnementSettings()
        {
            ShowTitle(GetEditorText(15), eManagers.SpawnManager);
            EditorGUILayout.BeginHorizontal();
            LayerMask tempLayers = EditorGUILayout.MaskField(GetEditorText(16), UnityEditorInternal.InternalEditorUtility.LayerMaskToConcatenatedLayersMask(EditorPrefs.GetInt("Spawn.GroundLayer", 0)), UnityEditorInternal.InternalEditorUtility.layers, m_ListBtnSelect);

            EditorPrefs.SetInt("Spawn.GroundLayer", UnityEditorInternal.InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(tempLayers));
            if (GUILayout.Button(GetEditorText(17), m_ButtonStyle))
            {
                StickSpawnToGround();
            }
            EditorGUILayout.EndHorizontal();
            ShowAdvancedToolTip(GetEditorText(18));
        }
Ejemplo n.º 29
0
        void OnGUI()
        {
            if (shouldReloadPreferences)
            {
                selectionHistory.HistorySize = EditorPrefs.GetInt(SelectionHistoryWindow.HistorySizePrefKey, 10);
                automaticRemoveDeleted       = EditorPrefs.GetBool(SelectionHistoryWindow.HistoryAutomaticRemoveDeletedPrefKey, true);
                allowDuplicatedEntries       = EditorPrefs.GetBool(SelectionHistoryWindow.HistoryAllowDuplicatedEntriesPrefKey, false);

                showHierarchyViewObjects = EditorPrefs.GetBool(SelectionHistoryWindow.HistoryShowHierarchyObjectsPrefKey, true);
                showProjectViewObjects   = EditorPrefs.GetBool(SelectionHistoryWindow.HistoryShowProjectViewObjectsPrefKey, true);

                shouldReloadPreferences = false;
            }

            if (automaticRemoveDeleted)
            {
                selectionHistory.ClearDeleted();
            }

            if (!allowDuplicatedEntries)
            {
                selectionHistory.RemoveDuplicated();
            }

            var favoritesEnabled = EditorPrefs.GetBool(HistoryFavoritesPrefKey, true);

            if (favoritesEnabled && selectionHistory.Favorites.Count > 0)
            {
                _favoritesScrollPosition = EditorGUILayout.BeginScrollView(_favoritesScrollPosition);
                DrawFavorites();
                EditorGUILayout.EndScrollView();
                EditorGUILayout.Separator();
            }

            bool changedBefore = GUI.changed;

            _historyScrollPosition = EditorGUILayout.BeginScrollView(_historyScrollPosition);

            bool changedAfter = GUI.changed;

            if (!changedBefore && changedAfter)
            {
                Debug.Log("changed");
            }

            DrawHistory();

            EditorGUILayout.EndScrollView();

            if (GUILayout.Button("Clear"))
            {
                selectionHistory.Clear();
                Repaint();
            }

            if (!automaticRemoveDeleted)
            {
                if (GUILayout.Button("Remove Deleted"))
                {
                    selectionHistory.ClearDeleted();
                    Repaint();
                }
            }

            if (allowDuplicatedEntries)
            {
                if (GUILayout.Button("Remove Duplciated"))
                {
                    selectionHistory.RemoveDuplicated();
                    Repaint();
                }
            }

            DrawSettingsButton();
        }
Ejemplo n.º 30
0
 public IntOption(string key, int defaultValue) : base(key)
 {
     value = EditorPrefs.GetInt(prefix + key, defaultValue);
 }