Exemplo n.º 1
0
        public override UILink BusinessToUI(BUSLink businessEntity)
        {
            UILink UIEntity = base.BusinessToUI(businessEntity);

            UIEntity.ChildBCName     = businessEntity.ChildBCName;
            UIEntity.ChildFieldName  = businessEntity.ChildFieldName;
            UIEntity.ParentBCName    = businessEntity.ParentBCName;
            UIEntity.ParentFieldName = businessEntity.ParentFieldName;
            return(UIEntity);
        }
Exemplo n.º 2
0
    void Start()
    {
        ui     = GameObject.FindGameObjectsWithTag("UILink")[0].GetComponent <UILink>();
        uiGame = new UIGame();
        uiGame.Init();

        oxygen        = ui.oxygenImage;
        testlist      = new List <int>();
        currentOxygen = maxOxygen;
    }
Exemplo n.º 3
0
    public void Init()
    {
        toolList = new List <Image>();
        ui       = GameObject.FindGameObjectWithTag("UILink").GetComponent <UILink>();
        //asigne all image with is ui element
        toolBox1 = ui.tool1;
        toolBox2 = ui.tool2;
        toolBox3 = ui.tool3;
        toolBox4 = ui.tool4;

        //add all image to list
        toolList.Add(toolBox1);
        toolList.Add(toolBox2);
        toolList.Add(toolBox3);
        toolList.Add(toolBox4);
    }
Exemplo n.º 4
0
 public void DoInitIfDont()
 {
     if (inited)
     {
         return;
     }
     inited = true;
     if (Links != null)
     {
         for (int i = 0; i < Links.Count; ++i)
         {
             UILink ul = Links[i];
             if (ul == null || !ul.LinkObj)
             {
                 continue;
             }
             all_objs[ul.Name]  = ul;
             HashMap[ul.HashID] = ul;
         }
     }
 }
Exemplo n.º 5
0
        public FrmDemo()
        {
            InitializeComponent();

            image       = new UIImage();
            image.Dock  = DockStyle.Right;
            image.Width = 400;
            this.UIControls.Add(image);
            //
            line                = new UILine();
            line.Location       = new Point(300, 270);
            line.Size           = new Size(500, 50);
            line.LineBlendStyle = BlendStyle.FadeInFadeOut;
            line.LineWidth      = 2;
            line.LineDashStyle  = DashStyle.Dash;
            this.UIControls.Add(line);
            //
            label          = new UILabel();
            label.Location = new Point(250, 200);
            label.Size     = new Size(100, 50);
            label.Font     = new Font("微软雅黑", 13f);
            label.Text     = "测试文本测试文本测试文本测试文本测试文本";
            this.UIControls.Add(label);
            //
            progress            = new UIProgress();
            progress.Location   = new Point(300, 200);
            progress.Percentage = 20;
            progress.Size       = new Size(600, 50);
            progress.Anchor     = AnchorStyles.None;
            this.UIControls.Add(progress);
            //
            btnOut                   = new UIButton();
            btnOut.Size              = new Size(300, 100);
            btnOut.Location          = new Point(10, 20);
            btnOut.Dock              = DockStyle.None;
            btnOut.UIParent          = this;
            btnOut.Name              = "out";
            btnOut.Text              = btnOut.Name;
            btnOut.Font              = new Font(btnOut.Font.FontFamily, 45f);
            btnOut.TextRenderingHint = TextRenderingHint.AntiAlias;
            btnOut.Click            += (sender, e) => Console.WriteLine("单击out");
            this.UIControls.Add(btnOut);

            //
            btnInner2          = new UIButton();
            btnInner2.Size     = new Size(50, 20);
            btnInner2.Location = new Point(55, 55);
            btnInner2.UIParent = this.btnOut;
            btnInner2.Name     = "in2";
            btnInner2.Text     = btnInner2.Name;
            btnInner2.Click   += (sender, e) => MessageBox.Show("单击in2");
            this.btnOut.UIControls.Add(btnInner2);
            //
            btnInner          = new UIButton();
            btnInner.Size     = new Size(50, 20);
            btnInner.Location = new Point(5, 15);
            btnInner.UIParent = this.btnOut;
            btnInner.Name     = "in";
            btnInner.Text     = btnInner.Name;
            btnInner.Click   += (sender, e) => Console.WriteLine("单击in");
            this.btnOut.UIControls.Add(btnInner);
            //
            marquee                = new UIMarquee();
            marquee.Size           = new Size(801, 4);
            marquee.Location       = new Point(100, 200);
            marquee.BorderColor    = Color.Transparent;
            this.marquee.BackColor = Color.Transparent;
            marquee.Dock           = DockStyle.Bottom;
            marquee.ProgressColor  = Color.DodgerBlue;
            this.UIControls.Add(this.marquee);
            this.marquee.SendToBack();
            //
            link           = new UILink();
            link.Size      = new Size(40, 15);
            link.Location  = new Point(500, 10);
            this.link.Font = new Font("微软雅黑", 10f, GraphicsUnit.Point);
            link.Text      = "换一张";
            this.UIControls.Add(this.link);
            //
            link2          = new UILink();
            link2.Size     = new Size(40, 15);
            link2.Location = new Point(540, 10);
            link2.Text     = "换一张";
            this.UIControls.Add(this.link2);
        }
Exemplo n.º 6
0
        public override IEnumerable <ValidationResult> BUSUIValidate(TContext context, BUSLink businessComponent, UILink UIEntity)
        {
            List <ValidationResult> result = base.BUSUIValidate(context, businessComponent, UIEntity).ToList();

            if (string.IsNullOrWhiteSpace(businessComponent.ErrorMessage))
            {
                if (businessComponent.ParentBCName == null)
                {
                    result.Add(new ValidationResult(
                                   "Business component with this name not found.",
                                   new List <string>()
                    {
                        "ParentBCName"
                    }));
                }
                else if (businessComponent.ParentFieldName == null)
                {
                    result.Add(new ValidationResult(
                                   "Field with this name not found.",
                                   new List <string>()
                    {
                        "ParentFieldName"
                    }));
                }
                if (businessComponent.ChildBCName == null)
                {
                    result.Add(new ValidationResult(
                                   "Business component with this name not found.",
                                   new List <string>()
                    {
                        "ChildBCName"
                    }));
                }
                else if (businessComponent.ChildFieldName == null)
                {
                    result.Add(new ValidationResult(
                                   "Field with this name not found.",
                                   new List <string>()
                    {
                        "ChildFieldName"
                    }));
                }
            }
            return(result);
        }
Exemplo n.º 7
0
        public override BUSLink UIToBusiness(UILink UIEntity, TContext context, IViewInfo viewInfo, bool isNewRecord)
        {
            BUSLink businessEntity = base.UIToBusiness(UIEntity, context, viewInfo, isNewRecord);

            // Parent bc
            BusinessComponent parentBusComp = context.BusinessComponents
                                              .AsNoTracking()
                                              .Select(bc => new
            {
                id     = bc.Id,
                name   = bc.Name,
                fields = bc.Fields.Select(field => new
                {
                    id   = field.Id,
                    name = field.Name,
                })
            })
                                              .Select(bc => new BusinessComponent
            {
                Id     = bc.id,
                Name   = bc.name,
                Fields = bc.fields.Select(field => new Field
                {
                    Id   = field.id,
                    Name = field.name
                }).ToList()
            })
                                              .FirstOrDefault(n => n.Name == UIEntity.ParentBCName);

            if (parentBusComp != null)
            {
                businessEntity.ParentBusComp = parentBusComp;
                businessEntity.ParentBCId    = parentBusComp.Id;
                businessEntity.ParentBCName  = parentBusComp.Name;
            }

            // Parent field
            Field parentField = parentBusComp.Fields.FirstOrDefault(n => n.Name == UIEntity.ParentFieldName);

            if (parentField != null)
            {
                businessEntity.ParentField     = parentField;
                businessEntity.ParentFieldId   = parentField.Id;
                businessEntity.ParentFieldName = parentField.Name;
            }

            // Child bc
            BusinessComponent childBusComp = context.BusinessComponents
                                             .AsNoTracking()
                                             .Select(bc => new
            {
                id     = bc.Id,
                name   = bc.Name,
                fields = bc.Fields.Select(field => new
                {
                    id   = field.Id,
                    name = field.Name,
                })
            })
                                             .Select(bc => new BusinessComponent
            {
                Id     = bc.id,
                Name   = bc.name,
                Fields = bc.fields.Select(field => new Field
                {
                    Id   = field.id,
                    Name = field.name
                }).ToList()
            })
                                             .FirstOrDefault(n => n.Name == UIEntity.ChildBCName);

            if (childBusComp != null)
            {
                businessEntity.ChildBusComp = childBusComp;
                businessEntity.ChildBCId    = childBusComp.Id;
                businessEntity.ChildBCName  = childBusComp.Name;
            }

            // Child field
            Field childField = childBusComp.Fields.FirstOrDefault(n => n.Name == UIEntity.ChildFieldName);

            if (childField != null)
            {
                businessEntity.ChildField     = childField;
                businessEntity.ChildFieldId   = childField.Id;
                businessEntity.ChildFieldName = childField.Name;
            }
            return(businessEntity);
        }
Exemplo n.º 8
0
        public override IEnumerable <ValidationResult> UIValidate(TContext context, IViewInfo viewInfo, UILink UIEntity, bool isNewRecord)
        {
            List <ValidationResult> result = base.UIValidate(context, viewInfo, UIEntity, isNewRecord).ToList();
            Link link = context.Links.AsNoTracking().FirstOrDefault(n => n.Name == UIEntity.Name);

            if (link != null && link.Id != UIEntity.Id)
            {
                result.Add(new ValidationResult("Link with this name is already exists.", new List <string>()
                {
                    "Name"
                }));
            }
            if (string.IsNullOrWhiteSpace(UIEntity.ParentBCName))
            {
                result.Add(new ValidationResult(
                               "Parent business component name is a required field.",
                               new List <string>()
                {
                    "ParentBCName"
                }));
            }
            if (string.IsNullOrWhiteSpace(UIEntity.ParentFieldName))
            {
                result.Add(new ValidationResult(
                               "Parent field name is a required field.",
                               new List <string>()
                {
                    "ParentFieldName"
                }));
            }
            if (string.IsNullOrWhiteSpace(UIEntity.ChildBCName))
            {
                result.Add(new ValidationResult(
                               "Child business component name is a required field.",
                               new List <string>()
                {
                    "ChildBCName"
                }));
            }
            if (string.IsNullOrWhiteSpace(UIEntity.ChildFieldName))
            {
                result.Add(new ValidationResult(
                               "Child field name is a required field.",
                               new List <string>()
                {
                    "ChildFieldName"
                }));
            }
            return(result);
        }
Exemplo n.º 9
0
 void Awake()
 {
     instance = this;
 }