Esempio n. 1
0
        private void OnGUI()
        {
            GUILayout.Label(string.Format("KEngine Options"), _headerStyle);
            EditorGUILayout.LabelField("KEngine Version:", KEngineVersion.ToString());

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("== Addon ==");
            var isNgui    = KDefineSymbolsHelper.HasDefineSymbol("NGUI");
            var newIsNgui = EditorGUILayout.Toggle("NGUI", isNgui);

            if (isNgui != newIsNgui)
            {
                if (newIsNgui)
                {
                    KDefineSymbolsHelper.AddDefineSymbols("NGUI");
                }
                else
                {
                    KDefineSymbolsHelper.RemoveDefineSymbols("NGUI");
                }
            }

            EditorGUILayout.LabelField("== AppConfigs.txt ==");
            //bool tabDirty = false;
            var configs = AppEngine.PreloadConfigs();

            foreach (var sectionData in configs.GetSections())
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("[" + sectionData.SectionName + "]");

                foreach (var key in sectionData.Keys)
                {
                    string value = key.Value;
                    EditorGUILayout.BeginHorizontal();
//                    EditorGUILayout.LabelField(key.KeyName);
//                    EditorGUILayout.LabelField(value);
                    string newValue = EditorGUILayout.TextField(key.KeyName, value);
                    if (value != newValue)
                    {
//                        tabDirty = true;
                        SetConfValue(sectionData.SectionName, key.KeyName, newValue);
                        AppEngine.PreloadConfigs(true);
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }

            //if (tabDirty)
            //{
            //    AssetDatabase.Refresh();
            //}
        }
Esempio n. 2
0
        private void OnGUI()
        {
            GUILayout.Label(string.Format("KEngine Options"), _headerStyle);
            EditorGUILayout.LabelField("KEngine Version:", KEngineVersion.ToString());

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("== Addon ==");
            var isNgui    = KDefineSymbolsHelper.HasDefineSymbol("NGUI");
            var newIsNgui = EditorGUILayout.Toggle("NGUI", isNgui);

            if (isNgui != newIsNgui)
            {
                if (newIsNgui)
                {
                    KDefineSymbolsHelper.AddDefineSymbols("NGUI");
                }
                else
                {
                    KDefineSymbolsHelper.RemoveDefineSymbols("NGUI");
                }
            }

            EditorGUILayout.LabelField("== KEngineConfig.txt ==");
            bool tabDirty = false;

            foreach (var item in AppEngine.ConfigsTable.GetAll())
            {
                string value    = item["Value"];
                string newValue = EditorGUILayout.TextField(item["Key"], value);
                if (value != newValue)
                {
                    AppEngine.SetConfig(item["Key"], newValue);
                    tabDirty = true;
                }
            }

            if (tabDirty)
            {
                AssetDatabase.Refresh();
            }
        }
Esempio n. 3
0
        private void OnGUI()
        {
            GUILayout.Label(string.Format("KEngine Options"), _headerStyle);
            EditorGUILayout.LabelField("KEngine Version:", KEngineVersion.ToString());

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("== Addon ==");
            var isNgui    = KDefineSymbolsHelper.HasDefineSymbol("NGUI");
            var newIsNgui = EditorGUILayout.Toggle("NGUI", isNgui);

            if (isNgui != newIsNgui)
            {
                if (newIsNgui)
                {
                    KDefineSymbolsHelper.AddDefineSymbols("NGUI");
                }
                else
                {
                    KDefineSymbolsHelper.RemoveDefineSymbols("NGUI");
                }
            }

            EditorGUILayout.LabelField("== KEngineConfig.txt ==");
            bool tabDirty = false;

            foreach (KTabFile.RowInterator row in ConfFile)
            {
                string value    = row.GetString("Value");
                string newValue = EditorGUILayout.TextField(row.GetString("Key"), value);
                if (value != newValue)
                {
                    ConfFile.SetValue <string>(row.Row, "Value", newValue);
                    tabDirty = true;
                }
            }

            if (tabDirty)
            {
                SaveConfigFile();
            }
        }