Пример #1
0
        //--------------------------------------
        // Flags
        //--------------------------------------


        /// <summary>
        /// Add's compiler or linker flag to the build configuration
        /// </summary>
        /// <param name="name">flag name.</param>
        /// <param name="type">flag type.</param>
        public static void AddFlag(string name, ISD_FlagType type)
        {
            foreach (ISD_Flag flag in ISD_Settings.Instance.Flags)
            {
                if (flag.Type == type && flag.Name.Equals(name))
                {
                    return;
                }
            }

            ISD_Flag newFlag = new ISD_Flag();

            newFlag.Name = name;
            newFlag.Type = ISD_FlagType.LinkerFlag;

            ISD_Settings.Instance.Flags.Add(newFlag);
        }
        public void BuildFlags()
        {
            Texture2D linkerFlags = SA_EditorAssets.GetTextureAtPath(ISD_Skin.ICONS_PATH + "linkerFlags.png");

            using (new SA_WindowBlockWithIndent(new GUIContent("Linker & Compiler Flags", linkerFlags))) {
                SA_EditorGUILayout.ReorderablList(ISD_Settings.Instance.Flags,
                                                  (ISD_Flag flag) => {
                    if (flag.Type.Equals(ISD_FlagType.CompilerFlag))
                    {
                        return(flag.Name + "     (Compiler)");
                    }
                    else
                    {
                        return(flag.Name + "     (Linker)");
                    }
                },
                                                  (ISD_Flag flag) => {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Full Name:", GUILayout.Width(100));
                    flag.Name = EditorGUILayout.TextField(flag.Name, GUILayout.ExpandWidth(true));
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Type:", GUILayout.Width(100));
                    //flag.Type     = EditorGUILayout.TextField(flag.Type, GUILayout.ExpandWidth(true));
                    flag.Type = (ISD_FlagType)EditorGUILayout.EnumPopup(flag.Type);
                    EditorGUILayout.EndHorizontal();
                },
                                                  () => {
                    ISD_Flag newFlag = new ISD_Flag();
                    newFlag.Name     = "New Flag";
                    ISD_Settings.Instance.Flags.Add(newFlag);
                }
                                                  );
            }

            EditorGUILayout.Space();
        }