Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Plain Craft Launcher 2/Controls/MyListItem.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ Public Class MyListItem
.SnapsToDevicePixels = True, .UseLayoutRounding = False,
.HorizontalAlignment = HorizontalAlignment.Stretch, .VerticalAlignment = VerticalAlignment.Stretch
}
RenderOptions.SetBitmapScalingMode(PathLogo, BitmapScalingMode.Linear)
If _Logo.Contains(PathTemp & $"Cache\Skin\Head") OrElse _Logo.Contains(PathTemp & $"Cache\Cape") Then
RenderOptions.SetBitmapScalingMode(PathLogo, BitmapScalingMode.NearestNeighbor)
Else
RenderOptions.SetBitmapScalingMode(PathLogo, BitmapScalingMode.Linear)
End If
Else
'矢量图
PathLogo = New Shapes.Path With {
Expand Down
30 changes: 27 additions & 3 deletions Plain Craft Launcher 2/Pages/PageLaunch/MySkin.xaml.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Public Class MySkin
Imports System.Drawing

Public Class MySkin

'事件
Public Event Click(sender As Object, e As MouseButtonEventArgs)
Expand Down Expand Up @@ -231,6 +233,23 @@ Retry:
Dim AccessToken As String = McLoginMsLoader.Output.AccessToken
Dim Uuid As String = McLoginMsLoader.Output.Uuid
Dim SkinData As JObject = GetJson(McLoginMsLoader.Output.ProfileJson)
For Each itemSkin In SkinData("capes")
If itemSkin("url") Is Nothing Then Continue For
Dim localFile = $"{PathTemp}Cache\Capes\{itemSkin("alias")}.png"
Dim capeFrontFile = $"{PathTemp}Cache\Capes\{itemSkin("alias")}-front.png"
If File.Exists(localFile) AndAlso File.Exists(capeFrontFile) Then
itemSkin("url") = capeFrontFile
Continue For
End If
NetDownloadByLoader(itemSkin("url").ToString(), localFile)
Dim capeFrontRegion As New Rectangle(1, 0, 11, 17)
Dim capeFront As New Bitmap(capeFrontRegion.Width, capeFrontRegion.Height)
Dim capeImage = Image.FromFile(localFile)
Dim gra = Graphics.FromImage(capeFront)
gra.DrawImage(capeImage, capeFrontRegion, capeFrontRegion, GraphicsUnit.Pixel)
capeFront.Save(capeFrontFile)
itemSkin("url") = capeFrontFile
Next
'获取玩家的所有披风
Dim SelId As Integer? = Nothing
RunInUiWait(
Expand All @@ -246,11 +265,16 @@ Retry:
{"Mojang Office", "Mojang 办公室披风"}, {"Home", "家园披风"}, {"Menace", "入侵披风"}, {"Yearn", "渴望披风"},
{"Common", "普通披风"}, {"Pan", "薄煎饼披风"}, {"Founder's", "创始人披风"}
}
Dim SelectionControl As New List(Of IMyRadio) From {New MyRadioBox With {.Text = "无披风"}}
Dim SelectionControl As New List(Of IMyRadio) From {New MyListItem With {.Title = "无披风", .Type = MyListItem.CheckType.RadioBox}}
For Each Cape In SkinData("capes")
Dim CapeName As String = Cape("alias").ToString
If CapeNames.ContainsKey(CapeName) Then CapeName = CapeNames(CapeName)
SelectionControl.Add(New MyRadioBox With {.Text = CapeName})
SelectionControl.Add(New MyListItem With {
.Title = CapeName,
.Type = MyListItem.CheckType.RadioBox,
.Logo = Cape("url"),
.LogoScale = 0.8
})
Next
SelId = MyMsgBoxSelect(SelectionControl, "选择披风", "确定", "取消")
Catch ex As Exception
Expand Down