Example #1
0
        /// <summary>
        /// 获取存储器的所有键
        /// </summary>
        /// <returns></returns>
        public IList <string> GetKeys()
        {
            IList <string> result = null;
            string         json   = PlayerPrefs.GetString(prefix + keysKey);

            if (json != null)
            {
                SerializedList serializedList = JSON.FromJson <SerializedList>(json);
                if (serializedList != null)
                {
                    result = serializedList.ToList();
                }
            }
            if (result != null)
            {
                return(result);
            }
            return(new List <string>());
        }
        public override void OnBodyGUI()
        {
            SerializedObject.Update();

            SerializedProperty andProperty = SerializedObject.FindProperty("_logicalAND");

            if (_conditionList == null)
            {
                _conditionList = new SerializedList <Condition>(SerializedObject,
                                                                CONDITIONS_SIZE_PATH, CONDITIONS_ARRAY_ACCESSOR_PATH);
            }
            //_conditionsSizeProperty = SerializedObject.FindProperty(CONDITIONS_SIZE_PATH);

            //Draw Conditions
            EditorGUILayout.PrefixLabel("Conditions");
            if (_conditionList.sizeProperty.intValue > 3)
            {
                _scrollAmount = EditorGUILayout.BeginScrollView(_scrollAmount);
                for (int i = 0; i < _conditionList.sizeProperty.intValue; i++)
                {
                    DrawCondition(i);
                }
                EditorGUILayout.EndScrollView();
            }
            else if (_conditionList.sizeProperty.intValue > 0)
            {
                for (int i = 0; i < _conditionList.sizeProperty.intValue; i++)
                {
                    DrawCondition(i);
                }
            }

            //Draw Buttons & Options
            if (GUILayout.Button("+"))
            {
                _conditionList.Add();
            }
            DrawAndOrToggle(andProperty, GUI.enabled);

            DrawIfElsePorts();

            SerializedObject.ApplyModifiedProperties();
        }