12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //
- // IHCentralizedManager.swift
- // Inhealth
- //
- // Created by weclouds on 2019/12/14.
- // Copyright © 2019 weclouds. All rights reserved.
- //
- import UIKit
- class IHCentralizedManager: NSObject ,IHViewManagerProtocolDelegate{
-
- lazy var mainView: IHCentralizedView = {
- let mainView = Bundle.main.loadNibNamed("IHCentralizedView", owner: nil, options: nil)?.last as! IHCentralizedView
- mainView.delegate = self
- return mainView
- }()
-
-
- lazy var scenemodeView: IHSceneModeView = {
- let mainView = Bundle.main.loadNibNamed("IHSceneModeView", owner: nil, options: nil)?.last as! IHSceneModeView
- mainView.delegate = self
- return mainView
- }()
- // private var vc = UIViewController()
- private weak var vc : UIViewController?
-
- func bindController(_ vc: UIViewController) {
- self.vc = vc
- self.vc?.navigationBarTitle = "批量设置"
-
- createUI()
- let centralizedVC = self.vc as! IHCentralizedVCtr
-
- if centralizedVC.isSetSencenModel == true {
- mainView.removeFromSuperview()
- scenemodeView.roomId = centralizedVC.roomId
- createUI2()
- }else{
- scenemodeView.removeFromSuperview()
- mainView.floorList = centralizedVC.floorList
- createUI()
- }
- }
- func createUI2() {
- scenemodeView.frame = CGRect(x: 0, y: 0, width: KSCREENWIDTH, height: 812 - KNavBarHeight)
- let sc = UIScrollView(frame: self.vc!.view.bounds)
- sc.addSubview(mainView)
- sc.contentSize = CGSize(width: 0, height: 812)
- self.vc?.view.addSubview(sc)
- }
- func createUI() {
-
- mainView.frame = CGRect(x: 0, y: 0, width: KSCREENWIDTH, height: 812 - KNavBarHeight)
- let sc = UIScrollView(frame: self.vc!.view.bounds)
- sc.addSubview(mainView)
- sc.contentSize = CGSize(width: 0, height: 812)
- self.vc?.view.addSubview(sc)
- }
- }
- extension IHCentralizedManager : IHCentralizedViewDelegate ,IHSceneModeViewDelegate{
- func sceneModeViewSetting(roomId: String, light: String?, color: String?, colorR: String?, colorG: String?, colorB: String?, status: String?, level: String?) {
- if light != nil && color != nil && colorR != nil && colorG != nil && colorB != nil && status != nil && level != nil {
- IHCentrlizedService.share.setLampCmd(roomId, light: light!, color: color!, colorR: colorR!, colorG: colorG!, colorB: colorB!, status: status!, level: level!, requestSuccess: { (isSuccess) in
-
- }) {
-
- }
- }
- }
- func centralizeSetting(roomId: String, light: String, color: String, colorR: String, colorG: String, colorB: String, status: String, level: String) {
- IHCentrlizedService.share.setLampCmd(roomId, light: light, color: color, colorR: colorR, colorG: colorG, colorB: colorB, status: status, level: level, requestSuccess: { (isSuccess) in
-
- }) {
-
- }
- }
- }
|