static public int get_i(IntPtr l)
 {
     try {
         FairyGUI.UIConfig.ConfigValue self = (FairyGUI.UIConfig.ConfigValue)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.i);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.UIConfig.ConfigValue o;
         o = new FairyGUI.UIConfig.ConfigValue();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_s(IntPtr l)
 {
     try {
         FairyGUI.UIConfig.ConfigValue self = (FairyGUI.UIConfig.ConfigValue)checkSelf(l);
         System.String v;
         checkType(l, 2, out v);
         self.s = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_c(IntPtr l)
 {
     try {
         FairyGUI.UIConfig.ConfigValue self = (FairyGUI.UIConfig.ConfigValue)checkSelf(l);
         UnityEngine.Color             v;
         checkType(l, 2, out v);
         self.c = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#5
0
 static int SetDefaultValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.UIConfig.ConfigKey   arg0 = (FairyGUI.UIConfig.ConfigKey)ToLua.CheckObject(L, 1, typeof(FairyGUI.UIConfig.ConfigKey));
         FairyGUI.UIConfig.ConfigValue arg1 = (FairyGUI.UIConfig.ConfigValue)ToLua.CheckObject <FairyGUI.UIConfig.ConfigValue>(L, 2);
         FairyGUI.UIConfig.SetDefaultValue(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            #if UNITY_5
            DrawPropertiesExcluding(serializedObject, propertyToExclude);
            #endif

            UIConfig config = (UIConfig)target;

            EditorGUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            itemsFoldout = EditorGUILayout.Foldout(itemsFoldout, "Config Items");
            if (EditorGUI.EndChangeCheck())
                EditorPrefs.SetBool("itemsFoldOut", itemsFoldout);
            EditorGUILayout.EndHorizontal();

            if (itemsFoldout)
            {
                Undo.RecordObject(config, "Items");

                int len = config.Items.Count;

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Add");
                UIConfig.ConfigKey selectedKey = (UIConfig.ConfigKey)EditorGUILayout.EnumPopup((System.Enum)UIConfig.ConfigKey.PleaseSelect);

                if (selectedKey != UIConfig.ConfigKey.PleaseSelect)
                {
                    int index = (int)selectedKey;

                    if (index > len - 1)
                    {
                        for (int i = len; i < index; i++)
                            config.Items.Add(new UIConfig.ConfigValue());

                        UIConfig.ConfigValue value = new UIConfig.ConfigValue();
                        value.valid = true;
                        InitDefaultValue(selectedKey, value);
                        config.Items.Add(value);
                    }
                    else
                    {
                        UIConfig.ConfigValue value = config.Items[index];
                        if (value == null)
                        {
                            value = new UIConfig.ConfigValue();
                            value.valid = true;
                            InitDefaultValue(selectedKey, value);
                            config.Items[index] = value;
                        }
                        else if (!value.valid)
                        {
                            value.valid = true;
                            InitDefaultValue(selectedKey, value);
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();

                for (int i = 0; i < len; i++)
                {
                    UIConfig.ConfigValue value = config.Items[i];
                    if (value == null || !value.valid)
                        continue;

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(((UIConfig.ConfigKey)i).ToString());
                    switch ((UIConfig.ConfigKey)i)
                    {
                        case UIConfig.ConfigKey.ClickDragSensitivity:
                        case UIConfig.ConfigKey.DefaultComboBoxVisibleItemCount:
                        case UIConfig.ConfigKey.DefaultScrollSpeed:
                        case UIConfig.ConfigKey.TouchDragSensitivity:
                        case UIConfig.ConfigKey.TouchScrollSensitivity:
                        case UIConfig.ConfigKey.InputCaretSize:
                            value.i = EditorGUILayout.IntField(value.i);
                            break;

                        case UIConfig.ConfigKey.ButtonSound:
                        case UIConfig.ConfigKey.GlobalModalWaiting:
                        case UIConfig.ConfigKey.HorizontalScrollBar:
                        case UIConfig.ConfigKey.LoaderErrorSign:
                        case UIConfig.ConfigKey.PopupMenu:
                        case UIConfig.ConfigKey.PopupMenu_seperator:
                        case UIConfig.ConfigKey.TooltipsWin:
                        case UIConfig.ConfigKey.VerticalScrollBar:
                        case UIConfig.ConfigKey.WindowModalWaiting:
                        case UIConfig.ConfigKey.DefaultFont:
                            value.s = EditorGUILayout.TextField(value.s);
                            break;

                        case UIConfig.ConfigKey.DefaultScrollBounceEffect:
                        case UIConfig.ConfigKey.DefaultScrollTouchEffect:
                        case UIConfig.ConfigKey.RenderingTextBrighterOnDesktop:
                        case UIConfig.ConfigKey.AllowSoftnessOnTopOrLeftSide:
                            value.b = EditorGUILayout.Toggle(value.b);
                            break;

                        case UIConfig.ConfigKey.ButtonSoundVolumeScale:
                            value.f = EditorGUILayout.Slider(value.f, 0, 1);
                            break;

                        case UIConfig.ConfigKey.ModalLayerColor:
                        case UIConfig.ConfigKey.InputHighlightColor:
                            value.c = EditorGUILayout.ColorField(value.c);
                            break;
                    }
                    if (GUILayout.Button(new GUIContent("X", "Delete Item"), EditorStyles.miniButtonRight, GUILayout.Width(30)))
                        config.Items[i].Reset();
                    EditorGUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            packagesFoldOut = EditorGUILayout.Foldout(packagesFoldOut, "Preload Packages");
            if (EditorGUI.EndChangeCheck())
                EditorPrefs.SetBool("packagesFoldOut", packagesFoldOut);
            EditorGUILayout.EndHorizontal();

            if (packagesFoldOut)
            {
                Undo.RecordObject(config, "PreloadPackages");

                EditorToolSet.LoadPackages();

                if (EditorToolSet.packagesPopupContents != null)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Add");
                    int selected = EditorGUILayout.Popup(EditorToolSet.packagesPopupContents.Length - 1, EditorToolSet.packagesPopupContents);
                    EditorGUILayout.EndHorizontal();

                    if (selected != EditorToolSet.packagesPopupContents.Length - 1)
                    {
                        UIPackage pkg = UIPackage.GetPackages()[selected];
                        string tmp = pkg.assetPath.ToLower();
                        int pos = tmp.LastIndexOf("resources/");
                        if (pos != -1)
                        {
                            string packagePath = pkg.assetPath.Substring(pos + 10);
                            if (config.PreloadPackages.IndexOf(packagePath) == -1)
                                config.PreloadPackages.Add(packagePath);

                            errorState = 0;
                        }
                        else
                        {
                            errorState = 10;
                        }
                    }
                }

                if (errorState > 0)
                {
                    errorState--;
                    EditorGUILayout.HelpBox("Package is not in resources folder.", MessageType.Warning);
                }

                int cnt = config.PreloadPackages.Count;
                int pi = 0;
                while (pi < cnt)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("" + pi + ".");
                    config.PreloadPackages[pi] = EditorGUILayout.TextField(config.PreloadPackages[pi]);
                    if (GUILayout.Button(new GUIContent("X", "Delete Item"), EditorStyles.miniButtonRight, GUILayout.Width(30)))
                    {
                        config.PreloadPackages.RemoveAt(pi);
                        cnt--;
                    }
                    else
                        pi++;
                    EditorGUILayout.EndHorizontal();
                }
            }
            else
                errorState = 0;

            if (serializedObject.ApplyModifiedProperties())
                (target as UIConfig).ApplyModifiedProperties();
        }