PlanetStarVC开发

This commit is contained in:
liyuhua
2024-02-28 19:01:10 +08:00
parent 166f2bde57
commit 4304c3cad8
80 changed files with 6003 additions and 2586 deletions

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_home_voice_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_home_voice_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_home_voice_change_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_home_voice_change_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_home_voice_choose_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_home_voice_choose_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_home_voice_top_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_home_voice_top_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_home_voice_user_info_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_home_voice_user_info_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_home_voice_user_info_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_home_voice_user_info_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star__woman@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star__woman@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_attention_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_attention_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_attention_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_attention_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_back@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_back@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_center_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_center_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_chat_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_chat_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_man@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_man@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_no_attention_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_no_attention_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_refresh@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_refresh@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_signature_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_signature_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ym_plane_star_water_drop_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ym_plane_star_water_drop_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@@ -37,7 +37,7 @@ class YMNetworkHelper: NSObject {
func requestSend(type:HTTPMethod,path:String,params:Dictionary<String, Any>, succeed:SessionCallSucceed?,fail:SessionCallFail?) -> Void {
getHttpRequestHeaders()
requestSend(type: type,host: "http://beta.api.ymlive.fun/", path: path, params: params, encoding: URLEncoding.queryString, header: headersSet, succeed: succeed, fail: fail)
requestSend(type: type,host: "https://api.ymlive.fun/", path: path, params: params, encoding: URLEncoding.queryString, header: headersSet, succeed: succeed, fail: fail)
}
func requestSend(type:HTTPMethod,

View File

@@ -3,3 +3,4 @@
//
#import "MAIDESEncryptTool.h"
#import <SVGAPlayer/SVGA.h>

View File

@@ -0,0 +1,58 @@
//
// HomeVoiceChooseItemVeiw.swift
// yinmeng-ios
//
// Created by duoban on 2024/2/28.
//
import UIKit
class HomeVoiceChooseItemVeiw: UIView {
var isChoose:Bool = false
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
}
func setUILayout(){
backgroundColor = ThemeColor(hexStr: "#1D1E1F")
layer.cornerRadius = 14
layer.masksToBounds = true
addSubview(leftIconView)
addSubview(rightTextView)
leftIconView.snp.makeConstraints { make in
make.width.height.equalTo(18)
make.left.equalTo(8)
make.centerY.equalTo(self)
}
rightTextView.snp.makeConstraints { make in
make.left.equalTo(28)
make.right.equalTo(9)
make.centerY.equalTo(self)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var image:String = "" {
didSet{
leftIconView.image = UIImage(named: image)
}
}
var text:String = ""{
didSet{
rightTextView.text = text
}
}
var leftIconView:UIImageView = {
let _leftIconView = UIImageView()
return _leftIconView
}()
var rightTextView:UILabel = {
let _rightTextView = UILabel()
_rightTextView.font = UIFont.systemFont(ofSize: 12, weight: .medium)
_rightTextView.textColor = ThemeColor(hexStr: "#E1E4E6")
return _rightTextView
}()
}

View File

@@ -0,0 +1,96 @@
//
// HomeVoiceChooseTypeView.swift
// yinmeng-ios
//
// Created by duoban on 2024/2/28.
//
import UIKit
typealias YinChooseTypeBlock = (_ type:Int)->Void
class HomeVoiceChooseTypeView: UIView {
var chooseTypeBlock:YinChooseTypeBlock?
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
}
func setUILayout(){
backgroundColor = .white
layer.cornerRadius = 8
layer.masksToBounds = true
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func clickItemAction(sender:UIButton){
if allBtn == sender{
allBtn.backgroundColor = ThemeColor(hexStr: "#DCDDE0")
allBtn.setTitleColor(ThemeColor(hexStr: "#1F1B4F"), for: .normal)
manBtn.setTitleColor(ThemeColor(hexStr: "#7D8499"), for: .normal)
manBtn.backgroundColor = .clear
womanBtn.setTitleColor(ThemeColor(hexStr: "#7D8499"), for: .normal)
womanBtn.backgroundColor = .clear
}else if manBtn == sender{
manBtn.backgroundColor = ThemeColor(hexStr: "#DCDDE0")
manBtn.setTitleColor(ThemeColor(hexStr: "#1F1B4F"), for: .normal)
allBtn.setTitleColor(ThemeColor(hexStr: "#7D8499"), for: .normal)
allBtn.backgroundColor = .clear
womanBtn.setTitleColor(ThemeColor(hexStr: "#7D8499"), for: .normal)
womanBtn.backgroundColor = .clear
}else{
womanBtn.backgroundColor = ThemeColor(hexStr: "#DCDDE0")
womanBtn.setTitleColor(ThemeColor(hexStr: "#1F1B4F"), for: .normal)
allBtn.setTitleColor(ThemeColor(hexStr: "#7D8499"), for: .normal)
allBtn.backgroundColor = .clear
manBtn.setTitleColor(ThemeColor(hexStr: "#7D8499"), for: .normal)
manBtn.backgroundColor = .clear
}
self.isHidden = true
if let _chooseTypeBlock = chooseTypeBlock{
let type = sender.tag - 100
_chooseTypeBlock(type)
}
}
var allBtn:UIButton = {
let _allBtn = UIButton()
_allBtn.setTitle("全部", for: .normal)
_allBtn.setTitleColor(ThemeColor(hexStr: "#1F1B4F"), for: .normal)
_allBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .medium)
_allBtn.backgroundColor = ThemeColor(hexStr: "#DCDDE0")
_allBtn.layer.cornerRadius = 6
_allBtn.tag = 100;
_allBtn.layer.masksToBounds = true
_allBtn.addTarget(self, action: #selector(clickItemAction(sender:)), for: .touchUpInside)
return _allBtn
}()
var manBtn:UIButton = {
let _manBtn = UIButton()
_manBtn.setTitle("男生", for: .normal)
_manBtn.setTitleColor(ThemeColor(hexStr: "#7D8499"), for: .normal)
_manBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .medium)
_manBtn.tag = 101;
_manBtn.layer.cornerRadius = 6
_manBtn.layer.masksToBounds = true
_manBtn.addTarget(self, action: #selector(clickItemAction(sender:)), for: .touchUpInside)
return _manBtn
}()
var womanBtn:UIButton = {
let _womanBtn = UIButton()
_womanBtn.setTitle("女生", for: .normal)
_womanBtn.setTitleColor(ThemeColor(hexStr: "#7D8499"), for: .normal)
_womanBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .medium)
_womanBtn.layer.cornerRadius = 6
_womanBtn.tag = 102;
_womanBtn.layer.masksToBounds = true
_womanBtn.addTarget(self, action: #selector(clickItemAction(sender:)), for: .touchUpInside)
return _womanBtn
}()
}

View File

@@ -7,23 +7,101 @@
import UIKit
class HomeVoiceVC: BaseViewController {
class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
setUILayout()
}
func setUILayout(){
view.addSubview(backgroundView)
view.addSubview(topLogoIcon)
view.addSubview(chooseItemVeiw)
view.addSubview(changeItemView)
view.addSubview(userInfoBtn)
view.addSubview(chooseTypeView)
backgroundView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
topLogoIcon.snp.makeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(14 + NavHeight)
make.width.equalTo(260)
make.height.equalTo(23)
}
chooseItemVeiw.snp.makeConstraints { make in
make.left.equalTo(20)
make.top.equalTo(self.topLogoIcon.snp.bottom).offset(18)
make.width.equalTo(61)
make.height.equalTo(27)
}
changeItemView.snp.makeConstraints { make in
make.left.equalTo(self.chooseItemVeiw.snp.right).offset(8)
make.top.height.equalTo(self.chooseItemVeiw)
make.width.equalTo(76)
}
userInfoBtn.snp.makeConstraints { make in
make.right.equalTo(-20)
make.height.equalTo(40)
make.width.equalTo(50)
make.centerY.equalTo(changeItemView)
}
chooseTypeView.snp.makeConstraints { make in
make.width.equalTo(64)
make.height.equalTo(107)
make.centerX.equalTo(self.chooseItemVeiw)
make.top.equalTo(self.changeItemView.snp.bottom)
}
chooseTypeView.chooseTypeBlock = {[weak self] type in
self?.chooseItemVeiw.isChoose = false
}
}
@objc func chooseItemAction(){
chooseItemVeiw.isChoose = !chooseItemVeiw.isChoose
chooseTypeView.isHidden = !chooseItemVeiw.isChoose
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
private lazy var backgroundView:UIImageView = {
let _backgroundView = UIImageView()
_backgroundView.image = UIImage(named: "yin_home_voice_bg")
_backgroundView.isUserInteractionEnabled = true
return _backgroundView
}()
var topLogoIcon:UIImageView = {
let _topLogoIcon = UIImageView()
_topLogoIcon.image = UIImage(named: "yin_home_voice_top_icon")
return _topLogoIcon
}()
var chooseItemVeiw:HomeVoiceChooseItemVeiw = {
let _chooseItemVeiw = HomeVoiceChooseItemVeiw(frame: .zero)
_chooseItemVeiw.image = "yin_home_voice_choose_icon"
_chooseItemVeiw.text = "筛选"
return _chooseItemVeiw
}()
var changeItemView:HomeVoiceChooseItemVeiw = {
let _changeItemView = HomeVoiceChooseItemVeiw(frame: .zero)
_changeItemView.image = "yin_home_voice_change_icon"
_changeItemView.text = "换一换"
return _changeItemView
}()
var userInfoBtn:UIButton = {
let _userInfoBtn = UIButton()
_userInfoBtn.setBackgroundImage(UIImage(named: "yin_home_voice_user_info_bg"), for: .normal)
_userInfoBtn.setImage(UIImage(named: "yin_home_voice_user_info_icon"), for: .normal)
return _userInfoBtn
}()
var chooseTypeView:HomeVoiceChooseTypeView = {
let _chooseTypeView = HomeVoiceChooseTypeView(frame: .zero)
_chooseTypeView.isHidden = true
return _chooseTypeView
}()
}

View File

@@ -0,0 +1,450 @@
//
// PlanetStarClickItemView.swift
// yinmeng-ios
//
// Created by duoban on 2024/2/26.
//
import UIKit
import Nuke
typealias RefreshBlcok = ()->Void
class PlanetStarClickItemView: UIView {
deinit{
if self.timer != nil{
self.timer?.invalidate()
self.timer = nil
}
}
override init(frame: CGRect) {
super.init(frame: frame)
yin_initUI()
timer = Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(beginRotationAnimation), userInfo: nil, repeats: true)
}
@objc func beginRotationAnimation(){
if self.isStop == true{
return
}
self.vapView.transform = CGAffineTransformRotate(self.vapView.transform, Double.pi / 1000 * 1);
}
func yin_initUI(){
addSubview(vapView)
vapView.frame = CGRect(x: -185, y: ScreenHeight/2 - 429 / 2 - 60, width: 429, height: 429)
parser.parse(withNamed: "StarIcon", in: Bundle.main) {[weak self] videoItem in
self?.vapView.videoItem = videoItem
self?.vapView.loops = 100000;
self?.vapView.startAnimation()
} failureBlock: { error in
}
for i in 0..<12 {
let clickHeadImageView = UIImageView()
clickHeadImageView.isUserInteractionEnabled = true
clickHeadImageView.layer.cornerRadius = 31
clickHeadImageView.layer.masksToBounds = true
clickHeadImageView.layer.borderWidth = 1
clickHeadImageView.layer.borderColor = ThemeColor(hexStr: "#57CDFF").cgColor
clickHeadImageView.tag = i + 100
clickHeadImageView.frame = CGRect(x: 0, y: 0, width: clickWidth, height: clickHeight)
let tap = UITapGestureRecognizer.init(target: self, action: #selector(clickImageViewAction))
clickHeadImageView.addGestureRecognizer(tap)
vapView.addSubview(clickHeadImageView)
clickViewList.append(clickHeadImageView)
}
setClickViewLayout()
vapView.superview?.layoutIfNeeded()
addSubview(bgImageView)
addSubview(imageView)
imageView.isHidden = true
let scale = ScreenWidth / 375 * 100
bgImageView.frame = CGRect(x: ScreenWidth , y: ScreenHeight/2 - 140 , width: 385, height: 254)
bgImageView.addSubview(backBtn)
backBtn.snp.makeConstraints { make in
make.width.height.equalTo(30)
make.top.equalTo(65)
make.right.equalTo(-round(scale))
}
bgImageView.addSubview(giftView)
giftView.snp.makeConstraints { make in
make.width.height.equalTo(58)
make.right.equalTo(self.backBtn)
make.top.equalTo(self.backBtn.snp.bottom).offset(1)
}
giftParser.parse(withNamed: "StarGift", in: Bundle.main) {[weak self] videoItem in
self?.giftView.videoItem = videoItem
self?.giftView.loops = 100000;
self?.giftView.startAnimation()
} failureBlock: { error in
}
bgImageView.isHidden = true
addSubview(refreshBtn)
refreshBtn.snp.makeConstraints { make in
make.centerY.equalTo(self.vapView)
make.width.height.equalTo((44))
make.right.equalTo(-32)
}
addSubview(bgUserInfoView)
bgUserInfoView.isHidden = true
bgUserInfoView.addSubview(nameLabelView)
bgUserInfoView.addSubview(sexImageVeiw)
bgUserInfoView.addSubview(attentionBtn)
bgUserInfoView.addSubview(chatBtn)
bgUserInfoView.addSubview(bgSignatureView)
bgSignatureView.addSubview(signatureView)
bgUserInfoView.snp.makeConstraints { make in
make.centerY.equalTo(self.bgImageView).offset(30)
make.height.equalTo((275))
make.left.equalTo(8)
make.width.equalTo(180)
}
nameLabelView.snp.makeConstraints { make in
make.left.top.equalTo(self.bgUserInfoView)
make.height.equalTo(28)
make.right.lessThanOrEqualTo(-25)
}
sexImageVeiw.snp.makeConstraints { make in
make.width.height.equalTo(16)
make.left.equalTo(self.nameLabelView.snp.right).offset(3)
make.centerY.equalTo(self.nameLabelView)
}
attentionBtn.snp.makeConstraints { make in
make.left.equalTo(self.nameLabelView)
make.top.equalTo(self.nameLabelView.snp.bottom).offset(10)
make.width.equalTo(72)
make.height.equalTo(48)
}
chatBtn.snp.makeConstraints { make in
make.left.equalTo(self.attentionBtn.snp.right).offset(8)
make.top.width.height.equalTo(self.attentionBtn)
}
bgSignatureView.snp.makeConstraints { make in
make.width.equalTo(154)
make.height.equalTo(86)
make.top.equalTo(self.nameLabelView.snp.bottom).offset(65)
make.left.equalTo(self.nameLabelView)
}
signatureView.snp.makeConstraints { make in
make.edges.equalTo(self.bgSignatureView).inset(9)
}
}
@objc func attentionBtnAction(){
self.attentionBtn.isSelected = !self.attentionBtn.isSelected
let type = self.attentionBtn.isSelected ? "1" : "2"
let params = ["uid":"\(AuthManager.userUid)","ticket":AuthManager.ticket,"type":type,"likedUid":self.chooseModel?.uid] as [String : Any]
RequestPost(path: "fans/like", parma: params) { data in
if(self.attentionBtn.isSelected){
HUDTool.show(with: "关注成功")
}else{
HUDTool.show(with: "取消关注成功")
}
} fail: { code, data in
}
}
@objc func refreshBtnAction(){
if let _refreshBlcok = refreshBlcok{
_refreshBlcok()
}
makeRotationAnim(view: refreshBtn)
}
func makeRotationAnim(view: UIView) {
// 1.
let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
// 2.
rotationAnim.fromValue = 0 //
rotationAnim.toValue = Double.pi * 2 //
rotationAnim.repeatCount = 2 //
rotationAnim.duration = 0.5
rotationAnim.autoreverses = false // ,NO
rotationAnim.isRemovedOnCompletion = true //truefalse
view.layer.add(rotationAnim, forKey: nil) // view
}
@objc func clickImageViewAction(sender:UITapGestureRecognizer){
self.isStop = true
self.vapView.transform = CGAffineTransformIdentity
let j = (sender.view?.tag ?? 100) - 100
self.chooseModel = self.dataList[j]
if let _chooseModel = self.chooseModel{
self.sexImageVeiw.image = _chooseModel.gender == 1 ? UIImage(named: "yin_plane_star_man") : UIImage(named: "yin_plane_star__woman")
self.nameLabelView.text = _chooseModel.nick
self.attentionBtn.isSelected = _chooseModel.hasLike
self.signatureView.text = _chooseModel.userDesc
}
if let startPoint = sender.view?.frame.origin{
let movePoint = ceterPoint!
let start = getAngle(point: startPoint)
let move = getAngle(point: movePoint)
if getLocation(startPoint) == 1 || getLocation(startPoint) == 4{
angle = angle + move - start
}else{
angle = angle + start - move + Double.pi
}
UIView.animate(withDuration: 0.4) {
self.setClickViewLayout()
}completion: { isCompletion in
self.setCliickViewAnimationCompletionLayout(view: sender.view as! UIImageView)
}
}
}
func setCliickViewAnimationCompletionLayout(view:UIImageView){
imageView.image = view.image
imageView.isHidden = false
refreshBtn.isHidden = true
let scale = ScreenWidth / 375 * 170
imageView.layer.borderColor = view.layer.borderColor
imageView.frame = CGRect(x: round(scale) + 44 , y: ScreenHeight/2 - 85+44, width: 52, height: 52)
imageView.layer.cornerRadius = 52/2
bgImageView.isHidden = false
imageView.isHidden = false
vapView.videoItem = nil
radius = 280
let scale1 = ScreenWidth / 375 * 115
UIView.animate(withDuration: 0.4) {
self.vapView.frame = CGRect(x: -200, y: ScreenHeight/2 - 480 / 2 - 60, width: 480, height: 480)
for imageVeiw in self.clickViewList {
imageVeiw.frame = CGRect(x: 0, y: 0, width: 52, height: 52)
imageVeiw.layer.cornerRadius = 52/2
}
self.setClickViewLayout()
self.imageView.frame = CGRect(x: round(scale) , y: ScreenHeight/2 - 85, width: 140, height: 140)
self.imageView.layer.cornerRadius = 140/2
self.bgImageView.frame = CGRect(x: round(scale1) , y: ScreenHeight/2 - 140 , width: 385, height: 254)
}completion: { isCompletion in
self.bgUserInfoView.isHidden = false
}
}
@objc func clickBackBtnAction(){
bgUserInfoView.isHidden = true
imageView.isHidden = true
radius = 224
UIView.animate(withDuration: 0.4) {
self.vapView.frame = CGRect(x: -185, y: ScreenHeight/2 - 429 / 2 - 60, width: 429, height: 429)
for imageVeiw in self.clickViewList {
imageVeiw.frame = CGRect(x: 0, y: 0, width: 62, height:62)
imageVeiw.layer.cornerRadius = 62/2
}
self.setClickViewLayout()
self.bgImageView.frame = CGRect(x: ScreenWidth , y: ScreenHeight/2 - 140 , width: 385, height: 254)
}completion: { isCompletion in
self.refreshBtn.isHidden = false
self.parser.parse(withNamed: "StarIcon", in: Bundle.main) {[weak self] videoItem in
self?.vapView.videoItem = videoItem
self?.vapView.loops = 100000;
self?.vapView.startAnimation()
} failureBlock: { error in
}
self.isStop = false
}
}
func setClickViewLayout(){
for (i,clickView) in clickViewList.enumerated() {
let j = CGFloat(i)
let width = clickView.frame.width
let y = radius + sin((j/12) * Double.pi*2 + angle) * (429/2 - width/2 - 20)
let x = radius + cos((j/12) * Double.pi*2 + angle) * (429/2 - width/2 - 20)
clickView.center = CGPoint(x: x, y: y)
if (ceterPoint == nil && i == 0){
ceterPoint = CGPoint(x: x, y: y)
}
}
}
func getAngle(point:CGPoint) -> Double{
let x = point.x - radius
let y = point.y - radius
let h = hypot(x, y)
let v:Double = y / h
return asin(v)
}
func getLocation(_ point:CGPoint) -> Int{
let x = Int(point.x - radius)
let y = Int(point.y - radius)
if (x >= 0){
return y >= 0 ? 1 : 4
}
return y >= 0 ? 2 : 3
}
func getAngleValue() -> Double{
let num:Double = 12.0
let value:Double = 2 * Double.pi / num
let remainder:Double = fmod(angle, value)
if(angle > 0 || angle == 0){
if fabs(remainder) > value / 2 {
angle = angle - fabs(remainder)
angle = angle + value
}else{
angle = angle - fabs(remainder)
}
}else{
if fabs(remainder) > value / 2{
angle = angle + fabs(remainder)
angle = angle - value
}else{
angle = angle + fabs(remainder)
}
}
return angle
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var ceterPoint:CGPoint?
var clickViewList:[UIImageView] = []
var clickWidth:CGFloat = 62
var clickHeight:CGFloat = 62
var radius:CGFloat = 224
var angle:Double = 0
var chooseModel:PlanetStarModel?
var dataList:[PlanetStarModel] = [] {
didSet{
for (i,model) in dataList.enumerated(){
if(i < clickViewList.count){
let clickView = clickViewList[i]
Nuke.loadImage(with: model.avatar, into: clickView)
clickView.layer.borderColor = model.gender == 2 ? ThemeColor(hexStr: "#D667FF").cgColor : ThemeColor(hexStr: "#57CDFF").cgColor
}
}
}
}
var backBtn:UIButton = {
let _backBtn = UIButton()
_backBtn.setImage(UIImage(named: "yin_plane_star_back"), for: .normal)
_backBtn.addTarget(self, action: #selector(clickBackBtnAction), for: .touchUpInside)
return _backBtn
}()
private lazy var vapView:SVGAImageView = {
let _vapView = SVGAImageView()
_vapView.contentMode = .scaleAspectFill
return _vapView
}()
private lazy var parser:SVGAParser = {
let _parser = SVGAParser()
return _parser
}()
private lazy var giftView:SVGAImageView = {
let _giftView = SVGAImageView()
_giftView.contentMode = .scaleAspectFill
return _giftView
}()
private lazy var giftParser:SVGAParser = {
let _giftParser = SVGAParser()
return _giftParser
}()
var imageView:UIImageView = {
let _imageView = UIImageView(frame: CGRect(x: 0, y: 0, width:52, height: 52))
_imageView.layer.cornerRadius = 52/2
_imageView.layer.borderWidth = 1;
_imageView.layer.masksToBounds = true
return _imageView
}()
var bgImageView:UIImageView = {
let _bgImageView = UIImageView()
_bgImageView.image = UIImage(named: "yin_plane_star_water_drop_bg")
_bgImageView.isUserInteractionEnabled = true
return _bgImageView
}()
var refreshBtn:UIButton = {
let _refreshBtn = UIButton()
_refreshBtn.setImage(UIImage(named: "yin_plane_star_refresh"), for: .normal)
_refreshBtn.addTarget(self, action: #selector(refreshBtnAction), for: .touchUpInside)
return _refreshBtn
}()
var nameLabelView:UILabel = {
let _nameLabelView = UILabel()
_nameLabelView.text = ""
_nameLabelView.font = UIFont.systemFont(ofSize: 20, weight: .medium)
_nameLabelView.textColor = .white
return _nameLabelView
}()
var sexImageVeiw:UIImageView = {
let _sexImageVeiw = UIImageView()
return _sexImageVeiw
}()
var attentionBtn:UIButton = {
let _attentionBtn = UIButton()
_attentionBtn.setBackgroundImage(UIImage(named: "yin_plane_star_attention_bg"), for: .normal)
_attentionBtn.setImage(UIImage(named: "yin_plane_star_no_attention_icon"), for: .normal)
_attentionBtn.setImage(UIImage(named: "yin_plane_star_attention_icon"), for: .selected)
_attentionBtn.addTarget(self, action: #selector(attentionBtnAction), for: .touchUpInside)
return _attentionBtn
}()
var chatBtn:UIButton = {
let _chatBtn = UIButton()
_chatBtn.setBackgroundImage(UIImage(named: "yin_plane_star_attention_bg"), for: .normal)
_chatBtn.setImage(UIImage(named: "yin_plane_star_chat_icon"), for: .normal)
return _chatBtn
}()
var bgSignatureView:UIImageView = {
let _bgSignatureView = UIImageView()
_bgSignatureView.image = UIImage(named: "yin_plane_star_signature_bg")
return _bgSignatureView
}()
var signatureView:UILabel = {
let _signatureView = UILabel()
_signatureView.font = UIFont.systemFont(ofSize: 11, weight: .regular)
_signatureView.textColor = ThemeColor(hexStr: "#ECEBF0")
_signatureView.text = ""
_signatureView.numberOfLines = 0
return _signatureView
}()
var bgUserInfoView:UIView = {
let _bgUserInfoView = UIView()
return _bgUserInfoView
}()
var timer:Timer?
var isStop:Bool = false
var refreshBlcok:RefreshBlcok?
}

View File

@@ -0,0 +1,21 @@
//
// PlanetStarModel.swift
// yinmeng-ios
//
// Created by duoban on 2024/2/27.
//
import Foundation
import HandyJSON
struct PlanetStarModel: HandyJSON, Codable {
var uid:Int = 0
var avatar:String? = ""
var gender:Int = 1
var userDesc:String = ""
var hasLike:Bool = false
var giftName:String = ""
var hallId:String = ""
var nick:String = ""
var goldPrice:String = "0"
}

View File

@@ -7,23 +7,98 @@
import UIKit
class PlanetStarVC: BaseViewController {
class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
var page:Int = 1
override func viewDidLoad() {
super.viewDidLoad()
yin_initUI()
requestData()
view.backgroundColor = .yellow
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
func requestData(){
RequestGet(path: "home/recommendUsers", parma: ["pageNum":"\(self.page)","pageSize":"30"]) { data in
if let list = Deserialized<PlanetStarModel>.toArray(with: data) {
var dataList:[PlanetStarModel] = []
guard list.isEmpty else {
for i in 0..<12 {
if i < list.count{
dataList.append(list[i])
}
}
self.dataArray = dataList
self.dealWithViewData()
return
}
self.page = 1
}
} fail: { code, data in
}
RequestGet(path: "special/gift/get", parma: ["pageNum":"\(self.page)","pageSize":"30"]) { data in
if let model = Deserialized<PlanetStarModel>.toModel(with: data) {
self.giftModel = model
}
} fail: { code, data in
}
}
*/
func dealWithViewData(){
self.bgRadiusView.dataList = dataArray
}
private func yin_initUI(){
view.addSubview(backgroundView)
view.addSubview(bgRadiusView)
bgRadiusView.frame = self.view.frame
backgroundView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
bgRadiusView.refreshBlcok = {[weak self] in
self?.page = (self?.page ?? 1) + 1
self?.requestData()
}
}
var giftModel:PlanetStarModel?
private lazy var backgroundView:UIImageView = {
let _backgroundView = UIImageView()
_backgroundView.image = UIImage(named: "yin_plane_star_bg")
_backgroundView.isUserInteractionEnabled = true
return _backgroundView
}()
private var bgRadiusView:PlanetStarClickItemView = {
let _bgRadiusView = PlanetStarClickItemView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth , height: ScreenHeight))
_bgRadiusView.isUserInteractionEnabled = true
return _bgRadiusView
}()
private var dataArray:[PlanetStarModel] = []
}

BIN
yinmeng-ios/StarGift.svga Normal file

Binary file not shown.

BIN
yinmeng-ios/StarIcon.svga Normal file

Binary file not shown.