Ejemplo n.º 1
0
 public void ConnectCanvasView(SKCanvasView CV)
 {
     _MainCanvas               = CV;
     _MainCanvas.IsVisible     = false;
     _MainCanvas.PaintSurface += _MainCanvas_PaintSurface;
     FlorineSkiaTapWrap.Associate(CV, DescriptionTapHandler);
 }
Ejemplo n.º 2
0
        public void ConnectCanvasView(SKCanvasView CV)
        {
            IFlorineSkiaConnectable picConn = Picture as IFlorineSkiaConnectable;

            if (picConn != null)
            {
                picConn.ConnectCanvasView(CV);
            }
            FlorineSkiaTapWrap.Associate(CV, OptionTapHandler);
            _views.Add(CV);
        }
Ejemplo n.º 3
0
        private void SetColor(object sender, FlorineSkiaTapWrap.TapEventArgs e)
        {
            FlorineSkiaTapWrap fstw = sender as FlorineSkiaTapWrap;

            if (null != fstw && null != PlayerView && null != ActualPlayer)
            {
                SKCanvasView scv = fstw.Tie;
                SKColor      ai;
                if (ColSel.TryGetValue(scv, out ai))
                {
                    float   fR       = ((float)ai.Red) / 255f;
                    float   fG       = ((float)ai.Green) / 255f;
                    float   fB       = ((float)ai.Blue) / 255f;
                    SKPaint newPaint = new SKPaint()
                    {
                        /*
                         * ColorFilter =
                         * SKColorFilter.CreateColorMatrix(new float[]
                         * {
                         *  0.21f, 0.72f, 0.07f, 0, 0,
                         *  0.21f, 0.72f, 0.07f, 0, 0,
                         *  0.21f, 0.72f, 0.07f, 0, 0,
                         *  0,     0,     0,     1, 0
                         * }),
                         */
                        ColorFilter =
                            SKColorFilter.CreateColorMatrix(new float[]
                        {
                            fR *0.21f, fR *0.72f, fR *0.07f, 0, 0,
                            fG *0.21f, fG *0.72f, fG *0.07f, 0, 0,
                            fB *0.21f, fB *0.72f, fB *0.07f, 0, 0,
                            0, 0, 0, 1, 0
                        })
                    };

                    _colCheck[_rmT[scv]] = ai;
                    UpdateRefColor(_rmT[scv], newPaint);
                    foreach (SKCanvasView bvSCV in BodyViews)
                    {
                        bvSCV.InvalidateSurface();
                    }
                    if (Opy.ContainsKey(_rmT[scv]) && Opy[_rmT[scv]].Count > 0)
                    {
                        Opy[_rmT[scv]][0].InvalidateSurface();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private View ColorSelector(string type, SKColor[] Targets)
        {
            Grid subGrid = new Grid();

            subGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            for (int i = 0; i < Targets.Count(); ++i)
            {
                subGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }
            int idx = 0;

            foreach (SKColor Target in Targets)
            {
                /*
                 * FlOval ai = new FlOval()
                 * {
                 *  Shape = FlOval.OvalType.Rectangle,
                 *  backgroundColor = new SKPaint() { Color = Target },
                 * };
                 */
                SKCanvasView canvas = new SKCanvasView();
                canvas.PaintSurface += ColorBoxFill;
                //ai.ConnectCanvasView(canvas);
                ColOpy[type].Add(canvas);
                ColSel[canvas] = Target;
                _rmT[canvas]   = type;
                FlorineSkiaTapWrap.Associate(canvas, SetColor);
                subGrid.Children.Add(canvas, idx, 0);
                ++idx;
            }
            return(subGrid);
        }
Ejemplo n.º 5
0
        private View SetupSelector(string type)
        {
            string Target = "";

            switch (type)
            {
            case "hair": Target = "01_hair/100%"; break;

            case "face": Target = "02_faces/100"; break;

            case "clothes":
                Target = "03_clothes/" + ActiveBodyType + "/100%";
                break;

            case "wings": Target = "05_wings/100%"; break;
            }
            Dictionary <string, SKImage> clothes = ResourceLoader.ImageList("customization/" + Target);

            //int i = 0;

            _lookups[type] = new List <AspectImage>();
            foreach (KeyValuePair <string, SKImage> kvp in clothes)
            {
                SKCanvasView canvas = new SKCanvasView();
                AspectImage  ai     = new AspectImage()
                {
                    baseImage = kvp.Value
                };
                ai.ConnectCanvasView(canvas);
                _rmI[canvas] = ai;
                _rmT[canvas] = type;
                _lookups[type].Add(ai);
                Opy[type].Add(canvas);
                if (type == "clothes")
                {
                    foreach (string s in BodyLookups.Keys)
                    {
                        AspectImage bodyAI = null;
                        if (s == ActiveBodyType)
                        {
                            bodyAI = ai;
                        }
                        else
                        {
                            string altlookup = kvp.Key
                                               .Replace(ActiveBodyType, s).Replace(ActiveBodyType.ToLower(), s.ToLower());
                            bodyAI = new AspectImage()
                            {
                                baseImage = ResourceLoader.LoadImage(altlookup.Replace("Image/", ""))
                            };
                        }

                        _ClothesLookup[s][ai] = bodyAI;
                    }
                }
                //
                FlorineSkiaTapWrap.Associate(canvas, SetComponentImage);


                Grid subGrid = new Grid();
                subGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                subGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                subGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                subGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                subGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                subGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });

                SKCanvasView Left  = LeftArrow(200, 0, 0, 200, 4);
                SKCanvasView Right = RightArrow(200, 0, 0, 200, 4);
                _rmT[Left]  = type;
                _rmT[Right] = type;
                FlorineSkiaTapWrap.Associate(Left, PrevClothes);
                FlorineSkiaTapWrap.Associate(Right, NextClothes);
                subGrid.Children.Add(Left, 0, 2, 0, 1);
                subGrid.Children.Add(Right, 3, 5, 0, 1);
                gridList[type] = subGrid;
            }
            gridList[type].Children.Add(Opy[type][0], 1, 4, 0, 1);
            switch (type)
            {
            case "hair":
                LeftShift(type, Opy[type], 31);
                foreach (KeyValuePair <string, PlayerAvatar> kpa in BodyLookups)
                {
                    kpa.Value.Hair = _rmI[Opy["hair"][0]].baseImage;
                }
                break;

            case "wings":
                LeftShift(type, Opy[type], 2);
                foreach (KeyValuePair <string, PlayerAvatar> kpa in BodyLookups)
                {
                    kpa.Value.Wings = _rmI[Opy["wings"][0]].baseImage;
                }
                break;

            case "body":
                ActualPlayer.Body = _rmI[Opy["body"][0]].baseImage;
                break;

            case "clothes":
                LeftShift(type, Opy[type], 9);
                foreach (KeyValuePair <string, PlayerAvatar> kpa in BodyLookups)
                {
                    kpa.Value.Clothes = _ClothesLookup[kpa.Key][_rmI[Opy["clothes"][0]]].baseImage;
                }
                break;

            case "face":
                LeftShift(type, Opy[type], 8);
                foreach (KeyValuePair <string, PlayerAvatar> kpa in BodyLookups)
                {
                    kpa.Value.Face = _rmI[Opy["face"][0]].baseImage;
                }
                break;
            }

            return(gridList[type]);
        }