Пример #1
0
 public bool Build()
 {
     if (!built && !cleared && ((text != null) || (picture != null)) && (symbolDatabase != null) && (ownTransform != null) &&
         (canvasTransform != null) && boxSizeLimitsSet)
     {
         lineHeight   = symbolDatabase.GetStandardSymbolUIHeight();
         margin       = 1.5f * lineHeight;
         marginDouble = 2f * margin;
         AdjustBoxSizeLimits();
         DefineTextAreaSizeLimits();
         AdjustTextContent();
         maxLineWidth = 0f;
         SplitTextIntoLines();
         AdjustTextLines();
         DefineTextAreaSize();
         DefineBoxArea();
         boxObject    = new GameObject("UITextBoxContainer", typeof(RectTransform));
         boxTransform = boxObject.GetComponent <RectTransform>();
         boxTransform.SetParent(ownTransform, false);
         boxTransform.anchoredPosition = Vector2.zero;
         boxImage        = boxObject.AddComponent <Image>();
         boxImage.type   = Image.Type.Tiled;
         boxImage.sprite = boxSprite;
         boxTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, boxArea.width);
         boxTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, boxArea.height);
         DefineTextAreaOffset();
         PlaceOrnaments();
         PlacePageLines();
         if (!instantCreation)
         {
             PrepareForOpening();
         }
         built = true;
         if (instantCreation)
         {
             ProgressOpening(true, 0f);
             ProgressWriting(true, 0f);
             instantCreation = false;
         }
         return(true);
     }
     return(false);
 }