Commit 3dc972d7 authored by SherryChaos's avatar SherryChaos

new bgm logic

parent ae4e04cf
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
MDPro3 v1.1.8.3更新: MDPro3 v1.1.8.3更新:
1.语音功能支持所有支持的语言。 1.语音功能支持所有支持的语言。
2.修复语音功能部分角色的台词错误。 2.修复语音功能部分角色的台词错误。
3. 3.设置中新增场地背景音乐由哪方决定的选项。
MDPro3 v1.1.8.2更新: MDPro3 v1.1.8.2更新:
1.语音功能新增全卡语音。 1.语音功能新增全卡语音。
......
This diff is collapsed.
...@@ -14,6 +14,7 @@ using YgomSystem.YGomTMPro; ...@@ -14,6 +14,7 @@ using YgomSystem.YGomTMPro;
using MDPro3.YGOSharp; using MDPro3.YGOSharp;
using MDPro3.YGOSharp.OCGWrapper.Enums; using MDPro3.YGOSharp.OCGWrapper.Enums;
using MDPro3.UI; using MDPro3.UI;
using static UnityEngine.Rendering.DebugUI;
namespace MDPro3 namespace MDPro3
{ {
...@@ -135,6 +136,9 @@ namespace MDPro3 ...@@ -135,6 +136,9 @@ namespace MDPro3
{ {
StopCoroutine(autoPlay); StopCoroutine(autoPlay);
autoPlay = null; autoPlay = null;
foreach(var cutin in cutins)
Destroy(cutin);
cutins.Clear();
UIManager.ShowExitButton(transitionTime); UIManager.ShowExitButton(transitionTime);
cg.alpha = 1; cg.alpha = 1;
cg.blocksRaycasts = true; cg.blocksRaycasts = true;
...@@ -174,7 +178,7 @@ namespace MDPro3 ...@@ -174,7 +178,7 @@ namespace MDPro3
return; return;
playing = true; playing = true;
if (Program.I().ocgcore.isShowed) if (Program.I().ocgcore.isShowed)
AudioManager.PlayBGMKeyCard(Program.I().ocgcore.field1Manager.name); AudioManager.PlayBgmKeyCard();
DOTween.To(v => { }, 0, 0, 1.6f).OnComplete(() => DOTween.To(v => { }, 0, 0, 1.6f).OnComplete(() =>
{ {
playing = false; playing = false;
...@@ -340,10 +344,14 @@ namespace MDPro3 ...@@ -340,10 +344,14 @@ namespace MDPro3
StartCoroutine(autoPlay); StartCoroutine(autoPlay);
} }
bool randomBGMPlayed; bool randomBGMPlayed;
List<GameObject> cutins = new List<GameObject>();
IEnumerator AutoPlayAsync() IEnumerator AutoPlayAsync()
{ {
while (playing) while (playing)
yield return null; yield return null;
if(!isShowed)
yield break;
AudioManager.PlayRandomKeyCardBGM(); AudioManager.PlayRandomKeyCardBGM();
randomBGMPlayed = true; randomBGMPlayed = true;
cg.alpha = 0f; cg.alpha = 0f;
...@@ -361,10 +369,10 @@ namespace MDPro3 ...@@ -361,10 +369,10 @@ namespace MDPro3
ie = ABLoader.LoadFromFileAsync("MonsterCutin2/" + card.Id, false, true); ie = ABLoader.LoadFromFileAsync("MonsterCutin2/" + card.Id, false, true);
diy = true; diy = true;
} }
StartCoroutine(ie);
while (ie.MoveNext()) while (ie.MoveNext())
yield return null; yield return null;
ie.Current.SetActive(false); ie.Current.SetActive(false);
cutins.Add(ie.Current);
while (playing) while (playing)
yield return null; yield return null;
ie.Current.SetActive(true); ie.Current.SetActive(true);
......
...@@ -3439,7 +3439,7 @@ namespace MDPro3 ...@@ -3439,7 +3439,7 @@ namespace MDPro3
cg.blocksRaycasts = true; cg.blocksRaycasts = true;
buttons.SetActive(true); buttons.SetActive(true);
messagePass = true; messagePass = true;
AudioManager.PlayBGMNormal(field1.name); AudioManager.PlayBgmNormal(Config.GetBool("BGMbyMySide", true) ? field0.name : field1.name);
}; };
}; };
}); });
...@@ -3592,7 +3592,7 @@ namespace MDPro3 ...@@ -3592,7 +3592,7 @@ namespace MDPro3
cg.interactable = true; cg.interactable = true;
cg.blocksRaycasts = true; cg.blocksRaycasts = true;
buttons.SetActive(true); buttons.SetActive(true);
AudioManager.PlayBGMNormal(field1.name); AudioManager.PlayBgmNormal(Config.GetBool("BGMbyMySide", true) ? field0.name : field1.name);
}; };
for (var i = 0; i < cards.Count; i++) for (var i = 0; i < cards.Count; i++)
...@@ -8768,7 +8768,7 @@ namespace MDPro3 ...@@ -8768,7 +8768,7 @@ namespace MDPro3
grave0Manager.PlayAnimatorTrigger(TriggerLabelDefine.DamagePhase3ToPhase4); grave0Manager.PlayAnimatorTrigger(TriggerLabelDefine.DamagePhase3ToPhase4);
if (stand0Manager != null) if (stand0Manager != null)
stand0Manager.PlayAnimatorTrigger(TriggerLabelDefine.DamagePhase3ToPhase4); stand0Manager.PlayAnimatorTrigger(TriggerLabelDefine.DamagePhase3ToPhase4);
AudioManager.PlayBGMClimax(field1.name); AudioManager.PlayBgmClimax();
} }
if (bgPhase0 == 4 && life0 <= 0) if (bgPhase0 == 4 && life0 <= 0)
{ {
...@@ -8812,7 +8812,7 @@ namespace MDPro3 ...@@ -8812,7 +8812,7 @@ namespace MDPro3
grave1Manager.PlayAnimatorTrigger(TriggerLabelDefine.DamagePhase3ToPhase4); grave1Manager.PlayAnimatorTrigger(TriggerLabelDefine.DamagePhase3ToPhase4);
if (stand1Manager != null) if (stand1Manager != null)
stand1Manager.PlayAnimatorTrigger(TriggerLabelDefine.DamagePhase3ToPhase4); stand1Manager.PlayAnimatorTrigger(TriggerLabelDefine.DamagePhase3ToPhase4);
AudioManager.PlayBGMClimax(field1.name); AudioManager.PlayBgmClimax();
} }
if (bgPhase1 == 4 && life1 <= 0) if (bgPhase1 == 4 && life1 <= 0)
{ {
......
...@@ -50,6 +50,8 @@ namespace MDPro3 ...@@ -50,6 +50,8 @@ namespace MDPro3
public Text uiScaleValue; public Text uiScaleValue;
public Button background; public Button background;
public Text backgroundValue; public Text backgroundValue;
public Button bgmBy;
public Text bgmByValue;
public Button cardLanguage; public Button cardLanguage;
public Text cardLanguageValue; public Text cardLanguageValue;
public Button language; public Button language;
...@@ -212,6 +214,7 @@ namespace MDPro3 ...@@ -212,6 +214,7 @@ namespace MDPro3
language.onClick.AddListener(OnLanguageChange); language.onClick.AddListener(OnLanguageChange);
confirm.onClick.AddListener(OnConfirmClicked); confirm.onClick.AddListener(OnConfirmClicked);
autoRPS.onClick.AddListener(OnAutoRPS); autoRPS.onClick.AddListener(OnAutoRPS);
bgmBy.onClick.AddListener(OnBgmByClicked);
duelAppearance.onClick.AddListener(OnDuelAppearcanceClick); duelAppearance.onClick.AddListener(OnDuelAppearcanceClick);
watchAppearance.onClick.AddListener(OnWatchAppearcanceClick); watchAppearance.onClick.AddListener(OnWatchAppearcanceClick);
...@@ -323,6 +326,7 @@ namespace MDPro3 ...@@ -323,6 +326,7 @@ namespace MDPro3
InitializeCardLanguage(); InitializeCardLanguage();
InitializeLanguage(); InitializeLanguage();
InitializeSwitches(); InitializeSwitches();
InitializeBgmBy();
} }
public override void Show(int preDepth) public override void Show(int preDepth)
...@@ -902,6 +906,31 @@ namespace MDPro3 ...@@ -902,6 +906,31 @@ namespace MDPro3
} }
} }
public void InitializeBgmBy()
{
var value = Config.GetBool("BGMbyMySide", true);
if (value)
bgmByValue.text = InterString.Get("我方");
else
bgmByValue.text = InterString.Get("对方");
}
public void OnBgmByClicked()
{
var value = Config.GetBool("BGMbyMySide", true);
if (value)
{
bgmByValue.text = InterString.Get("对方");
Config.SetBool("BGMbyMySide", false);
}
else
{
bgmByValue.text = InterString.Get("我方");
Config.SetBool("BGMbyMySide", true);
}
}
public void OnAutoRPS() public void OnAutoRPS()
{ {
if (autoRPSValue.text == InterString.Get("关")) if (autoRPSValue.text == InterString.Get("关"))
......
...@@ -36,12 +36,12 @@ namespace MDPro3.UI ...@@ -36,12 +36,12 @@ namespace MDPro3.UI
private void PlayAudio(string path) private void PlayAudio(string path)
{ {
if (path == "") if (string.IsNullOrEmpty(path))
return; return;
if (audioType == AudioType.SE) if (audioType == AudioType.SE)
AudioManager.PlaySE(path); AudioManager.PlaySE(path);
else if (audioType == AudioType.Voice) else if (audioType == AudioType.Voice)
AudioManager.PlayVoiceByPath(path); AudioManager.PlayVoiceByResourcePath(path);
} }
} }
......
...@@ -639,3 +639,6 @@ YDK 内容不合法,主卡组必须满 40 张->YDK 内容不合法,主卡组 ...@@ -639,3 +639,6 @@ YDK 内容不合法,主卡组必须满 40 张->YDK 内容不合法,主卡组
自定义游戏->自定义游戏 自定义游戏->自定义游戏
检测到新版先行卡,请至 [游戏设置]-[扩展卡包]-[更新先行卡] 处进行更新。->检测到新版先行卡,请至 [游戏设置]-[扩展卡包]-[更新先行卡] 处进行更新。 检测到新版先行卡,请至 [游戏设置]-[扩展卡包]-[更新先行卡] 处进行更新。->检测到新版先行卡,请至 [游戏设置]-[扩展卡包]-[更新先行卡] 处进行更新。
SMAA High->SMAA High SMAA High->SMAA High
决斗场地背景音乐->决斗场地背景音乐
场地背景音乐->场地背景音乐
场地背景音乐由哪方决定->场地背景音乐由哪方决定
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