Beispiel #1
0
        protected override void SetUpContentView()
        {
            base.SetUpContentView();

            if (CustomCell.ShowArrowIndicator)
            {
                Accessory        = UITableViewCellAccessory.DisclosureIndicator;
                EditingAccessory = UITableViewCellAccessory.DisclosureIndicator;

                SetRightMarginZero();
            }

            StackV.RemoveArrangedSubview(ContentStack);
            StackV.RemoveArrangedSubview(DescriptionLabel);
            ContentStack.RemoveFromSuperview();
            DescriptionLabel.RemoveFromSuperview();

            _coreView = new CustomCellContent();

            if (CustomCell.UseFullSize)
            {
                StackH.RemoveArrangedSubview(IconView);
                IconView.RemoveFromSuperview();

                StackH.LayoutMargins = new UIEdgeInsets(0, 0, 0, 0);
                StackH.Spacing       = 0;
            }

            StackV.AddArrangedSubview(_coreView);
        }
Beispiel #2
0
        public EntryCellView(Cell formsCell) : base(formsCell)
        {
            ValueField = new UITextField             // TODO: enable multi-line entries
            {
                BorderStyle      = UITextBorderStyle.None,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                ReturnKeyType    = UIReturnKeyType.Done,
            };

            ValueField.TouchUpInside   += ValueFieldOnTouchUpInside;
            ValueField.EditingChanged  += TextField_EditingChanged;
            ValueField.EditingDidBegin += ValueField_EditingDidBegin;
            ValueField.EditingDidEnd   += ValueField_EditingDidEnd;
            ValueField.ShouldReturn     = OnShouldReturn;

            _EntryCell.Focused += EntryCell_Focused;


            _FieldWrapper = new UIView
            {
                AutosizesSubviews = true
            };
            _FieldWrapper.SetContentHuggingPriority(100f, UILayoutConstraintAxis.Horizontal);
            _FieldWrapper.SetContentCompressionResistancePriority(100f, UILayoutConstraintAxis.Horizontal);

            _FieldWrapper.AddSubview(ValueField);
            ContentStack.AddArrangedSubview(_FieldWrapper);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:AiForms.Renderers.Droid.EntryCellView"/> class.
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="cell">Cell.</param>
        public EntryCellView(Context context, Cell cell) : base(context, cell)
        {
            _EditText = new AiEditText(context);

            _EditText.Focusable  = true;
            _EditText.ImeOptions = ImeAction.Done;
            _EditText.SetOnEditorActionListener(this);

            _EditText.OnFocusChangeListener = this;
            _EditText.SetSingleLine(true);
            _EditText.Ellipsize = TextUtils.TruncateAt.End;

            _EditText.InputType       |= InputTypes.TextFlagNoSuggestions; //disabled spell check
            _EditText.Background.Alpha = 0;                                //hide underline

            _EditText.ClearFocusAction = DoneEdit;
            Click += EntryCellView_Click;

            //remove weight and change width due to fill _EditText.
            var titleParam = TitleLabel.LayoutParameters as LinearLayout.LayoutParams;

            titleParam.Weight = 0;
            titleParam.Width  = ViewGroup.LayoutParams.WrapContent;
            titleParam        = null;

            var lparams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WrapContent, 1f);

            using (lparams) {
                ContentStack.AddView(_EditText, lparams);
            }
        }
Beispiel #4
0
        private void CreateSkyboxes(GraphicsDevice device, ContentStack content, FrameService frameService, CubeMapGenerator cubeMapGenerator, IrradianceMapGenerator irradianceMapGenerator, EnvironmentMapGenerator environmentMapGenerator)
        {
            var skyboxNames = new string[]
            {
                "Skyboxes/Circus/Circus_Backstage_3k",
                "Skyboxes/Industrial/fin4_Bg",
                "Skyboxes/Milkyway/Milkyway_small",
                "Skyboxes/Grid/testgrid",
                "Skyboxes/Loft/Newport_Loft_Ref"
            };

            foreach (var name in skyboxNames)
            {
                content.Push("generator");
                var equiRect    = content.Load <Texture2D>(name);
                var albedo      = cubeMapGenerator.Generate(equiRect);
                var irradiance  = irradianceMapGenerator.Generate(equiRect);
                var environment = environmentMapGenerator.Generate(equiRect);

                content.Pop();
                content.Link(albedo);
                content.Link(irradiance);
                content.Link(environment);

                this.Textures.Add(new SkyboxTextures(name, albedo, irradiance, environment));
            }

            frameService.Skybox = SkyboxGenerator.Generate(device, this.Textures[0].Albedo,
                                                           this.Textures[0].Irradiance,
                                                           this.Textures[0].Environment);
        }
Beispiel #5
0
        public SkyboxSceneService(GraphicsDevice device, ContentStack content, CubeMapGenerator cubeMapGenerator, IrradianceMapGenerator irradianceMapGenerator, EnvironmentMapGenerator environmentMapGenerator, FrameService frameService)
        {
            this.Textures     = new List <SkyboxTextures>();
            this.FrameService = frameService;

            content.Push("skybox");
            this.CreateSkyboxes(device, content, frameService, cubeMapGenerator, irradianceMapGenerator, environmentMapGenerator);
        }
 /// <summary>
 /// Dispose the specified disposing.
 /// </summary>
 /// <returns>The dispose.</returns>
 /// <param name="disposing">If set to <c>true</c> disposing.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         ContentStack.RemoveArrangedSubview(ValueLabel);
         ValueLabel.Dispose();
     }
     base.Dispose(disposing);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:AiForms.Renderers.iOS.LabelCellView"/> class.
        /// </summary>
        /// <param name="formsCell">Forms cell.</param>
        public LabelCellView(Cell formsCell) : base(formsCell)
        {
            ValueLabel = new UILabel();
            ValueLabel.TextAlignment = UITextAlignment.Right;

            ContentStack.AddArrangedSubview(ValueLabel);
            ValueLabel.SetContentHuggingPriority(100f, UILayoutConstraintAxis.Horizontal);
            ValueLabel.SetContentCompressionResistancePriority(100f, UILayoutConstraintAxis.Horizontal);
        }
Beispiel #8
0
        public SceneManager(FrameService frameService, EntityAdministrator entities, ComponentAdministrator components, ContentStack content, IEnumerable <IScene> scenes)
        {
            this.Scenes       = scenes.ToList();
            this.FrameService = frameService;
            this.Entities     = entities;
            this.Components   = components;
            this.Content      = content;

            this.nextScene = this.Scenes[0];
        }
 /// <summary>
 /// Dispose the specified disposing.
 /// </summary>
 /// <returns>The dispose.</returns>
 /// <param name="disposing">If set to <c>true</c> disposing.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         ValueField.EditingChanged -= _textField_EditingChanged;
         ValueField.ShouldReturn    = null;
         ValueField.RemoveFromSuperview();
         ValueField.Dispose();
         ValueField = null;
         ContentStack.RemoveArrangedSubview(_FieldWrapper);
         _FieldWrapper.Dispose();
         _FieldWrapper = null;
     }
     base.Dispose(disposing);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:AiForms.Renderers.Droid.LabelCellView"/> class.
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="cell">Cell.</param>
        public LabelCellView(Context context, Cell cell) : base(context, cell)
        {
            ValueLabel = new TextView(context);
            ValueLabel.SetSingleLine(true);
            ValueLabel.Ellipsize = TextUtils.TruncateAt.End;
            ValueLabel.Gravity   = GravityFlags.Right;

            var textParams = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent)
            {
            };

            using (textParams) {
                ContentStack.AddView(ValueLabel, textParams);
            }
        }
Beispiel #11
0
        /// <summary>
        /// Dispose the specified disposing.
        /// </summary>
        /// <returns>The dispose.</returns>
        /// <param name="disposing">If set to <c>true</c> disposing.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                CellBase.PropertyChanged   -= CellPropertyChanged;
                CellParent.PropertyChanged -= ParentPropertyChanged;

                if (CellBase.Section != null)
                {
                    CellBase.Section.PropertyChanged -= SectionPropertyChanged;
                    CellBase.Section = null;
                }

                HintLabel?.Dispose();
                HintLabel = null;
                TitleLabel?.Dispose();
                TitleLabel = null;
                DescriptionLabel?.Dispose();
                DescriptionLabel = null;
                IconView?.SetImageDrawable(null);
                IconView?.SetImageBitmap(null);
                IconView?.Dispose();
                IconView = null;
                ContentStack?.Dispose();
                ContentStack = null;
                AccessoryStack?.Dispose();
                AccessoryStack = null;
                Cell           = null;

                _iconTokenSource?.Dispose();
                _iconTokenSource = null;
                _Context         = null;

                _backgroundColor?.Dispose();
                _backgroundColor = null;
                _selectedColor?.Dispose();
                _selectedColor = null;
                _ripple?.Dispose();
                _ripple = null;

                Background?.Dispose();
                Background = null;
            }
            base.Dispose(disposing);
        }
Beispiel #12
0
        public void Load(ContentStack content)
        {
            var sponza = content.Load <GeometryModel>("sponza/sponza");

            (var geometry, var geometryTransform, var geometryBounds) = this.Geometry.Create(sponza);

            geometryTransform.SetScale(0.05f);

            (var particpatingMedia, var participatingMediaTransform) = this.ParticipatingMedia.Create(this.Device.Viewport.Width, this.Device.Viewport.Height);

            particpatingMedia.Strength = 4.0f;
            particpatingMedia.Color    = new Color(0.1f, 0.1f, 0.1f);
            participatingMediaTransform.SetScale(new Vector3(200, 150.0f, 120.0f));

            (var particleEmitter, var particleTransform, var particleBounds, var forces) = this.Particles.Create(1024 * 1024);
            particleTransform.MoveTo(new Vector3(-49.0f, 3.0f, 0.0f));
            particleTransform.SetRotation(Quaternion.CreateFromYawPitchRoll(0, MathHelper.PiOver2, 0));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:AiForms.Renderers.iOS.EntryCellView"/> class.
        /// </summary>
        /// <param name="formsCell">Forms cell.</param>
        public EntryCellView(Cell formsCell) : base(formsCell)
        {
            ValueField = new UITextField()
            {
                BorderStyle = UITextBorderStyle.None
            };
            ValueField.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            ValueField.EditingChanged += _textField_EditingChanged;
            ValueField.ShouldReturn    = OnShouldReturn;


            _FieldWrapper = new UIView();
            _FieldWrapper.AutosizesSubviews = true;
            _FieldWrapper.SetContentHuggingPriority(100f, UILayoutConstraintAxis.Horizontal);
            _FieldWrapper.SetContentCompressionResistancePriority(100f, UILayoutConstraintAxis.Horizontal);

            _FieldWrapper.AddSubview(ValueField);
            ContentStack.AddArrangedSubview(_FieldWrapper);
        }
Beispiel #14
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                ValueField.TouchUpInside   -= ValueFieldOnTouchUpInside;
                ValueField.EditingChanged  -= TextField_EditingChanged;
                ValueField.EditingDidBegin -= ValueField_EditingDidBegin;
                ValueField.EditingDidEnd   -= ValueField_EditingDidEnd;
                _EntryCell.Focused         -= EntryCell_Focused;
                ValueField.ShouldReturn     = null;
                ValueField.RemoveFromSuperview();
                ValueField.Dispose();
                ValueField = null;

                ContentStack.RemoveArrangedSubview(_FieldWrapper);
                _FieldWrapper.Dispose();
                _FieldWrapper = null;
            }

            base.Dispose(disposing);
        }
        protected override void CreateContentView()
        {
            base.CreateContentView();

            _container = new FormsViewContainer(Context);


            _coreView = FindViewById <LinearLayout>(Resource.Id.CellBody);
            ContentStack.RemoveFromParent();
            DescriptionLabel.RemoveFromParent();

            if (CustomCell.UseFullSize)
            {
                IconView.RemoveFromParent();
                var layout  = FindViewById <ARelativeLayout>(Resource.Id.CellLayout);
                var rMargin = CustomCell.ShowArrowIndicator ? _Context.ToPixels(10) : 0;
                layout.SetPadding(0, 0, (int)rMargin, 0);
                _coreView.SetPadding(0, 0, 0, 0);
            }

            _coreView.AddView(_container);
        }
Beispiel #16
0
        public void Load(ContentStack content)
        {
            var geometry = SphereGenerator.Generate(this.Device, 15);
            var material = new Material(this.Assets.WhitePixel, this.Assets.NormalPixel(), this.Assets.MetalicnessPixel(0.5f), this.Assets.RoughnessPixel(0.0f), this.Assets.AmbientOcclussionPixel(1.0f));

            var entity = this.Entities.Create();

            this.Components.Add(new GeometryComponent(entity, new GeometryModel(geometry, material)));
            this.Components.Add(new TransformComponent(entity));

            var transforms = new Matrix[1024];
            var i          = 0;

            for (var x = -16; x < 16; x++)
            {
                for (var y = -16; y < 16; y++)
                {
                    var p = new Vector3(x * 2, y * 2, 0.0f);
                    transforms[i++] = Matrix.CreateTranslation(p);
                }
            }

            this.Components.Add(InstancingComponent.Create(entity, transforms));
        }
Beispiel #17
0
        public void Load(ContentStack content)
        {
            var red = new Texture2D(this.Device, 1, 1);

            red.SetData(new Color[] { Color.White });
            content.Link(red);

            var white = new Texture2D(this.Device, 1, 1);

            white.SetData(new Color[] { Color.White });
            content.Link(white);

            var black = new Texture2D(this.Device, 1, 1);

            black.SetData(new Color[] { Color.Black });
            content.Link(black);

            var normal = new Texture2D(this.Device, 1, 1);

            normal.SetData(new Color[] { new Color(0.5f, 0.5f, 1.0f) });
            content.Link(normal);

            var blue  = content.Load <Texture2D>("Textures/Blue");
            var bumps = content.Load <Texture2D>("Textures/Bricks_Normal");

            var rows     = 7;
            var columns  = 7;
            var spacing  = 2.5f;
            var geometry = SphereGenerator.Generate(this.Device, 15);

            for (var row = 0; row < rows; row++)
            {
                var metalicness = row / (float)rows;

                var metalicnessTexture = new Texture2D(this.Device, 1, 1);
                metalicnessTexture.SetData(new Color[] { new Color(Vector3.One * metalicness) });
                content.Link(metalicnessTexture);

                for (var col = 0; col < columns; col++)
                {
                    var roughness        = Math.Clamp(col / (float)columns, 0.05f, 1.0f);
                    var roughnessTexture = new Texture2D(this.Device, 1, 1);
                    roughnessTexture.SetData(new Color[] { new Color(Vector3.One * roughness) });
                    content.Link(roughnessTexture);

                    var material = new Material(red, normal, metalicnessTexture, roughnessTexture, white);

                    var position = new Vector3((col - (columns / 2.0f)) * spacing, (row - (rows / 2.0f)) * spacing, 0.0f);
                    this.CreateSphere(geometry, material, position, Vector3.One);
                }
            }

            var backgroundGeometry = CubeGenerator.Generate(this.Device);

            this.CreateSphere(backgroundGeometry, new Material(bumps, GeneratedAssets.NormalPixel(), black, white, white), Vector3.Forward * 20, new Vector3(200, 200, 1));

            this.CreateLight(new Vector3(-10, 10, 10), Color.Red, 30.0f);
            this.CreateLight(new Vector3(10, 10, 10), Color.Blue, 30.0f);
            this.CreateLight(new Vector3(-10, -10, 10), Color.Green, 30.0f);
            this.CreateLight(new Vector3(10, -10, 10), Color.White, 30.0f);

            this.CreateSpotLight(new Vector3(0, 0, 10), Vector3.Forward, 1500.0f);
        }
Beispiel #18
0
        private void AddLargeAsteroid(ContentStack content)
        {
            var asteroid = content.Load <GeometryModel>("AsteroidField/Asteroid001");

            (var geometry, var transform, var bounds) = this.Geometry.Create(asteroid);
        }
Beispiel #19
0
 public void Load(ContentStack content)
 {
     this.AddAsteroidField();
     this.AddDust();
     this.AddLargeAsteroid(content);
 }
Beispiel #20
0
 public void Load(ContentStack content)
 {
 }
Beispiel #21
0
 public GeneratedAssets(GraphicsDevice device, ContentStack content)
 {
     this.Device  = device;
     this.Content = content;
 }