コード例 #1
0
        private async Task <Rect> BuildSyncMemberUI(SyncObject targetInstance)
        {
            UIBuilder ui = new UIBuilder(VisualSlot, 800, 5000, 0.1f);

            ui.Style.MinHeight         = 30f;
            ui.Style.ForceExpandHeight = false;
            ui.Image(new color(141 / 255.0f, 186 / 255.0f, 104 / 255.0f));
            ui.VerticalLayout(4f, 0, Alignment.TopLeft);
            ui.Style.MinHeight         = 30f;
            ui.Style.PreferredHeight   = 30f;
            ui.Style.ForceExpandHeight = true;
            VerticalLayout content = ui.VerticalLayout(4f, 10f, Alignment.TopLeft);

            /*ui.Style.ChildAlignment = Alignment.TopLeft;
             * {
             *  ui.HorizontalLayout(4f);
             *  ui.Style.FlexibleWidth = 1000f;
             *  ui.Button("<b>" + targetInstance.GetType().GetNiceName() + "</b>", color.White);
             *
             *  ui.Style.FlexibleWidth = 0.0f;
             *  ui.Style.MinWidth = 32f;
             *
             *  ui.Button("D", MathX.Lerp(color.Green, color.White, 0.7f));
             *  ui.Button("X", MathX.Lerp(color.Red, color.White, 0.7f));
             *  ui.NestOut();
             * }*/
            //WorkerInspector.BuildInspectorUI(targetInstance, ui);
            SyncMemberEditorBuilder.Build(targetInstance, null, null, ui);
            await new Updates(5);
            return(content.RectTransform.BoundingRect);
        }
コード例 #2
0
        private async Task <Rect> BuildComponentUI(Component targetInstance)
        {
            UIBuilder ui = new UIBuilder(VisualSlot, 800, 5000, 0.1f);

            ui.Style.MinHeight         = 30f;
            ui.Style.ForceExpandHeight = false;
            ui.Image(new color(141 / 255.0f, 186 / 255.0f, 104 / 255.0f));
            ui.VerticalLayout(4f, 0, Alignment.TopLeft);
            ui.Style.MinHeight         = 30f;
            ui.Style.PreferredHeight   = 30f;
            ui.Style.ForceExpandHeight = true;
            VerticalLayout content = ui.VerticalLayout(4f, 10f, Alignment.TopLeft);

            ui.Style.ChildAlignment = Alignment.TopLeft;
            {
                ui.HorizontalLayout(4f);
                ui.Style.FlexibleWidth = 1000f;
                ui.Button("<b>" + targetInstance.GetType().GetNiceName() + "</b>", color.White);

                ui.Style.FlexibleWidth = 0.0f;
                ui.Style.MinWidth      = 32f;

                ui.Button("D", MathX.Lerp(color.Green, color.White, 0.7f));
                ui.Button("X", MathX.Lerp(color.Red, color.White, 0.7f));
                ui.NestOut();
            }
            if (targetInstance is ICustomInspector customInspector)
            {
                ui.Style.MinHeight = 24f;
                customInspector.BuildInspectorUI(ui);
            }
            else
            {
                WorkerInspector.BuildInspectorUI(targetInstance, ui);
            }
            await new Updates(5);
            return(content.RectTransform.BoundingRect);
        }