コード例 #1
0
            private static Widget ProcessHeadingClose(Token token, BuilderContext ctx)
            {
                var    richText  = new SelectableText(textSpan: ctx.inline.Pop());
                Widget container = null;

                if (ctx.useNotifyContainer)
                {
                    var positionRecord = new PositionRecord {
                        title = ctx.title
                    };
                    container = new NotifyContainer(
                        margin: EdgeInsets.only(top: 40f),
                        child: richText,
                        notifyFn: fn => positionRecord.getPosition = fn
                        );
                    ctx.positionRecords.Add(positionRecord);
                }
                else
                {
                    container = new Container(
                        margin: EdgeInsets.only(top: 40f),
                        child: richText
                        );
                }

                ctx.Clear();
                return(container);
            }
コード例 #2
0
 private void OnSelectedChanged(SelectableText t)
 {
     if (!Input.GetKey(KeyCode.LeftControl))
     {
         foreach (var sel in m_Options.Values.Where(s => s != t))
         {
             sel.Selected = false;
         }
     }
 }
コード例 #3
0
        public override void didUpdateWidget(StatefulWidget old)
        {
            SelectableText oldWidget = (SelectableText)old;

            base.didUpdateWidget(oldWidget);

            if (oldWidget.focusNode != this.widget.focusNode)
            {
                oldWidget.focusNode.removeListener(this._handleFocusChanged);
                this.widget.focusNode.addListener(this._handleFocusChanged);
            }
        }
コード例 #4
0
ファイル: MenuInteraction.cs プロジェクト: ggjamer/2019
    public void AddText(int id, string text, Action callback)
    {
        GameObject gameObject = Instantiate(TextPrefab, transform);

        gameObject.transform.localPosition    = new Vector3(0, 0 - offset * selectableTexts.Count, 1);
        gameObject.GetComponent <Text>().text = text;
        SelectableText selectableText = new SelectableText();

        selectableText.id         = id;
        selectableText.text       = text;
        selectableText.callback   = callback;
        selectableText.gameObject = gameObject;

        this.selectableTexts.Add(selectableText);
    }
コード例 #5
0
 public void CreateSelectableText(string[] commands)
 {
     arrow.SetParent(transform);
     foreach (SelectableText selectableText in selectableTexts)
     {
         Destroy(selectableText.gameObject);
     }
     selectableTexts.Clear();
     foreach (string command in commands)
     {
         Debug.Log(command);
         SelectableText text = Instantiate(selectableTextPrefab, transform);
         text.SetText(command);
         selectableTexts.Add(text);
     }
 }
コード例 #6
0
ファイル: builder.cs プロジェクト: zuoyanshun/ConnectAppCN
 Widget _buildRichText(TextSpan text)
 {
     if (this.selectable)
     {
         return(SelectableText.rich(
                    text
                    //textScaleFactor: styleSheet.textScaleFactor,
                    ));
     }
     else
     {
         return(new RichText(
                    text: text,
                    textScaleFactor: this.styleSheet.textScaleFactor
                    ));
     }
 }
コード例 #7
0
            private static Widget ProcessParagraphClose(Token token, BuilderContext ctx)
            {
                if (ctx.imageNode != null)
                {
                    var node = ctx.imageNode;
                    ctx.Clear();
                    return(node);
                }

                var richText = new SelectableText(
                    textSpan: ctx.inline.Pop()
                    );
                var container = new Container(
                    margin: EdgeInsets.only(top: 24f),
                    child: richText
                    );

                ctx.Clear();
                return(container);
            }
コード例 #8
0
            private static Widget ProcessParagraphClose(Token token, BuilderContext ctx)
            {
                if (ctx.ImageNode != null)
                {
                    var node = ctx.ImageNode;
                    ctx.Clear();
                    return(node);
                }

                var richText = new SelectableText(
                    textSpan: ctx.Inline.Pop()
                    );
                var container = new Container(
                    margin: EdgeInsets.only(top: 24f),
                    child: richText
                    );

                ctx.Clear();
                if (ctx.ListItem)
                {
                    return(new Row(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: new List <Widget>
                    {
                        new Container(
                            margin: EdgeInsets.only(top: 26f, right: 8f),
                            child: new Text("\u2022")
                            ),
                        new Expanded(
                            child: container
                            ),
                    }
                               ));
                }
                return(container);
            }