123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726 |
- using System;
- using System.Collections.Generic;
- using ET;
- using FairyGUI;
- using UI.MiniGame;
- using UnityEngine;
- 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;
- private System.Random rand;
- private int _gameID;
- private int _res;
- //当前拖拽的index;
- private int indexID;
- //开始拖拽的坐标
- private float startX;
- private float startY;
- private int indexX;
- private int indexY;
- private float waitBtnTime = 0.5f;
- //当前任务id;后台获取数据
- private int taskId;
- //当前点击id信息
- private int materialID;
- private int propID = 3000020;
- public override void Dispose()
- {
- if (_valueBarController != null)
- {
- _valueBarController.Dispose();
- _valueBarController = null;
- }
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_MergeGameUI.PACKAGE_NAME;
- _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);
- _ui.m_shopBtn.onClick.Add(ShowShopBtn);
- _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()
- {
- for (int i = 0; i < itemNum; i++)
- {
- 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();
- }
- 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;
- 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>());
- for (int j = 0; j < itemNum; 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;
- 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)
- {
- guideAfuBtn = itemList[i][j];
- itemList[i][j].GetChild("icon").icon = "ui://MiniGame/doubao_txkicon";
- itemList[i][j].onClick.Add(OnClickDouBaoBtn);
- itemList[i][j].draggable = false;
- continue;
- }
- if ( j == itemNum - 1)
- {
- guideAfuBtn = itemList[i][j];
- itemList[i][j].GetChild("icon").icon = "ui://MiniGame/afu_txkicon";
- itemList[i][j].onClick.Add(OnClickAFuBtn);
- itemList[i][j].draggable = false;
- continue;
- }
- }
- //表示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;
- itemList[i][j].onDragStart.Add(onDragStart);
- itemList[i][j].onDragEnd.Add(onDragEnd);
- itemList[i][j].onClick.Add(OnClickItem);
- itemList[i][j].dragBounds = new Rect(_ui.m_rangeTop.x + 90, _ui.m_rangeTop.y + 90, _ui.m_rangeTop.width, _ui.m_rangeTop.height);
- 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 (idList[i][j] == 0)
- {
- itemList[i][j].GetChild("icon").icon = "";
- //itemList[i][j].draggable = false;
- }
- else
- {
- itemList[i][j].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, idList[i][j]).resName, "MergeGame");
- }
- }
- }
- }
- private void onDragStart(EventContext context)
- {
- GObject item = context.sender as GObject;
- int itemInfo = (int)(context.sender as GObject).data;
- 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)));
- startX = item.x;
- startY = item.y;
- indexID = itemInfo;
- _ui.m_rangeDown.RemoveChild(item);
- _ui.m_rangeTop.AddChild(item);
- }
- 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;
-
- //合成规则:相同合成,但是材料只有五级,5和5不能合成6, 6属于另一类材料的一级
- if (itemEndInfo == indexID && (indexX != endIndexX || indexY != endIndexY) && (itemEndInfo % maxLv != 0))
- {
- indexID = 0;
- idList[indexX][indexY] = 0;
- itemList[indexX][indexY].data = 0;
- 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.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();
- if(InspectionTasks())
- {
- _ui.m_rewardGet.visible = true;
- }
- else
- {
- _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)
- {
- idList[indexX][indexY] = 0;
- itemList[indexX][indexY].data = 0;
- 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.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;
- }
- //if (indexID == 0)
- //{
- // item.draggable = false;
- //}
- //if(itemEndInfo > 0 )
- //{
- // itemList[endIndexX][endIndexY].draggable = true;
- //}
- _ui.m_rangeTop.RemoveChild(item);
- _ui.m_rangeDown.AddChild(item);
- item.x = startX;
- item.y = startY;
- UpdateShowList();
- startX = 0;
- startY = 0;
- indexX = 0;
- indexY = 0;
- indexID = 0;
- }
- private void OnClickItem(EventContext context)
- {
- GObject item = context.sender as GObject;
- int id = (int)item.data;
- if(id <= 0)
- {
- return;
- }
- 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;
- 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 OnClickIconItem(EventContext context)
- {
- int id = MergeGameArray.Instance.GetCfg(taskId).bonusWinArr[0][0];
- GoodsItemTipsController.ShowItemTips(id);
- }
- private async void OnClickSellBtn()
- {
- if(materialID == 0)
- {
- return;
- }
- 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 async void OnClickAFuBtn()
- {
- if (!canBtn)
- {
- return;
- }
- canBtn = false;
- Timers.inst.Add(waitBtnTime, 1,UpdateBtnTimer);
- bool gameOver = false;
- for (int i = 0; i < itemNum; i++)
- {
- for (int j = 0; j < itemNum; j++)
- {
- if (idList[i][j] == 0)
- {
- gameOver = true;
- break;
- }
- }
- }
- if (!gameOver)
- {
- PromptController.Instance.ShowFloatTextPrompt("没有存放空间!");
- return;
- }
- bool result = await MiniGameProxy.ReqMergeGameBtn(2,taskId);
- if(result)
- {
- 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)
- {
- if(y == 0)
- {
- y = 1;
- }
- else if(y == 1)
- {
- y = 2;
- }
- else if(y == 2)
- {
- y = 3;
- }
- }
- else if (x == 4 && y == 4)
- {
- 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 async void OnClickDouBaoBtn()
- {
- if(!canBtn)
- {
- return;
- }
- canBtn = false;
- Timers.inst.Add(waitBtnTime, 1, UpdateBtnTimer);
- bool gameOver = false;
- for (int i = 0; i < itemNum; i++)
- {
- for (int j = 0; j < itemNum; j++)
- {
- if (idList[i][j] == 0)
- {
- gameOver = true;
- break;
- }
- }
- }
- if (!gameOver)
- {
- PromptController.Instance.ShowFloatTextPrompt("没有存放空间!");
- return;
- }
- bool result = await MiniGameProxy.ReqMergeGameBtn(1,taskId);
- if (result)
- {
- 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)
- {
- if (y == 0)
- {
- y = 1;
- }
- else if (y == 1)
- {
- y = 2;
- }
- else if (y == 2)
- {
- y = 3;
- }
- }
- else if(x== 4 && y== 4)
- {
- 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.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];
- int targetNum = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][1];
- switch (k)
- {
- case 0:
- _ui.m_rewardOne.target.visible = true;
- _ui.m_rewardTwo.target.visible = false;
- _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.GetCfgByresTypeAndmaterialld(_res, targetID).resName, "MergeGame");
- _ui.m_rewardTwo.m_Count.text = targetNum.ToString();
- break;
- default:
- break;
- }
- }
- if (InspectionTasks())
- {
- _ui.m_rewardGet.visible = true;
- }
- else
- {
- _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 UpdateShowList()
- {
- for (int i = 0; i < itemNum; i++)
- {
- for (int j = 0; j < itemNum; j++)
- {
- itemList[i][j].data = idList[i][j];
- 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 (idList[i][j] == 0)
- {
- itemList[i][j].GetChild("icon").icon = "";
- }
- else if (idList[i][j] > 0)
- {
- itemList[i][j].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, idList[i][j]).resName, "MergeGame");
- }
- }
- }
- }
- //提交任务
- 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()
- {
- bool isTarged = true;
- 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];
- int currentNum = 0;
- for (int i = 0; i < itemNum; i++)
- {
- for (int j = 0; j < itemNum; j++)
- {
- if (idList[i][j] == targetID)
- {
- currentNum++;
- if (currentNum == targetNum)
- {
- break;
- }
- }
- }
- if (currentNum == targetNum)
- {
- break;
- }
- }
- if (currentNum == targetNum && isTarged)
- {
- isTarged = true;
- }
- else
- {
- isTarged = false;
- }
- }
- return isTarged;
- }
- 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.GetCfgByresTypeAndmaterialld(_res, idList[i][j]).resName,"MergeGame");
- _ui.m_newMaterial.m_t0.Play();
- }
- private void OnClickHideTips()
- {
- if(_ui.m_newMaterial.target.visible == true)
- {
- _ui.m_newMaterial.target.visible = false;
- }
- }
- private void ShowMergeRouteTips()
- {
- ViewManager.Show<MergeGameMaterialTipView>(new object[]{ _res });
- }
- private void ShowShopBtn()
- {
- ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_EXCHANGE, ConstStoreSubId.STORE_ACTIVITY_EXCHANGE });
- }
- private void UpdateItemData()
- {
- _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);
- //}
- }
- }
|