public void ConnectCanvasView(SKCanvasView CV) { _MainCanvas = CV; _MainCanvas.IsVisible = false; _MainCanvas.PaintSurface += _MainCanvas_PaintSurface; FlorineSkiaTapWrap.Associate(CV, DescriptionTapHandler); }
public void ConnectCanvasView(SKCanvasView CV) { IFlorineSkiaConnectable picConn = Picture as IFlorineSkiaConnectable; if (picConn != null) { picConn.ConnectCanvasView(CV); } FlorineSkiaTapWrap.Associate(CV, OptionTapHandler); _views.Add(CV); }
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); }
public override void PostLayout(bool IsTall, Grid grid, Controller GameController, IPlatformFoundry GameFoundry, IPage SourcePage) { ActualPlayerBase = GameController.CurrentState.Player; ActualPlayer = GameController.CurrentState.Player.Avatar.Picture as PlayerAvatar; Entry NameEntry = new Entry() { Text = "Faerina", HorizontalTextAlignment = TextAlignment.Center, // FontSize = 8f, VerticalOptions = new LayoutOptions() { Alignment = LayoutAlignment.End }, }; NameEntry.TextChanged += NameEntry_TextChanged; grid.Children.Add(NameEntry, 0, 30, 0, 4); SKPointI ClothesStart = new SKPointI(5, 22); SKPointI WingStart = new SKPointI(15, 16); SKPointI HairStart = new SKPointI(5, 16); SKPointI FaceStart = new SKPointI(15, 22); OvalLookup["Box"] = OvalT(0, 0, 200, 120, 2f); OvalLookup["Box"].Item2.innerHighlight = new SKColor(100, 250, 250, 255); OvalLookup["Pear"] = OvalT(0, 0, 200, 120, 2f); OvalLookup["Round"] = OvalT(0, 0, 200, 120, 2f); grid.Children.Add(OvalLookup["Pear"].Item1, 0, 10, 2, 15); grid.Children.Add(OvalLookup["Box"].Item1, 10, 20, 2, 15); grid.Children.Add(OvalLookup["Round"].Item1, 20, 30, 2, 15); grid.Children.Add(ColorSelector("body", new SKColor[] { new SKColor(253, 196, 179), // 1 new SKColor(245, 185, 158), // 2 new SKColor(228, 131, 86), // 3 new SKColor(217, 118, 76), // 4 new SKColor(182, 88, 34), // 5 new SKColor(143, 70, 29), // 6 new SKColor(113, 50, 20), // 6 }), 4, 26, 14, 16); grid.Children.Add(Oval(0, 0, 200, 120, 1f), ClothesStart.X, ClothesStart.X + 10, ClothesStart.Y, ClothesStart.Y + 6); grid.Children.Add(Oval(0, 0, 200, 120, 1f), WingStart.X, WingStart.X + 10, WingStart.Y, WingStart.Y + 6); grid.Children.Add(Oval(0, 0, 200, 120, 1f), HairStart.X, HairStart.X + 10, HairStart.Y, HairStart.Y + 6); grid.Children.Add(SetupSelector("clothes"), ClothesStart.X, ClothesStart.X + 10, ClothesStart.Y, ClothesStart.Y + 6); grid.Children.Add(SetupSelector("wings"), WingStart.X, WingStart.X + 10, WingStart.Y, WingStart.Y + 6); grid.Children.Add(SetupSelector("hair"), HairStart.X, HairStart.X + 10, HairStart.Y, HairStart.Y + 6); grid.Children.Add(ColorSelector("hair", new SKColor[] { new SKColor(202, 191, 177), new SKColor(255, 208, 115, 120), new SKColor(255, 240, 225), }), 1, 6, HairStart.Y + 1, HairStart.Y + 2);//21, 29, 22, 23); grid.Children.Add(ColorSelector("hair", new SKColor[] { new SKColor(230, 206, 168), new SKColor(222, 188, 153), new SKColor(143, 70, 29), }), 1, 6, HairStart.Y + 2, HairStart.Y + 3);//21, 29, 22, 23); grid.Children.Add(ColorSelector("hair", new SKColor[] { new SKColor(106, 78, 66), new SKColor(83, 61, 53), new SKColor(9, 8, 6), }), 1, 6, HairStart.Y + 3, HairStart.Y + 4);//21, 29, 22, 23); grid.Children.Add(ColorSelector("hair", new SKColor[] { new SKColor(145, 75, 67), new SKColor(181, 82, 57), new SKColor(205, 75, 67) }), 1, 6, HairStart.Y + 4, HairStart.Y + 5);//21, 29, 22, 23); grid.Children.Add(Oval(0, 0, 200, 120, 1f), FaceStart.X, FaceStart.X + 10, FaceStart.Y, FaceStart.Y + 6); grid.Children.Add(SetupSelector("face"), FaceStart.X, FaceStart.X + 10, FaceStart.Y, FaceStart.Y + 6); UpdateRefColor("body", PaintFor(new SKColor(217, 118, 76))); UpdateRefColor("hair", PaintFor(new SKColor(83, 61, 53))); // FlorineSkiaCVWrap PearView = new FlorineSkiaCVWrap(BodyLookups["Pear"]); FlorineSkiaCVWrap RoundView = new FlorineSkiaCVWrap(BodyLookups["Round"]); BodyViews.Add(PlayerView); BodyViews.Add(PearView); BodyViews.Add(RoundView); //innerHighlight = new SKColor(100, 250, 250, 255), grid.Children.Add(PlayerView, 11, 19, 3, 14); grid.Children.Add(PearView, 1, 9, 3, 14); grid.Children.Add(RoundView, 21, 29, 3, 14); FlorineSkiaTapWrap.Associate(PlayerView, BoxSelect); FlorineSkiaTapWrap.Associate(PearView, PearSelect); FlorineSkiaTapWrap.Associate(RoundView, RoundSelect); //FlorineSkiaTapWrap.Associate(OvalLookup["Box"].Item1, BoxSelect); //FlorineSkiaTapWrap.Associate(OvalLookup["Pear"].Item1, PearSelect); //FlorineSkiaTapWrap.Associate(OvalLookup["Round"].Item1, RoundSelect); }
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]); }