|
@@ -10,8 +10,11 @@ namespace GFGGame
|
|
|
public class MergeGameView : BaseWindow
|
|
|
{
|
|
|
private UI_MergeGameUI _ui;
|
|
|
-
|
|
|
+ private ValueBarController _valueBarController;
|
|
|
private List<List<GComponent>> itemList = new List<List<GComponent>>();
|
|
|
+ private GComponent guideDouBaoBtn;
|
|
|
+ private GComponent guideAfuBtn;
|
|
|
+ private bool canBtn = true;
|
|
|
private List<List<int>> idList = new List<List<int>>();
|
|
|
private int itemNum;
|
|
|
private int maxLv;
|
|
@@ -26,6 +29,7 @@ namespace GFGGame
|
|
|
private float startY;
|
|
|
private int indexX;
|
|
|
private int indexY;
|
|
|
+ private float waitBtnTime = 0.5f;
|
|
|
|
|
|
//当前任务id;后台获取数据
|
|
|
private int taskId;
|
|
@@ -36,6 +40,11 @@ namespace GFGGame
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
+ if (_valueBarController != null)
|
|
|
+ {
|
|
|
+ _valueBarController.Dispose();
|
|
|
+ _valueBarController = null;
|
|
|
+ }
|
|
|
if (_ui != null)
|
|
|
{
|
|
|
_ui.Dispose();
|
|
@@ -51,7 +60,8 @@ namespace GFGGame
|
|
|
_ui = UI_MergeGameUI.Create();
|
|
|
this.viewCom = _ui.target;
|
|
|
isfullScreen = true;
|
|
|
-
|
|
|
+ isReturnView = true;
|
|
|
+ _valueBarController = new ValueBarController(_ui.m_valueBar);
|
|
|
_ui.m_backBtn.onClick.Add(Hide);
|
|
|
_ui.m_rewardGet.onClick.Add(SubmitTask);
|
|
|
_ui.m_MergeTipBtn.onClick.Add(ShowMergeRouteTips);
|
|
@@ -59,15 +69,22 @@ namespace GFGGame
|
|
|
_ui.m_sellBtn.target.onClick.Add(OnClickSellBtn);
|
|
|
_ui.target.onClick.Add(OnClickHideTips);
|
|
|
_ui.m_btnProp.target.onClick.Add(OnItemTips);
|
|
|
+ _ui.m_rewardIcon.onClick.Add(OnClickIconItem);
|
|
|
}
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
+ _valueBarController.OnShown();
|
|
|
//进入这个界面的时候向后台获取任务id和历史id列表
|
|
|
+ idList = MiniGameDateManager.Instance.GetIdListToLL();
|
|
|
+ canBtn = true;
|
|
|
+ waitBtnTime = 0.5f;
|
|
|
UpdateView();
|
|
|
UpdateList();
|
|
|
UpdateTask();
|
|
|
UpdateItemData();
|
|
|
+ _ui.m_guildDouBaoBtn.target.touchable = false;
|
|
|
+ //Timers.inst.AddUpdate(CheckGuide);
|
|
|
}
|
|
|
protected override void OnHide()
|
|
|
{
|
|
@@ -75,73 +92,96 @@ namespace GFGGame
|
|
|
{
|
|
|
for (int j = 0; j < itemNum; j++)
|
|
|
{
|
|
|
+ itemList[i][j].GetChild("icon").icon = "";
|
|
|
itemList[i][j].Dispose();
|
|
|
itemList[i][j] = null;
|
|
|
}
|
|
|
}
|
|
|
idList.Clear();
|
|
|
itemList.Clear();
|
|
|
+ _ui.m_rangeDown.RemoveChildren();
|
|
|
+ Timers.inst.Remove(UpdateBtnTimer);
|
|
|
+ _valueBarController.OnHide();
|
|
|
base.OnHide();
|
|
|
}
|
|
|
- private void UpdateData()
|
|
|
+ protected override void AddEventListener()
|
|
|
{
|
|
|
-
|
|
|
+ base.AddEventListener();
|
|
|
+ }
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ base.RemoveEventListener();
|
|
|
+ }
|
|
|
+ private void UpdateBtnTimer(object param)
|
|
|
+ {
|
|
|
+ canBtn = true;
|
|
|
+ Timers.inst.Remove(UpdateBtnTimer);
|
|
|
}
|
|
|
private void UpdateView()
|
|
|
{
|
|
|
itemNum = 5;
|
|
|
taskId = MiniGameDateManager.Instance.taskID;
|
|
|
- _res = MergeGameArray.Instance.GetCfg(taskId).resArr[0];
|
|
|
+ MergeGame mergeCfg = MergeGameArray.Instance.GetCfg(taskId);
|
|
|
+ propID = mergeCfg.comsumeBuyArr[0][0];
|
|
|
+ int sellId = mergeCfg.bonusWinArr[0][0];
|
|
|
+ _valueBarController.UpdateList(new List<int>() { propID, sellId });
|
|
|
+ _res = MergeGameArray.Instance.GetCfg(taskId).resType;
|
|
|
maxLv = 5;
|
|
|
materialID = 0;
|
|
|
rand = new System.Random();
|
|
|
_ui.m_rewardGet.visible = false;
|
|
|
_ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellReward").icon = "";
|
|
|
//_ui.m_newMaterial.target.visible = false;
|
|
|
_ui.m_name.text = "";
|
|
|
_ui.m_desc.text = "";
|
|
|
_ui.m_bg.url = ResPathUtil.GetBgImgPath("jbnf_xyxbj");
|
|
|
+ ItemCfg itemcfg = ItemCfgArray.Instance.GetCfg(propID);
|
|
|
+ _ui.m_doubaoicon.url = ResPathUtil.GetIconPath(itemcfg.res,"png");
|
|
|
+ _ui.m_afuicon.url = ResPathUtil.GetIconPath(itemcfg.res, "png");
|
|
|
}
|
|
|
private void UpdateList()
|
|
|
{
|
|
|
for (int i = 0; i < itemNum; i++)
|
|
|
{
|
|
|
itemList.Add(new List<GComponent>());
|
|
|
- idList.Add(new List<int>());
|
|
|
+ //idList.Add(new List<int>());
|
|
|
for (int j = 0; j < itemNum; j++)
|
|
|
{
|
|
|
- idList[i].Add(j);
|
|
|
+ //idList[i].Add(j);
|
|
|
itemList[i].Add(UIPackage.CreateObject(UI_MergeGameUI.PACKAGE_NAME, "MergeGameItemUI").asCom);
|
|
|
_ui.m_rangeDown.AddChild(itemList[i][j]);
|
|
|
//对两个按钮单独处理
|
|
|
if (i == itemNum - 1)
|
|
|
{
|
|
|
itemList[i][j].data = -1;
|
|
|
- idList[i][j] = -1;
|
|
|
+ //idList[i][j] = -1;
|
|
|
itemList[i][j].SetPosition((_ui.m_rangeDown.width / 10.0f) * (1 + (j * 2.0f)), (_ui.m_rangeDown.height / 10) * (1 + (i * 2.0f)), 0);
|
|
|
if (j == 0)
|
|
|
{
|
|
|
- itemList[i][j].GetChild("icon").icon = "ui://MiniGame/jbnf_doubao_icon";
|
|
|
- itemList[i][j].onClick.Add(OnClickAFuBtn);
|
|
|
+ guideAfuBtn = itemList[i][j];
|
|
|
+ itemList[i][j].GetChild("icon").icon = "ui://MiniGame/doubao_txkicon";
|
|
|
+ itemList[i][j].onClick.Add(OnClickDouBaoBtn);
|
|
|
continue;
|
|
|
}
|
|
|
if ( j == itemNum - 1)
|
|
|
{
|
|
|
- itemList[i][j].GetChild("icon").icon = "ui://MiniGame/jbnf_afu_icon";
|
|
|
- itemList[i][j].onClick.Add(OnClickDouBaoBtn);
|
|
|
+ guideAfuBtn = itemList[i][j];
|
|
|
+ itemList[i][j].GetChild("icon").icon = "ui://MiniGame/afu_txkicon";
|
|
|
+ itemList[i][j].onClick.Add(OnClickAFuBtn);
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
- //表示id;这里后续要改
|
|
|
- idList[i][j] = 0;
|
|
|
- if (i == 1 && j == 2)
|
|
|
- {
|
|
|
- idList[i][j] = 1;
|
|
|
- }
|
|
|
- if(i== 2 && j== 2)
|
|
|
- {
|
|
|
- idList[i][j] = 1;
|
|
|
- }
|
|
|
+ //表示id;这里后续要改,默认有两个基础材料
|
|
|
+ //idList[i][j] = 0;
|
|
|
+ //if (i == 1 && j == 2)
|
|
|
+ //{
|
|
|
+ // idList[i][j] = 1;
|
|
|
+ //}
|
|
|
+ //if(i== 2 && j== 2)
|
|
|
+ //{
|
|
|
+ // idList[i][j] = 1;
|
|
|
+ //}
|
|
|
//
|
|
|
itemList[i][j].data = idList[i][j];
|
|
|
itemList[i][j].draggable = true;
|
|
@@ -158,7 +198,7 @@ namespace GFGGame
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- itemList[i][j].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, idList[i][j])[0].resName, "MergeGame");
|
|
|
+ itemList[i][j].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, idList[i][j]).resName, "MergeGame");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -175,10 +215,10 @@ namespace GFGGame
|
|
|
_ui.m_rangeDown.RemoveChild(item);
|
|
|
_ui.m_rangeTop.AddChild(item);
|
|
|
}
|
|
|
- private void onDragEnd(EventContext context)
|
|
|
+ private async void onDragEnd(EventContext context)
|
|
|
{
|
|
|
GObject item = context.sender as GObject;
|
|
|
-
|
|
|
+ List<int> afterIDList = MiniGameDateManager.Instance.GetListByll(idList);
|
|
|
int endIndexY = Math.Min(itemNum - 1 , (int)(item.x / (_ui.m_rangeDown.width/5)));
|
|
|
int endIndexX = Math.Min(itemNum - 1 ,(int)(item.y / (_ui.m_rangeDown.height/5)));
|
|
|
int itemEndInfo = (int)itemList[endIndexX][endIndexY].data;
|
|
@@ -192,11 +232,11 @@ namespace GFGGame
|
|
|
itemList[indexX][indexY].GetChild("icon").icon = "";
|
|
|
idList[endIndexX][endIndexY] = itemEndInfo + 1;
|
|
|
itemList[endIndexX][endIndexY].data = itemEndInfo + 1;
|
|
|
- itemList[endIndexX][endIndexY].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, itemEndInfo + 1)[0].resName, "MergeGame");
|
|
|
+ itemList[endIndexX][endIndexY].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, itemEndInfo + 1).resName, "MergeGame");
|
|
|
ShowNewMaterialView(endIndexX, endIndexY);
|
|
|
- UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[endIndexX][endIndexY]);
|
|
|
- itemUI.m_t0.Play();
|
|
|
- UI_MergeGameItemUI.ProxyEnd();
|
|
|
+ //UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[endIndexX][endIndexY]);
|
|
|
+ //itemUI.m_t0.Play();
|
|
|
+ //UI_MergeGameItemUI.ProxyEnd();
|
|
|
|
|
|
if(InspectionTasks())
|
|
|
{
|
|
@@ -206,6 +246,16 @@ namespace GFGGame
|
|
|
{
|
|
|
_ui.m_rewardGet.visible = false;
|
|
|
}
|
|
|
+ _ui.m_name.text = "";
|
|
|
+ _ui.m_desc.text = "";
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellReward").icon = "";
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
|
|
|
+ materialID = 0;
|
|
|
+ bool result = await MiniGameProxy.ReqMergeGame(itemEndInfo, itemEndInfo, afterIDList, MiniGameDateManager.Instance.GetListByll(idList));
|
|
|
+ if(result)
|
|
|
+ {
|
|
|
+ idList = MiniGameDateManager.Instance.GetIdListToLL();
|
|
|
+ }
|
|
|
}
|
|
|
if (itemEndInfo != indexID && itemEndInfo == 0)
|
|
|
{
|
|
@@ -214,7 +264,19 @@ namespace GFGGame
|
|
|
itemList[indexX][indexY].GetChild("icon").icon = "";
|
|
|
idList[endIndexX][endIndexY] = indexID;
|
|
|
itemList[endIndexX][endIndexY].data = indexID;
|
|
|
- itemList[endIndexX][endIndexY].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, indexID)[0].resName, "MergeGame");
|
|
|
+ itemList[endIndexX][endIndexY].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, indexID).resName, "MergeGame");
|
|
|
+
|
|
|
+ _ui.m_name.text = "";
|
|
|
+ _ui.m_desc.text = "";
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellReward").icon = "";
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
|
|
|
+ materialID = 0;
|
|
|
+
|
|
|
+ bool result = await MiniGameProxy.ReqMergeGame(indexID, itemEndInfo, afterIDList, MiniGameDateManager.Instance.GetListByll(idList));
|
|
|
+ if(result)
|
|
|
+ {
|
|
|
+ idList = MiniGameDateManager.Instance.GetIdListToLL();
|
|
|
+ }
|
|
|
|
|
|
itemEndInfo = indexID;
|
|
|
indexID = 0;
|
|
@@ -239,6 +301,7 @@ namespace GFGGame
|
|
|
|
|
|
_ui.m_rangeTop.RemoveChild(item);
|
|
|
_ui.m_rangeDown.AddChild(item);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void OnClickItem(EventContext context)
|
|
@@ -252,41 +315,61 @@ namespace GFGGame
|
|
|
indexY = Math.Min(itemNum - 1, (int)(item.x / (_ui.m_rangeDown.width / 5)));
|
|
|
indexX = Math.Min(itemNum - 1, (int)(item.y / (_ui.m_rangeDown.height / 5)));
|
|
|
materialID = id;
|
|
|
- _ui.m_name.text = id.ToString();
|
|
|
- _ui.m_desc.text = id.ToString();
|
|
|
- ItemCfg itemReward = ItemCfgArray.Instance.GetCfg(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, id)[0].bonusSellArr[0][0]);
|
|
|
- _ui.m_sellBtn.target.GetChild("sellReward").icon = ResPathUtil.GetCommonGameResPath(itemReward.res);
|
|
|
- _ui.m_sellBtn.target.GetChild("sellGetNum").text = MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, id)[0].bonusSellArr[0][1].ToString();
|
|
|
+ MergeCfg mergeCfg = MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(MiniGameDateManager.Instance.MergeGameMatType,id);
|
|
|
+ _ui.m_name.text = mergeCfg.name;
|
|
|
+ _ui.m_desc.text = mergeCfg.desc;
|
|
|
+ ItemCfg itemReward = ItemCfgArray.Instance.GetCfg(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, id).bonusSellArr[0][0]);
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellReward").icon = ResPathUtil.GetIconPath(itemReward.res,"png");
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellGetNum").text = MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, id).bonusSellArr[0][1].ToString();
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- private void OnClickSellBtn()
|
|
|
+ private void OnClickIconItem(EventContext context)
|
|
|
+ {
|
|
|
+ int id = MergeGameArray.Instance.GetCfg(taskId).bonusWinArr[0][0];
|
|
|
+ GoodsItemTipsController.ShowItemTips(id);
|
|
|
+ }
|
|
|
+ private async void OnClickSellBtn()
|
|
|
{
|
|
|
if(materialID == 0)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- //移除
|
|
|
- _ui.m_name.text = "";
|
|
|
- _ui.m_desc.text = "";
|
|
|
- _ui.m_sellBtn.target.GetChild("sellReward").icon = "";
|
|
|
- _ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
|
|
|
- materialID = 0;
|
|
|
- idList[indexX][indexY] = 0;
|
|
|
- itemList[indexX][indexY].data = 0;
|
|
|
- UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[indexX][indexY]);
|
|
|
- itemUI.m_t2.Play();
|
|
|
- itemUI.m_t3.Play();
|
|
|
- UI_MergeGameItemUI.ProxyEnd();
|
|
|
- indexX = 0;
|
|
|
- indexY = 0;
|
|
|
- //获得奖励
|
|
|
+ int index = indexX * itemNum + indexY;
|
|
|
+ if(index >= 20)
|
|
|
+ {
|
|
|
+ index = index - 1;
|
|
|
+ }
|
|
|
+ bool result = await MiniGameProxy.ReqMergeGameSellBtn(materialID, index);
|
|
|
+ if(result)
|
|
|
+ {
|
|
|
+ //移除
|
|
|
+ _ui.m_name.text = "";
|
|
|
+ _ui.m_desc.text = "";
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellReward").icon = "";
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
|
|
|
+ materialID = 0;
|
|
|
+ idList[indexX][indexY] = 0;
|
|
|
+ itemList[indexX][indexY].data = 0;
|
|
|
+ UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[indexX][indexY]);
|
|
|
+ itemUI.m_t2.Play();
|
|
|
+ itemUI.m_t3.Play();
|
|
|
+ UI_MergeGameItemUI.ProxyEnd();
|
|
|
+ indexX = 0;
|
|
|
+ indexY = 0;
|
|
|
+ //获得奖励
|
|
|
+ idList = MiniGameDateManager.Instance.GetIdListToLL();
|
|
|
+ UpdateTask();
|
|
|
+ }
|
|
|
}
|
|
|
- private void OnClickAFuBtn()
|
|
|
+ private async void OnClickAFuBtn()
|
|
|
{
|
|
|
+ if (!canBtn)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ canBtn = false;
|
|
|
+ Timers.inst.Add(waitBtnTime, 1,UpdateBtnTimer);
|
|
|
bool gameOver = false;
|
|
|
- bool isRand = false;
|
|
|
- int materialID = 0;
|
|
|
for (int i = 0; i < itemNum; i++)
|
|
|
{
|
|
|
for (int j = 0; j < itemNum; j++)
|
|
@@ -300,53 +383,59 @@ namespace GFGGame
|
|
|
}
|
|
|
if (!gameOver)
|
|
|
{
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("没有存放空间!");
|
|
|
return;
|
|
|
}
|
|
|
- if(MergeGameArray.Instance.GetCfg(taskId).materialId1Arr.Length > 1)
|
|
|
- {
|
|
|
- isRand = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- isRand = false;
|
|
|
- materialID = MergeGameArray.Instance.GetCfg(taskId).materialId1Arr[0];
|
|
|
- }
|
|
|
- while (true)
|
|
|
+ bool result = await MiniGameProxy.ReqMergeGameBtn(2,taskId);
|
|
|
+ if(result)
|
|
|
{
|
|
|
- int x = rand.Next(0, itemNum);
|
|
|
- int y = rand.Next(0, itemNum);
|
|
|
- int num;
|
|
|
- int randNum = rand.Next(0, 2);
|
|
|
- if (randNum == 0)
|
|
|
+ int x = MiniGameDateManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[1] / itemNum;
|
|
|
+ int y = MiniGameDateManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[1] % itemNum;
|
|
|
+ int num = MiniGameDateManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[0];
|
|
|
+ //if (idList[x][y] == 0)
|
|
|
+ if (x == 4)
|
|
|
{
|
|
|
- num = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- num = 6;
|
|
|
- }
|
|
|
- if(!isRand)
|
|
|
- {
|
|
|
- num = materialID;
|
|
|
+ if(y == 0)
|
|
|
+ {
|
|
|
+ y = 1;
|
|
|
+ }
|
|
|
+ else if(y == 1)
|
|
|
+ {
|
|
|
+ y = 2;
|
|
|
+ }
|
|
|
+ else if(y == 2)
|
|
|
+ {
|
|
|
+ y = 3;
|
|
|
+ }
|
|
|
}
|
|
|
- if (idList[x][y] == 0)
|
|
|
+ else if (x == 4 && y == 4)
|
|
|
{
|
|
|
- idList[x][y] = num;
|
|
|
- itemList[x][y].data = num;
|
|
|
- itemList[x][y].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, num)[0].resName, "MergeGame");
|
|
|
- itemList[x][y].draggable = true;
|
|
|
- UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[x][y]);
|
|
|
- itemUI.m_t1.Play();
|
|
|
- UI_MergeGameItemUI.ProxyEnd();
|
|
|
- break;
|
|
|
+ y = 3;
|
|
|
}
|
|
|
+
|
|
|
+ idList[x][y] = num;
|
|
|
+ itemList[x][y].data = num;
|
|
|
+ itemList[x][y].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, num).resName, "MergeGame");
|
|
|
+ itemList[x][y].draggable = true;
|
|
|
+ UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[x][y]);
|
|
|
+ itemUI.m_t1.Play();
|
|
|
+ UI_MergeGameItemUI.ProxyEnd();
|
|
|
+
|
|
|
+ idList = MiniGameDateManager.Instance.GetIdListToLL();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
}
|
|
|
}
|
|
|
- private void OnClickDouBaoBtn()
|
|
|
+ private async void OnClickDouBaoBtn()
|
|
|
{
|
|
|
+ if(!canBtn)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ canBtn = false;
|
|
|
+ Timers.inst.Add(waitBtnTime, 1, UpdateBtnTimer);
|
|
|
bool gameOver = false;
|
|
|
- bool isRand = false;
|
|
|
- int materialID = 0;
|
|
|
for (int i = 0; i < itemNum; i++)
|
|
|
{
|
|
|
for (int j = 0; j < itemNum; j++)
|
|
@@ -360,54 +449,66 @@ namespace GFGGame
|
|
|
}
|
|
|
if (!gameOver)
|
|
|
{
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("没有存放空间!");
|
|
|
return;
|
|
|
}
|
|
|
- if (MergeGameArray.Instance.GetCfg(taskId).materialId2Arr.Length > 1)
|
|
|
+ bool result = await MiniGameProxy.ReqMergeGameBtn(1,taskId);
|
|
|
+ if (result)
|
|
|
{
|
|
|
- isRand = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- isRand = false;
|
|
|
- materialID = MergeGameArray.Instance.GetCfg(taskId).materialId2Arr[0];
|
|
|
- }
|
|
|
- while (true)
|
|
|
- {
|
|
|
- int x = rand.Next(0, itemNum);
|
|
|
- int y = rand.Next(0, itemNum);
|
|
|
- int num;
|
|
|
- int randNum = rand.Next(0, 2);
|
|
|
- if (randNum == 0)
|
|
|
- {
|
|
|
- num = 11;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- num = 16;
|
|
|
- }
|
|
|
- if (!isRand)
|
|
|
+ int x = MiniGameDateManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[1] / itemNum;
|
|
|
+ int y = MiniGameDateManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[1] % itemNum;
|
|
|
+ int num = MiniGameDateManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[0];
|
|
|
+ //if (idList[x][y] == 0)
|
|
|
+ if(x == 4)
|
|
|
{
|
|
|
- num = materialID;
|
|
|
+ if (y == 0)
|
|
|
+ {
|
|
|
+ y = 1;
|
|
|
+ }
|
|
|
+ else if (y == 1)
|
|
|
+ {
|
|
|
+ y = 2;
|
|
|
+ }
|
|
|
+ else if (y == 2)
|
|
|
+ {
|
|
|
+ y = 3;
|
|
|
+ }
|
|
|
}
|
|
|
- if (idList[x][y] == 0)
|
|
|
+ else if(x== 4 && y== 4)
|
|
|
{
|
|
|
- idList[x][y] = num;
|
|
|
- itemList[x][y].data = num;
|
|
|
- itemList[x][y].draggable = true;
|
|
|
- itemList[x][y].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, num)[0].resName, "MergeGame");
|
|
|
- UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[x][y]);
|
|
|
- itemUI.m_t1.Play();
|
|
|
- UI_MergeGameItemUI.ProxyEnd();
|
|
|
- break;
|
|
|
+ y = 3;
|
|
|
}
|
|
|
+
|
|
|
+ idList[x][y] = num;
|
|
|
+ itemList[x][y].data = num;
|
|
|
+ itemList[x][y].draggable = true;
|
|
|
+ itemList[x][y].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, num).resName, "MergeGame");
|
|
|
+ UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[x][y]);
|
|
|
+ itemUI.m_t1.Play();
|
|
|
+ UI_MergeGameItemUI.ProxyEnd();
|
|
|
+
|
|
|
+ idList = MiniGameDateManager.Instance.GetIdListToLL();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void UpdateTask()
|
|
|
{
|
|
|
+ if(MiniGameDateManager.Instance.CurLevelStatus == true)
|
|
|
+ {
|
|
|
+ _ui.m_taskShow.visible = false;
|
|
|
+ _ui.m_taskEnd.visible = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _ui.m_taskShow.visible = true;
|
|
|
+ _ui.m_taskEnd.visible = false;
|
|
|
+ }
|
|
|
_ui.m_rewardNum.text = String.Format("+{0}", MergeGameArray.Instance.GetCfg(taskId).bonusWinArr[0][1]);
|
|
|
ItemCfg itemReward = ItemCfgArray.Instance.GetCfg(MergeGameArray.Instance.GetCfg(taskId).bonusWinArr[0][0]);
|
|
|
- _ui.m_rewardIcon.url = ResPathUtil.GetCommonGameResPath(itemReward.res);
|
|
|
+ _ui.m_rewardIcon.url = ResPathUtil.GetIconPath(itemReward.res,"png");
|
|
|
for (int k = 0; k < MergeGameArray.Instance.GetCfg(taskId).targetIdArr.Length; k++)
|
|
|
{
|
|
|
int targetID = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][0];
|
|
@@ -417,12 +518,12 @@ namespace GFGGame
|
|
|
case 0:
|
|
|
_ui.m_rewardOne.target.visible = true;
|
|
|
_ui.m_rewardTwo.target.visible = false;
|
|
|
- _ui.m_rewardOne.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, targetID)[0].resName, "MergeGame");
|
|
|
+ _ui.m_rewardOne.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, targetID).resName, "MergeGame");
|
|
|
_ui.m_rewardOne.m_Count.text = targetNum.ToString();
|
|
|
break;
|
|
|
case 1:
|
|
|
_ui.m_rewardTwo.target.visible = true;
|
|
|
- _ui.m_rewardTwo.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, targetID)[0].resName, "MergeGame");
|
|
|
+ _ui.m_rewardTwo.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, targetID).resName, "MergeGame");
|
|
|
_ui.m_rewardTwo.m_Count.text = targetNum.ToString();
|
|
|
break;
|
|
|
default:
|
|
@@ -437,45 +538,79 @@ namespace GFGGame
|
|
|
{
|
|
|
_ui.m_rewardGet.visible = false;
|
|
|
}
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
|
|
|
+ _ui.m_sellBtn.target.GetChild("sellReward").icon = "";
|
|
|
+ _ui.m_name.text = "";
|
|
|
+ _ui.m_desc.text = "";
|
|
|
+ materialID = 0;
|
|
|
}
|
|
|
- //提交任务
|
|
|
- private void SubmitTask()
|
|
|
+ private void UpdateShowList()
|
|
|
{
|
|
|
- for(int k = 0;k< MergeGameArray.Instance.GetCfg(taskId).targetIdArr.Length; k++)
|
|
|
+ for (int i = 0; i < itemNum; i++)
|
|
|
{
|
|
|
- int targetID = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][0];
|
|
|
- int targetNum = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][1];
|
|
|
- for (int i = 0; i < itemNum; i++)
|
|
|
+ for (int j = 0; j < itemNum; j++)
|
|
|
{
|
|
|
- for (int j = 0; j < itemNum; j++)
|
|
|
+ itemList[i][j].data = idList[i][j];
|
|
|
+ if (idList[i][j] == 0)
|
|
|
{
|
|
|
- if(idList[i][j] == targetID)
|
|
|
- {
|
|
|
- idList[i][j] = 0;
|
|
|
- itemList[i][j].data = 0;
|
|
|
- UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[i][j]);
|
|
|
- itemUI.m_t2.Play();
|
|
|
- itemUI.m_t3.Play();
|
|
|
- UI_MergeGameItemUI.ProxyEnd();
|
|
|
- targetNum--;
|
|
|
- if(targetNum == 0)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ itemList[i][j].GetChild("icon").icon = "";
|
|
|
}
|
|
|
- if (targetNum == 0)
|
|
|
+ else if (idList[i][j] > 0)
|
|
|
{
|
|
|
- break;
|
|
|
+ itemList[i][j].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, idList[i][j]).resName, "MergeGame");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //向后台发送任务ID,获得奖励
|
|
|
- //taskId = MiniGameDateManager.Instance.taskID;
|
|
|
- //暂用
|
|
|
- taskId++;
|
|
|
- //
|
|
|
- UpdateTask();
|
|
|
+ }
|
|
|
+ //提交任务
|
|
|
+ private async void SubmitTask()
|
|
|
+ {
|
|
|
+ if (!InspectionTasks())
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("提交材料不足!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ bool result = await MiniGameProxy.ReqMergeGameLevelPass(taskId);
|
|
|
+ if(result)
|
|
|
+ {
|
|
|
+ //for (int k = 0; k < MergeGameArray.Instance.GetCfg(taskId).targetIdArr.Length; k++)
|
|
|
+ //{
|
|
|
+ // int targetID = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][0];
|
|
|
+ // int targetNum = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][1];
|
|
|
+ // for (int i = 0; i < itemNum; i++)
|
|
|
+ // {
|
|
|
+ // for (int j = 0; j < itemNum; j++)
|
|
|
+ // {
|
|
|
+ // if (idList[i][j] == targetID)
|
|
|
+ // {
|
|
|
+ // idList[i][j] = 0;
|
|
|
+ // itemList[i][j].data = 0;
|
|
|
+ // //UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[i][j]);
|
|
|
+ // //itemUI.m_t2.Play();
|
|
|
+ // //itemUI.m_t3.Play();
|
|
|
+ // //UI_MergeGameItemUI.ProxyEnd();
|
|
|
+ // targetNum--;
|
|
|
+ // if (targetNum == 0)
|
|
|
+ // {
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (targetNum == 0)
|
|
|
+ // {
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //向后台发送任务ID,获得奖励
|
|
|
+ taskId = MiniGameDateManager.Instance.taskID;
|
|
|
+ idList = MiniGameDateManager.Instance.GetIdListToLL();
|
|
|
+ UpdateTask();
|
|
|
+ UpdateShowList();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ }
|
|
|
}
|
|
|
//检查是否达到提交要求
|
|
|
private bool InspectionTasks()
|
|
@@ -518,15 +653,15 @@ namespace GFGGame
|
|
|
private void ShowNewMaterialView(int i ,int j)
|
|
|
{
|
|
|
//判断是否是新材料。再显示
|
|
|
-
|
|
|
+ if(MiniGameDateManager.Instance.NewItemIdDic.ContainsKey(idList[i][j]))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
_ui.m_newMaterial.target.x = itemList[i][j].x + _ui.m_rangeDown.x;
|
|
|
_ui.m_newMaterial.target.y = itemList[i][j].y + _ui.m_rangeDown.y;
|
|
|
_ui.m_newMaterial.target.visible = true;
|
|
|
- _ui.m_newMaterial.target.GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, idList[i][j])[0].resName,"MergeGame");
|
|
|
- UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(_ui.m_newMaterial.target);
|
|
|
- itemUI.m_t0.Play();
|
|
|
- UI_MergeGameItemUI.ProxyEnd();
|
|
|
-
|
|
|
+ _ui.m_newMaterial.target.GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, idList[i][j]).resName,"MergeGame");
|
|
|
+ _ui.m_newMaterial.m_t0.Play();
|
|
|
}
|
|
|
private void OnClickHideTips()
|
|
|
{
|
|
@@ -544,23 +679,45 @@ namespace GFGGame
|
|
|
ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_EXCHANGE, ConstStoreSubId.STORE_ACTIVITY_EXCHANGE });
|
|
|
}
|
|
|
private void UpdateItemData()
|
|
|
- {
|
|
|
- ItemCfg itemcfg = ItemCfgArray.Instance.GetCfg(propID);
|
|
|
- _ui.m_btnProp.target.icon = ResPathUtil.GetIconPath(itemcfg.res,"png");
|
|
|
- ItemData item;
|
|
|
- if (BagDataManager.Instance.GetBagData().TryGetValue(propID, out item))
|
|
|
- {
|
|
|
- _ui.m_btnProp.target.title = item.num.ToString();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _ui.m_btnProp.target.title = "0";
|
|
|
- }
|
|
|
+ {
|
|
|
+ _ui.m_btnProp.target.visible = false;
|
|
|
+ //ItemCfg itemcfg = ItemCfgArray.Instance.GetCfg(propID);
|
|
|
+ //_ui.m_btnProp.target.icon = ResPathUtil.GetIconPath(itemcfg.res,"png");
|
|
|
+ //ItemData item;
|
|
|
+ //if (BagDataManager.Instance.GetBagData().TryGetValue(propID, out item))
|
|
|
+ //{
|
|
|
+ // _ui.m_btnProp.target.title = item.num.ToString();
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // _ui.m_btnProp.target.title = "0";
|
|
|
+ //}
|
|
|
}
|
|
|
private void OnItemTips()
|
|
|
{
|
|
|
object[] sourceDatas = new object[] { propID, null };
|
|
|
GoodsItemTipsController.ShowItemTips(propID, sourceDatas);
|
|
|
}
|
|
|
+
|
|
|
+ //private void CheckGuide(object param)
|
|
|
+ //{
|
|
|
+ // if (GuideDataManager.IsGuideFinish(ConstGuideId.FIELD) <= 0)
|
|
|
+ // {
|
|
|
+ // UpdateCheckGuide(null);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // Timers.inst.Remove(CheckGuide);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //protected void UpdateCheckGuide(object param)
|
|
|
+ //{
|
|
|
+ // if (!ViewManager.CheckIsTopView(this.viewCom)) return;
|
|
|
+ // GuideController.TryGuide(guideDouBaoBtn, ConstGuideId.FIELD, 1, "点击豆包按钮获取材料!");
|
|
|
+ // GuideController.TryGuide(guideAfuBtn, ConstGuideId.FIELD, 2, "点击阿福按钮获取材料!");
|
|
|
+ // GuideController.TryGuide(null, ConstGuideId.FIELD, 3, "拖拽相同材料进行合成!", -1, true, _ui.target.height - 600);
|
|
|
+ // GuideController.TryGuide(_ui.m_rewardGet, ConstGuideId.FIELD, 4, "提交对应材料获得物品!");
|
|
|
+ // GuideController.TryCompleteGuide(ConstGuideId.FIELD, 5);
|
|
|
+ //}
|
|
|
}
|
|
|
}
|