init
|
After Width: | Height: | Size: 387 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "c99a49fb-b6c2-4a51-8678-3ca156d64e4c",
|
||||
"files": [
|
||||
".jpg",
|
||||
".json"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "c99a49fb-b6c2-4a51-8678-3ca156d64e4c@6c48a",
|
||||
"displayName": "kukla_3_cg",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "c99a49fb-b6c2-4a51-8678-3ca156d64e4c",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "c99a49fb-b6c2-4a51-8678-3ca156d64e4c@f9941",
|
||||
"displayName": "kukla_3_cg",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 996,
|
||||
"height": 1280,
|
||||
"rawWidth": 996,
|
||||
"rawHeight": 1280,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-498,
|
||||
-640,
|
||||
0,
|
||||
498,
|
||||
-640,
|
||||
0,
|
||||
-498,
|
||||
640,
|
||||
0,
|
||||
498,
|
||||
640,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
1280,
|
||||
996,
|
||||
1280,
|
||||
0,
|
||||
0,
|
||||
996,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-498,
|
||||
-640,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
498,
|
||||
640,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "c99a49fb-b6c2-4a51-8678-3ca156d64e4c@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": false,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "c99a49fb-b6c2-4a51-8678-3ca156d64e4c@6c48a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "ef69a3fa-89bb-485f-9642-3e9593cb386e",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "ef69a3fa-89bb-485f-9642-3e9593cb386e@6c48a",
|
||||
"displayName": "shuqing_disgust",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "ef69a3fa-89bb-485f-9642-3e9593cb386e",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "ef69a3fa-89bb-485f-9642-3e9593cb386e@f9941",
|
||||
"displayName": "shuqing_disgust",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "none",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 925,
|
||||
"height": 1189,
|
||||
"rawWidth": 925,
|
||||
"rawHeight": 1189,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-462.5,
|
||||
-594.5,
|
||||
0,
|
||||
462.5,
|
||||
-594.5,
|
||||
0,
|
||||
-462.5,
|
||||
594.5,
|
||||
0,
|
||||
462.5,
|
||||
594.5,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
1189,
|
||||
925,
|
||||
1189,
|
||||
0,
|
||||
0,
|
||||
925,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-462.5,
|
||||
-594.5,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
462.5,
|
||||
594.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "ef69a3fa-89bb-485f-9642-3e9593cb386e@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "ef69a3fa-89bb-485f-9642-3e9593cb386e@6c48a"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 767 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "85135ace-1558-4859-91d7-d68373493572",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "85135ace-1558-4859-91d7-d68373493572@6c48a",
|
||||
"displayName": "bd_6",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "85135ace-1558-4859-91d7-d68373493572",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "85135ace-1558-4859-91d7-d68373493572@f9941",
|
||||
"displayName": "bd_6",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 51,
|
||||
"height": 51,
|
||||
"rawWidth": 51,
|
||||
"rawHeight": 51,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-25.5,
|
||||
-25.5,
|
||||
0,
|
||||
25.5,
|
||||
-25.5,
|
||||
0,
|
||||
-25.5,
|
||||
25.5,
|
||||
0,
|
||||
25.5,
|
||||
25.5,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
51,
|
||||
51,
|
||||
51,
|
||||
0,
|
||||
0,
|
||||
51,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-25.5,
|
||||
-25.5,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
25.5,
|
||||
25.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "85135ace-1558-4859-91d7-d68373493572@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "85135ace-1558-4859-91d7-d68373493572@6c48a"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 149 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "7340e767-b956-4227-afd9-0da45401b75d",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "7340e767-b956-4227-afd9-0da45401b75d@6c48a",
|
||||
"displayName": "amy_avatar",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "7340e767-b956-4227-afd9-0da45401b75d",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "7340e767-b956-4227-afd9-0da45401b75d@f9941",
|
||||
"displayName": "amy_avatar",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 80,
|
||||
"height": 80,
|
||||
"rawWidth": 80,
|
||||
"rawHeight": 80,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-40,
|
||||
-40,
|
||||
0,
|
||||
40,
|
||||
-40,
|
||||
0,
|
||||
-40,
|
||||
40,
|
||||
0,
|
||||
40,
|
||||
40,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
80,
|
||||
80,
|
||||
80,
|
||||
0,
|
||||
0,
|
||||
80,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-40,
|
||||
-40,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
40,
|
||||
40,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "7340e767-b956-4227-afd9-0da45401b75d@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "7340e767-b956-4227-afd9-0da45401b75d@6c48a"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 865 KiB |
@@ -0,0 +1,363 @@
|
||||
import { _decorator, instantiate, Label, Layout, Node, Prefab, RichText, ScrollView, Sprite, tween, UIOpacity, UITransform, Vec3 } from 'cc';
|
||||
import { GButton } from '../../Main/Common/GButton';
|
||||
import Utils from '../../Main/Common/Utils';
|
||||
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
|
||||
import li_BaseView from '../../Main/Common/li_BaseView';
|
||||
import GameManager from '../../Main/Manager/GameManager';
|
||||
import ResManager from '../../Main/Manager/ResManager';
|
||||
import { SDKManager } from '../../Main/Channel/SDKManager';
|
||||
import { ViewManager } from '../../Main/Manager/ViewManager';
|
||||
import { E_AD_TARGET } from './TalkAdDialog';
|
||||
import SubManager from '../SubManager';
|
||||
import HttpUnit from '../../Main/Common/HttpUnit';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//聊天记录界面
|
||||
@ccclass('Record_UI')
|
||||
export class Record_UI extends li_BaseView {
|
||||
|
||||
@property(Prefab)
|
||||
private talkDescItem: Prefab = null;
|
||||
@property(Prefab)
|
||||
private talkNpcItem: Prefab = null;
|
||||
@property(Prefab)
|
||||
private talkUserItem: Prefab = null;
|
||||
|
||||
private _nodeTab: any = {};
|
||||
private talkSV: ScrollView = null;
|
||||
private _data;
|
||||
|
||||
private itemNodeList: any[] = [];
|
||||
private itemDataList: any[] = [];
|
||||
|
||||
//----重写父类接口---------------------------------------
|
||||
onLoadCT() {
|
||||
this.registerListenner();
|
||||
Utils.parseNode(this.node, this._nodeTab)
|
||||
this.talkSV = this._nodeTab.talkSV.getComponent(ScrollView);
|
||||
}
|
||||
openUIDataCT(data: any): void {
|
||||
this._data = data
|
||||
}
|
||||
|
||||
|
||||
registerListenner() {
|
||||
// Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
GButton.BandClick(this._nodeTab.btnBack, ()=>{
|
||||
this.onClose();
|
||||
}, this);
|
||||
|
||||
//撤回按钮
|
||||
GButton.BandClick(this._nodeTab.chehuiNode, ()=>{
|
||||
let cellLen = this.itemDataList.length
|
||||
if (cellLen <= 1) {
|
||||
SubManager.ShowPrompt("没有可以撤回的对话")
|
||||
return
|
||||
}
|
||||
|
||||
let contStr = ""
|
||||
let levelData = GameManager.CurLevelData
|
||||
if (!levelData || levelData.can_use_cancel_cnt <= 0) {
|
||||
contStr = "关卡内撤回次数已用完"
|
||||
} else {
|
||||
contStr = `撤回最近 1 次对话,并返还 1 次对话次数,剩余 ${levelData.can_use_cancel_cnt} 次`
|
||||
}
|
||||
ViewManager.I.openBundlesView("UI/StartUI/TalkAdDialog", {
|
||||
type: E_AD_TARGET.chehui, //撤回,并加聊天次数
|
||||
content: contStr,
|
||||
adCallback: (isfree: any) => {
|
||||
if (isfree) {
|
||||
this.doChehuiTalk()
|
||||
} else {
|
||||
SDKManager.show_reward_video_ad(this.node.uuid, 1)
|
||||
}
|
||||
},
|
||||
shareCallback: ()=>{
|
||||
SDKManager.show_reward_share(this.node.uuid, 1)
|
||||
}
|
||||
})
|
||||
}, this);
|
||||
|
||||
SDKManager.register_video_reward(this.node.uuid, (tag:number)=>{
|
||||
console.log("视频广告回调", tag)
|
||||
if (tag == 1) {
|
||||
// 撤回聊天
|
||||
this.doChehuiTalk()
|
||||
}
|
||||
})
|
||||
SDKManager.register_share_reward(this.node.uuid, (tag:number)=>{
|
||||
console.log("分享回调", tag)
|
||||
if (tag == 1) {
|
||||
// 撤回聊天
|
||||
this.doChehuiTalk()
|
||||
}
|
||||
})
|
||||
|
||||
let lvCfg = GameManager.getLevelCfg(GameManager.CurLevelId)
|
||||
//npc名字
|
||||
Utils.setString(this._nodeTab.npcName, lvCfg.name)
|
||||
|
||||
//介绍
|
||||
let descClone:any = instantiate(this.talkDescItem)
|
||||
this._nodeTab.talkLay.addChild(descClone);
|
||||
Utils.parseNode(descClone);
|
||||
Utils.setString(descClone.labDesc, lvCfg.tips)
|
||||
let descOpa:UIOpacity = descClone.getComponent(UIOpacity)
|
||||
descOpa.opacity = 0
|
||||
tween(descOpa).to(0.2, {opacity: 255}).start()
|
||||
|
||||
//聊天列表
|
||||
this.itemNodeList = []
|
||||
this.itemDataList = []
|
||||
let talkLay: Layout = this.talkSV.content.getComponent(Layout)
|
||||
let talkCellLen = GameManager.TalkRecordList.length
|
||||
let aniTime = 0 //滚动动作总时间
|
||||
talkLay.enabled = false;
|
||||
for (let i=0; i<talkCellLen; i++) {
|
||||
// for (let i=talkCellLen-1; i>=0; i--) {
|
||||
let info = GameManager.TalkRecordList[i];
|
||||
let titem = info.isMe ? this.talkUserItem : this.talkNpcItem;
|
||||
let itemClone:any = instantiate(titem);
|
||||
this._nodeTab.talkLay.addChild(itemClone);
|
||||
|
||||
Utils.parseNode(itemClone);
|
||||
this.itemNodeList.push(itemClone);
|
||||
this.itemDataList.push(info);
|
||||
|
||||
let labpx = info.isMe ? -15 : 15;
|
||||
itemClone.zw1.position = new Vec3(0, 0, 0)
|
||||
itemClone.zw2.position = new Vec3(0, 0, 0)
|
||||
itemClone.labTalk1.position = new Vec3(labpx, 0, 0)
|
||||
itemClone.labTalk2.position = new Vec3(labpx, 0, 0)
|
||||
itemClone.zw1.active = false
|
||||
itemClone.zw2.active = false
|
||||
itemClone.labTalk1.active = false
|
||||
itemClone.labTalk2.active = false
|
||||
|
||||
//头像
|
||||
let spt = itemClone.headIcon.getComponent(Sprite)
|
||||
if (info.isMe) {
|
||||
let avatarUrl = SDKManager.avatarUrl;
|
||||
if (avatarUrl == "" || avatarUrl == null) {
|
||||
SDKManager.getUserInfo((data) => {
|
||||
ResManager.I.changeRemoteSpriteFrame(spt, data.avatarUrl)
|
||||
})
|
||||
} else {
|
||||
ResManager.I.changeRemoteSpriteFrame(spt, avatarUrl)
|
||||
}
|
||||
} else {
|
||||
let headPath = `head/${lvCfg.characterAvatar}`
|
||||
ResManager.I.changeBundleSpriteFrame(spt.getComponent(Sprite), headPath, "Raw")
|
||||
}
|
||||
|
||||
//对话文本前后有各有一个占位节点
|
||||
let zw1 = instantiate(itemClone.zw1)
|
||||
zw1.active = true
|
||||
itemClone.kuang.addChild(zw1)
|
||||
//对话文本 括号中间的文字用斜体
|
||||
let kidx = 0
|
||||
let clab
|
||||
for(let i=0; i<10; i++) {
|
||||
let kl = info.talk.indexOf("(", kidx) //左括号
|
||||
if (kl == -1) {
|
||||
if (kidx < info.talk.length) {
|
||||
clab = instantiate(itemClone.labTalk2)
|
||||
clab.active = true
|
||||
itemClone.kuang.addChild(clab)
|
||||
Utils.setString(clab, info.talk.substring(kidx, info.talk.length))
|
||||
kidx = info.talk.length
|
||||
}
|
||||
} else {
|
||||
let kr = info.talk.indexOf(")", kl) //右括号
|
||||
if (kr != -1) {
|
||||
//匹配到括号
|
||||
if (kidx < kl) {
|
||||
clab = instantiate(itemClone.labTalk2)
|
||||
clab.active = true
|
||||
itemClone.kuang.addChild(clab)
|
||||
Utils.setString(clab, info.talk.substring(kidx, kl))
|
||||
}
|
||||
clab = instantiate(itemClone.labTalk1)
|
||||
clab.active = true
|
||||
itemClone.kuang.addChild(clab)
|
||||
Utils.setString(clab, info.talk.substring(kl+1, kr))
|
||||
kidx = kr + 1
|
||||
} else {
|
||||
if (kidx < info.talk.length) {
|
||||
clab = instantiate(itemClone.labTalk2)
|
||||
clab.active = true
|
||||
itemClone.kuang.addChild(clab)
|
||||
Utils.setString(clab, info.talk.substring(kidx, info.talk.length))
|
||||
kidx = info.talk.length
|
||||
}
|
||||
}
|
||||
}
|
||||
if (kidx >= info.talk.length) {
|
||||
break
|
||||
}
|
||||
}
|
||||
let zw2 = instantiate(itemClone.zw1)
|
||||
zw2.active = true
|
||||
itemClone.kuang.addChild(zw2)
|
||||
//基础得分
|
||||
let scoreBase = info.scoreBase || -1;
|
||||
if (info.isMe || scoreBase < 0) {
|
||||
itemClone.labScore.active = false;
|
||||
} else {
|
||||
itemClone.labScore.active = true;
|
||||
Utils.setString(itemClone.labScore, `得分:${scoreBase}`)
|
||||
}
|
||||
//额外加分
|
||||
let scoreAdditional = info.scoreAdditional || 0;
|
||||
if (info.isMe || scoreAdditional <= 0) {
|
||||
itemClone.labScoreAdd.active = false;
|
||||
} else {
|
||||
itemClone.labScoreAdd.active = true;
|
||||
Utils.setString(itemClone.labScoreAdd, `加分:${scoreAdditional}`)
|
||||
}
|
||||
|
||||
//动作
|
||||
let kuangOpa:UIOpacity = itemClone.kuang.getComponent(UIOpacity)
|
||||
kuangOpa.opacity = 1;
|
||||
// let didx = talkCellLen-1-i;
|
||||
let didx = i;
|
||||
let tdelay = didx * 0.03;
|
||||
let self = this;
|
||||
if (i == talkCellLen-1) {
|
||||
aniTime = 0.2 + tdelay;
|
||||
}
|
||||
tween(kuangOpa)
|
||||
.delay(0.2 + tdelay)
|
||||
.call(()=>{
|
||||
//滚动到当前节点处
|
||||
self.talkSV.scrollToPercentVertical((talkCellLen-1-i) / talkCellLen, 0.1);
|
||||
//调整框宽度
|
||||
let widthmax = 0;
|
||||
itemClone.kuang.children.forEach((item)=>{
|
||||
let tf = item.getComponent(UITransform);
|
||||
if (tf && tf.width > widthmax) {
|
||||
widthmax = tf.width;
|
||||
}
|
||||
})
|
||||
let kuangTf:UITransform = itemClone.kuang.getComponent(UITransform);
|
||||
kuangTf.width = widthmax + 30;
|
||||
})
|
||||
.to(0.2, { opacity: 255 })
|
||||
.start();
|
||||
}
|
||||
|
||||
//延迟一下,设置文本换行模式
|
||||
this.scheduleOnce(()=>{
|
||||
for (let i=0; i<this.itemNodeList.length; i++) {
|
||||
let item = this.itemNodeList[i];
|
||||
item.kuang.children.forEach((child)=>{
|
||||
let lab = child.getComponent(Label);
|
||||
if (lab) {
|
||||
let labTf:UITransform = child.getComponent(UITransform);
|
||||
if (labTf.height < 50) { //小于50,说明没换行,改为自动宽度
|
||||
lab.overflow = Label.Overflow.NONE;
|
||||
} else {
|
||||
lab.overflow = Label.Overflow.RESIZE_HEIGHT;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}, 0.1)
|
||||
//延迟一下,都设置成一样宽,是右侧的文本左对齐
|
||||
this.scheduleOnce(()=>{
|
||||
for (let i=0; i<this.itemNodeList.length; i++) {
|
||||
let item = this.itemNodeList[i];
|
||||
|
||||
let widthmax = 0;
|
||||
item.kuang.children.forEach((item)=>{
|
||||
let tf = item.getComponent(UITransform);
|
||||
if (tf && tf.width > widthmax) {
|
||||
widthmax = tf.width;
|
||||
}
|
||||
})
|
||||
|
||||
item.kuang.children.forEach((child)=>{
|
||||
let lab = child.getComponent(Label);
|
||||
if (lab) {
|
||||
let labTf:UITransform = child.getComponent(UITransform);
|
||||
lab.overflow = Label.Overflow.RESIZE_HEIGHT;
|
||||
labTf.width = widthmax;
|
||||
// if (labTf.height < 50) { //小于50,说明没换行,改为自动宽度
|
||||
// lab.overflow = Label.Overflow.NONE;
|
||||
// } else {
|
||||
// lab.overflow = Label.Overflow.RESIZE_HEIGHT;
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
}, 0.12)
|
||||
|
||||
//延迟一下,调整文本框的宽度。高度由layout自动调整
|
||||
this.scheduleOnce(()=>{
|
||||
talkLay.enabled = true;
|
||||
}, 0.15)
|
||||
|
||||
//撤回按钮显示动画
|
||||
let chehuiOpa: UIOpacity = this._nodeTab.chehuiNode.getComponent(UIOpacity);
|
||||
chehuiOpa.opacity = 0;
|
||||
tween(chehuiOpa)
|
||||
.delay(aniTime)
|
||||
.to(0.2, {opacity: 255})
|
||||
.start();
|
||||
|
||||
//刷新撤回次数
|
||||
this.refreshChehuiCount()
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**刷新撤回次数 */
|
||||
refreshChehuiCount() {
|
||||
let levelData = GameManager.CurLevelData
|
||||
let n_cur = levelData.can_use_cancel_cnt || 0
|
||||
let n_max = 3
|
||||
Utils.setString(this._nodeTab.labChehui, n_cur + "/" + n_max)
|
||||
}
|
||||
|
||||
|
||||
/**撤回上一轮发言 */
|
||||
doChehuiTalk() {
|
||||
HttpUnit.ins.sendTalkChehui({record_id: GameManager.RecordId}, (data) => {
|
||||
if (data) {
|
||||
SubManager.ShowPrompt("撤回成功,已返还聊天次数")
|
||||
GameManager.CurLevelData = data.level
|
||||
GameManager.srouceCnt = data.level.current_cnt
|
||||
GameManager.RemoveLastRoundTalkRecord()
|
||||
GameManager.RemoveLastSetpScore()
|
||||
GameManager.removeLastNpcTalkData()
|
||||
Utils.sendInnerMsg(InnerMsgCode.Data_ChehuiUp, {})
|
||||
this.onClose()
|
||||
// this.refreshChehuiCount()
|
||||
// let cellLen = this.itemNodeList.length
|
||||
// if (cellLen > 1) {
|
||||
// for (let i=cellLen-1; i>=0; i--) {
|
||||
// let item: Node = this.itemNodeList[i]
|
||||
// let info = this.itemDataList[i]
|
||||
// item.removeFromParent()
|
||||
// this.itemNodeList.splice(i, 1)
|
||||
// this.itemDataList.splice(i, 1)
|
||||
// if (info && info.isMe) {
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// GameManager.RemoveLastRoundTalkRecord()
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 1018 KiB |
@@ -0,0 +1,97 @@
|
||||
import { _decorator, Node, Sprite, view } from 'cc';
|
||||
import { GButton } from '../../Main/Common/GButton';
|
||||
import Utils from '../../Main/Common/Utils';
|
||||
import li_BaseView from '../../Main/Common/li_BaseView';
|
||||
import HttpUnit from '../../Main/Common/HttpUnit';
|
||||
import SubManager from '../SubManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**广告、分享的用途类型 */
|
||||
export enum E_AD_TARGET {
|
||||
/**加相亲次数 */
|
||||
xiangqin = 1,
|
||||
/**加聊天次数 */
|
||||
liaotian = 2,
|
||||
}
|
||||
|
||||
//关卡内看广告弹窗界面
|
||||
@ccclass('TalkAdDialog')
|
||||
export class TalkAdDialog extends li_BaseView {
|
||||
|
||||
private _nodeTab: any = {};
|
||||
private _data;
|
||||
|
||||
//----重写父类接口---------------------------------------
|
||||
onLoadCT() {
|
||||
this.registerListenner();
|
||||
Utils.parseNode(this.node, this._nodeTab)
|
||||
|
||||
}
|
||||
openUIDataCT(data: any): void {
|
||||
this._data = data || {};
|
||||
}
|
||||
|
||||
|
||||
registerListenner() {
|
||||
// Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
GButton.BandClick(this._nodeTab.mask, ()=>{
|
||||
if (this._data.closeCallback) {
|
||||
this._data.closeCallback();
|
||||
}
|
||||
this.doClose();
|
||||
}, this, 0, null, null, false);
|
||||
|
||||
GButton.BandClick(this._nodeTab.btnClose, ()=>{
|
||||
if (this._data.closeCallback) {
|
||||
this._data.closeCallback();
|
||||
}
|
||||
this.doClose();
|
||||
}, this);
|
||||
|
||||
GButton.BandClick(this._nodeTab.btnShare, ()=>{
|
||||
if (this._data.type == E_AD_TARGET.liaotian && HttpUnit.GetTalkShareNum() <= 0) {
|
||||
SubManager.ShowPrompt("今日分享次数已用完");
|
||||
return;
|
||||
}
|
||||
if (this._data.type == E_AD_TARGET.xiangqin && HttpUnit.GetXiangqinShareNum() <= 0) {
|
||||
SubManager.ShowPrompt("今日分享次数已用完");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._data.shareCallback) {
|
||||
this._data.shareCallback();
|
||||
}
|
||||
this.doClose();
|
||||
}, this);
|
||||
|
||||
GButton.BandClick(this._nodeTab.btnAD, ()=>{
|
||||
if (this._data.type == E_AD_TARGET.liaotian && HttpUnit.GetTalkAdNum() <= 0) {
|
||||
SubManager.ShowPrompt("今日广告次数已用完");
|
||||
return;
|
||||
}
|
||||
if (this._data.type == E_AD_TARGET.xiangqin && HttpUnit.GetXiangqinAdNum() <= 0) {
|
||||
SubManager.ShowPrompt("今日广告次数已用完");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._data.adCallback) {
|
||||
this._data.adCallback();
|
||||
}
|
||||
this.doClose();
|
||||
}, this);
|
||||
|
||||
Utils.setString(this._nodeTab.labContent, this._data.content);
|
||||
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 61 KiB |
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.27",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "0b71b4a8-b879-4b62-946f-11f7c35e6afc",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "0b71b4a8-b879-4b62-946f-11f7c35e6afc@6c48a",
|
||||
"displayName": "blackmoon_nightgod_default",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"imageUuidOrDatabaseUri": "0b71b4a8-b879-4b62-946f-11f7c35e6afc",
|
||||
"isUuid": true,
|
||||
"visible": false,
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "0b71b4a8-b879-4b62-946f-11f7c35e6afc@f9941",
|
||||
"displayName": "blackmoon_nightgod_default",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": -44.5,
|
||||
"trimX": 0,
|
||||
"trimY": 89,
|
||||
"width": 925,
|
||||
"height": 1100,
|
||||
"rawWidth": 925,
|
||||
"rawHeight": 1189,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-462.5,
|
||||
-550,
|
||||
0,
|
||||
462.5,
|
||||
-550,
|
||||
0,
|
||||
-462.5,
|
||||
550,
|
||||
0,
|
||||
462.5,
|
||||
550,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
1100,
|
||||
925,
|
||||
1100,
|
||||
0,
|
||||
0,
|
||||
925,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0.9251471825063078,
|
||||
1,
|
||||
0.9251471825063078
|
||||
],
|
||||
"minPos": [
|
||||
-462.5,
|
||||
-550,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
462.5,
|
||||
550,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "0b71b4a8-b879-4b62-946f-11f7c35e6afc@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"type": "sprite-frame",
|
||||
"hasAlpha": true,
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "0b71b4a8-b879-4b62-946f-11f7c35e6afc@6c48a"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 8.7 KiB |
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "d5e82cb9-1725-4b1e-b9e9-5e8377251b7f",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
import { _decorator, instantiate, Node, PageView, Prefab, Sprite, tween, UITransform, Vec3, view } from 'cc';
|
||||
import { GButton } from '../../Main/Common/GButton';
|
||||
import Utils from '../../Main/Common/Utils';
|
||||
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
|
||||
import li_BaseView from '../../Main/Common/li_BaseView';
|
||||
import GameManager from '../../Main/Manager/GameManager';
|
||||
import ResManager from '../../Main/Manager/ResManager';
|
||||
import GameRootUI from '../../Main/Common/GameRootUI';
|
||||
import HttpUnit from '../../Main/Common/HttpUnit';
|
||||
import { ViewManager } from '../../Main/Manager/ViewManager';
|
||||
import { E_AD_TARGET } from './TalkAdDialog';
|
||||
import { SDKManager } from '../../Main/Channel/SDKManager';
|
||||
import SubManager from '../SubManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//图鉴奖励界面
|
||||
@ccclass('TujianReward_UI')
|
||||
export class TujianReward_UI extends li_BaseView {
|
||||
|
||||
@property(Prefab)
|
||||
private rewardPageItem: Prefab = null //角色页签节点
|
||||
private npcPageView: PageView = null //可领取角色页签容器
|
||||
|
||||
private _nodeTab: any = {};
|
||||
private _data;
|
||||
private rewardList: any[] = []; //可领取的奖励列表
|
||||
private targetPicId:number|null = null; //目标图片Id
|
||||
private isShowBigPic: boolean = false; //是否显示大图
|
||||
private autoClose: boolean = false; //是否自动关闭
|
||||
|
||||
/**缩放图片信息 */
|
||||
private bigPicInfo = {
|
||||
pageItem: null, //翻页item
|
||||
npcPic: null, //npc图片
|
||||
origScale: Vec3.ZERO, //原始缩放
|
||||
}
|
||||
|
||||
|
||||
//----重写父类接口---------------------------------------
|
||||
onLoadCT() {
|
||||
this.registerListenner();
|
||||
Utils.parseNode(this.node, this._nodeTab)
|
||||
|
||||
this.npcPageView = this._nodeTab.npcPageView.getComponent(PageView)
|
||||
}
|
||||
openUIDataCT(data: any): void {
|
||||
this._data = data
|
||||
}
|
||||
|
||||
|
||||
registerListenner() {
|
||||
Utils.addInnerEL(InnerMsgCode.Data_ZhencangUp, this, this.resiveZhencangUp)
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
GButton.BandClick(this._nodeTab.mask, ()=>{
|
||||
this.onClose();
|
||||
}, this, 0, null, null, false);
|
||||
|
||||
GButton.BandClick(this._nodeTab.btnCancel, ()=>{
|
||||
this.onClose();
|
||||
}, this);
|
||||
GButton.BandClick(this._nodeTab.btnAD, ()=>{
|
||||
ViewManager.I.openBundlesView("UI/StartUI/TalkAdDialog", {
|
||||
type: E_AD_TARGET.shoucangJiangli, //收藏奖励
|
||||
content: "每日可以免费领取 1 次奖励,更多奖励需要“观看广告”领取",
|
||||
adCallback: (isfree:any)=>{
|
||||
if (isfree){
|
||||
this.doGetReward()
|
||||
} else {
|
||||
SDKManager.show_reward_video_ad(this.node.uuid, 1)
|
||||
}
|
||||
},
|
||||
shareCallback: ()=>{
|
||||
SDKManager.show_reward_share(this.node.uuid, 1)
|
||||
}
|
||||
})
|
||||
}, this);
|
||||
GButton.BandClick(this._nodeTab.btnFree, ()=>{
|
||||
this.doGetReward();
|
||||
}, this);
|
||||
|
||||
|
||||
SDKManager.register_video_reward(this.node.uuid, (tag:number)=>{
|
||||
console.log("视频广告回调", tag)
|
||||
if (tag == 1) {
|
||||
// 加次数
|
||||
SubManager.ShowPrompt("观看视频成功")
|
||||
this.doGetReward()
|
||||
}
|
||||
})
|
||||
SDKManager.register_share_reward(this.node.uuid, (tag:number)=>{
|
||||
console.log("分享回调", tag)
|
||||
if (tag == 1) {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
this.scheduleOnce(()=>{
|
||||
this.refreshPageList()
|
||||
}, 0.1)
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
/**私家珍藏数据变化消息 */
|
||||
resiveZhencangUp(data:any) {
|
||||
this.refreshPageList()
|
||||
}
|
||||
|
||||
|
||||
/**刷新翻页容器 */
|
||||
refreshPageList() {
|
||||
let list = GameManager.zhencangCanget
|
||||
this._doRefreshWithData(list)
|
||||
}
|
||||
private _doRefreshWithData(data: any[]) {
|
||||
this.rewardList = data
|
||||
if (this.rewardList.length == 0) {
|
||||
if (this.isShowBigPic) {
|
||||
this.autoClose = true
|
||||
return
|
||||
}
|
||||
this.onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
let wsize = view.getVisibleSize()
|
||||
let tempNode = instantiate(this.rewardPageItem)
|
||||
let tntf = tempNode.getComponent(UITransform)
|
||||
tntf.setContentSize(wsize.width, tntf.height)
|
||||
|
||||
let targetPageIdx = -1
|
||||
this.npcPageView.removeAllPages()
|
||||
for (let i=0; i<this.rewardList.length; i++) {
|
||||
let pnode: any = instantiate(tempNode)
|
||||
this.npcPageView.addPage(pnode)
|
||||
Utils.parseNode(pnode)
|
||||
let rewarddata = this.rewardList[i]
|
||||
|
||||
//图片模糊
|
||||
let cgPic: Sprite = pnode.npcPic.getComponent(Sprite)
|
||||
ResManager.I.SetBlur(cgPic, true)
|
||||
|
||||
if (this.targetPicId && this.targetPicId == rewarddata.id) {
|
||||
targetPageIdx = i
|
||||
}
|
||||
|
||||
// GButton.RemoveAndBandClick(pnode.npcPic, ()=>{
|
||||
// this.changePicScale(pnode);
|
||||
// }, this, 0, null, null, false);
|
||||
}
|
||||
|
||||
//按钮状态
|
||||
let freecount = HttpUnit.GetZhencangFreeCount()
|
||||
let havefree = freecount > 0
|
||||
this._nodeTab.btnFree.active = havefree
|
||||
this._nodeTab.btnAD.active = !havefree
|
||||
|
||||
if (targetPageIdx >= 0) {
|
||||
this.scheduleOnce(()=>{
|
||||
this.npcPageView.scrollToPage(targetPageIdx, 0.5)
|
||||
}, 0)
|
||||
}
|
||||
this.targetPicId = null
|
||||
}
|
||||
// //翻页容器事件回调
|
||||
// guidePageViewEvent(param1, param2) {
|
||||
// let pageIdx = this.npcPageView.curPageIdx
|
||||
// this.changeLevel(pageIdx+1)
|
||||
// }
|
||||
|
||||
/**获取当前页奖励 */
|
||||
doGetReward() {
|
||||
let pageIdx = this.npcPageView.curPageIdx
|
||||
let data = this.rewardList[pageIdx]
|
||||
console.log("当前页奖励:", pageIdx, data)
|
||||
HttpUnit.ins.getZhencangReward({id: data.id}, (_data) => {
|
||||
if (_data) {
|
||||
let targetdata = this.rewardList[pageIdx+1]
|
||||
if (targetdata) {
|
||||
this.targetPicId = targetdata.id
|
||||
} else {
|
||||
targetdata = this.rewardList[pageIdx-1]
|
||||
if (targetdata) {
|
||||
this.targetPicId = targetdata.id
|
||||
}
|
||||
}
|
||||
|
||||
//放大图片
|
||||
this.isShowBigPic = true
|
||||
let pnode:any = this.npcPageView.getPages()[pageIdx]
|
||||
let npcPic = pnode.npcPic
|
||||
let wpos = new Vec3(0,0,0);
|
||||
npcPic.getWorldPosition(wpos);
|
||||
let BigPicRoot:Node = this._nodeTab.BigPicRoot;
|
||||
let npos = BigPicRoot.getComponent(UITransform).convertToNodeSpaceAR(wpos);
|
||||
let npcPicClone = instantiate(npcPic);
|
||||
npcPicClone.setParent(BigPicRoot);
|
||||
npcPicClone.setPosition(npos);
|
||||
ResManager.I.SetBlur(npcPicClone.getComponent(Sprite), false)
|
||||
|
||||
let ttime = 0.2;
|
||||
GameRootUI.DisableOper(ttime+0.1)
|
||||
let s = 1
|
||||
let windowSize = view.getVisibleSize(); // 获取窗口大小
|
||||
let picTf:UITransform = npcPicClone.getComponent(UITransform);
|
||||
if (picTf.height < windowSize.height) {
|
||||
s = windowSize.height / picTf.height;
|
||||
}
|
||||
tween((npcPicClone))
|
||||
.to(ttime, { scale: new Vec3(s, s, s), position: new Vec3(0, 0, 0) }, { easing: 'quadOut' })
|
||||
.call(() => {
|
||||
//刷新数据
|
||||
GameManager.refreshZhencangCanget()
|
||||
})
|
||||
.start();
|
||||
|
||||
GButton.RemoveAndBandClick(npcPicClone, ()=>{
|
||||
npcPicClone.destroy();
|
||||
this.isShowBigPic = false;
|
||||
if (this.autoClose) {
|
||||
this.onClose();
|
||||
}
|
||||
}, this, 0, null, null, false);
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//region 图片缩放逻辑
|
||||
changePicScale(item: any) {
|
||||
if (this.bigPicInfo.pageItem) {
|
||||
//缩小
|
||||
let npcPic = this.bigPicInfo.npcPic
|
||||
let wpos = new Vec3(0,0,0);
|
||||
this.bigPicInfo.pageItem.picRoot.getWorldPosition(wpos);
|
||||
let npos = this._nodeTab.BigPicRoot.getComponent(UITransform).convertToNodeSpaceAR(wpos);
|
||||
|
||||
let ttime = 0.3;
|
||||
GameRootUI.DisableOper(ttime+0.1)
|
||||
tween((npcPic))
|
||||
.to(ttime, { scale: this.bigPicInfo.origScale, position: npos }, { easing: 'quadOut' })
|
||||
.call(() => {
|
||||
npcPic.setParent(this.bigPicInfo.pageItem.picRoot);
|
||||
npcPic.setPosition(new Vec3(0,0,0));
|
||||
this.bigPicInfo.pageItem = null;
|
||||
this.bigPicInfo.npcPic = null;
|
||||
})
|
||||
.start();
|
||||
|
||||
} else {
|
||||
//放大
|
||||
let npcPic:Node = item.npcPic;
|
||||
this.bigPicInfo.pageItem = item;
|
||||
this.bigPicInfo.npcPic = npcPic;
|
||||
this.bigPicInfo.origScale = npcPic.scale.clone();
|
||||
|
||||
let wpos = new Vec3(0,0,0);
|
||||
npcPic.getWorldPosition(wpos);
|
||||
let BigPicRoot:Node = this._nodeTab.BigPicRoot;
|
||||
let npos = BigPicRoot.getComponent(UITransform).convertToNodeSpaceAR(wpos);
|
||||
npcPic.setParent(BigPicRoot);
|
||||
npcPic.setPosition(npos);
|
||||
|
||||
let ttime = 0.3;
|
||||
GameRootUI.DisableOper(ttime+0.1)
|
||||
//放大图片
|
||||
let s = 1
|
||||
let windowSize = view.getVisibleSize(); // 获取窗口大小
|
||||
let picTf:UITransform = npcPic.getComponent(UITransform);
|
||||
if (picTf.height < windowSize.height) {
|
||||
s = windowSize.height / picTf.height;
|
||||
}
|
||||
tween((npcPic))
|
||||
.to(ttime, { scale: new Vec3(s, s, s), position: new Vec3(0, 0, 0) }, { easing: 'quadOut' })
|
||||
.start();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||