Commit 5b55ea73 authored by wanqing's avatar wanqing

设置界面,爪子移动区域优化

parent 02e4b863
...@@ -121,63 +121,6 @@ NavMeshSettings: ...@@ -121,63 +121,6 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1001 &44176021
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1384633641988006, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_Name
value: TinySauce
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4464613669252742, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0b960778462d34f7283156e4edafb7a2, type: 3}
--- !u!1 &186647394 --- !u!1 &186647394
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -259,7 +202,7 @@ Transform: ...@@ -259,7 +202,7 @@ Transform:
- {fileID: 1872965181} - {fileID: 1872965181}
- {fileID: 186647395} - {fileID: 186647395}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &707446925 --- !u!114 &707446925
MonoBehaviour: MonoBehaviour:
...@@ -273,38 +216,8 @@ MonoBehaviour: ...@@ -273,38 +216,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: eac3ab1cd8d56dc4fb10ca3966649e25, type: 3} m_Script: {fileID: 11500000, guid: eac3ab1cd8d56dc4fb10ca3966649e25, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
battleUI: {fileID: 8344528902126245600} battleUI: {fileID: 9106672011051914353}
m_levelManager: {fileID: 186647396} m_levelManager: {fileID: 186647396}
--- !u!1 &1859283441
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 44176021}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1859283442}
m_Layer: 0
m_Name: TinySauce (Missing Prefab)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1859283442
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 44176021}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1859283441}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1872965180 --- !u!1 &1872965180
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -349,8 +262,8 @@ MonoBehaviour: ...@@ -349,8 +262,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 65d718b4fac224944ad7728793e3fdc7, type: 3} m_Script: {fileID: 11500000, guid: 65d718b4fac224944ad7728793e3fdc7, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
pad: {fileID: 8344528901304131775} pad: {fileID: 9106672010263290414}
joyStick: {fileID: 2874693686150493834} joyStick: {fileID: 3046733044930327579}
--- !u!114 &1872965183 --- !u!114 &1872965183
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -363,43 +276,7 @@ MonoBehaviour: ...@@ -363,43 +276,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ff376a18ea419e546ba78667f1b5c6b3, type: 3} m_Script: {fileID: 11500000, guid: ff376a18ea419e546ba78667f1b5c6b3, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!114 &2874693686150493834 stripped --- !u!1001 &551544051915097355
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1259541852, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
m_PrefabInstance: {fileID: 8990117750319156764}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c26c7a0dcd8138d4194e0a4435a4740c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8344528901304131775 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6064464676810081129, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
m_PrefabInstance: {fileID: 8990117750319156764}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e3ca8d9f66bfdf4da1bfb54682c658b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8344528902126245600 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6064464677632144694, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
m_PrefabInstance: {fileID: 8990117750319156764}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 719c0ad6d83af074a83455f6c88d41e0, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &8990117750319156764
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
...@@ -449,7 +326,7 @@ PrefabInstance: ...@@ -449,7 +326,7 @@ PrefabInstance:
- target: {fileID: 6064464677632144690, guid: 919382978f5e2684ba83e6daf6491458, - target: {fileID: 6064464677632144690, guid: 919382978f5e2684ba83e6daf6491458,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6064464677632144690, guid: 919382978f5e2684ba83e6daf6491458, - target: {fileID: 6064464677632144690, guid: 919382978f5e2684ba83e6daf6491458,
type: 3} type: 3}
...@@ -518,3 +395,39 @@ PrefabInstance: ...@@ -518,3 +395,39 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 919382978f5e2684ba83e6daf6491458, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
--- !u!114 &3046733044930327579 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1259541852, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
m_PrefabInstance: {fileID: 551544051915097355}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c26c7a0dcd8138d4194e0a4435a4740c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &9106672010263290414 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6064464676810081129, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
m_PrefabInstance: {fileID: 551544051915097355}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e3ca8d9f66bfdf4da1bfb54682c658b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &9106672011051914353 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6064464677632144694, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
m_PrefabInstance: {fileID: 551544051915097355}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 719c0ad6d83af074a83455f6c88d41e0, type: 3}
m_Name:
m_EditorClassIdentifier:
...@@ -47,7 +47,7 @@ public class BattleCtrl : MonoBehaviour ...@@ -47,7 +47,7 @@ public class BattleCtrl : MonoBehaviour
//Assert.IsNotNull(battleUI, "battleUI is null"); //Assert.IsNotNull(battleUI, "battleUI is null");
InitServices(); InitServices();
Init(); Init();
TinySauce.OnGameStarted(); //TinySauce.OnGameStarted();
} }
void Start() void Start()
...@@ -196,7 +196,7 @@ public class BattleCtrl : MonoBehaviour ...@@ -196,7 +196,7 @@ public class BattleCtrl : MonoBehaviour
_GameServices = null; _GameServices = null;
//m_levelManager.curLevel.OnDispose(); //m_levelManager.curLevel.OnDispose();
//m_levelManager = null; //m_levelManager = null;
TinySauce.OnGameFinished(0); //TinySauce.OnGameFinished(0);
} }
} }
...@@ -11,6 +11,7 @@ public class ThirdLevelBoxCollision : MonoBehaviour ...@@ -11,6 +11,7 @@ public class ThirdLevelBoxCollision : MonoBehaviour
private bool m_bIsTrigger = false;//是否碰到了目标 private bool m_bIsTrigger = false;//是否碰到了目标
private Vector3 m_pos = new Vector3(-0.73f, 1.19f, -2.54f); private Vector3 m_pos = new Vector3(-0.73f, 1.19f, -2.54f);
private Quaternion m_rotation = Quaternion.Euler(0, 83.33f, 0); private Quaternion m_rotation = Quaternion.Euler(0, 83.33f, 0);
private bool m_bControl = true;
private void OnCollisionEnter(Collision other) private void OnCollisionEnter(Collision other)
{ {
if (string.Equals(other.gameObject.name, "Claw")) if (string.Equals(other.gameObject.name, "Claw"))
...@@ -37,7 +38,11 @@ public class ThirdLevelBoxCollision : MonoBehaviour ...@@ -37,7 +38,11 @@ public class ThirdLevelBoxCollision : MonoBehaviour
}); });
if (m_bIsTrigger && m_bIsRigid) if (m_bIsTrigger && m_bIsRigid)
{ {
BattleCtrl.instance.OnBattleWin(); if(m_bControl)
{
m_bControl = false;
BattleCtrl.instance.OnBattleWin();
}
//m_targetTrans.localPosition = m_pos; //m_targetTrans.localPosition = m_pos;
//m_targetTrans.localRotation = m_rotation; //m_targetTrans.localRotation = m_rotation;
} }
...@@ -49,7 +54,11 @@ public class ThirdLevelBoxCollision : MonoBehaviour ...@@ -49,7 +54,11 @@ public class ThirdLevelBoxCollision : MonoBehaviour
m_bIsTrigger = true; m_bIsTrigger = true;
if(m_bIsTrigger && m_bIsRigid) if(m_bIsTrigger && m_bIsRigid)
{ {
BattleCtrl.instance.OnBattleWin(); if (m_bControl)
{
m_bControl = false;
BattleCtrl.instance.OnBattleWin();
}
//m_targetTrans.localPosition = m_pos; //m_targetTrans.localPosition = m_pos;
//m_targetTrans.localRotation = m_rotation; //m_targetTrans.localRotation = m_rotation;
} }
......
...@@ -5,14 +5,16 @@ using UnityEngine; ...@@ -5,14 +5,16 @@ using UnityEngine;
public class LevelLimitTrigger : MonoBehaviour public class LevelLimitTrigger : MonoBehaviour
{ {
private ChainRopeView m_chainRopeView; private ChainRopeView m_chainRopeView;
private bool m_bControl = true;
private void Start() private void Start()
{ {
m_chainRopeView = BattleCtrl.instance.levelManager.curLevel.chainRopeView; m_chainRopeView = BattleCtrl.instance.levelManager.curLevel.chainRopeView;
} }
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
if (other.gameObject.CompareTag("Target") && !m_chainRopeView.IsCatch) if (other.gameObject.CompareTag("Target") && !m_chainRopeView.IsCatch && m_bControl)
{ {
m_bControl = false;
BattleCtrl.instance.OnBattleFail(); BattleCtrl.instance.OnBattleFail();
} }
} }
......
...@@ -4,11 +4,12 @@ using UnityEngine; ...@@ -4,11 +4,12 @@ using UnityEngine;
public class TargetTrigger : MonoBehaviour public class TargetTrigger : MonoBehaviour
{ {
private bool m_bControl = true;
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
if (other.gameObject.CompareTag("Target")) if (other.gameObject.CompareTag("Target") && m_bControl)
{ {
m_bControl = false;
BattleCtrl.instance.OnBattleWin(); BattleCtrl.instance.OnBattleWin();
BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget(); BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
} }
......
...@@ -28,11 +28,16 @@ public class BattleUI : MonoBehaviour ...@@ -28,11 +28,16 @@ public class BattleUI : MonoBehaviour
public Text m_cameraFieldView; public Text m_cameraFieldView;
public GameObject m_battleObj;//战斗UI public GameObject m_battleObj;//战斗UI
public GameObject m_mouseObj;//手势UI public GameObject m_mouseObj;//手势UI
public Text m_clawMoveSpeed;//爪子移动速度
public Button m_settingBtn;//设置按钮
public GameObject m_settingPanel;//设置界面
public Action onStartBtn; public Action onStartBtn;
public Action onPosUpBtn; public Action onPosUpBtn;
public Action onPosDownBtn; public Action onPosDownBtn;
public Action onFieldFarBtn; public Action onFieldFarBtn;
public Action onFieldNearBtn; public Action onFieldNearBtn;
public Action onClawMoveSpeedAddBtn;
public Action onClawMoveSpeedDownBtn;
void Awake() void Awake()
{ {
m_dragBtn.onClick.AddListener(SetDragMode); m_dragBtn.onClick.AddListener(SetDragMode);
...@@ -42,11 +47,13 @@ public class BattleUI : MonoBehaviour ...@@ -42,11 +47,13 @@ public class BattleUI : MonoBehaviour
m_selectBtn.onClick.AddListener(SelectLevel); m_selectBtn.onClick.AddListener(SelectLevel);
m_tryAgain.onClick.AddListener(TryAgainLevel); m_tryAgain.onClick.AddListener(TryAgainLevel);
m_startBtn.onClick.AddListener(StartBtn); m_startBtn.onClick.AddListener(StartBtn);
m_settingBtn.onClick.AddListener(SettingBtn);
//m_posUpBtn.onClick.AddListener(PosUpBtn); //m_posUpBtn.onClick.AddListener(PosUpBtn);
//m_posDownBtn.onClick.AddListener(PosDownBtn); //m_posDownBtn.onClick.AddListener(PosDownBtn);
//m_fieldFarBtn.onClick.AddListener(FieldFarBtn); //m_fieldFarBtn.onClick.AddListener(FieldFarBtn);
//m_fieldNearBtn.onClick.AddListener(FieldNearBtn); //m_fieldNearBtn.onClick.AddListener(FieldNearBtn);
GameServices.audioServices.PlayBgm(GameServices.configService.audioConfig.GameBgm); GameServices.audioServices.PlayBgm(GameServices.configService.audioConfig.GameBgm);
GameServices.configService.playerConfig.ClawMoveSpeed = 0.8f;//开始默认值
} }
void SetDragMode() void SetDragMode()
{ {
...@@ -86,6 +93,18 @@ public class BattleUI : MonoBehaviour ...@@ -86,6 +93,18 @@ public class BattleUI : MonoBehaviour
onStartBtn?.Invoke(); onStartBtn?.Invoke();
m_startBtn.gameObject.SetActive(false); m_startBtn.gameObject.SetActive(false);
m_startLogoObj.SetActive(false); m_startLogoObj.SetActive(false);
SetBattleObjState(true);
SettingBtnState(false);
}
//设置
void SettingBtn()
{
m_settingPanel.SetActive(!m_settingPanel.activeSelf);
}
//设置按钮状态
public void SettingBtnState(bool bool_)
{
m_settingBtn.gameObject.SetActive(bool_);
} }
//镜头拉上 //镜头拉上
public void PosUpBtn() public void PosUpBtn()
...@@ -127,6 +146,19 @@ public class BattleUI : MonoBehaviour ...@@ -127,6 +146,19 @@ public class BattleUI : MonoBehaviour
m_cameraFieldView.text = string.Format("fieldView{0:f1}", varCam.fieldOfView); m_cameraFieldView.text = string.Format("fieldView{0:f1}", varCam.fieldOfView);
} }
} }
//爪子移动速度增加
public void ClawMoveSpeedAddBtn()
{
onClawMoveSpeedAddBtn?.Invoke();
m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
}
//爪子移动速度减少
public void ClawMoveSpeedDownBtn()
{
onClawMoveSpeedDownBtn?.Invoke();
m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
}
//胜利 //胜利
public void OnBattleWin() public void OnBattleWin()
{ {
...@@ -178,6 +210,10 @@ public class BattleUI : MonoBehaviour ...@@ -178,6 +210,10 @@ public class BattleUI : MonoBehaviour
m_cameraPosY.text = string.Format("pos{0:f3}", varCam.transform.position.y); m_cameraPosY.text = string.Format("pos{0:f3}", varCam.transform.position.y);
m_cameraFieldView.text = string.Format("fieldView{0:f1}", varCam.fieldOfView); m_cameraFieldView.text = string.Format("fieldView{0:f1}", varCam.fieldOfView);
} }
GameServices.timerServices.Push(this, 1, delegate
{
m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
});
} }
//设置战斗UI状态 //设置战斗UI状态
public void SetBattleObjState(bool bool_) public void SetBattleObjState(bool bool_)
......
...@@ -11,6 +11,7 @@ public class SettingPanel : MonoBehaviour ...@@ -11,6 +11,7 @@ public class SettingPanel : MonoBehaviour
public GameObject m_vibrationImageObj;//震动✔ public GameObject m_vibrationImageObj;//震动✔
public GameObject m_soundImageObj;//音效✔ public GameObject m_soundImageObj;//音效✔
public GameObject m_bgmImageObj;//背景音乐✔ public GameObject m_bgmImageObj;//背景音乐✔
public GameObject m_settingObj;//设置按钮
private void Awake() private void Awake()
{ {
m_vibrationBtn.onClick.AddListener(OnVibrationClick); m_vibrationBtn.onClick.AddListener(OnVibrationClick);
...@@ -26,7 +27,7 @@ public class SettingPanel : MonoBehaviour ...@@ -26,7 +27,7 @@ public class SettingPanel : MonoBehaviour
} }
else else
{ {
m_vibrationImageObj.SetActive(true); m_vibrationImageObj.SetActive(false);
} }
string varStr2 = GlobalConfig.SoundKey; string varStr2 = GlobalConfig.SoundKey;
if (LocalRecord.HasKey(varStr2)) if (LocalRecord.HasKey(varStr2))
...@@ -35,7 +36,7 @@ public class SettingPanel : MonoBehaviour ...@@ -35,7 +36,7 @@ public class SettingPanel : MonoBehaviour
} }
else else
{ {
m_soundImageObj.SetActive(true); m_soundImageObj.SetActive(false);
} }
string varStr3 = GlobalConfig.BgmKey; string varStr3 = GlobalConfig.BgmKey;
if (LocalRecord.HasKey(varStr3)) if (LocalRecord.HasKey(varStr3))
...@@ -44,7 +45,7 @@ public class SettingPanel : MonoBehaviour ...@@ -44,7 +45,7 @@ public class SettingPanel : MonoBehaviour
} }
else else
{ {
m_bgmImageObj.SetActive(true); m_bgmImageObj.SetActive(false);
} }
} }
//震动 //震动
...@@ -78,7 +79,9 @@ public class SettingPanel : MonoBehaviour ...@@ -78,7 +79,9 @@ public class SettingPanel : MonoBehaviour
} }
public void OnCloseClick() public void OnCloseClick()
{ {
m_settingObj.SetActive(false);
gameObject.SetActive(false); gameObject.SetActive(false);
BattleCtrl.instance.battleUI.SetBattleObjState(true); BattleCtrl.instance.battleUI.SetBattleObjState(true);
BattleCtrl.instance.battleUI.SettingBtnState(false);
} }
} }
...@@ -119,6 +119,9 @@ public class ChainRopeView : MonoBehaviour ...@@ -119,6 +119,9 @@ public class ChainRopeView : MonoBehaviour
m_rightClawTrans.localRotation = Quaternion.Euler(0, m_rightClawStartRatateY, 0); m_rightClawTrans.localRotation = Quaternion.Euler(0, m_rightClawStartRatateY, 0);
m_thumbRT = GameServices.inputService.joyStick.thumb; m_thumbRT = GameServices.inputService.joyStick.thumb;
//m_threeClawTrans.localRotation = Quaternion.Euler(0, m_threeClawStartRatateY, m_addAngleSpeed); //m_threeClawTrans.localRotation = Quaternion.Euler(0, m_threeClawStartRatateY, m_addAngleSpeed);
BattleCtrl.instance.battleUI.onClawMoveSpeedAddBtn = onClawMoveSpeedAddBtn;
BattleCtrl.instance.battleUI.onClawMoveSpeedDownBtn = onClawMoveSpeedDownBtn;
} }
//按下鼠标 //按下鼠标
void OnClickDown() void OnClickDown()
...@@ -128,9 +131,22 @@ public class ChainRopeView : MonoBehaviour ...@@ -128,9 +131,22 @@ public class ChainRopeView : MonoBehaviour
BattleCtrl.instance.battleUI.SetMousePos(varX, varY); BattleCtrl.instance.battleUI.SetMousePos(varX, varY);
} }
void onClawMoveSpeedAddBtn()
{
GameServices.configService.playerConfig.ClawMoveSpeed -= Time.deltaTime;
}
void onClawMoveSpeedDownBtn()
{
GameServices.configService.playerConfig.ClawMoveSpeed += Time.deltaTime;
}
//移动 //移动
void OnMove(Vector3 dir) void OnMove(Vector3 dir)
{ {
//移动区域
if(Input.mousePosition.y > Screen.height / 2f)
{
return;
}
float varX = Input.mousePosition.x - Screen.width / 2f; float varX = Input.mousePosition.x - Screen.width / 2f;
float varY = Input.mousePosition.y - Screen.height / 2f; float varY = Input.mousePosition.y - Screen.height / 2f;
BattleCtrl.instance.battleUI.SetMousePos(varX, varY); BattleCtrl.instance.battleUI.SetMousePos(varX, varY);
...@@ -149,7 +165,7 @@ public class ChainRopeView : MonoBehaviour ...@@ -149,7 +165,7 @@ public class ChainRopeView : MonoBehaviour
m_rigidBody.drag = 10; m_rigidBody.drag = 10;
m_rigidBody.angularDrag = 10; m_rigidBody.angularDrag = 10;
} }
float varParamDis = Screen.width * 0.8f /2;//参数距离 float varParamDis = Screen.width * GameServices.configService.playerConfig.ClawMoveSpeed / 2;//参数距离
Vector3 varPos = m_topCollider.transform.position; Vector3 varPos = m_topCollider.transform.position;
//向左滑 //向左滑
if (dir.x > 0) if (dir.x > 0)
...@@ -222,12 +238,16 @@ public class ChainRopeView : MonoBehaviour ...@@ -222,12 +238,16 @@ public class ChainRopeView : MonoBehaviour
// 抬起回调 // 抬起回调
void OnTouchUp() void OnTouchUp()
{ {
//移动区域
if (Input.mousePosition.y > Screen.height / 2f)
{
return;
}
BattleCtrl.instance.battleUI.SetMousePos(0,0); BattleCtrl.instance.battleUI.SetMousePos(0,0);
if (!BattleCtrl.instance.isStartBattle) if (!BattleCtrl.instance.isStartBattle)
{ {
return; return;
} }
m_clawDownOrUpAudioSource = GameServices.audioServices.GetPlayAudioSource(GameServices.configService.audioConfig.clawDownOrUp);
//第五关特殊处理 //第五关特殊处理
//if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFiveIndex) //if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFiveIndex)
//{ //{
...@@ -248,6 +268,7 @@ public class ChainRopeView : MonoBehaviour ...@@ -248,6 +268,7 @@ public class ChainRopeView : MonoBehaviour
m_thumbRT.sizeDelta = varThumb; m_thumbRT.sizeDelta = varThumb;
if (rope.isLoaded && rope.restLength <= m_ropeStartLength) if (rope.isLoaded && rope.restLength <= m_ropeStartLength)
{ {
m_clawDownOrUpAudioSource = GameServices.audioServices.GetPlayAudioSource(GameServices.configService.audioConfig.clawDownOrUp);
m_lightObj.SetParent(m_clawBody.parent.parent); m_lightObj.SetParent(m_clawBody.parent.parent);
if (m_bIsCatch) if (m_bIsCatch)
{ {
...@@ -438,6 +459,11 @@ public class ChainRopeView : MonoBehaviour ...@@ -438,6 +459,11 @@ public class ChainRopeView : MonoBehaviour
} }
DestroyImmediate(blueprint); DestroyImmediate(blueprint);
DetachHook(); DetachHook();
if (m_clawDownOrUpAudioSource)
{
GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource);
m_clawDownOrUpAudioSource = null;
}
} }
/** /**
......
...@@ -6,8 +6,11 @@ using UnityEngine; ...@@ -6,8 +6,11 @@ using UnityEngine;
public class AudioServices : MonoBehaviour public class AudioServices : MonoBehaviour
{ {
public AudioSource bgmSource; public AudioSource bgmSource;
public List<AudioSource> activeSource = new List<AudioSource>(); //public List<AudioSource> activeSource = new List<AudioSource>();
public List<AudioSource> inActiveSouce = new List<AudioSource>(); //public List<AudioSource> inActiveSouce = new List<AudioSource>();
Stack<AudioSource> m_audioSourceStack = new Stack<AudioSource>();
List<AudioSource> m_lstaudioSource = new List<AudioSource>();
static AudioServices m_Instance; static AudioServices m_Instance;
public static AudioServices instance public static AudioServices instance
...@@ -35,35 +38,55 @@ public class AudioServices : MonoBehaviour ...@@ -35,35 +38,55 @@ public class AudioServices : MonoBehaviour
private AudioSource GetSource() private AudioSource GetSource()
{ {
AudioSource source = null; AudioSource source = null;
if (inActiveSouce.Count > 0) if (m_audioSourceStack.Count > 0)
{ {
source = inActiveSouce[0]; source = m_audioSourceStack.Pop();
inActiveSouce.RemoveAt(0);
activeSource.Add(source);
} }
else else
{ {
source = transform.gameObject.AddComponent<AudioSource>(); source = transform.gameObject.AddComponent<AudioSource>();
source.playOnAwake = false; source.playOnAwake = false;
activeSource.Add(source); m_lstaudioSource.Add(source);
}
if (source)
{
source.volume = GlobalConfig.isEnableSound ? 1 : 0; //根据全局配置设置音量
} }
source.volume = GlobalConfig.isEnableSound ? 1 : 0; //根据全局配置设置音量
return source; return source;
//AudioSource source = null;
//if (inActiveSouce.Count > 0)
//{
// source = inActiveSouce[0];
// inActiveSouce.RemoveAt(0);
// activeSource.Add(source);
//}
//else
//{
// source = transform.gameObject.AddComponent<AudioSource>();
// source.playOnAwake = false;
// activeSource.Add(source);
//}
//source.volume = GlobalConfig.isEnableSound ? 1 : 0; //根据全局配置设置音量
//return source;
} }
private void RecycleSource(AudioSource source) private void RecycleSource(AudioSource source)
{ {
source.Stop(); //activeSource.Remove(source);
source.clip = null; //inActiveSouce.Add(source);
activeSource.Remove(source); if (source)
inActiveSouce.Add(source); {
m_audioSourceStack.Push(source);
source.Stop();
source.clip = null;
}
} }
public void PlayBgm(AudioClip clip) public void PlayBgm(AudioClip clip)
{ {
if(LocalRecord.HasKey(GlobalConfig.BgmKey) && LocalRecord.GetIntRecord(GlobalConfig.BgmKey) == 0) if(!LocalRecord.HasKey(GlobalConfig.BgmKey) || LocalRecord.GetIntRecord(GlobalConfig.BgmKey) == 0)
{ {
return; return;
} }
...@@ -91,7 +114,7 @@ public class AudioServices : MonoBehaviour ...@@ -91,7 +114,7 @@ public class AudioServices : MonoBehaviour
public void PlayAudio(AudioClip clip, bool isLoop = false, Action onPlayEnd = null) public void PlayAudio(AudioClip clip, bool isLoop = false, Action onPlayEnd = null)
{ {
if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0) if (!LocalRecord.HasKey(GlobalConfig.SoundKey) || LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{ {
return; return;
} }
...@@ -108,7 +131,7 @@ public class AudioServices : MonoBehaviour ...@@ -108,7 +131,7 @@ public class AudioServices : MonoBehaviour
} }
public AudioSource GetPlayAudioSource(AudioClip clip) public AudioSource GetPlayAudioSource(AudioClip clip)
{ {
if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0) if (!LocalRecord.HasKey(GlobalConfig.SoundKey) || LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{ {
return null; return null;
} }
...@@ -122,7 +145,7 @@ public class AudioServices : MonoBehaviour ...@@ -122,7 +145,7 @@ public class AudioServices : MonoBehaviour
public void AudioPlayFinished(AudioSource source) public void AudioPlayFinished(AudioSource source)
{ {
if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0) if (!LocalRecord.HasKey(GlobalConfig.SoundKey) || LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{ {
return; return;
} }
...@@ -138,10 +161,13 @@ public class AudioServices : MonoBehaviour ...@@ -138,10 +161,13 @@ public class AudioServices : MonoBehaviour
private void OnDestroy() private void OnDestroy()
{ {
activeSource.Clear(); //activeSource.Clear();
inActiveSouce.Clear(); //inActiveSouce.Clear();
activeSource = null; //activeSource = null;
inActiveSouce = null; //inActiveSouce = null;
bgmSource = null; bgmSource = null;
m_lstaudioSource.Clear();
m_lstaudioSource = null;
m_audioSourceStack = null;
} }
} }
\ No newline at end of file
...@@ -60,6 +60,9 @@ public class PlayerConfig ...@@ -60,6 +60,9 @@ public class PlayerConfig
public float cameraMoveSpeed = 2; public float cameraMoveSpeed = 2;
[Header("镜头远近速度")] [Header("镜头远近速度")]
public float cameraFieldSpeed = 2; public float cameraFieldSpeed = 2;
//爪子移动速度
public float ClawMoveSpeed { get; set; }
} }
[Serializable] [Serializable]
public class LevelConfig public class LevelConfig
......
This diff is collapsed.
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