Commit 5e402b67 authored by liujiangnan's avatar liujiangnan

feat: 根据级别变换颜色

parent f95973ad
This diff is collapsed.
......@@ -133,6 +133,33 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
}
drawLevelItemPic(pname) {
const _pname = pname.replace(/\s+/g, "");
const left = cc.find(`Canvas/MainScene/UnitView/UnitPageView/view/units_list/line_left`);
const right = cc.find(`Canvas/MainScene/UnitView/UnitPageView/view/units_list/line_right`);
for(let i=1; i<=8; i++) {
if (i % 2 == 1) {
const group = cc.find(`unit_group${i}`, left);
group.children.forEach(item => {
if (item.name == `bg_unit${i}` || item.name == `bg_${i}`) {
const sf = cc.find(`Canvas/res/${_pname}/${item.name}`).getComponent(cc.Sprite).spriteFrame;
item.getComponent(cc.Sprite).spriteFrame = sf;
}
});
} else {
const group = cc.find(`unit_group${i}`, right);
group.children.forEach(item => {
if (item.name == `bg_unit${i}` || item.name == `bg_${i}`) {
const sf = cc.find(`Canvas/res/${_pname}/${item.name}`).getComponent(cc.Sprite).spriteFrame;
item.getComponent(cc.Sprite).spriteFrame = sf;
}
});
}
}
}
moveUnitViewBackground() {
//获取滚动视图相对于左上角原点的当前滚动偏移
let scrollOffset: cc.Vec2 = this.UnitViewPager.getScrollOffset();
......@@ -174,6 +201,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
pname = pname.toLowerCase().trim();
}
}
// 根据不同级别渲染图片
this.drawLevelItemPic(pname);
const operationState = {
id: 'operation',
......@@ -249,13 +278,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
return result
}, []);
// rows = rows.filter(r => !r.has_courseware)
console.log('UnitView', list);
console.log('lessonsBtn.length', lessonsBtn.length);
lessonsBtn.forEach((b, idx) => {
const attr: Attributes = b.getComponent('Attributes');
const index = attr.attrMap['index'];
console.log('index', index);
const lesson = list[index];
const lock = cc.find('icon_key', b);
......@@ -271,10 +297,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
b.attr({ 'data_id': lesson.id });
b.attr({ 'data_pid': lesson.pid });
console.log("this.kidInfo: ", this.kidInfo);
console.log("===liu3===unlock_syllabuses==", this.kidInfo.unlock_syllabuses?.includes(lesson.id+""));
// console.log("===liu3===lesson.id==", lesson.id);
console.log("===liu3===index==", ((index-0) % 3 === 0));
if (index == 0 || ( this.kidInfo && this.kidInfo.unlock_syllabuses?.includes(lesson.id+"") && (index-0) % 3 === 0)) {
......@@ -294,8 +316,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
richText.font = cc.find("Canvas/res/font/BRLNSDB").getComponent(cc.Label).font;
console.log('idx: ', idx);
console.log("传入按钮名1:", name);
titleNode.getComponent(cc.RichText).string = `<outline align=top color=${outline}
width=4>${name}</outline>`;
......@@ -304,18 +324,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
titleNode.y = pos.y;
titleNode.parent = b;
console.log("显示按钮名1:", titleNode.getComponent(cc.RichText).string);
console.log('titleNode.x: ', titleNode.x);
console.log('titleNode.y: ', titleNode.y);
console.log('titleNode.active: ', titleNode.active);
console.log('titleNode.parent.x: ', titleNode.parent.x);
console.log('titleNode.parent.y: ', titleNode.parent.y);
console.log('titleNode.parent.active: ', titleNode.parent.active);
// delayCall(1, () => {
// console.log('idx: ', idx);
......
......@@ -143,6 +143,11 @@ export function getSpriteFrimeByUrl(url, cb) {
})
}
export function getSpriteFrime(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
return sf;
}
export function getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
......
{
"ver": "1.1.2",
"uuid": "5c9274d9-0397-4a95-921b-14e3a7ec1c8f",
"uuid": "eb38718a-603d-4517-9dd8-fc875f315b89",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.1.2",
"uuid": "92e69316-02bd-4e08-b414-6a747070897c",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "debee643-30f2-4ca1-87b8-3b38dcd2b831",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 371,
"height": 163,
"platformSettings": {},
"subMetas": {
"bg_1": {
"ver": "1.0.4",
"uuid": "f9c8e6d0-0191-45d6-930a-0d30f84f3a0b",
"rawTextureUuid": "debee643-30f2-4ca1-87b8-3b38dcd2b831",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 371,
"height": 163,
"rawWidth": 371,
"rawHeight": 163,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2245d614-13a5-4119-bf37-2f0fb793de5f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 371,
"height": 163,
"platformSettings": {},
"subMetas": {
"bg_2": {
"ver": "1.0.4",
"uuid": "8fe0b37e-9460-4b98-b028-143fb0b9d9c1",
"rawTextureUuid": "2245d614-13a5-4119-bf37-2f0fb793de5f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 371,
"height": 163,
"rawWidth": 371,
"rawHeight": 163,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a6f19483-59fd-4546-bf7f-bdc65caf59e1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 371,
"height": 163,
"platformSettings": {},
"subMetas": {
"bg_3": {
"ver": "1.0.4",
"uuid": "d5ae9793-4807-4d20-865f-3f994f7e6add",
"rawTextureUuid": "a6f19483-59fd-4546-bf7f-bdc65caf59e1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 371,
"height": 163,
"rawWidth": 371,
"rawHeight": 163,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "099eff28-cd85-43b5-8949-a9675ddb4b1b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 371,
"height": 163,
"platformSettings": {},
"subMetas": {
"bg_4": {
"ver": "1.0.4",
"uuid": "e232c978-5838-4665-9b40-b4019bc9339b",
"rawTextureUuid": "099eff28-cd85-43b5-8949-a9675ddb4b1b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 371,
"height": 163,
"rawWidth": 371,
"rawHeight": 163,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"ver": "1.1.2",
"uuid": "97fa2ae9-07b7-4976-ad5e-0d078a926aa3",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment