コード例 #1
0
        private void SetActor(XActor actor)
        {
            Actor = actor;

            this.flowLayoutPanel.Controls.Clear();

            actorLabel.Text   = $"Actor {Actor.id}: {Actor.Description}";
            objectsLabel.Text = $"Objects: {string.Join(", ", Actor.Objects.Object)}";

            Control commentLabel = this.CreateCommentControl(4);

            commentLabel.Text = SetComment(Actor.Comment, Actor.CommentOther);
            flowLayoutPanel.Controls.Add(commentLabel);

            foreach (var item in Actor.Variables)
            {
                //actor.Variables
                if (!(item.UI.Item is UINone))  // UITypes.none
                {
                    BaseControl control;

                    switch (item.UI.Item)
                    {
                    case UISelect c /*UITypes.select*/: control = new SelectControl(); break;

                    case UISwitchFlag c /*UITypes.switchflag*/: control = new FlagsControl(); break;

                    case UICollectFlag c /*UITypes.collectflag*/: control = new FlagsControl(); break;

                    case UIChestFlag c /*UITypes.chestflag*/: control = new FlagsControl(); break;

                    default: control = new NumControl(); break;
                    }
                    control.Dock = DockStyle.Fill;
                    control.SetUi(item);
                    flowLayoutPanel.Controls.Add(control);
                }
                else
                {
                    //pass default value
                }
                if (item.Comment != null)
                {
                    Label comment = new Label();
                    comment.MinimumSize = new Size(350, 0);
                    comment.Text        = item.Comment;
                    flowLayoutPanel.Controls.Add(comment);
                }
            }

            //test.SetUi(actor.Variables[0]);
            //actorPanel.Controls.Add(test);
        }
コード例 #2
0
ファイル: ActorControl.cs プロジェクト: Ecksters/OcaLib
        private void SetActor(XActor actor)
        {
            Actor = actor;

            this.flowLayoutPanel.Controls.Clear();

            actorLabel.Text   = string.Format("Actor {0}: {1}", Actor.id, Actor.Description);
            objectsLabel.Text = string.Format("Objects: {0}", string.Join(", ", Actor.Objects.Object));

            Control commentLabel = this.CreateCommentControl(4);

            commentLabel.Text = SetComment(Actor.Comment, Actor.CommentOther);
            flowLayoutPanel.Controls.Add(commentLabel);

            foreach (var item in Actor.Variables)
            {
                if (item.UI.name != UITypes.none)
                {
                    BaseControl control;

                    switch (item.UI.name)
                    {
                    case UITypes.select: control = new SelectControl(); break;

                    case UITypes.switchflag: control = new FlagsControl(); break;

                    case UITypes.collectflag: control = new FlagsControl(); break;

                    case UITypes.chestflag: control = new FlagsControl(); break;

                    default: control = new NumControl(); break;
                    }
                    control.Dock = DockStyle.Fill;
                    control.SetUi(item);
                    flowLayoutPanel.Controls.Add(control);
                }
                else
                {
                    //pass default value
                }
                if (item.Comment != null)
                {
                    Label comment = new Label();
                    comment.MinimumSize = new Size(350, 0);
                    comment.Text        = item.Comment;
                    flowLayoutPanel.Controls.Add(comment);
                }
            }

            //test.SetUi(actor.Variables[0]);
            //actorPanel.Controls.Add(test);
        }