This commit is contained in:
Martin 2022-12-22 14:05:31 +01:00
parent 8b2897f38b
commit f15f654ac6
9 changed files with 464 additions and 35 deletions

View File

@ -248,7 +248,7 @@
"__expectedType__": "cc.AudioClip"
},
"_loop": true,
"_playOnAwake": true,
"_playOnAwake": false,
"_volume": 1,
"_id": ""
},

View File

@ -20,25 +20,31 @@
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
},
{
"__id__": 8
},
{
"__id__": 10
},
{
"__id__": 12
},
{
"__id__": 14
}
],
"_active": true,
"_components": [
{
"__id__": 20
},
{
"__id__": 22
},
{
"__id__": 24
},
{
"__id__": 26
}
],
"_prefab": {
"__id__": 16
"__id__": 28
},
"_lpos": {
"__type__": "cc.Vec3",
@ -70,7 +76,7 @@
},
{
"__type__": "cc.Node",
"_name": "SkillTitle",
"_name": "Title",
"_objFlags": 0,
"_parent": {
"__id__": 1
@ -200,6 +206,270 @@
},
"fileId": "b23ZKbNTtBGqonQhKULY4F"
},
{
"__type__": "cc.Node",
"_name": "Description",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 11
}
],
"_prefab": {
"__id__": 13
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 16.532,
"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": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 10
},
"_contentSize": {
"__type__": "cc.Size",
"width": 117.86,
"height": 80
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5cEiirW8lFMbNYu/3Nqu51"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 12
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_string": "Increase healthwefwef",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 15,
"_fontSize": 15,
"_fontFamily": "Arial",
"_lineHeight": 20,
"_overflow": 1,
"_enableWrapText": true,
"_font": {
"__uuid__": "c96b42a9-d20d-4c59-8e99-8ed749a715c8",
"__expectedType__": "cc.BitmapFont"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 1,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2eMtRyCjtF2a1RNdoIUZs/"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "e2JV80Si1M+JfO9kW6Ga0d"
},
{
"__type__": "cc.Node",
"_name": "Sprite",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
},
{
"__id__": 17
}
],
"_prefab": {
"__id__": 19
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -48,
"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": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"__prefab": {
"__id__": 16
},
"_contentSize": {
"__type__": "cc.Size",
"width": 26,
"height": 22
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b0oSTIwV9M3btBKLcJZX+X"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"__prefab": {
"__id__": 18
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "e6f506a9-a7b6-4382-8e34-716df203e7ae@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": {
"__uuid__": "c4872559-07b2-44e5-9613-5f22506b1989",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "df5r3bDyFISqMuUS02/aAs"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "dbYlHctO5I568ZqegDS1AZ"
},
{
"__type__": "cc.UITransform",
"_name": "",
@ -209,7 +479,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 9
"__id__": 21
},
"_contentSize": {
"__type__": "cc.Size",
@ -236,7 +506,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 11
"__id__": 23
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@ -280,7 +550,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 13
"__id__": 25
},
"playOnLoad": true,
"_clips": [
@ -308,11 +578,17 @@
},
"_enabled": true,
"__prefab": {
"__id__": 15
"__id__": 27
},
"skillTitle": {
"__id__": 5
},
"skillDescription": {
"__id__": 11
},
"skillIcon": {
"__id__": 17
},
"_id": ""
},
{

View File

@ -32,28 +32,31 @@
},
{
"__id__": 26
},
{
"__id__": 32
}
],
"_active": true,
"_components": [
{
"__id__": 32
},
{
"__id__": 34
},
{
"__id__": 36
"__id__": 38
},
{
"__id__": 40
},
{
"__id__": 38
"__id__": 42
},
{
"__id__": 46
},
{
"__id__": 44
}
],
"_prefab": {
"__id__": 42
"__id__": 48
},
"_lpos": {
"__type__": "cc.Vec3",
@ -733,6 +736,138 @@
},
"fileId": "69ItV8RjNK0LBrhjv1o0Iu"
},
{
"__type__": "cc.Node",
"_name": "Icon",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 33
},
{
"__id__": 35
}
],
"_prefab": {
"__id__": 37
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 25.234,
"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": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"__prefab": {
"__id__": 34
},
"_contentSize": {
"__type__": "cc.Size",
"width": 16,
"height": 32
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f19c9B7K5Efo2QTH+f0fvq"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"__prefab": {
"__id__": 36
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "1ad27e7b-edee-48c1-8e87-90bd16039dc1@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": {
"__uuid__": "c4872559-07b2-44e5-9613-5f22506b1989",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "24NFMgic5FZIkT8040WkWI"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "8dK6A1v6BCg571nXx6pyVq"
},
{
"__type__": "cc.UITransform",
"_name": "",
@ -742,7 +877,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 33
"__id__": 39
},
"_contentSize": {
"__type__": "cc.Size",
@ -769,7 +904,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 35
"__id__": 41
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@ -813,7 +948,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 37
"__id__": 43
},
"levelPointPrefab": {
"__uuid__": "41ca6952-fa32-4e38-8d43-eec2e982533c",
@ -834,8 +969,11 @@
"maxLevel": {
"__id__": 23
},
"icon": {
"__id__": 35
},
"uiButton": {
"__id__": 38
"__id__": 44
},
"_id": ""
},
@ -852,7 +990,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 39
"__id__": 45
},
"_id": ""
},
@ -869,7 +1007,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 41
"__id__": 47
},
"clickEvents": [],
"_interactable": true,

View File

@ -65,6 +65,7 @@ export class AppRoot extends Component {
const gameAssetsNode = instantiate(this.gameAssetsPrefab);
gameAssetsNode.setParent(this.node);
this.gameAssets = gameAssetsNode.getComponent(GameAssets);
this.gameAssets.init();
this.audio.init(this.LiveUserData.soundVolume, this.LiveUserData.musicVolume);
}

View File

@ -2,7 +2,7 @@ import { sys } from "cc";
import { UserData } from "../Game/Data/UserData";
export class SaveSystem {
private userDataIdentifier = "user-de";
private userDataIdentifier = "user-dse";
public save(userData: UserData): void {
sys.localStorage.setItem(this.userDataIdentifier, JSON.stringify(userData));
}

View File

@ -10,6 +10,11 @@ export class GameAssets extends Component {
@property(MetaUpgradeIcons) private metaUpgradeIcons: MetaUpgradeIcons;
@property(AudioAssets) private audioAssets: AudioAssets;
public init(): void {
this.upgradeIcons.init();
this.metaUpgradeIcons.init();
}
public get UpgradeIcons(): UpgradeIcons {
return this.upgradeIcons;
}

View File

@ -1,4 +1,5 @@
import { Component, Label, NodeEventType, _decorator } from "cc";
import { approx, Component, Label, NodeEventType, Sprite, _decorator } from "cc";
import { AppRoot } from "../../../AppRoot/AppRoot";
import { ISignal } from "../../../Services/EventSystem/ISignal";
import { Signal } from "../../../Services/EventSystem/Signal";
import { TranslationData } from "../../Data/TranslationData";
@ -8,12 +9,16 @@ const { ccclass, property } = _decorator;
@ccclass("LevelUpSkill")
export class LevelUpSkill extends Component {
@property(Label) private skillTitle: Label;
@property(Label) private skillDescription: Label;
@property(Sprite) private skillIcon: Sprite;
private chooseSkillEvent: Signal<UpgradeType> = new Signal<UpgradeType>();
private skillType: UpgradeType;
public init(skillType: UpgradeType, translationData: TranslationData): void {
this.skillType = skillType;
this.skillTitle.string = `${translationData[`${skillType}_TITLE`]}`;
this.skillDescription.string = `${translationData[`${skillType}_DESC`]}`;
this.skillIcon.spriteFrame = AppRoot.Instance.GameAssets.UpgradeIcons.getIcon(skillType);
this.node.on(NodeEventType.TOUCH_START, this.chooseSkill, this);
}

View File

@ -1,4 +1,5 @@
import { Component, instantiate, Label, Node, Prefab, _decorator } from "cc";
import { Component, instantiate, Label, Node, Prefab, Sprite, _decorator } from "cc";
import { AppRoot } from "../../../AppRoot/AppRoot";
import { MetaUpgradeSettings } from "../../../Game/Data/GameSettings";
import { TranslationData } from "../../../Game/Data/TranslationData";
import { MetaUpgradeType } from "../../../Game/Upgrades/UpgradeType";
@ -17,6 +18,7 @@ export class UpgradeUI extends Component {
@property(Label) private description: Label;
@property(Label) private cost: Label;
@property(Label) private maxLevel: Label;
@property(Sprite) private icon: Sprite;
@property(UIButton) private uiButton: UIButton;
@ -33,6 +35,7 @@ export class UpgradeUI extends Component {
this.upgradeSettings = upgradeSettings;
this.translationData = translationData;
this.icon.spriteFrame = AppRoot.Instance.GameAssets.MetaUpgradeIcons.getIcon(upgradeType);
this.title.string = `${translationData[`${upgradeType}_TITLE`]}`;
this.uiButton.InteractedEvent.on(() => this.interactedEvent.trigger(upgradeType), this);

View File

@ -32,6 +32,7 @@ export class AudioPlayer extends Component {
}
public playMusic(clip: AudioClip): void {
this.musicSource.stop();
this.musicSource.clip = clip;
this.musicSource.play();
}