Пример #1
0
 // Use this for initialization
 void Awake()
 {
     _nameInputField = nameInputField.GetComponent <InputField>();
     _addButton      = addButton.GetComponent <Button>();
     _removeButton   = removeButton.GetComponent <Button>();
     _anchorsList    = anchorsList.GetComponent <SingleSelectionList>();
 }
        protected override void UpdateSetting()
        {
            SingleSelectionList ssl = (SingleSelectionList)_setting;

            ssl.Selected = _selectedIndex;
            base.UpdateSetting();
        }
        protected override void SettingChanged()
        {
            SingleSelectionList ssl = (SingleSelectionList)_setting;

            _selectedIndex = ssl.Selected;
            base.SettingChanged();
        }
Пример #4
0
 void Awake()
 {
     _nameInputField = nameInputField.GetComponent <InputField>();
     _canvasDropdown = canvasDropdown.GetComponent <Dropdown>();
     _objectsList    = objectsList.GetComponent <SingleSelectionList>();
     HUDEditor.Instance.OnHUDChangedEvent        += OnHUDChanged;
     HUDEditor.Instance.OnRootCanvasChangedEvent += OnRootCanvasChangedEvent;
 }
Пример #5
0
 void Awake()
 {
     _collisionsList = collisionsList.GetComponent <SingleSelectionList>();
     _removeButton   = removeButton.GetComponent <Button>();
     _enabledToggle  = enabledToggle.GetComponent <Toggle>();
     _boxPanel       = boxPanel.GetComponent <BoxSubPanel>();
     _copyButton     = copyButton.GetComponent <Button>();
 }
Пример #6
0
 void Awake()
 {
     _hitsList      = hitsList.GetComponent <SingleSelectionList>();
     _removeButton  = removeButton.GetComponent <Button>();
     _enabledToggle = enabledToggle.GetComponent <Toggle>();
     _boxPanel      = boxPanel.GetComponent <BoxSubPanel>();
     _copyButton    = copyButton.GetComponent <Button>();
     _typeDropdown  = typeDropdown.GetComponent <Dropdown>();
 }
Пример #7
0
        void Awake()
        {
            _eventsList         = eventsList.GetComponent <SingleSelectionList>();
            _animationsList     = animationsList.GetComponent <SingleSelectionList>();
            _animationsDropdown = animationsDropdown.GetComponent <Dropdown>();
            _editButton         = editButton.GetComponent <Button>();
            _addButton          = addButton.GetComponent <Button>();
            _removeButton       = removeButton.GetComponent <Button>();

            allEvents       = new Dictionary <ConditionalEvent, List <CharacterAnimation> >(new ConditionalEventComparer());
            allEventsSorted = new List <ConditionalEvent>();
        }
Пример #8
0
        // Use this for initialization
        void Awake()
        {
            // Get the scripts for buttons
            _addButton    = addButton.GetComponent <Button>();
            _removeButton = removeButton.GetComponent <Button>();
            _closeButton  = closeButton.GetComponent <Button>();

            // Get the scripts for lists
            _bundlesList      = bundlesList.GetComponent <SingleSelectionList>();
            _prefabsList      = prefabsList.GetComponent <SingleSelectionList>();
            _skinsList        = skinsList.GetComponent <SingleSelectionList>();
            _portraitDropdown = portraitDropdown.GetComponent <Dropdown>();
            _portraitImage    = portraitImage.GetComponent <Image>();
        }
Пример #9
0
        // Use this for initialization
        void Awake()
        {
            // NOTE: decided to take this feature off
//			_addCollisionButton     = addCollisionButton.GetComponent<Button>();
//			_removeCollisionButton  = removeCollisionButton.GetComponent<Button>();
//			_addHitButton			= addHitButton.GetComponent<Button>();
//			_removeHitButton        = removeHitButton.GetComponent<Button>();
//			_collisionsList = collisionsList.GetComponent<SingleSelectionList>();
//			_hitsList = hitsList.GetComponent<SingleSelectionList>();
//			_addCollisionButton.interactable = false;
//			_removeCollisionButton.interactable = false;
//			_addHitButton.interactable = false;
//			_removeHitButton.interactable = false;


            _createButton = createButton.GetComponent <Button>();
            _filesList    = filesList.GetComponent <SingleSelectionList>();
            _createButton.interactable = false;
        }
 protected override void UpdateItemsList()
 {
     _items.Clear();
     if (_setting != null)
     {
         SingleSelectionList ssl = (SingleSelectionList)_setting;
         int current             = 0;
         _selectedIndex = ssl.Selected;
         foreach (IResourceString item in ssl.Items)
         {
             ListItem listItem = new ListItem(KEY_NAME, item)
             {
                 Selected = (current == _selectedIndex)
             };
             listItem.SelectedProperty.Attach(OnSelectionChanged);
             _items.Add(listItem);
             current++;
         }
     }
     _items.FireChange();
 }
Пример #11
0
 // Use this for initialization
 void Awake()
 {
     _filesList = filesList.GetComponent <SingleSelectionList>();
 }
Пример #12
0
        /// <summary>
        /// Returns a default radiopanel.
        /// This panel will try to fit into the second column,
        /// if not it will take a new line and spread over the whole width.
        /// </summary>
        /// <param name="position">Position of the Panel.</param>
        /// <param name="tag">Tag for the panel, containing data about the RadioButtons.</param>
        /// <returns></returns>
        private Panel CreateRadioPanel(Position position, SingleSelectionList tag)
        {
            Panel panel = new Panel();

            panel.AutoSize = false;
            panel.Tag      = tag;
            panel.TabIndex = position.NextTabIndex;
            panel.Name     = "radioPanel" + position.TabIndex.ToString();
            bool takeNewLine         = false; // needed to know the columnwidth when calculating the expected height
            List <RadioButton> items = new List <RadioButton>(tag.Items.Count);

            for (int i = 0; i < tag.Items.Count; i++)
            {
                RadioButton btn = new RadioButton();
                btn.AutoSize        = false;
                btn.TabIndex        = position.NextTabIndex;
                btn.Name            = "radioButton" + position.TabIndex.ToString();
                btn.Text            = tag.Items[i].Evaluate();
                btn.CheckAlign      = ContentAlignment.TopLeft;
                btn.Checked         = (i == tag.Selected);
                btn.CheckedChanged += _singleSelectionListChange;
                btn.Tag             = i;
                SetHelp(btn, tag.Help.Evaluate());
                items.Add(btn);
                // see if we should take a new line (add 30 for the radiobutton and to cover too small measurements)
                btn.Width = (int)(btn.CreateGraphics().MeasureString(btn.Text, btn.Font).Width + 30);
                if (btn.Width > position.WidthColumnTwo)
                {
                    takeNewLine = true;
                }
            }
            // we can't calculate the height before, because we don't know the available width (depends on takeNewLine)
            // => second loop is needed
            Position nPos = (Position)position.Clone();

            nPos.LinePosition = 0;
            int width; // values depend on the new line, we can't use Position

            if (takeNewLine)
            {
                width = position.Width - position.Margin;
            }
            else
            {
                width = position.WidthColumnTwo;
            }
            foreach (RadioButton btn in items)
            {
                btn.Location = new Point(0, nPos.LinePosition);
                if (btn.Width > width) // doesn't fit in the column, we'll have to calculate the height to avoid overlapping controls
                {
                    btn.MaximumSize    = new Size(width, (int)((double)btn.Width / width * btn.Height + position.LineHeight - btn.Height));
                    btn.MinimumSize    = btn.MaximumSize;
                    btn.AutoSize       = true;
                    nPos.LinePosition += btn.MaximumSize.Height;
                }
                else
                {
                    nPos.LinePosition += nPos.LineHeight;
                }
                panel.Controls.Add(btn);
            }
            panel.Size = new Size(width, nPos.LinePosition);
            // Locate and return the panel
            if (!takeNewLine)
            {
                panel.Location = new Point(position.StartColumnTwo, position.LinePosition);
            }
            else
            {
                position.LinePosition += position.ItemHeight;
                panel.Location         = new Point(position.StartColumnOne + position.Margin, position.LinePosition);
            }
            return(panel);
        }
Пример #13
0
 void Awake()
 {
     _paramsList   = paramsList.GetComponent <SingleSelectionList>();
     _removeButton = removeButton.GetComponent <Button>();
     _typeDropdown = typeDropdown.GetComponent <Dropdown>();
 }
Пример #14
0
 /// <summary>
 /// Returns a default radiopanel.
 /// This panel will try to fit into the second column,
 /// if not it will take a new line and spread over the whole width.
 /// </summary>
 /// <param name="position">Position of the Panel.</param>
 /// <param name="tag">Tag for the panel, containing data about the RadioButtons.</param>
 /// <returns></returns>
 private Panel CreateRadioPanel(Position position, SingleSelectionList tag)
 {
   Panel panel = new Panel();
   panel.AutoSize = false;
   panel.Tag = tag;
   panel.TabIndex = position.NextTabIndex;
   panel.Name = "radioPanel" + position.TabIndex.ToString();
   bool takeNewLine = false; // needed to know the columnwidth when calculating the expected height
   List<RadioButton> items = new List<RadioButton>(tag.Items.Count);
   for (int i = 0; i < tag.Items.Count; i++)
   {
     RadioButton btn = new RadioButton();
     btn.AutoSize = false;
     btn.TabIndex = position.NextTabIndex;
     btn.Name = "radioButton" + position.TabIndex.ToString();
     btn.Text = tag.Items[i].Evaluate();
     btn.CheckAlign = ContentAlignment.TopLeft;
     btn.Checked = (i == tag.Selected);
     btn.CheckedChanged += _singleSelectionListChange;
     btn.Tag = i;
     SetHelp(btn, tag.Help.Evaluate());
     items.Add(btn);
     // see if we should take a new line (add 30 for the radiobutton and to cover too small measurements)
     btn.Width = (int)(btn.CreateGraphics().MeasureString(btn.Text, btn.Font).Width + 30);
     if (btn.Width > position.WidthColumnTwo)
       takeNewLine = true;
   }
   // we can't calculate the height before, because we don't know the available width (depends on takeNewLine)
   // => second loop is needed
   Position nPos = (Position)position.Clone();
   nPos.LinePosition = 0;
   int width; // values depend on the new line, we can't use Position
   if (takeNewLine)
   {
     width = position.Width - position.Margin;
   }
   else
   {
     width = position.WidthColumnTwo;
   }
   foreach (RadioButton btn in items)
   {
     btn.Location = new Point(0, nPos.LinePosition);
     if (btn.Width > width)  // doesn't fit in the column, we'll have to calculate the height to avoid overlapping controls
     {
       btn.MaximumSize = new Size(width, (int)((double)btn.Width / width * btn.Height + position.LineHeight - btn.Height));
       btn.MinimumSize = btn.MaximumSize;
       btn.AutoSize = true;
       nPos.LinePosition += btn.MaximumSize.Height;
     }
     else
       nPos.LinePosition += nPos.LineHeight;
     panel.Controls.Add(btn);
   }
   panel.Size = new Size(width, nPos.LinePosition);
   // Locate and return the panel
   if (!takeNewLine)
     panel.Location = new Point(position.StartColumnTwo, position.LinePosition);
   else
   {
     position.LinePosition += position.ItemHeight;
     panel.Location = new Point(position.StartColumnOne + position.Margin, position.LinePosition);
   }
   return panel;
 }
Пример #15
0
 void Awake()
 {
     _editButton   = editButton.GetComponent <Button>();
     _removeButton = removeButton.GetComponent <Button>();
     _eventsList   = eventsList.GetComponent <SingleSelectionList>();
 }