Пример #1
0
            public override MouseHandlingResult HandleClick()
            {
                int rowCount = ArcenSettingTable.Instance.VisibleRows.Count;

                for (int i = 0; i < rowCount; i++)
                {
                    ArcenSetting setting = ArcenSettingTable.Instance.VisibleRows[i];
                    switch (setting.Type)
                    {
                    case ArcenSettingType.BoolToggle:
                        setting.TempValue_Bool = setting.DefaultBoolValue;
                        break;

                    case ArcenSettingType.FloatSlider:
                        setting.TempValue_Float = setting.DefaultFloatValue;
                        break;

                    case ArcenSettingType.IntTextbox:
                        setting.TempValue_Int    = setting.DefaultIntValue;
                        setting.TempValue_String = setting.DefaultIntValue.ToString();
                        break;
                    }
                }
                return(MouseHandlingResult.None);
            }
Пример #2
0
            public override void HandleChangeInValue(string NewValue)
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                setting.TempValue_String = NewValue;
            }
Пример #3
0
            public override void GetTextToShow(ArcenDoubleCharacterBuffer buffer)
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                buffer.Add(setting.TempValue_Bool ? "On" : "Off");
            }
Пример #4
0
            public override void GetTextToShow(ArcenDoubleCharacterBuffer buffer)
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                buffer.Add(setting.DisplayName);
            }
Пример #5
0
            public override MouseHandlingResult HandleClick()
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return(MouseHandlingResult.None);
                }

                setting.TempValue_Bool = !setting.TempValue_Bool;
                return(MouseHandlingResult.None);
            }
Пример #6
0
            public override void HandleMouseover()
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }
                if (setting.Description.Length > 0)
                {
                    Window_AtMouseTooltipPanel.bPanel.Instance.SetText(setting.Description);
                }
            }
Пример #7
0
            //public override char ValidateInput( string input, int charIndex, char addedChar )
            //{
            //    if ( input.Length >= 10 )
            //        return '\0';
            //    if ( !char.IsDigit( addedChar ) )
            //        return '\0';

            //    ArcenSetting setting = GetSettingForController( this );
            //    if ( setting == null ) return '\0';

            //    string testInput = input.Insert( charIndex, addedChar.ToString() );
            //    int testInputAsType;
            //    if ( !Int32.TryParse( testInput, out testInputAsType ) )
            //        return '\0';

            //    if ( testInputAsType < setting.MinIntValue )
            //        return '\0';

            //    if ( setting.MaxIntValue > setting.MinIntValue && testInputAsType > setting.MaxIntValue )
            //        return '\0';

            //    return addedChar;
            //}

            public override void OnUpdate()
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                ArcenUI_Input elementAsType = (ArcenUI_Input)Element;

                elementAsType.SetText(setting.TempValue_String);
            }
Пример #8
0
            public override void OnChange(float NewValue)
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                float range            = setting.MaxFloatValue - setting.MinFloatValue;
                float adjustedNewValue = setting.MinFloatValue + (range * NewValue);

                setting.TempValue_Float = adjustedNewValue;
            }
Пример #9
0
            public override void HandleSelectionChanged(IArcenUI_Dropdown_Option Item)
            {
                if (Item == null)
                {
                    return;
                }
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                ArcenUI_Dropdown elementAsType = (ArcenUI_Dropdown)Element;

                int newValue = elementAsType.Items.IndexOf(Item);

                setting.TempValue_Int = newValue;
            }
Пример #10
0
            public override void GetTextToShow(ArcenDoubleCharacterBuffer buffer)
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                switch (setting.Type)
                {
                case ArcenSettingType.BoolToggle:
                    break;

                case ArcenSettingType.FloatSlider:
                    buffer.Add(setting.TempValue_Float.ToString());
                    buffer.Add(" (ranges from ").Add(setting.MinFloatValue.ToString());
                    if (setting.MaxFloatValue > 0 && setting.MaxFloatValue > setting.MinFloatValue)
                    {
                        buffer.Add(" to ").Add(setting.MaxFloatValue.ToString());
                    }
                    buffer.Add(")");
                    break;

                case ArcenSettingType.IntTextbox:
                    int valueAsInt;
                    if (!Int32.TryParse(setting.TempValue_String, out valueAsInt))
                    {
                        buffer.Add("Must be an integer.");
                    }
                    else if (valueAsInt < setting.MinIntValue)
                    {
                        buffer.Add("Must be at least ").Add(setting.MinIntValue);
                    }
                    else if (setting.MaxIntValue > 0 && setting.MaxIntValue > setting.MinIntValue && valueAsInt > setting.MaxIntValue)
                    {
                        buffer.Add("Must be at most ").Add(setting.MaxIntValue);
                    }
                    break;
                }
            }
Пример #11
0
            public override void OnUpdate()
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                float currentValue = setting.TempValue_Float;
                float range        = setting.MaxFloatValue - setting.MinFloatValue;

                if (range == 0)
                {
                    range = 1;
                }
                float currentPortion = (currentValue - setting.MinFloatValue) / range;

                ArcenUI_Slider elementAsType = (ArcenUI_Slider)Element;

                elementAsType.ReferenceSlider.value = currentPortion;
            }
Пример #12
0
            public override void OnUpdate()
            {
                ArcenSetting setting = GetSettingForController(this);

                if (setting == null)
                {
                    return;
                }

                ArcenUI_Dropdown elementAsType = (ArcenUI_Dropdown)Element;

                if (elementAsType.Items.Count <= 0)
                {
                    for (int i = 0; i < ArcenUI.SupportedResolutions.Count; i++)
                    {
                        elementAsType.Items.Add(new ResolutionOption(ArcenUI.SupportedResolutions[i]));
                    }
                }

                if (elementAsType.Items.Count > setting.TempValue_Int && setting.TempValue_Int != elementAsType.GetSelectedIndex())
                {
                    elementAsType.SetSelectedIndex(setting.TempValue_Int);
                }
            }
Пример #13
0
        public override void PopulateFreeFormControls(ArcenUI_SetOfCreateElementDirectives Set)
        {
            Rect scrollbarRect = ArcenRectangle.CreateUnityRect(mainAreaBounds.x - 2, mainAreaBounds.y + 2, 2, mainAreaBounds.height - 5);

            AddVerticalSlider(Set, typeof(sScrollbar), 0, scrollbarRect);

            int rowsToShow = GetMaxRowsToShow();

            int rowCount = ArcenSettingTable.Instance.VisibleRows.Count;

            if (sScrollbar.Instance != null)
            {
                int range = rowCount - rowsToShow;
                if (range <= 0)
                {
                    startingTableIndex = 0;
                }
                else
                {
                    ArcenUI_Slider slider = (ArcenUI_Slider)sScrollbar.Instance.Element;
                    startingTableIndex = Mathf.FloorToInt(range * slider.ReferenceSlider.value);
                }
            }

            float runningY = 3;

            Rect headerTextBounds = ArcenRectangle.CreateUnityRect(mainAreaBounds.xMin, runningY, 15, headerRowHeight);

            AddText(Set, typeof(tHeader), 0, headerTextBounds);

            Rect closeButtonBounds = ArcenRectangle.CreateUnityRect(headerTextBounds.xMax + 2, runningY, 10, headerRowHeight);

            AddButton(Set, typeof(bCancel), 0, closeButtonBounds);

            Rect saveButtonBounds = ArcenRectangle.CreateUnityRect(closeButtonBounds.xMax + 2, runningY, 10, headerRowHeight);

            AddButton(Set, typeof(bSave), 0, saveButtonBounds);

            Rect resetButtonBounds = ArcenRectangle.CreateUnityRect(saveButtonBounds.xMax + 2, runningY, 10, headerRowHeight);

            AddButton(Set, typeof(bReset), 0, resetButtonBounds);

            runningY += headerRowHeight;

            int rowsLeft = rowCount - startingTableIndex;

            rowsToShow = Math.Min(rowsLeft, rowsToShow);
            for (int i = 0; i < rowsToShow; i++)
            {
                ArcenSetting setting = ArcenSettingTable.Instance.VisibleRows[startingTableIndex + i];

                Rect nameBounds = ArcenRectangle.CreateUnityRect(mainAreaBounds.xMin, runningY, 50, rowHeight);
                AddText(Set, typeof(tSettingName), i, nameBounds);

                Rect valueSettingControlBounds = ArcenRectangle.CreateUnityRect(nameBounds.xMax, runningY, 15, rowHeight);
                switch (setting.Type)
                {
                case ArcenSettingType.BoolToggle:
                    AddButton(Set, typeof(bToggle), i, valueSettingControlBounds);
                    break;

                case ArcenSettingType.IntTextbox:
                    AddInput(Set, typeof(iIntInput), i, valueSettingControlBounds);
                    break;

                case ArcenSettingType.FloatSlider:
                    AddHorizontalSlider(Set, typeof(sFloatSlider), i, valueSettingControlBounds);
                    break;

                case ArcenSettingType.IntDropdown:
                    AddDropdown(Set, typeof(dIntDropdown), i, valueSettingControlBounds);
                    break;
                }

                Rect valueDescriptionBounds = ArcenRectangle.CreateUnityRect(valueSettingControlBounds.xMax, runningY, 30, rowHeight);
                AddText(Set, typeof(tSettingValueDescription), i, valueDescriptionBounds);

                runningY += rowHeight;
            }
        }