コード例 #1
0
        /// <summary>
        /// 追加宏.
        /// </summary>
        /// <param name="iAddNewDefine">新追加的宏.</param>
        private void AddDefine(string iName, bool iAndroid, bool iIOS)
        {
            if ((true == string.IsNullOrEmpty(iName)) || (null == this.Defines))
            {
                return;
            }
            bool isExist = false;

            foreach (DefineInfo define in this.Data.Defines)
            {
                if (true == string.IsNullOrEmpty(define.Name))
                {
                    continue;
                }
                if (true == iName.Equals(define.Name))
                {
                    define.Android = iAndroid;
                    define.iOS     = iIOS;
                    isExist        = true;
                    break;
                }
            }
            if (false == isExist)
            {
                DefineInfo _define = new DefineInfo(iName, iAndroid, iIOS);
                this.Defines.Add(_define);
            }

            // 按名字排序
            this.Defines.Sort((x, y) => (x.Name.CompareTo(y.Name)));

            UtilsLog.Info("DefinesWindow", "AddDefine -> Name:{0} Andorid:{1} iOS:{2}",
                          iName, iAndroid, iIOS);
        }
コード例 #2
0
        /// <summary>
        /// 删除宏.
        /// </summary>
        /// <param name="iDelDefine">删除的宏索引.</param>
        private void DelDefine(int iDelDefineIdx)
        {
            if ((-1 >= iDelDefineIdx) || (null == this.Defines))
            {
                return;
            }
            isPause = true;
            DefineInfo _delDefine = this.Defines[iDelDefineIdx];

            this.Defines.RemoveAt(iDelDefineIdx);

            // 按名字排序
            this.Defines.Sort((x, y) => (x.Name.CompareTo(y.Name)));

            UtilsLog.Info(this.ClassName, "DelDefine -> Name:{0} Andorid:{1} iOS:{2}",
                          _delDefine.Name, _delDefine.Android, _delDefine.iOS);
            isPause = false;
        }
コード例 #3
0
        /// <summary>
        /// 追加宏.
        /// </summary>
        /// <param name="iAddNewDefine">新追加的宏.</param>
        public void AddDefines(string[] iNames, bool iAndroid, bool iIOS)
        {
            if ((null == iNames) || (0 >= iNames.Length) ||
                (null == this.Defines))
            {
                return;
            }
            foreach (string defineName in iNames)
            {
                bool isExist = false;
                foreach (DefineInfo define in this.Defines)
                {
                    if (true == string.IsNullOrEmpty(define.Name))
                    {
                        continue;
                    }
                    if (true == defineName.Equals(define.Name))
                    {
                        if (true == iAndroid)
                        {
                            define.Android = iAndroid;
                        }
                        if (true == iIOS)
                        {
                            define.iOS = iIOS;
                        }
                        isExist = true;
                        break;
                    }
                }
                if (false == isExist)
                {
                    DefineInfo _define = new DefineInfo(defineName, iAndroid, iIOS);
                    this.Defines.Add(_define);
                    UtilsLog.Info("DefinesData", "AddDefine -> Name:{0} Andorid:{1} iOS:{2}",
                                  defineName, iAndroid, iIOS);
                }
            }

            // 按名字排序
            this.Defines.Sort((x, y) => (x.Name.CompareTo(y.Name)));
        }
コード例 #4
0
        /// <summary>
        /// 绘制WindowGUI.
        /// </summary>
        protected override void OnWindowGUI()
        {
            // 列表
            _scrollViewStartPos = EditorGUILayout.BeginScrollView(
                _scrollViewStartPos, GUILayout.Width(ScrollViewRect.width), GUILayout.Height(ScrollViewRect.height));
            if (null != this.Defines)
            {
                for (int idx = 0; idx < this.Defines.Count; ++idx)
                {
                    DefineInfo defineInfo = this.Defines[idx];
                    if (true == string.IsNullOrEmpty(defineInfo.Name))
                    {
                        continue;
                    }
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(defineInfo.Name,
                                               GUILayout.Width(ScrollViewRect.width - 175.0f), GUILayout.Height(LineHeight));

                    EditorGUILayout.LabelField("Android",
                                               GUILayout.Width(48.0f), GUILayout.Height(LineHeight));
                    defineInfo.Android = EditorGUILayout.Toggle(defineInfo.Android,
                                                                GUILayout.Width(10.0f), GUILayout.Height(LineHeight));

                    EditorGUILayout.LabelField("iOS",
                                               GUILayout.Width(22.0f), GUILayout.Height(LineHeight));
                    defineInfo.iOS = EditorGUILayout.Toggle(defineInfo.iOS,
                                                            GUILayout.Width(10.0f), GUILayout.Height(LineHeight));

                    if (GUILayout.Button("Del", GUILayout.Width(40.0f)))
                    {
                        // 删除宏
                        this.DelDefine(idx);
                        InputNewDefine = null;
                    }

                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndScrollView();

            // 追加宏
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("追加宏:",
                                       GUILayout.Width(40.0f), GUILayout.Height(LineHeight));
            InputNewDefine = EditorGUILayout.TextField(
                InputNewDefine, GUILayout.Width(195.0f), GUILayout.Height(ConfInfo.LineHeight));

            EditorGUILayout.LabelField("Android",
                                       GUILayout.Width(48.0f), GUILayout.Height(LineHeight));
            InputAndroidSelected = EditorGUILayout.Toggle(InputAndroidSelected,
                                                          GUILayout.Width(10.0f), GUILayout.Height(LineHeight));

            EditorGUILayout.LabelField("iOS",
                                       GUILayout.Width(22.0f), GUILayout.Height(LineHeight));
            InputIOSSelected = EditorGUILayout.Toggle(InputIOSSelected,
                                                      GUILayout.Width(10.0f), GUILayout.Height(LineHeight));

            if (GUILayout.Button("Add", GUILayout.Width(40.0f)))
            {
                // 追加宏
                this.AddDefine(InputNewDefine, InputAndroidSelected, InputIOSSelected);
                InputNewDefine       = null;
                InputAndroidSelected = false;
                InputIOSSelected     = false;
            }
            EditorGUILayout.EndHorizontal();

            this.Repaint();
        }