Commit dca64066 authored by unknown's avatar unknown

魔法咒语好了

parent c32713d5
......@@ -342,7 +342,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -114.222,
"y": 0,
"z": 0
},
"_lrot": {
......@@ -380,8 +380,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 160,
"height": 50
"width": 224,
"height": 282
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......
......@@ -10,7 +10,7 @@
},
{
"__type__": "cc.Scene",
"_name": "MagicSpells",
"_name": "MagicSpells_1",
"_objFlags": 0,
"_parent": null,
"_children": [
......@@ -22,6 +22,9 @@
},
{
"__id__": 7
},
{
"__id__": 70
}
],
"_active": true,
......@@ -29,7 +32,7 @@
"_prefab": null,
"autoReleaseAssets": false,
"_globals": {
"__id__": 70
"__id__": 73
},
"_id": "31b6bf24-7062-4edc-ba09-5fd282192579"
},
......@@ -312,7 +315,7 @@
"_priority": 1073741824,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 418.6192468619247,
"_orthoHeight": 414.4124472573839,
"_near": 1,
"_far": 2000,
"_color": {
......@@ -1722,7 +1725,7 @@
},
"_enabled": true,
"__prefab": null,
"totalTime": 300,
"totalTime": 60,
"oneScore": 10,
"succScore": 200,
"curScoreLab": {
......@@ -1751,19 +1754,94 @@
"quesIfoCount": 5,
"_id": "78ClK1kytPYZ7ZnlrSEX1M"
},
{
"__type__": "cc.Node",
"_name": "Audio",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 71
},
{
"__id__": 72
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "a6OA2wx3JNA6oiMyToEsyg"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 70
},
"_enabled": true,
"__prefab": null,
"_clip": null,
"_loop": false,
"_playOnAwake": true,
"_volume": 1,
"_id": "1dIRG4FkdDDK51rb37C3G3"
},
{
"__type__": "a46f84T2a1GlbP4xSghryjX",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 70
},
"_enabled": true,
"__prefab": null,
"audioSource": {
"__id__": 71
},
"_id": "acebgi7bZMsYJe6NAYG6Ez"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 71
"__id__": 74
},
"shadows": {
"__id__": 72
"__id__": 75
},
"_skybox": {
"__id__": 73
"__id__": 76
},
"fog": {
"__id__": 74
"__id__": 77
}
},
{
......
import { _decorator, Component, Node, director, CCInteger, Label, CCFloat, CCString, v3 } from 'cc';
import { countdownMus } from '../../../../startFolder/script/common/AudioDef';
import { countdownMus, failMus, rightMus, succMus, wrongMus } from '../../../../startFolder/script/common/AudioDef';
import { AudioMgr } from '../../../../startFolder/script/common/AudioMgr';
import { Utils } from '../../../../startFolder/script/common/Utils';
import { VIEW_DEF } from '../../../../startFolder/script/common/ViewDef';
import { viewMgr } from '../../../../startFolder/script/common/ViewMgr';
import { viewMgr, VIEW_INDEX } from '../../../../startFolder/script/common/ViewMgr';
import { ChallengeFailView } from '../../commonView/script/ChallengeFailView';
import { ChallengeSuccView } from '../../commonView/script/ChallengeSuccView';
import { SwitchErrorView } from '../../commonView/script/SwitchErrorView';
import { SwitchOkView } from '../../commonView/script/SwitchOkView';
import { MgcSpAswOneView } from './MgcSpAswOneView';
import { MgcSpAswTwoView } from './MgcSpAswTwoView';
import { MgcSpQueView } from './MgcSpQueView';
......@@ -69,6 +73,16 @@ export class MagicSpellsCtr extends Component {
//@ts-ignore
this.totalTime = resData.totalTime;
}
//@ts-ignore
if (resData.succScore) {
//@ts-ignore
this.succScore = resData.succScore;
}
//@ts-ignore
if (resData.oneScore) {
//@ts-ignore
this.oneScore = resData.oneScore;
}
}
start() {
......@@ -95,7 +109,18 @@ export class MagicSpellsCtr extends Component {
gameEnd() {
this.gameState = GAME_STATE.END;
if (this.curScore >= this.succScore) {
viewMgr.openView(VIEW_DEF.ChallengeSuccView, (node) => {
AudioMgr.playOneShot(succMus);
node?.getComponent(ChallengeSuccView)?.init();
}, VIEW_INDEX.TOP);
}
else {
viewMgr.openView(VIEW_DEF.ChallengeFailView, (view) => {
AudioMgr.playOneShot(failMus);
view?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP);
}
}
roundStart(isDelay: boolean) {
......@@ -145,9 +170,16 @@ export class MagicSpellsCtr extends Component {
if (this.gameState != GAME_STATE.ASW_1) return;
if (this.isSameItemIfo(this.rightIfo!, ifo)) {
this.curScore += this.oneScore;
AudioMgr.playOneShot(rightMus);
viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => {
node.getComponent(SwitchOkView)?.init(0.5);
});
}
else {
AudioMgr.playOneShot(wrongMus);
viewMgr.openView(VIEW_DEF.SwitchErrorView, (node) => {
node.getComponent(SwitchErrorView)?.init(0.5);
});
}
this.curScoreLab.string = "我的" + this.curScore + "分";
this.aswTwoStart();
......@@ -177,9 +209,16 @@ export class MagicSpellsCtr extends Component {
if (this.gameState != GAME_STATE.ASW_2) return;
if (this.isSameItemIfo(this.rightIfo!, ifo)) {
this.curScore += this.oneScore;
AudioMgr.playOneShot(rightMus);
viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => {
node.getComponent(SwitchOkView)?.init(0.5);
});
}
else {
AudioMgr.playOneShot(wrongMus);
viewMgr.openView(VIEW_DEF.SwitchErrorView, (node) => {
node.getComponent(SwitchErrorView)?.init(0.5);
});
}
this.curScoreLab.string = "我的" + this.curScore + "分";
viewMgr.getView(VIEW_DEF.MgcSpAswTwoView).getComponent(MgcSpAswTwoView)?.playDisappear(() => {
......
......@@ -59,12 +59,22 @@ export class QuickQuizCtr extends Component {
private costTime = 0;
private isPlayCountdownMus = false;
setGameData(resData: object){
setGameData(resData: object) {
//@ts-ignore
if(resData.totalTime){
if (resData.totalTime) {
//@ts-ignore
this.totalTime = resData.totalTime;
}
//@ts-ignore
if (resData.succScore) {
//@ts-ignore
this.succScore = resData.succScore;
}
//@ts-ignore
if (resData.oneScore) {
//@ts-ignore
this.oneScore = resData.oneScore;
}
}
start() {
......
......@@ -831,4 +831,21 @@ export const levelCfg: OneVarLevelItf[] = [
}
]
}
, {
gameIdHead: 120,
title: "魔法咒语",
desc: "魔法咒语",
levelArr: [{
gameId: 12001,
sceneUnitIfo: SCENE_DEF.MagicSpells_1,
comName: "MagicSpellsCtr",
level: 1,
resData: {
totalTime: 120,
succScore: 60,
oneScore: 6
}
}
]
}
];
\ No newline at end of file
......@@ -23,8 +23,8 @@ export class LevelHomeCtr extends Component {
// [3]
if (!levelMgr.loadedOutData) {
levelMgr.loadedOutData = true;
levelMgr.gameIdHead = 10;
levelMgr.unLockCount = 6;
levelMgr.gameIdHead = 120;
levelMgr.unLockCount = 1;
if(Utils.getValueFromHref("gameIdHead")){
levelMgr.gameIdHead = Number(Utils.getValueFromHref("gameIdHead"));
}
......
......@@ -84,6 +84,8 @@ interface ScenePathItf {
FoodForTheParty_2: ScenePathUnitItf,
//快问快答
QuickQuiz_1: ScenePathUnitItf,
//魔法咒语
MagicSpells_1: ScenePathUnitItf,
}
export const SCENE_DEF: ScenePathItf = {
TestScene: {
......@@ -361,6 +363,11 @@ export const SCENE_DEF: ScenePathItf = {
sceneName: "QuickQuiz_1",
desc: "快问快答,第一个版本"
},
MagicSpells_1: {
bundleName: "sceneBundle",
sceneName: "MagicSpells_1",
desc: "魔法咒语,第一个版本"
},
}
/**
* [1] Class member could be defined like this.
......
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