|
@@ -62,18 +62,15 @@ namespace GFGGame
|
|
|
|
|
|
private EffectUI _effectUI1;
|
|
|
private EffectUI _effectUI2;
|
|
|
- private EffectUI _effectUI3;
|
|
|
- private EffectUI _effectUI4;
|
|
|
+ private List<EffectUI> _effectFlipList = new List<EffectUI>();
|
|
|
+ private List<EffectUI> _effectRemoveList = new List<EffectUI>();
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
EffectUIPool.Recycle(_effectUI1);
|
|
|
_effectUI1 = null;
|
|
|
EffectUIPool.Recycle(_effectUI2);
|
|
|
_effectUI2 = null;
|
|
|
- EffectUIPool.Recycle(_effectUI3);
|
|
|
- _effectUI3 = null;
|
|
|
- EffectUIPool.Recycle(_effectUI4);
|
|
|
- _effectUI4 = null;
|
|
|
+ DestroyObjectFromView();
|
|
|
if (_ui != null)
|
|
|
{
|
|
|
_ui.Dispose();
|
|
@@ -94,6 +91,8 @@ namespace GFGGame
|
|
|
|
|
|
UIObjectFactory.SetPackageItemExtension("ui://MiniGame/CardComponent", typeof(Card));
|
|
|
|
|
|
+ _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_barEffect, "ui_Activity", "YXJY_Game_JinDu");
|
|
|
+ _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_titleEffec, "ui_Activity", "YXJY_Game_Text");
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
@@ -114,15 +113,33 @@ namespace GFGGame
|
|
|
}
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
- _ui.m_cardList.RemoveChildrenToPool();
|
|
|
- base.OnHide();
|
|
|
+ DestroyObjectFromView();
|
|
|
cardList.Clear();
|
|
|
Timers.inst.Remove(UpdateTime);
|
|
|
Timers.inst.Remove(UpdateBar);
|
|
|
Timers.inst.Remove(UpdateHit);
|
|
|
Timers.inst.Remove(StartTime);
|
|
|
+
|
|
|
+ base.OnHide();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ private void DestroyObjectFromView()
|
|
|
+ {
|
|
|
+ for (int i = 0; i < _effectFlipList.Count; i++)
|
|
|
+ {
|
|
|
+ EffectUIPool.Recycle(_effectFlipList[i]);
|
|
|
+ _effectFlipList[i] = null;
|
|
|
+ }
|
|
|
+ _effectFlipList.Clear();
|
|
|
+
|
|
|
+ for (int i = 0; i < _effectRemoveList.Count; i++)
|
|
|
+ {
|
|
|
+ EffectUIPool.Recycle(_effectRemoveList[i]);
|
|
|
+ _effectRemoveList[i] = null;
|
|
|
+ }
|
|
|
+ _effectRemoveList.Clear();
|
|
|
+ }
|
|
|
private void OnClickBtnBack()
|
|
|
{
|
|
|
Timers.inst.Remove(UpdateTime);
|
|
@@ -156,6 +173,15 @@ namespace GFGGame
|
|
|
UI_cardItem cardItem = UI_cardItem.Proxy(item);
|
|
|
Dictionary<string, int> itemInfo = new Dictionary<string, int>();
|
|
|
|
|
|
+ cardItem.target.visible = true;
|
|
|
+ cardItem.target.alpha = 1;
|
|
|
+ EffectUI _effectUI1 = EffectUIPool.CreateEffectUI(cardItem.m_flipEffect, "ui_Activity", "YXJY_Game_OpenCard");
|
|
|
+ _effectFlipList.Add(_effectUI1);
|
|
|
+ cardItem.m_flipEffect.visible = false;
|
|
|
+ EffectUI _effectUI2 = EffectUIPool.CreateEffectUI(cardItem.m_removeEffect, "ui_Activity", "YXJY_Game_CardDie");
|
|
|
+ _effectRemoveList.Add(_effectUI2);
|
|
|
+ cardItem.m_removeEffect.visible = false;
|
|
|
+
|
|
|
cardItem.m_card.GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(CardCfgArray.Instance.dataArray[cardArray[index]].resName);
|
|
|
if (cardItem.target.data == null)
|
|
|
{
|
|
@@ -210,9 +236,13 @@ namespace GFGGame
|
|
|
_ui.m_ScareBar.min = 0;
|
|
|
_ui.m_ScareBar.value = gameTime;
|
|
|
_ui.m_star1.SetPosition(((float)(gameTime - CustemsNum[0])/(float)gameTime) * _ui.m_ScareBar.width + 70,_ui.m_star1.position.y, _ui.m_star1.position.z);
|
|
|
- _ui.m_star2.SetPosition(((float)(gameTime - CustemsNum[1]) / (float)gameTime) * _ui.m_ScareBar.width, _ui.m_star1.position.y, _ui.m_star1.position.z);
|
|
|
+ _ui.m_star2.SetPosition(((float)(gameTime - CustemsNum[1]) / (float)gameTime) * _ui.m_ScareBar.width + 10, _ui.m_star1.position.y, _ui.m_star1.position.z);
|
|
|
_ui.m_star3.SetPosition(((float)(gameTime - CustemsNum[2]) / (float)gameTime) * _ui.m_ScareBar.width, _ui.m_star1.position.y, _ui.m_star1.position.z);
|
|
|
|
|
|
+ _ui.m_title.visible = false;
|
|
|
+ _ui.m_titleEffec.visible = true;
|
|
|
+ _ui.m_barEffect.x = _ui.m_ScareBar.width;
|
|
|
+
|
|
|
_ui.m_cardList.touchable = true;
|
|
|
//计时器
|
|
|
Timers.inst.Add(1.0f, 0, UpdateTime);
|
|
@@ -250,8 +280,8 @@ namespace GFGGame
|
|
|
//翻牌
|
|
|
card.Turn();
|
|
|
//.
|
|
|
- cardList.Remove(cardInfo);
|
|
|
-
|
|
|
+ cardList.RemoveAt(0);
|
|
|
+ isSame = true;
|
|
|
break;
|
|
|
}
|
|
|
else
|
|
@@ -269,29 +299,37 @@ namespace GFGGame
|
|
|
{
|
|
|
cardInfo["state"] = 1;
|
|
|
card.Turn();
|
|
|
+ item.m_flipEffect.visible = true;
|
|
|
cardList.Add(cardInfo);
|
|
|
}
|
|
|
UI_cardItem.ProxyEnd();
|
|
|
}
|
|
|
private void StartTime(object param = null)
|
|
|
{
|
|
|
+
|
|
|
_ui.m_cardList.touchable = false;
|
|
|
canHit = false;
|
|
|
UpdateCard();
|
|
|
- Timers.inst.Remove(StartTime);
|
|
|
}
|
|
|
//这里是处理已翻开的数量
|
|
|
private void UpdateCard()
|
|
|
{
|
|
|
+ Timers.inst.Remove(StartTime);
|
|
|
List<Dictionary<string, int>> removeList = new List<Dictionary<string, int>>();
|
|
|
- for (int i = 1; i < cardList.Count; i++)
|
|
|
+ for (int i = 1; i < cardList.Count; i+= 2)
|
|
|
{
|
|
|
if(cardList[i]["id"] == cardList[i-1]["id"])
|
|
|
{
|
|
|
cardList[i]["state"] = 2;
|
|
|
//消除
|
|
|
- _ui.m_cardList.GetChildAt(cardList[i]["index"]).visible = false;
|
|
|
- _ui.m_cardList.GetChildAt(cardList[i - 1]["index"]).visible = false;
|
|
|
+ UI_cardItem item1 = UI_cardItem.Proxy(_ui.m_cardList.GetChildAt(cardList[i]["index"]));
|
|
|
+ item1.m_t0.Play();
|
|
|
+ UI_cardItem.ProxyEnd();
|
|
|
+
|
|
|
+ UI_cardItem item2 = UI_cardItem.Proxy(_ui.m_cardList.GetChildAt(cardList[i-1]["index"]));
|
|
|
+ item2.m_t0.Play();
|
|
|
+ UI_cardItem.ProxyEnd();
|
|
|
+
|
|
|
currentCardNum -= 2;
|
|
|
removeList.Add(cardList[i-1]);
|
|
|
removeList.Add(cardList[i]);
|
|
@@ -316,6 +354,7 @@ namespace GFGGame
|
|
|
//翻回去
|
|
|
Card card = (Card)item.m_card;
|
|
|
card.Turn();
|
|
|
+ item.m_flipEffect.visible = false;
|
|
|
cardList[i - 1]["state"] = 0;
|
|
|
UI_cardItem.ProxyEnd();
|
|
|
if (cardList.Count % 2 == 0 && i == cardList.Count - 1)
|
|
@@ -324,6 +363,7 @@ namespace GFGGame
|
|
|
//翻回去
|
|
|
Card cardLast = (Card)carditem.m_card;
|
|
|
cardLast.Turn();
|
|
|
+ carditem.m_flipEffect.visible = false;
|
|
|
cardList[i]["state"] = 0;
|
|
|
UI_cardItem.ProxyEnd();
|
|
|
}
|
|
@@ -346,11 +386,11 @@ namespace GFGGame
|
|
|
}
|
|
|
private void UpdateHit(object param = null)
|
|
|
{
|
|
|
- Timers.inst.Remove(UpdateHit);
|
|
|
StartHit = true;
|
|
|
firstHit = true;
|
|
|
canHit = true;
|
|
|
_ui.m_cardList.touchable = true;
|
|
|
+ Timers.inst.Remove(UpdateHit);
|
|
|
}
|
|
|
private void UpdateTime(object param = null)
|
|
|
{
|
|
@@ -367,6 +407,7 @@ namespace GFGGame
|
|
|
{
|
|
|
barTime -= 0.1f;
|
|
|
_ui.m_ScareBar.value = barTime;
|
|
|
+ _ui.m_barEffect.x -= (880.0f/ (float)(gameTime*10));
|
|
|
}
|
|
|
|
|
|
private void Gameover(bool isPass = false)
|