Beispiel #1
0
 public void OnUiWidthChange()
 {
     if (UiWidth != ViewRect.rect.width)
     {
         UiWidth = ViewRect.rect.width;
         float Ratio = UiWidth / 500f;
         PlayBtn.GetComponent <RectTransform>().sizeDelta                       = new Vector2(60 * Ratio, 30);
         PlayBtn.GetComponent <RectTransform>().anchoredPosition                = new Vector2(10 * Ratio, 0);
         PauseBtn.GetComponent <RectTransform>().sizeDelta                      = new Vector2(60 * Ratio, 30);
         PauseBtn.GetComponent <RectTransform>().anchoredPosition               = new Vector2(80 * Ratio, 0);
         StopBtn.GetComponent <RectTransform>().sizeDelta                       = new Vector2(60 * Ratio, 30);
         StopBtn.GetComponent <RectTransform>().anchoredPosition                = new Vector2(150 * Ratio, 0);
         SwitchModeBtn.GetComponent <RectTransform>().sizeDelta                 = new Vector2(120 * Ratio, 30);
         SwitchModeBtn.GetComponent <RectTransform>().anchoredPosition          = new Vector2(220 * Ratio, 0);
         CurrentModeText.GetComponent <RectTransform>().sizeDelta               = new Vector2(90 * Ratio, 30);
         CurrentModeText.GetComponent <RectTransform>().anchoredPosition        = new Vector2(340 * Ratio, 0);
         ResetBtn.GetComponent <RectTransform>().sizeDelta                      = new Vector2(50 * Ratio, 30);
         ResetBtn.GetComponent <RectTransform>().anchoredPosition               = new Vector2(480 * Ratio, 0);
         FixTimeBtn.GetComponent <RectTransform>().sizeDelta                    = new Vector2(100 * Ratio, 30);
         FixTimeBtn.GetComponent <RectTransform>().anchoredPosition             = new Vector2(210 * Ratio, 0);
         OffsetLabel.GetComponent <RectTransform>().sizeDelta                   = new Vector2(60 * Ratio, 30);
         OffsetLabel.GetComponent <RectTransform>().anchoredPosition            = new Vector2(315 * Ratio, 0);
         OffsetInputField.GetComponent <RectTransform>().sizeDelta              = new Vector2(100 * Ratio, 30);
         OffsetInputField.GetComponent <RectTransform>().anchoredPosition       = new Vector2(380 * Ratio, 0);
         PreciseControllerLabel.GetComponent <RectTransform>().sizeDelta        = new Vector2(190 * Ratio, 30);
         PreciseControllerLabel.GetComponent <RectTransform>().anchoredPosition = new Vector2(10 * Ratio, 0);
     }
 }
        /// <summary>
        /// Identifies all label reference pairs that cross the specified global label.  When
        /// a matching pair is found, the pair's destination label is marked as global and
        /// added to the global label list.
        /// </summary>
        /// <param name="glabel">Global label of interest.</param>
        private void FindIntersectingPairs(OffsetLabel glabel)
        {
            Debug.Assert(mGlobalFlags[glabel.Offset]);

            int globOffset = glabel.Offset;

            for (int i = 0; i < mOffsetPairs.Count; i++)
            {
                OffsetPair pair = mOffsetPairs[i];

                // If the destination was marked global earlier, remove and ignore this entry.
                // Note this also means that pair.DstOffset != label.Offset.
                if (mGlobalFlags[pair.DstOffset])
                {
                    mOffsetPairs.RemoveAt(i);
                    i--;
                    continue;
                }

                // Check to see if the global label falls between the source and destination
                // offsets.
                //
                // If the reference source is itself a global label, it can reference local
                // labels forward, but not backward.  We need to take that into account for
                // the case where label.Offset==pair.SrcOffset.
                bool intersect;
                if (pair.SrcOffset < pair.DstOffset)
                {
                    // Forward reference.  src==glob is ok
                    intersect = pair.SrcOffset < globOffset && pair.DstOffset >= globOffset;
                }
                else
                {
                    // Backward reference.  src==glob is bad
                    intersect = pair.SrcOffset >= globOffset && pair.DstOffset <= globOffset;
                }

                if (intersect)
                {
                    //Debug.WriteLine("Global " + glabel + " btwn " + pair + " (" +
                    //    mProject.GetAnattrib(pair.DstOffset).Symbol.Label + ")");

                    // Change the destination label to global.
                    mGlobalFlags[pair.DstOffset] = true;
                    mGlobalLabels.Add(new OffsetLabel(pair.DstOffset,
                                                      mProject.GetAnattrib(pair.DstOffset).Symbol.Label));

                    // Carefully remove it from the list we're iterating through.
                    mOffsetPairs.RemoveAt(i);
                    i--;
                }
            }
        }