代码结构整理
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import {_decorator, Component, math, Node, Sprite} from 'cc';
|
||||
import {Config18x, PicInfo} from "db://assets/Scripts/Main/Config/Config18x";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import PicType = Config18x.PicType;
|
||||
import ImageState = Config18x.ImageState;
|
||||
import {ViewManager} from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import {GButton} from "db://assets/Scripts/Main/Common/GButton";
|
||||
import {GirlDetailPanel} from "./GirlDetailPanel";
|
||||
|
||||
const {ccclass, property} = _decorator;
|
||||
|
||||
@ccclass('DetailImageItem')
|
||||
export class DetailImageItem extends Component {
|
||||
@property(Sprite)
|
||||
img: Sprite;
|
||||
|
||||
@property(Node)
|
||||
lock: Node;
|
||||
@property(Node)
|
||||
question: Node;
|
||||
|
||||
base:GirlDetailPanel;
|
||||
url:string;
|
||||
|
||||
onLoad()
|
||||
{
|
||||
GButton.BandClick(this.node,this.onClickThis,this);
|
||||
}
|
||||
|
||||
onClickThis()
|
||||
{
|
||||
let data = {url:this.url,closeFunc:()=>{
|
||||
this.base.setVideEnable(true);
|
||||
|
||||
}
|
||||
}
|
||||
if(this.url){
|
||||
ViewManager.I.openBundlesView('ShowPanel',data);
|
||||
this.base.setVideEnable(false);
|
||||
}
|
||||
}
|
||||
refresh(info: PicInfo,base:GirlDetailPanel) {
|
||||
this.base = base;
|
||||
this.lock.active = info.imageState === ImageState.Lock;
|
||||
this.question.active = info.imageState === ImageState.UnKnown
|
||||
|
||||
if (info.picType == PicType.LocalImage) {
|
||||
this.url = info.url;
|
||||
if (info.imageState !== ImageState.Release) {
|
||||
this.url += '_blured';
|
||||
if (info.imageState === ImageState.Lock)
|
||||
this.img.color = new math.Color(127, 127, 127, 255);
|
||||
else
|
||||
this.img.color = new math.Color(50, 50, 50, 255);
|
||||
|
||||
} else {
|
||||
this.img.color = new math.Color(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
ResManager.I.changeBundleSpriteFrame(this.img, this.url, "Chat18x");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user