mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 16:46:00 +00:00
Icons
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -32,6 +32,7 @@ export class AudioPlayer extends Component {
|
||||
}
|
||||
|
||||
public playMusic(clip: AudioClip): void {
|
||||
this.musicSource.stop();
|
||||
this.musicSource.clip = clip;
|
||||
this.musicSource.play();
|
||||
}
|
||||
|
Reference in New Issue
Block a user