|
@@ -4,23 +4,24 @@ using ET;
|
|
|
using FairyGUI;
|
|
|
using UI.MiniGame;
|
|
|
using UnityEngine;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
|
public class GameStartView : BaseView
|
|
|
{
|
|
|
private UI_GameStartUI _ui;
|
|
|
- //后续这里改成读表内容
|
|
|
- private List<string> name = new List<string>() { "翻牌", "2048" };
|
|
|
- private List<string> viewName = new List<string>() { "FlipGameView", "TZFEGameView" };
|
|
|
- private List<string> CustemsDesc = new List<string>()
|
|
|
- {
|
|
|
- "首次评价达到卓越奖励:",
|
|
|
- "首次评价达到优秀奖励:",
|
|
|
- "首次评价达到良好奖励:",
|
|
|
- };
|
|
|
+ //后续这里改成读表内容,1:CardGame,2:Merge2048Game,3:HuarongRoadGame
|
|
|
+ private List<string> viewJumpName = new List<string>() {"","FlipGameView", "TZFEGameView" ,"ActivityHuaRongDaoView"};
|
|
|
+ private List<ActivityOpenCfg> activityGameDate;
|
|
|
+ private List<int> GameType = new List<int>();
|
|
|
+ private List<int> ChallengeList = new List<int>();
|
|
|
|
|
|
- private int currentGame = 0;
|
|
|
+ //由于每个游戏都有一个表
|
|
|
+ private List<CardGame> CardGameDate;
|
|
|
+ private List<Merge2048Game> Merge2048GameDate;
|
|
|
+ private int NumTicketOne = 3;
|
|
|
+ private int NumTicketTwo = 3;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -51,18 +52,33 @@ namespace GFGGame
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
-
|
|
|
+ activityGameDate = ActivityOpenCfgArray.Instance.GetCfgsBytype(ConstLimitTimeActivityType.ActLimitStlyc);
|
|
|
+ GetGameIdByActivityDate();
|
|
|
+ UpdateChallengeBtn();
|
|
|
+ UpdateView();
|
|
|
}
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
-
|
|
|
+ GameType.Clear();
|
|
|
+ ChallengeList.Clear();
|
|
|
base.OnHide();
|
|
|
}
|
|
|
private void UpdateView()
|
|
|
{
|
|
|
+ if(ChallengeList.Count == 0)
|
|
|
+ {
|
|
|
+ _ui.m_rewardBtn.visible = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _ui.m_rewardBtn.visible = true;
|
|
|
+ }
|
|
|
+ _ui.m_ticket.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(3000017).res);
|
|
|
+ _ui.m_needNum1.text = NumTicketOne.ToString();
|
|
|
+ _ui.m_needNum2.text = NumTicketTwo.ToString();
|
|
|
+ _ui.m_needIcon1.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(3000017).res);
|
|
|
+ _ui.m_needIcon2.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(3000017).res);
|
|
|
_ui.m_ticketNum.text = "999";
|
|
|
- _ui.m_game1name.text = name[0];
|
|
|
- _ui.m_game2name.text = name[1];
|
|
|
}
|
|
|
private void OnClickBtnBack()
|
|
|
{
|
|
@@ -74,21 +90,103 @@ namespace GFGGame
|
|
|
}
|
|
|
private void OnClickBtnReward()
|
|
|
{
|
|
|
- ViewManager.Show<ChallengeRewardView>(new object[] { new List<int>() { 0,1 } });
|
|
|
+ ViewManager.Show<ChallengeRewardView>(new object[] { ChallengeList });
|
|
|
}
|
|
|
private void OnClickBtnAdd()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
- private void OnClickBtnGameOne()
|
|
|
+ private async void OnClickBtnGameOne()
|
|
|
{
|
|
|
- ViewManager.Show($"GFGGame.{viewName[0]}");
|
|
|
+ var result = await MiniGameProxy.ReqMiniGameStart(CardGameArray.Instance.GetCfgsBytypeAndsubType(GameType[0], GameType[1])[0].id, GameType[0], activityGameDate[0].id);
|
|
|
+ if (!result) return;
|
|
|
+ ViewManager.Show($"GFGGame.{viewJumpName[GameType[0]]}", new object[] { CardGameArray.Instance.GetCfgsBytypeAndsubType(GameType[0], GameType[1])[0].id });
|
|
|
this.Hide();
|
|
|
}
|
|
|
- private void OnClickBtnGameTwo()
|
|
|
+ private async void OnClickBtnGameTwo()
|
|
|
{
|
|
|
- ViewManager.Show($"GFGGame.{viewName[1]}");
|
|
|
+ var result = await MiniGameProxy.ReqMiniGameStart(Merge2048GameArray.Instance.GetCfgsBytypeAndsubType(GameType[2], GameType[3])[0].id, GameType[0], activityGameDate[0].id);
|
|
|
+ if (!result) return;
|
|
|
+ //当存在关卡时需要获取后台数据,哪一关了,这个可以在关卡界面写
|
|
|
+ ViewManager.Show($"GFGGame.{viewJumpName[GameType[2]]}",new object[] { Merge2048GameArray.Instance.GetCfgsBytypeAndsubType(GameType[2],GameType[3])[0].id });
|
|
|
this.Hide();
|
|
|
}
|
|
|
+
|
|
|
+ private void GetGameIdByActivityDate()
|
|
|
+ {
|
|
|
+ string pattern = @"\d+";
|
|
|
+ for(int i = 0; i < activityGameDate[0].params5Arr.Length; i++)
|
|
|
+ {
|
|
|
+ MatchCollection matches = Regex.Matches(activityGameDate[0].params5Arr[i], pattern);
|
|
|
+ foreach (Match match in matches)
|
|
|
+ {
|
|
|
+ GameType.Add(int.Parse(match.Value));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateChallengeBtn()
|
|
|
+ {
|
|
|
+ int index = 0;
|
|
|
+ //当两个游戏都只有一关时,奖励按钮隐藏
|
|
|
+ for(int i = 0;i<GameType.Count;i+=2)
|
|
|
+ {
|
|
|
+ switch (GameType[i])
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ List<CardGame> CardGameDate = CardGameArray.Instance.GetCfgsBytypeAndsubType(GameType[i], GameType[i +1]);
|
|
|
+ if( CardGameDate.Count <= 1)
|
|
|
+ {
|
|
|
+ ChallengeList.Add(GameType[i]);
|
|
|
+ ChallengeList.Add(GameType[i+1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(i < 1)
|
|
|
+ {
|
|
|
+ //NumTicketOne = CardGameDate[0].comsumeStartArr[0][1];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //NumTicketTwo = CardGameDate[0].comsumeStartArr[0][1];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ List<Merge2048Game> Merge2048GameDate = Merge2048GameArray.Instance.GetCfgsBytypeAndsubType(GameType[i], GameType[i + 1]);
|
|
|
+ if (Merge2048GameDate.Count <= 1)
|
|
|
+ {
|
|
|
+ ChallengeList.Add(GameType[i]);
|
|
|
+ ChallengeList.Add(GameType[i + 1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (i < 1)
|
|
|
+ {
|
|
|
+ //NumTicketOne = CardGameDate[0].comsumeStartArr[0][1];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //NumTicketTwo = CardGameDate[0].comsumeStartArr[0][1];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ List <HuarongRoadGame> HuarongRoadGameDate = HuarongRoadGameArray.Instance.GetCfgsBytypeAndsubType(GameType[i], GameType[i + 1]);
|
|
|
+ if (HuarongRoadGameDate.Count <= 1)
|
|
|
+ {
|
|
|
+ ChallengeList.Add(GameType[i]);
|
|
|
+ ChallengeList.Add(GameType[i + 1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (i < 1)
|
|
|
+ {
|
|
|
+ //NumTicketOne = CardGameDate[0].comsumeStartArr[0][1];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //NumTicketTwo = CardGameDate[0].comsumeStartArr[0][1];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|