Add audio logs.
加入音频的日志。
This commit is contained in:
parent
6807064bd8
commit
5ad4c1f09d
|
@ -126,4 +126,7 @@ log_parameter_inconsistency,参数不齐。,Parameter inconsistency.,パラメ
|
||||||
log_room_slot_position_is_empty,房间位置描述为空。,Room location is described as empty.,部屋の位置は空です。
|
log_room_slot_position_is_empty,房间位置描述为空。,Room location is described as empty.,部屋の位置は空です。
|
||||||
log_room_overlap,房间重叠。,The rooms overlap.,部屋が重なります。
|
log_room_overlap,房间重叠。,The rooms overlap.,部屋が重なります。
|
||||||
log_game_over_event_is_empty,游戏结束事件为空。,End of game event is empty.,ゲームオーバーでイベントは空です。
|
log_game_over_event_is_empty,游戏结束事件为空。,End of game event is empty.,ゲームオーバーでイベントは空です。
|
||||||
log_cannot_resurrect_non_existent_player,不能复活不存在的玩家。,Cannot resurrect non-existent players.,存在しないプレイヤーを復活させることはできません。
|
log_cannot_resurrect_non_existent_player,不能复活不存在的玩家。,Cannot resurrect non-existent players.,存在しないプレイヤーを復活させることはできません。
|
||||||
|
log_no_audio_stream_player,没有音频播放器组件。,No audio player component.,オーディオプレーヤーキットはありません。
|
||||||
|
log_audio_stream_player_is_playing,音频播放器正在播放中。,The audio player is playing.,オーディオプレーヤーが再生中です。
|
||||||
|
log_play_audio,播放音频BUS为{0}Stream为{1}.,BUS is {0} and Stream is {1}.,再生オーディオはBUSが{0}Streamが{1}です。
|
|
|
@ -168,18 +168,18 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
||||||
}
|
}
|
||||||
|
|
||||||
private CollisionShape2D? _collisionShape2D;
|
private CollisionShape2D? _collisionShape2D;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Whether the resource has been loaded</para>
|
/// <para>Whether the resource has been loaded</para>
|
||||||
/// <para>是否已加载过资源了</para>
|
/// <para>是否已加载过资源了</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _loadedResource;
|
private bool _loadedResource;
|
||||||
|
|
||||||
public sealed override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
LoadResource();
|
LoadResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void LoadResource()
|
public virtual void LoadResource()
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
||||||
SetCollisionMaskValue(Config.LayerNumber.Barrier, true);
|
SetCollisionMaskValue(Config.LayerNumber.Barrier, true);
|
||||||
_loadedResource = true;
|
_loadedResource = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _MouseEnter()
|
public override void _MouseEnter()
|
||||||
{
|
{
|
||||||
if (Picked)
|
if (Picked)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using ColdMint.scripts.character;
|
using ColdMint.scripts.character;
|
||||||
|
using ColdMint.scripts.debug;
|
||||||
using ColdMint.scripts.pickable;
|
using ColdMint.scripts.pickable;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
|
@ -22,7 +23,10 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
public override void LoadResource()
|
public override void LoadResource()
|
||||||
{
|
{
|
||||||
base.LoadResource();
|
base.LoadResource();
|
||||||
_audioStreamPlayer2D = GetNode<AudioStreamPlayer2D>("Marker2D/AudioStreamPlayer2D");
|
if (_audioStreamPlayer2D == null)
|
||||||
|
{
|
||||||
|
_audioStreamPlayer2D = GetNode<AudioStreamPlayer2D>("Marker2D/AudioStreamPlayer2D");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Use(Node2D? owner, Vector2 targetGlobalPosition)
|
public override bool Use(Node2D? owner, Vector2 targetGlobalPosition)
|
||||||
|
@ -97,7 +101,26 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize);
|
characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_audioStreamPlayer2D?.Play();
|
if (_audioStreamPlayer2D == null)
|
||||||
|
{
|
||||||
|
//No audio player
|
||||||
|
//没有音频播放器
|
||||||
|
LogCat.Log("no_audio_stream_player");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_audioStreamPlayer2D.IsPlaying())
|
||||||
|
{
|
||||||
|
//The audio is playing
|
||||||
|
//音频正在播放中
|
||||||
|
LogCat.Log("audio_stream_player_is_playing");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Play audio
|
||||||
|
//播放音频
|
||||||
|
LogCat.LogWithFormat("play_audio", LogCat.LogLabel.Default, _audioStreamPlayer2D.Bus, _audioStreamPlayer2D.Stream);
|
||||||
|
_audioStreamPlayer2D.Play();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user