protected override IGUIBrowserObject ConvertEditObjectToBrowserObject(FieldInfo editObject)
        {
            IGUIBrowserObject       browserObject = base.ConvertEditObjectToBrowserObject(editObject);
            GUIGenericBrowserObject uabo          = browserObject.gameObject.GetComponent <GUIGenericBrowserObject>();

            uabo.EditButton.functionName = "OnClickBrowserObject";
            uabo.EditButton.target       = gameObject;
            uabo.Icon.atlas      = Mats.Get.IconsAtlas;
            uabo.Icon.spriteName = "SkillIconCraftRepairMachine";
            uabo.Icon.enabled    = true;
            Vector3 iconPosition = uabo.Icon.transform.localPosition;

            iconPosition.z = -25f;                                    //this is necessary with this layout for some reason
            uabo.Icon.transform.localPosition = iconPosition;

            DifficultySettingGlobal dsg = null;

            if (CurrentDifficultySetting != null)
            {
                bool foundSetting = false;
                //see if the current difficulty setting has this global setting
                for (int i = 0; i < CurrentDifficultySetting.GlobalVariables.Count; i++)
                {
                    if (CurrentDifficultySetting.GlobalVariables[i].GlobalVariableName == editObject.Name)
                    {
                        dsg = CurrentDifficultySetting.GlobalVariables[i];
                        browserObject.name    = "B_" + editObject.Name;
                        uabo.Background.color = Colors.Darken(Colors.Get.BookColorLore);
                        NumAffectedGlobalValues++;
                        foundSetting = true;
                        break;
                    }
                }

                if (!foundSetting)
                {
                    //unassigned difficulty settings are listed below
                    browserObject.name = "D_" + editObject.Name;
                    NumUnaffectedGlobalValues++;
                    uabo.Name.text = editObject.Name + ":  " + editObject.GetValue(null).ToString();
                }
                else
                {
                    //get the value of the global setting
                    switch (editObject.FieldType.Name)
                    {
                    case "Int32":
                        uabo.Name.text = editObject.Name + ":  " + dsg.VariableValue;
                        break;

                    case "Boolean":
                        uabo.Name.text = editObject.Name + ":  " + dsg.VariableValue;
                        break;

                    case "Single":
                        //we have to make sure it's displayed correctly
                        float floatValue = (float)Single.Parse(dsg.VariableValue);
                        uabo.Name.text = editObject.Name + ":  " + floatValue.ToString("0.0#####");
                        break;

                    case "Double":
                        double doubleValue = (double)Double.Parse(dsg.VariableValue);
                        uabo.Name.text = editObject.Name + ":  " + doubleValue.ToString("0.0#####");
                        break;

                    default:
                        break;
                    }
                }
            }

            uabo.Initialize(null);
            return(browserObject);
        }
        public override void PushSelectedObjectToViewer()
        {
            if (SavingNew)
            {
                return;
            }

            mSuspendUpdates = true;

            var atts = SelectedObject.GetCustomAttributes(typeof(EditableDifficultySettingAttribute), true);
            EditableDifficultySettingAttribute dsa = null;

            foreach (var att in atts)
            {
                dsa = (EditableDifficultySettingAttribute)att;
                if (dsa != null)
                {
                    break;
                }
            }

            if (dsa == null)
            {
                GlobalVariableNameLabel.text = "Unknown / Not a difficulty setting";
                GlobalVariableTypeLabel.text = "Unknown";
                GlobalVariableDescLabel.text = "This type is unknown and/or uneditable";
                return;
            }

            DifficultySettingGlobal dsg = null;

            for (int i = 0; i < CurrentDifficultySetting.GlobalVariables.Count; i++)
            {
                if (CurrentDifficultySetting.GlobalVariables[i].GlobalVariableName == SelectedObject.Name)
                {
                    dsg = CurrentDifficultySetting.GlobalVariables[i];
                    break;
                }
            }

            GlobalVariableNameLabel.text = SelectedObject.Name;
            GlobalVariableDescLabel.text = dsa.Description;

            switch (dsa.Type)
            {
            case EditableDifficultySettingAttribute.SettingType.Bool:
                GlobalVariableTypeLabel.text = "Type: True/False";
                CurrentToggleValue           = (bool)SelectedObject.GetValue(null);
                if (dsg != null)
                {
                    Boolean.TryParse(dsg.VariableValue, out CurrentToggleValue);
                }
                BooleanInput.isChecked = CurrentToggleValue;
                BooleanInput.gameObject.SetActive(true);
                IntegerInput.gameObject.SetActive(false);
                DecimalInput.gameObject.SetActive(false);
                break;

            case EditableDifficultySettingAttribute.SettingType.FloatRange:
                GlobalVariableTypeLabel.text = "Type: Decimal Range (" + dsa.MinRangeFloat.ToString("0.0#####") + " - " + dsa.MaxRangeFloat.ToString("0.0#####") + ")";
                CurrentDecimalValue          = (float)SelectedObject.GetValue(null);
                if (dsg != null)
                {
                    Single.TryParse(dsg.VariableValue, out CurrentDecimalValue);
                }
                DecimalInput.text       = CurrentDecimalValue.ToString("0.0#####");
                DecimalInput.label.text = DecimalInput.text;
                DecimalInput.gameObject.SetActive(true);
                UIInput.current = DecimalInput;
                IntegerInput.gameObject.SetActive(false);
                BooleanInput.gameObject.SetActive(false);
                break;

            case EditableDifficultySettingAttribute.SettingType.IntRange:
                GlobalVariableTypeLabel.text = "Type: Integer Range (" + dsa.MinRangeInt.ToString() + " - " + dsa.MaxRangeInt.ToString() + ")";
                CurrentIntegerValue          = (int)SelectedObject.GetValue(null);
                if (dsg != null)
                {
                    Int32.TryParse(dsg.VariableValue, out CurrentIntegerValue);
                }
                IntegerInput.text       = CurrentIntegerValue.ToString();
                IntegerInput.label.text = IntegerInput.text;
                UIInput.current         = IntegerInput;
                IntegerInput.gameObject.SetActive(true);
                DecimalInput.gameObject.SetActive(false);
                BooleanInput.gameObject.SetActive(false);
                break;

            case EditableDifficultySettingAttribute.SettingType.String:
                //StringInput.gameObject.SetActive(true);
                break;

            case EditableDifficultySettingAttribute.SettingType.Hidden:
            default:
                IntegerInput.gameObject.SetActive(false);
                DecimalInput.gameObject.SetActive(false);
                BooleanInput.gameObject.SetActive(false);
                GlobalVariableTypeLabel.text = "(Hidden)";
                GlobalVariableDescLabel.text = "This type is unknown and/or uneditable";
                break;
            }

            ApplyChangesButton.gameObject.SetActive(true);
            ApplyChangesButton.SendMessage("SetDisabled");
            RemoveSettingButton.gameObject.SetActive(true);

            mSuspendUpdates = false;
        }
        public void OnClickApplySettingButton()
        {
            if (mSuspendUpdates)
            {
                return;
            }

            mSuspendUpdates = true;

            bool createdNewSetting = false;

            var atts = SelectedObject.GetCustomAttributes(typeof(EditableDifficultySettingAttribute), true);
            EditableDifficultySettingAttribute dsa = null;

            foreach (var att in atts)
            {
                dsa = (EditableDifficultySettingAttribute)att;
                if (dsa != null)
                {
                    break;
                }
            }

            DifficultySettingGlobal dsg = null;

            for (int i = 0; i < CurrentDifficultySetting.GlobalVariables.Count; i++)
            {
                if (CurrentDifficultySetting.GlobalVariables[i].GlobalVariableName == SelectedObject.Name)
                {
                    dsg = CurrentDifficultySetting.GlobalVariables[i];
                    break;
                }
            }

            if (dsg == null)
            {
                dsg = new DifficultySettingGlobal();
                dsg.GlobalVariableName = SelectedObject.Name;
                CurrentDifficultySetting.GlobalVariables.Add(dsg);
                createdNewSetting = true;
            }

            switch (dsa.Type)
            {
            case EditableDifficultySettingAttribute.SettingType.Bool:
                dsg.VariableValue = CurrentToggleValue.ToString();
                //SelectedObject.SetValue(null, CurrentToggleValue);
                break;

            case EditableDifficultySettingAttribute.SettingType.FloatRange:
                dsg.VariableValue = CurrentDecimalValue.ToString();
                //SelectedObject.SetValue(null, CurrentDecimalValue);
                break;

            case EditableDifficultySettingAttribute.SettingType.IntRange:
                dsg.VariableValue = CurrentIntegerValue.ToString();
                //SelectedObject.SetValue(null, CurrentIntegerValue);
                break;

            case EditableDifficultySettingAttribute.SettingType.String:
                //StringInput.gameObject.SetActive(true);
                break;

            case EditableDifficultySettingAttribute.SettingType.Hidden:
            default:
                break;
            }

            ApplyChangesButton.SendMessage("SetDisabled");

            mSuspendUpdates = false;

            CurrentDifficultySetting.HasBeenCustomized = true;

            if (createdNewSetting)
            {
                ReceiveFromParentEditor(FetchItems());
                ResetInputs();
            }
            else
            {
                ResetInputs();
            }
        }