删除不再使用的资源文件,包括多个图像集和其对应的 Contents.json 文件,更新 MedalsModel.h 和 MedalsModel.m 以支持使用勋章的类型,新增 MedalsCyclePagerCell 组件以优化勋章展示,保持代码结构一致性。
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressup_noble_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressup_noble_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 34 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "noble_privilege_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "noble_privilege_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 7.8 KiB |
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@@ -5,7 +5,6 @@
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_across_pk_invite_result_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
|
Before Width: | Height: | Size: 6.5 KiB |
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailiing_enter.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 43 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_add@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_add@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 3.0 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_animation_gift_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_animation_gift_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 51 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 319 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_buy_fuel_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_buy_fuel_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 180 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_buy_fuel_cancel@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_buy_fuel_cancel@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 11 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_buy_fuel_sure@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_buy_fuel_sure@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 9.9 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_description@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_description@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 6.1 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_explore@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_explore@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 34 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_explore_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_explore_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 97 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_getfule@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_getfule@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 7.4 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_prize_cowry_large@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_prize_cowry_large@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 248 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_prize_crowy@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_prize_crowy@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 159 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_prize_normal_large@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_prize_normal_large@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 191 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_prize_normal@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_prize_normal@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 163 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.9 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 66 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank_first@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank_first@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.3 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank_second@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank_second@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 3.4 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank_third@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rank_third@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.7 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_record@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_record@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 6.2 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_redu@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_redu@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 674 B |
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rule_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_rule_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 5.1 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_sailing@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_sailing@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 102 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_tips_normal@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_tips_normal@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 420 B |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_tips_select@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_sailing_tips_select@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 581 B |
@@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, copy) NSString *nick;
|
||||
@property (nonatomic, assign) NSInteger uid;
|
||||
@property (nonatomic, copy) NSArray <MedalSeriesVo *> *medalSeries;
|
||||
@property (nonatomic, copy) NSArray *useMedals;
|
||||
@property (nonatomic, copy) NSArray <MedalVo *>*useMedals;
|
||||
@end
|
||||
|
||||
|
||||
|
@@ -30,7 +30,8 @@
|
||||
@implementation UserMedalsModel
|
||||
+ (NSDictionary *)mj_objectClassInArray {
|
||||
return @{
|
||||
@"medalSeries" : [MedalSeriesVo class]
|
||||
@"medalSeries" : [MedalSeriesVo class],
|
||||
@"useMedals" : [MedalVo class]
|
||||
};
|
||||
}
|
||||
@end
|
||||
|
30
YuMi/Modules/YMMine/View/Medals/MedalsCyclePagerCell.h
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// MedalsCyclePagerCell.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2025/1/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
@class MedalVo;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MedalsCyclePagerCell : UICollectionViewCell
|
||||
|
||||
- (void)updateCell:(MedalVo *)model;
|
||||
|
||||
/**
|
||||
* 当 cell 将要显示时调用
|
||||
* 用于恢复 mp4 播放
|
||||
*/
|
||||
- (void)willDisplay;
|
||||
|
||||
/**
|
||||
* 当 cell 结束显示时调用
|
||||
* 用于暂停 mp4 播放
|
||||
*/
|
||||
- (void)didEndDisplaying;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
252
YuMi/Modules/YMMine/View/Medals/MedalsCyclePagerCell.m
Normal file
@@ -0,0 +1,252 @@
|
||||
//
|
||||
// MedalsCyclePagerCell.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2025/1/7.
|
||||
//
|
||||
|
||||
#import "MedalsCyclePagerCell.h"
|
||||
#import "MedalsModel.h"
|
||||
#import <QGVAPWrapView.h>
|
||||
#import "XPRoomGiftAnimationParser.h"
|
||||
|
||||
@interface MedalsCyclePagerCell ()
|
||||
|
||||
@property(nonatomic, copy) NSString *imagePath;
|
||||
@property(nonatomic, copy) NSString *mp4Path;
|
||||
|
||||
@property(nonatomic, strong) NetImageView *imageView;
|
||||
@property(nonatomic, strong) VAPView *mp4View;
|
||||
@property(nonatomic, strong) XPRoomGiftAnimationParser *mp4Parser;
|
||||
|
||||
@property (nonatomic, strong) MedalVo *displayModel;
|
||||
@property (nonatomic, assign) BOOL isVisible; // 跟踪 cell 是否可见
|
||||
|
||||
@end
|
||||
|
||||
@implementation MedalsCyclePagerCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self setupUI];
|
||||
[self setupNotifications];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self setupUI];
|
||||
[self setupNotifications];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setupUI {
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
|
||||
// 添加图片视图
|
||||
self.imageView = [[NetImageView alloc] init];
|
||||
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self.contentView addSubview:self.imageView];
|
||||
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.contentView);
|
||||
make.size.mas_equalTo(CGSizeMake(184, 184));
|
||||
}];
|
||||
|
||||
// 添加 MP4 视图
|
||||
[self.contentView addSubview:self.mp4View];
|
||||
[self.mp4View mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.imageView);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setupNotifications {
|
||||
// 监听应用进入后台和恢复前台的通知
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(appDidEnterBackground)
|
||||
name:UIApplicationDidEnterBackgroundNotification
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(appWillEnterForeground)
|
||||
name:UIApplicationWillEnterForegroundNotification
|
||||
object:nil];
|
||||
|
||||
// 监听内存警告通知
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(didReceiveMemoryWarning)
|
||||
name:UIApplicationDidReceiveMemoryWarningNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (void)prepareForReuse {
|
||||
[super prepareForReuse];
|
||||
|
||||
// 停止播放
|
||||
[self stopMP4Playback];
|
||||
|
||||
// 隐藏 mp4 视图
|
||||
self.mp4View.hidden = YES;
|
||||
self.imageView.hidden = NO;
|
||||
|
||||
// 重置状态
|
||||
self.mp4Path = nil;
|
||||
self.imagePath = nil;
|
||||
self.isVisible = NO;
|
||||
|
||||
// 清空图片
|
||||
self.imageView.image = nil;
|
||||
}
|
||||
|
||||
- (void)updateCell:(MedalVo *)model {
|
||||
self.displayModel = model;
|
||||
[self updateDisplayWithCurrentModel];
|
||||
}
|
||||
|
||||
- (void)updateDisplayWithCurrentModel {
|
||||
if (self.displayModel) {
|
||||
if ([self.displayModel.picUrl hasSuffix:@"mp4"]) {
|
||||
[self setMp4Path:self.displayModel.picUrl];
|
||||
} else {
|
||||
[self setImagePath:self.displayModel.picUrl];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setImagePath:(NSString *)imagePath {
|
||||
// 停止之前的 mp4 播放
|
||||
[self stopMP4Playback];
|
||||
|
||||
_imagePath = imagePath;
|
||||
self.mp4View.hidden = YES;
|
||||
self.imageView.hidden = NO;
|
||||
self.imageView.imageUrl = imagePath;
|
||||
}
|
||||
|
||||
- (void)setMp4Path:(NSString *)mp4Path {
|
||||
// 如果是相同的 mp4 路径,不需要重新加载
|
||||
if ([_mp4Path isEqualToString:mp4Path]) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 停止之前的 mp4 播放
|
||||
[self stopMP4Playback];
|
||||
|
||||
_mp4Path = mp4Path;
|
||||
self.mp4View.hidden = NO;
|
||||
self.imageView.hidden = YES;
|
||||
|
||||
if (!_mp4Parser) {
|
||||
self.mp4Parser = [[XPRoomGiftAnimationParser alloc] init];
|
||||
}
|
||||
|
||||
@kWeakify(self);
|
||||
[self.mp4Parser parseWithURL:mp4Path
|
||||
completionBlock:^(NSString * _Nullable videoUrl) {
|
||||
@kStrongify(self);
|
||||
if (![NSString isEmpty:videoUrl]) {
|
||||
// 只有当 cell 可见时才播放
|
||||
if (self.isVisible) {
|
||||
[self.mp4View playHWDMP4:videoUrl repeatCount:-1 delegate:nil];
|
||||
} else {
|
||||
// 存储 URL,但不立即播放
|
||||
self.mp4View.tag = 1; // 标记已准备好播放
|
||||
}
|
||||
}
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
NSLog(@"Failed to parse mp4: %@", error);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - MP4 播放控制
|
||||
|
||||
- (void)stopMP4Playback {
|
||||
if (self.mp4View) {
|
||||
[self.mp4View stopHWDMP4];
|
||||
self.mp4View.tag = 0; // 重置播放状态标记
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pauseMP4Playback {
|
||||
if (self.mp4View && !self.mp4View.hidden) {
|
||||
[self.mp4View pauseHWDMP4];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)resumeMP4Playback {
|
||||
if (self.mp4View && !self.mp4View.hidden && self.mp4Path) {
|
||||
if (self.mp4View.tag == 1) { // 已准备好但尚未播放
|
||||
@kWeakify(self);
|
||||
[self.mp4Parser parseWithURL:self.mp4Path
|
||||
completionBlock:^(NSString * _Nullable videoUrl) {
|
||||
@kStrongify(self);
|
||||
if (![NSString isEmpty:videoUrl] && self.isVisible) {
|
||||
[self.mp4View playHWDMP4:videoUrl repeatCount:-1 delegate:nil];
|
||||
}
|
||||
} failureBlock:nil];
|
||||
} else {
|
||||
[self.mp4View resumeHWDMP4];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 可见性管理
|
||||
|
||||
- (void)willDisplay {
|
||||
self.isVisible = YES;
|
||||
[self resumeMP4Playback];
|
||||
}
|
||||
|
||||
- (void)didEndDisplaying {
|
||||
self.isVisible = NO;
|
||||
[self pauseMP4Playback];
|
||||
}
|
||||
|
||||
#pragma mark - 通知处理
|
||||
|
||||
- (void)appDidEnterBackground {
|
||||
[self pauseMP4Playback];
|
||||
}
|
||||
|
||||
- (void)appWillEnterForeground {
|
||||
if (self.isVisible) {
|
||||
[self resumeMP4Playback];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// 内存警告时停止播放
|
||||
if (!self.isVisible) {
|
||||
[self stopMP4Playback];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 生命周期
|
||||
|
||||
- (void)dealloc {
|
||||
// 停止播放
|
||||
[self stopMP4Playback];
|
||||
|
||||
// 移除通知观察者
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
// 清理资源
|
||||
self.mp4Parser = nil;
|
||||
NSLog(@"MedalsCyclePagerCell dealloc");
|
||||
}
|
||||
|
||||
#pragma mark - Lazy load
|
||||
|
||||
- (VAPView *)mp4View {
|
||||
if (!_mp4View) {
|
||||
_mp4View = [[VAPView alloc] init];
|
||||
_mp4View.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _mp4View;
|
||||
}
|
||||
|
||||
@end
|
@@ -10,6 +10,7 @@
|
||||
#import "UserInfoModel.h"
|
||||
#import "TYCyclePagerView.h"
|
||||
#import "MedalsCollectionViewCell.h"
|
||||
#import "MedalsCyclePagerCell.h"
|
||||
#import "MedalsDetailView.h"
|
||||
#import "MedalsWearingViewController.h"
|
||||
#import "MedalsRankViewController.h"
|
||||
@@ -28,18 +29,20 @@ typedef enum : NSInteger {
|
||||
MedalsCenterDisplayType_Square
|
||||
} MedalsCenterDisplayType;
|
||||
|
||||
@interface MedalsViewController () <MedalsPresenterProtocol, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
@interface MedalsViewController () <MedalsPresenterProtocol, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, TYCyclePagerViewDataSource, TYCyclePagerViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) UserInfoModel *userInfo;
|
||||
@property (nonatomic, copy) NSArray <UIButton *> *centerTabButtons;
|
||||
@property (nonatomic, strong) UILabel *medalDescLabel;
|
||||
@property (nonatomic, strong) UIButton *emptyUserMedalButton;
|
||||
@property (nonatomic, strong) TYCyclePagerView *medalsCyclePagerView;
|
||||
@property (nonatomic, strong) UIView *emptyView;
|
||||
@property (nonatomic, copy) UICollectionView *medalsCollectionView;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray <MedalSeriesVo *>*datasourceTaskMedals;
|
||||
@property (nonatomic, strong) NSMutableArray <MedalSeriesVo *>*datasourceActivityMedals;
|
||||
@property (nonatomic, strong) NSMutableArray <MedalSeriesVo *>*datasourceGloryMedals;
|
||||
@property (nonatomic, copy) NSArray <MedalVo *> *useMedals;
|
||||
|
||||
@property (nonatomic, assign) NSInteger currentPageTaskMedals;
|
||||
@property (nonatomic, assign) NSInteger currentPageActivityMedals;
|
||||
@@ -110,6 +113,8 @@ typedef enum : NSInteger {
|
||||
[self setupWearingButton];
|
||||
if (self.userInfo.medals.medalCount == 0) {
|
||||
[self setupEmptyUserMedals];
|
||||
} else {
|
||||
[self setupWearingUserMedals];
|
||||
}
|
||||
} else {
|
||||
[self setupOthersMedalInfo];
|
||||
@@ -265,11 +270,19 @@ typedef enum : NSInteger {
|
||||
}
|
||||
|
||||
- (void)setupEmptyUserMedals {
|
||||
|
||||
[self.view addSubview:self.medalsCyclePagerView];
|
||||
[self.view addSubview:self.emptyUserMedalButton];
|
||||
[self.emptyUserMedalButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(100);
|
||||
make.width.height.mas_equalTo(184);
|
||||
make.centerX.mas_equalTo(self.view);
|
||||
make.size.mas_equalTo(CGSizeMake(184, 184));
|
||||
make.top.mas_equalTo(100);
|
||||
}];
|
||||
|
||||
[self.medalsCyclePagerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.emptyUserMedalButton);
|
||||
make.width.mas_equalTo([UIScreen mainScreen].bounds.size.width);
|
||||
make.height.mas_equalTo(self.emptyUserMedalButton);
|
||||
}];
|
||||
|
||||
[self.view addSubview:self.medalDescLabel];
|
||||
@@ -282,6 +295,15 @@ typedef enum : NSInteger {
|
||||
}
|
||||
|
||||
- (void)setupWearingUserMedals {
|
||||
// 添加 TYCyclePagerView 用于显示佩戴的勋章
|
||||
[self.view addSubview:self.medalsCyclePagerView];
|
||||
[self.medalsCyclePagerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(100);
|
||||
make.centerX.mas_equalTo(self.view);
|
||||
make.width.mas_equalTo([UIScreen mainScreen].bounds.size.width);
|
||||
make.height.mas_equalTo(184);
|
||||
}];
|
||||
|
||||
[self.view addSubview:self.medalDescLabel];
|
||||
self.medalDescLabel.text = @"显示过期时间";//YMLocalizedString(@"20.20.61_text_6");
|
||||
[self.medalDescLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -403,6 +425,7 @@ typedef enum : NSInteger {
|
||||
[self endReresh];
|
||||
[self _updateDataSource:userMedalsModel.medalSeries];
|
||||
[self _updateOtherInfo:userMedalsModel];
|
||||
[self _updateWearingInfo];
|
||||
}
|
||||
|
||||
- (void)userMedalsFailure {
|
||||
@@ -463,8 +486,15 @@ typedef enum : NSInteger {
|
||||
}
|
||||
|
||||
- (void)_updateWearingInfo {
|
||||
self.useMedals = self.userMedalsModel.useMedals;
|
||||
if (self.displayType != MedalsCenterDisplayType_Other) {
|
||||
|
||||
if (self.useMedals.count > 0 ) {
|
||||
self.emptyUserMedalButton.hidden = YES;
|
||||
[self.medalsCyclePagerView reloadData];
|
||||
} else {
|
||||
self.emptyUserMedalButton.hidden = NO;
|
||||
self.medalsCyclePagerView.hidden = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,6 +642,50 @@ typedef enum : NSInteger {
|
||||
return model;
|
||||
}
|
||||
|
||||
#pragma mark - TYCyclePagerView DataSource & Delegate
|
||||
|
||||
- (NSInteger)numberOfItemsInPagerView:(TYCyclePagerView *)pageView {
|
||||
return self.useMedals.count;
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)pagerView:(TYCyclePagerView *)pagerView cellForItemAtIndex:(NSInteger)index {
|
||||
MedalsCyclePagerCell *cell = [pagerView dequeueReusableCellWithReuseIdentifier:@"MedalsCyclePagerCell" forIndex:index];
|
||||
MedalVo *vo = [self.useMedals xpSafeObjectAtIndex:index];
|
||||
[cell updateCell:vo];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (TYCyclePagerViewLayout *)layoutForPagerView:(TYCyclePagerView *)pageView {
|
||||
TYCyclePagerViewLayout *layout = [[TYCyclePagerViewLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(184, 184);
|
||||
layout.itemSpacing = 10;
|
||||
layout.layoutType = TYCyclePagerTransformLayoutLinear;
|
||||
layout.itemHorizontalCenter = YES;
|
||||
return layout;
|
||||
}
|
||||
|
||||
- (void)pagerView:(TYCyclePagerView *)pageView didScrollFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex {
|
||||
// 处理滚动事件,暂停之前的 cell,恢复当前的 cell
|
||||
// 获取可见的 cells
|
||||
NSArray *visibleCells = pageView.collectionView.visibleCells;
|
||||
|
||||
// 简化处理:遍历所有可见的 cells,暂停非当前 index 的 cell
|
||||
for (UICollectionViewCell *cell in visibleCells) {
|
||||
if ([cell isKindOfClass:[MedalsCyclePagerCell class]]) {
|
||||
NSIndexPath *indexPath = [pageView.collectionView indexPathForCell:cell];
|
||||
if (indexPath) {
|
||||
NSInteger cellIndex = indexPath.item;
|
||||
if (cellIndex == toIndex) {
|
||||
[(MedalsCyclePagerCell *)cell willDisplay];
|
||||
} else {
|
||||
[(MedalsCyclePagerCell *)cell didEndDisplaying];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Lazy load
|
||||
- (UIButton *)medalsSquareButton {
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
@@ -767,4 +841,18 @@ typedef enum : NSInteger {
|
||||
return _otherAvatar;
|
||||
}
|
||||
|
||||
- (TYCyclePagerView *)medalsCyclePagerView {
|
||||
if (!_medalsCyclePagerView) {
|
||||
_medalsCyclePagerView = [[TYCyclePagerView alloc] init];
|
||||
_medalsCyclePagerView.dataSource = self;
|
||||
_medalsCyclePagerView.delegate = self;
|
||||
_medalsCyclePagerView.backgroundColor = [UIColor clearColor];
|
||||
_medalsCyclePagerView.isInfiniteLoop = NO;
|
||||
_medalsCyclePagerView.clipsToBounds = NO;
|
||||
[_medalsCyclePagerView registerClass:[MedalsCyclePagerCell class]
|
||||
forCellWithReuseIdentifier:@"MedalsCyclePagerCell"];
|
||||
}
|
||||
return _medalsCyclePagerView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// XPNobleCenterMyNobleView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/1/4.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "NobleCenterModel.h"
|
||||
#import "RechargeListModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPNobleCenterMyNobleViewDelegate <NSObject>
|
||||
|
||||
-(void)payNobleCenterWithModel:(RechargeListModel *)rechargeModel vipInfo:(NobleInfo *)vipInfo ;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface XPNobleCenterMyNobleView : UIView
|
||||
|
||||
///总数据
|
||||
@property (nonatomic, strong) NobleCenterModel *model;
|
||||
@property(nonatomic,strong) NobleInfo *vipInfo;
|
||||
@property(nonatomic,strong) RechargeListModel *rechargeModel;
|
||||
@property(nonatomic,weak) id<XPNobleCenterMyNobleViewDelegate>delegate;
|
||||
@property(nonatomic,assign) BOOL isHiddenPayBtn;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -1,427 +0,0 @@
|
||||
//
|
||||
// XPNobleCenterMyNobleView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/1/4.
|
||||
//
|
||||
|
||||
#import "XPNobleCenterMyNobleView.h"
|
||||
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor+NobleCenter.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "TTPopup.h"
|
||||
#import "XPNobleCenterResidueView.h"
|
||||
|
||||
@interface XPNobleCenterMyNobleView ()
|
||||
|
||||
///顶部view
|
||||
@property (nonatomic, strong) UIView *topView;
|
||||
///等级详情
|
||||
@property (nonatomic, strong) YYLabel *nobleLabel;
|
||||
///时间帮助按钮
|
||||
@property (nonatomic, strong) UIButton *timeDescButton;
|
||||
///权力值图标
|
||||
@property (nonatomic, strong) UIImageView *privilegeIconImage;
|
||||
///底层进度条
|
||||
@property (nonatomic, strong) UIView *backProgressView;
|
||||
///当前进度条
|
||||
@property (nonatomic, strong) UIImageView *currentProgressView;
|
||||
///进度条圆标
|
||||
@property (nonatomic, strong) UIImageView *indicateImageView;
|
||||
///保级值箭头
|
||||
@property (nonatomic, strong) UIImageView *safeLevelImageView;
|
||||
///当前权力值
|
||||
@property (nonatomic, strong) UILabel *currentValueLabel;
|
||||
///保级权力值
|
||||
@property (nonatomic, strong) UILabel *safeValueLabel;
|
||||
///升级权力值
|
||||
@property (nonatomic, strong) UILabel *upGradeValueLabel;
|
||||
///开通VIP
|
||||
@property (nonatomic, strong) UILabel *openNobleButton;
|
||||
///
|
||||
@property (nonatomic,strong) UIImageView *openNobleView;
|
||||
@property (nonatomic,strong) UIImageView *openNobleIconView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPNobleCenterMyNobleView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = UIColorFromRGB(0x252014);
|
||||
[self addSubview:self.topView];
|
||||
[self.topView addSubview:self.nobleLabel];
|
||||
[self.topView addSubview:self.timeDescButton];
|
||||
[self addSubview:self.privilegeIconImage];
|
||||
[self addSubview:self.backProgressView];
|
||||
[self.backProgressView addSubview:self.currentProgressView];
|
||||
[self addSubview:self.indicateImageView];
|
||||
[self addSubview:self.safeLevelImageView];
|
||||
[self addSubview:self.currentValueLabel];
|
||||
[self addSubview:self.safeValueLabel];
|
||||
[self addSubview:self.upGradeValueLabel];
|
||||
|
||||
[self addSubview:self.openNobleView];
|
||||
|
||||
[self.openNobleView addSubview:self.openNobleIconView];
|
||||
[self.openNobleView addSubview:self.openNobleButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.trailing.mas_equalTo(0);
|
||||
make.height.mas_greaterThanOrEqualTo(36);
|
||||
}];
|
||||
CGFloat width = KScreenWidth - 29 - 15;
|
||||
[self.nobleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(15);
|
||||
make.top.bottom.equalTo(self.topView);
|
||||
make.width.mas_lessThanOrEqualTo(width);
|
||||
}];
|
||||
[self.timeDescButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.topView);
|
||||
make.leading.mas_equalTo(self.nobleLabel.mas_trailing).mas_offset(3);
|
||||
make.width.height.mas_equalTo(14);
|
||||
}];
|
||||
[self.privilegeIconImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(14);
|
||||
make.top.mas_equalTo(self.topView.mas_bottom).mas_offset(24);
|
||||
make.width.mas_equalTo(50);
|
||||
make.height.mas_equalTo(16);
|
||||
}];
|
||||
[self.backProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.privilegeIconImage);
|
||||
make.leading.mas_equalTo(self.privilegeIconImage.mas_trailing).mas_offset(12);
|
||||
make.trailing.mas_equalTo(-14);
|
||||
make.height.mas_equalTo(12);
|
||||
}];
|
||||
[self.currentProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.top.bottom.mas_equalTo(self.backProgressView);
|
||||
make.trailing.mas_equalTo(self.indicateImageView.mas_centerX);
|
||||
}];
|
||||
|
||||
[self.indicateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.backProgressView);
|
||||
make.width.height.mas_equalTo(18);
|
||||
make.centerX.mas_equalTo(self.backProgressView.mas_leading).mas_offset(2);
|
||||
}];
|
||||
|
||||
[self.currentValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.indicateImageView).priorityMedium();
|
||||
make.top.mas_equalTo(self.backProgressView.mas_bottom).mas_offset(5);
|
||||
make.trailing.mas_lessThanOrEqualTo(-12).priorityHigh();
|
||||
}];
|
||||
[self.safeValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.safeLevelImageView.mas_top).mas_offset(-2);
|
||||
make.height.mas_equalTo(10);
|
||||
}];
|
||||
|
||||
[self.safeLevelImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.backProgressView.mas_top).mas_offset(2);
|
||||
make.centerX.mas_equalTo(self.safeValueLabel);
|
||||
make.width.height.mas_equalTo(8);
|
||||
}];
|
||||
[self.upGradeValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.safeValueLabel);
|
||||
make.trailing.mas_equalTo(self.backProgressView);
|
||||
}];
|
||||
|
||||
|
||||
[self.openNobleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.bottom.mas_equalTo(-kSafeAreaBottomHeight - 5);
|
||||
make.width.mas_equalTo(300);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
[self.openNobleButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_lessThanOrEqualTo(258);
|
||||
make.centerX.equalTo(self.openNobleView);
|
||||
make.top.bottom.equalTo(self.openNobleView);
|
||||
}];
|
||||
[self.openNobleIconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(20);
|
||||
make.centerY.equalTo(self.openNobleView);
|
||||
make.trailing.equalTo(self.openNobleButton.mas_leading).mas_offset(-2);
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - private
|
||||
- (NSMutableAttributedString *)createNobleStringWithModel:(NobleCenterModel *)model {
|
||||
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init];
|
||||
[string appendAttributedString:[self createAttribute:YMLocalizedString(@"XPNobleCenterMyNobleView0") color:[DJDKMIMOMColor normalNobleTextColor]]];
|
||||
NSString *levelName = @"";
|
||||
NSInteger distanceValue = 0;
|
||||
NSString *nextLevelName = @"";
|
||||
NSInteger saveScore = 0;
|
||||
NSInteger nextSecore = 0;
|
||||
BOOL hadNextLevel = YES;//标记
|
||||
for (NobleInfo *info in model.vipInfos) {
|
||||
if (info.vipLevel == model.currentLevel) {
|
||||
levelName = info.vipName;
|
||||
saveScore = info.levelKeepScore;
|
||||
nextSecore = info.levelUpScore;
|
||||
distanceValue = info.levelUpScore - model.currScore;
|
||||
}
|
||||
if (info.vipLevel > model.currentLevel && hadNextLevel) {
|
||||
hadNextLevel = NO;
|
||||
nextLevelName = info.vipName;
|
||||
|
||||
}
|
||||
}
|
||||
NSAttributedString *levelStr = [[NSAttributedString alloc] initWithString:levelName attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12], NSForegroundColorAttributeName:[DJDKMIMOMColor hightNobleLightTextColor]}];
|
||||
[string appendAttributedString:levelStr];
|
||||
if (model.isMaxLevel) {
|
||||
[string appendAttributedString:[self createAttribute:YMLocalizedString(@"XPNobleCenterMyNobleView1") color:[DJDKMIMOMColor normalNobleTextColor]]];
|
||||
} else {
|
||||
[string appendAttributedString:[self createAttribute:YMLocalizedString(@"XPNobleCenterMyNobleView2") color:[DJDKMIMOMColor normalNobleTextColor]]];
|
||||
NSAttributedString *distanceStr = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%zd", distanceValue] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13], NSForegroundColorAttributeName:[DJDKMIMOMColor hightNobleLightTextColor]}];
|
||||
[string appendAttributedString:distanceStr];
|
||||
[string appendAttributedString:[self createAttribute:YMLocalizedString(@"XPNobleCenterMyNobleView3") color:[DJDKMIMOMColor normalNobleTextColor]]];
|
||||
[string appendAttributedString:[self createAttribute:nextLevelName color:[DJDKMIMOMColor normalNobleTextColor]]];
|
||||
}
|
||||
[string appendAttributedString:[self createAttribute:YMLocalizedString(@"XPNobleCenterMyNobleView4") color:[DJDKMIMOMColor normalNobleTextColor]]];
|
||||
|
||||
NSAttributedString *countTimeStr = [[NSAttributedString alloc] initWithString:[self cacularTimeWithSecond:model.remainSeconds] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13], NSForegroundColorAttributeName:[DJDKMIMOMColor hightNobleLightTextColor]}];
|
||||
[string appendAttributedString:countTimeStr];
|
||||
|
||||
NSTextAttachment * attachment = [[NSTextAttachment alloc] init];
|
||||
attachment.bounds = CGRectMake(0, 0, 10, 12);
|
||||
attachment.image = [UIImage imageNamed:@"noble_indicate_icon"];
|
||||
NSAttributedString * starAttribute = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)attachment];
|
||||
[string appendAttributedString:starAttribute];
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
- (NSAttributedString *)createAttribute:(NSString * )text color:(UIColor *)color {
|
||||
NSDictionary * attribute = @{NSFontAttributeName:[UIFont systemFontOfSize:10], NSForegroundColorAttributeName:color};
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text attributes:attribute];
|
||||
return attr;
|
||||
}
|
||||
|
||||
- (NSString *)cacularTimeWithSecond:(long long)second {
|
||||
long long minSecond = 60;
|
||||
long long hourSecond = minSecond * 60;
|
||||
long long daySecond = hourSecond * 24;
|
||||
|
||||
NSString *day = @"";
|
||||
NSString *hour = @"";
|
||||
if (second > daySecond) {
|
||||
day = [NSString stringWithFormat:@"%lld%@", second / daySecond, YMLocalizedString(@"App_Commont_Day")];
|
||||
if (second % daySecond > hourSecond) {
|
||||
hour = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterMyNobleView5"), (second % daySecond) / hourSecond];
|
||||
return [NSString stringWithFormat:@"%@%@", day, hour];
|
||||
}else {
|
||||
return day;
|
||||
}
|
||||
} else if (second > hourSecond) {
|
||||
return hour = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterMyNobleView6"), second / hourSecond];
|
||||
} else {
|
||||
return YMLocalizedString(@"XPNobleCenterMyNobleView7");
|
||||
}
|
||||
}
|
||||
#pragma mark - events
|
||||
- (void)onTimeButtonClick:(UIButton *)button {
|
||||
XPNobleCenterResidueView *alertView = [[XPNobleCenterResidueView alloc] initWithFrame:CGRectMake(0, 0, 300, 286)];
|
||||
TTPopupService * config = [[TTPopupService alloc] init];
|
||||
config.shouldDismissOnBackgroundTouch = NO;
|
||||
config.contentView = alertView;
|
||||
[TTPopup popupWithConfig:config];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setModel:(NobleCenterModel *)model {
|
||||
_model = model;
|
||||
self.nobleLabel.attributedText = [self createNobleStringWithModel:model];
|
||||
NSInteger safeScore = 0;
|
||||
NSInteger nextScore = 0;
|
||||
for (NobleInfo *info in model.vipInfos) {
|
||||
if (info.vipLevel == model.currentLevel) {
|
||||
safeScore = info.levelKeepScore;
|
||||
nextScore = info.levelUpScore;
|
||||
}
|
||||
}
|
||||
self.safeValueLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterMyNobleView8"), safeScore];
|
||||
self.upGradeValueLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterMyNobleView9"), nextScore];
|
||||
self.currentValueLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterMyNobleView10"), model.currScore];
|
||||
CGFloat margin = self.backProgressView.frame.size.width * (model.currScore * 1.0 / nextScore);
|
||||
if (nextScore == 0) {
|
||||
margin = 0;
|
||||
}
|
||||
[self.indicateImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.backProgressView.mas_leading).mas_offset(margin);
|
||||
}];
|
||||
CGFloat safeMargin = self.backProgressView.frame.size.width * (safeScore * 1.0 / nextScore);
|
||||
if (nextScore == 0) {
|
||||
safeMargin = 0;
|
||||
}
|
||||
[self.safeValueLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.backProgressView.mas_leading).mas_offset(safeMargin);
|
||||
}];
|
||||
self.upGradeValueLabel.hidden = model.isMaxLevel;
|
||||
|
||||
}
|
||||
- (void)setVipInfo:(NobleInfo *)vipInfo{
|
||||
_vipInfo = vipInfo;
|
||||
if (_vipInfo.vipLevel > _model.currentLevel){
|
||||
self.openNobleView.hidden = NO;
|
||||
self.openNobleButton.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterMyNobleView11"),_rechargeModel.money.floatValue,_vipInfo.vipName];
|
||||
}else{
|
||||
self.openNobleView.hidden = YES;
|
||||
}
|
||||
}
|
||||
- (void)setIsHiddenPayBtn:(BOOL)isHiddenPayBtn{
|
||||
_isHiddenPayBtn = isHiddenPayBtn;
|
||||
self.openNobleView.hidden = _isHiddenPayBtn;
|
||||
}
|
||||
-(void)onOpenNobleButtonClick{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(payNobleCenterWithModel:vipInfo:)]){
|
||||
[self.delegate payNobleCenterWithModel:self.rechargeModel vipInfo:self.vipInfo];
|
||||
}
|
||||
}
|
||||
- (UIView *)topView {
|
||||
if (!_topView) {
|
||||
_topView = [[UIView alloc] init];
|
||||
_topView.backgroundColor = UIColorFromRGB(0x302B20);
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
- (YYLabel *)nobleLabel {
|
||||
if (!_nobleLabel) {
|
||||
_nobleLabel = [[YYLabel alloc] init];
|
||||
_nobleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_nobleLabel.numberOfLines = 0;
|
||||
}
|
||||
return _nobleLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)privilegeIconImage {
|
||||
if (!_privilegeIconImage) {
|
||||
_privilegeIconImage = [[UIImageView alloc] initWithImage:[UIImage getLanguageImage:@"noble_privilege_icon"]];
|
||||
}
|
||||
return _privilegeIconImage;
|
||||
}
|
||||
|
||||
- (UIView *)backProgressView {
|
||||
if (!_backProgressView) {
|
||||
_backProgressView = [[UIView alloc] init];
|
||||
_backProgressView.backgroundColor = UIColorFromRGB(0x443A24);
|
||||
_backProgressView.layer.cornerRadius = 6;
|
||||
_backProgressView.layer.masksToBounds = YES;
|
||||
_backProgressView.layer.borderColor = UIColorFromRGB(0xB49158).CGColor;
|
||||
_backProgressView.layer.borderWidth = 0.5;
|
||||
}
|
||||
return _backProgressView;
|
||||
}
|
||||
- (UIImageView *)currentProgressView {
|
||||
if (!_currentProgressView) {
|
||||
_currentProgressView = [[UIImageView alloc] init];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xF2B04E),UIColorFromRGB(0xFFE5BA)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(12, 12)];
|
||||
_currentProgressView.image = image;
|
||||
}
|
||||
return _currentProgressView;
|
||||
}
|
||||
|
||||
- (UIImageView *)indicateImageView {
|
||||
if (!_indicateImageView) {
|
||||
_indicateImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"noble_indicate_icon"]];
|
||||
}
|
||||
return _indicateImageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)safeLevelImageView {
|
||||
if (!_safeLevelImageView) {
|
||||
_safeLevelImageView = [[UIImageView alloc] init];
|
||||
_safeLevelImageView.image = [UIImage imageNamed:@"noble_safe_level_arrow"];
|
||||
}
|
||||
return _safeLevelImageView;
|
||||
}
|
||||
|
||||
|
||||
- (UILabel *)currentValueLabel {
|
||||
if (!_currentValueLabel) {
|
||||
_currentValueLabel = [[UILabel alloc] init];
|
||||
_currentValueLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||||
// _currentValueLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_currentValueLabel.text = @"0";
|
||||
_currentValueLabel.textColor = [DJDKMIMOMColor hightNobleLightTextColor];
|
||||
}
|
||||
return _currentValueLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)safeValueLabel {
|
||||
if (!_safeValueLabel) {
|
||||
_safeValueLabel = [[UILabel alloc] init];
|
||||
_safeValueLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||||
_safeValueLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_safeValueLabel.text = @"0";
|
||||
_safeValueLabel.textColor = [DJDKMIMOMColor normalNobleTextColor];
|
||||
}
|
||||
return _safeValueLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)upGradeValueLabel {
|
||||
if (!_upGradeValueLabel) {
|
||||
_upGradeValueLabel = [[UILabel alloc] init];
|
||||
_upGradeValueLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||||
_upGradeValueLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_upGradeValueLabel.text = @"0";
|
||||
_upGradeValueLabel.textColor = [DJDKMIMOMColor normalNobleTextColor];
|
||||
}
|
||||
return _upGradeValueLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)timeDescButton {
|
||||
if (!_timeDescButton) {
|
||||
_timeDescButton = [[UIButton alloc] init];
|
||||
[_timeDescButton setBackgroundImage:[UIImage imageNamed:@"noble_time_help"] forState:UIControlStateNormal];
|
||||
[_timeDescButton addTarget:self action:@selector(onTimeButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _timeDescButton;
|
||||
}
|
||||
- (UIImageView *)openNobleView{
|
||||
if (!_openNobleView){
|
||||
_openNobleView = [UIImageView new];
|
||||
_openNobleView.image = kImage(@"noble_open_btn_bg");
|
||||
_openNobleView.userInteractionEnabled = YES;
|
||||
_openNobleView.hidden = YES;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onOpenNobleButtonClick)];
|
||||
[_openNobleView addGestureRecognizer:tap];
|
||||
}
|
||||
return _openNobleView;
|
||||
}
|
||||
- (UILabel *)openNobleButton {
|
||||
if (!_openNobleButton) {
|
||||
NSString *title = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterViewController0"), @"2.99"];
|
||||
_openNobleButton = [UILabel new];
|
||||
_openNobleButton.text = title;
|
||||
_openNobleButton.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||
_openNobleButton.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
_openNobleButton.numberOfLines = 0;
|
||||
_openNobleButton.textAlignment = NSTextAlignmentCenter;
|
||||
|
||||
}
|
||||
return _openNobleButton;
|
||||
}
|
||||
-(UIImageView *)openNobleIconView{
|
||||
if (!_openNobleIconView){
|
||||
_openNobleIconView = [UIImageView new];
|
||||
_openNobleIconView.image = kImage(@"noble_open_btn");
|
||||
}
|
||||
return _openNobleIconView;
|
||||
}
|
||||
|
||||
@end
|