Beispiel #1
0
        private void UpdateInfluences(Management.Calculations.Wire wire)
        {
            ClearInfluences();

            var isWiresInfluencesExists  = wire.WiresInfluences.Count != 0;
            var isBlocksInfluencesExists = wire.BlocksInfluences.Count != 0;

            _scrollviewElement.gameObject.SetActive(isWiresInfluencesExists || isBlocksInfluencesExists);
            _noInfluence.SetActive(!(isWiresInfluencesExists || isBlocksInfluencesExists));

            if (!(isWiresInfluencesExists || isBlocksInfluencesExists))
            {
                return;
            }

            foreach (var influence in wire.WiresInfluences)
            {
                var inf = Influence.Factory.Create(_influencePrefab, influence.Wire.Name, influence.Frequency.ToString(), influence.Value);
                inf.transform.SetParent(_content);
            }

            foreach (var influence in wire.BlocksInfluences)
            {
                foreach (var(frequencyMin, frequencyMax, value) in influence.Influences)
                {
                    var inf = Influence.Factory.Create(_influencePrefab, influence.Name, $"{frequencyMin} / {frequencyMax}", value);
                    inf.transform.SetParent(_content);
                }
            }

            SetScrollViewHeightToShowElements(Mathf.Clamp(wire.WiresInfluences.Count + wire.BlocksInfluences.Count, 1, 4));
            SetFreuquencyColumnWidthToMax();
        }
 public void MutualActionOfBCSAndBA_Clicked(Management.Calculations.Wire wire)
 {
     if (_wirePanel.IsOpen)
     {
         _wirePanel.Open(wire);
     }
     else
     {
         _wirePanel.Open(wire, Input.mousePosition);
     }
 }
Beispiel #3
0
        public void Open(Management.Calculations.Wire wire, Vector2 position, bool asMousePosition = true)
        {
            _wireName.text  = wire.Name;
            _wireValue.text = wire.Value.ToString();

            UpdateInfluences(wire);

            if (asMousePosition)
            {
                RectTransformUtility.ScreenPointToLocalPointInRectangle(_parentRectTransform, position, null, out position);
                position += new Vector2(_rectTransform.rect.width / 2f, -_rectTransform.rect.height / 2f);
            }

            SetPosition(position);

            Show();

            IsOpen = true;
        }
Beispiel #4
0
 public void Open(Management.Calculations.Wire wire) => Open(wire, _rectTransform.anchoredPosition, false);
 private void Wire_Clicked(Wire wire) => Clicked.Invoke(wire);