Commit 36ce342d authored by wanqing's avatar wanqing

修改代码

parent b10d31f7
...@@ -15,9 +15,13 @@ public class PropSelectUI : MonoBehaviour ...@@ -15,9 +15,13 @@ public class PropSelectUI : MonoBehaviour
public GameObject m_doubleMaskObj; public GameObject m_doubleMaskObj;
public GameObject m_coinMaskObj; public GameObject m_coinMaskObj;
private Button m_strengthButton; public Button m_strengthButton;
private Button m_doubleButton; public Button m_doubleButton;
private Button m_coinButton; public Button m_coinButton;
private bool m_bIsBuyOne;
private bool m_bIsBuyTwo;
private bool m_bIsBuyThree;
private void Awake() private void Awake()
{ {
m_strengthButton = m_strengthObj.GetComponent<Button>(); m_strengthButton = m_strengthObj.GetComponent<Button>();
...@@ -39,52 +43,65 @@ public class PropSelectUI : MonoBehaviour ...@@ -39,52 +43,65 @@ public class PropSelectUI : MonoBehaviour
m_coinSymbolObj.SetActive(false); m_coinSymbolObj.SetActive(false);
if(m_strengthButton) if(m_strengthButton)
{ {
m_strengthButton.enabled = true; m_strengthButton.enabled = varCoin >= 10;
} }
if(m_doubleButton) if(m_doubleButton)
{ {
m_doubleButton.enabled = true; m_doubleButton.enabled = varCoin >= 20;
} }
if(m_coinButton) if(m_coinButton)
{ {
m_coinButton.enabled = true; m_coinButton.enabled = varCoin >= 10;
} }
m_bIsBuyOne = false;
m_bIsBuyTwo = false;
m_bIsBuyThree = false;
} }
public void SetState(bool value) public void SetState(bool value)
{ {
m_strengthMaskObj.SetActive(!value); int varCoin = LocalRecord.GetIntRecord(GlobalConfig.CoinReCordKey);
m_doubleMaskObj.SetActive(!value); m_strengthMaskObj.SetActive(!value || varCoin < 10 || m_bIsBuyOne);
m_coinMaskObj.SetActive(!value); m_doubleMaskObj.SetActive(!value || varCoin < 20 || m_bIsBuyTwo);
m_strengthButton.enabled = value; m_coinMaskObj.SetActive(!value || varCoin < 10 || m_bIsBuyThree);
m_doubleButton.enabled = value; m_strengthButton.enabled = value && varCoin >= 10 && !m_bIsBuyOne;
m_coinButton.enabled = value; m_doubleButton.enabled = value && varCoin >= 20 && !m_bIsBuyTwo;
m_coinButton.enabled = value && varCoin >= 10 && !m_bIsBuyThree;
} }
//点击加强 //点击加强
public void OnClickStrength() public void OnClickStrength()
{ {
BattleCtrl.instance.battleUI.SetBombStrength(); BattleCtrl.instance.battleUI.SetBombStrength();
BattleCtrl.instance.battleUI.SetCoin(-10); BattleCtrl.instance.battleUI.SetCoin(-10);
//SetOpenState(); SetOpenState();
m_strengthObj.SetActive(false); //m_strengthObj.SetActive(false);
m_strengthMaskObj.SetActive(true);
m_strengthButton.enabled = false;
m_strengthSymbolObj.SetActive(true); m_strengthSymbolObj.SetActive(true);
m_bIsBuyOne = true;
} }
//点击double //点击double
public void OnClickDouble() public void OnClickDouble()
{ {
BattleCtrl.instance.battleUI.SetBombDouble(); BattleCtrl.instance.battleUI.SetBombDouble();
BattleCtrl.instance.battleUI.SetCoin(-20); BattleCtrl.instance.battleUI.SetCoin(-20);
//SetOpenState(); SetOpenState();
m_doubleObj.SetActive(false); //m_doubleObj.SetActive(false);
m_doubleMaskObj.SetActive(true);
m_doubleButton.enabled = false;
m_doubleSymbolObj.SetActive(true); m_doubleSymbolObj.SetActive(true);
m_bIsBuyTwo = true;
} }
//点击金币 //点击金币
public void OnClickCoin() public void OnClickCoin()
{ {
BattleCtrl.instance.battleUI.SetCoinDouble(); BattleCtrl.instance.battleUI.SetCoinDouble();
BattleCtrl.instance.battleUI.SetCoin(-10); BattleCtrl.instance.battleUI.SetCoin(-10);
//SetOpenState(); SetOpenState();
m_coinObj.SetActive(false); //m_coinObj.SetActive(false);
m_coinMaskObj.SetActive(true);
m_coinButton.enabled = false;
m_coinSymbolObj.SetActive(true); m_coinSymbolObj.SetActive(true);
m_bIsBuyThree = true;
} }
//开始 //开始
public void OnClickStart() public void OnClickStart()
...@@ -100,17 +117,23 @@ public class PropSelectUI : MonoBehaviour ...@@ -100,17 +117,23 @@ public class PropSelectUI : MonoBehaviour
void SetOpenState() void SetOpenState()
{ {
int varCoin = LocalRecord.GetIntRecord(GlobalConfig.CoinReCordKey); int varCoin = LocalRecord.GetIntRecord(GlobalConfig.CoinReCordKey);
if(m_strengthObj.activeSelf) //if(m_strengthObj.activeSelf)
{ //{
m_strengthObj.SetActive(varCoin >= 10); // m_strengthObj.SetActive(varCoin >= 10);
} //}
if(m_doubleObj.activeSelf) //if(m_doubleObj.activeSelf)
{ //{
m_doubleObj.SetActive(varCoin >= 20); // m_doubleObj.SetActive(varCoin >= 20);
} //}
if(m_coinObj.activeSelf) //if(m_coinObj.activeSelf)
{ //{
m_coinObj.SetActive(varCoin >= 10); // m_coinObj.SetActive(varCoin >= 10);
} //}
m_strengthMaskObj.SetActive(varCoin < 10 || m_bIsBuyOne);
m_doubleMaskObj.SetActive(varCoin < 20 || m_bIsBuyTwo);
m_coinMaskObj.SetActive(varCoin < 10 || m_bIsBuyThree);
m_strengthButton.enabled = varCoin >= 10 && !m_bIsBuyOne;
m_doubleButton.enabled = varCoin >= 20 && !m_bIsBuyTwo;
m_coinButton.enabled = varCoin >= 10 && !m_bIsBuyThree;
} }
} }
...@@ -1998,7 +1998,7 @@ GameObject: ...@@ -1998,7 +1998,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &6239114279345162872 --- !u!224 &6239114279345162872
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -8427,6 +8427,9 @@ MonoBehaviour: ...@@ -8427,6 +8427,9 @@ MonoBehaviour:
m_strengthMaskObj: {fileID: 5927221786089016403} m_strengthMaskObj: {fileID: 5927221786089016403}
m_doubleMaskObj: {fileID: 1777016099821604868} m_doubleMaskObj: {fileID: 1777016099821604868}
m_coinMaskObj: {fileID: 1361138347524019810} m_coinMaskObj: {fileID: 1361138347524019810}
m_strengthButton: {fileID: 4752653425415952349}
m_doubleButton: {fileID: 5882450331430651428}
m_coinButton: {fileID: 781047637346676936}
--- !u!1 &3632395786067152575 --- !u!1 &3632395786067152575
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -9898,7 +9901,7 @@ GameObject: ...@@ -9898,7 +9901,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &1888649736239092238 --- !u!224 &1888649736239092238
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -16500,7 +16503,7 @@ GameObject: ...@@ -16500,7 +16503,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &7566100893700461193 --- !u!224 &7566100893700461193
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
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