MergeGameView.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. using System;
  2. using System.Collections.Generic;
  3. using ET;
  4. using FairyGUI;
  5. using UI.MiniGame;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. public class MergeGameView : BaseWindow
  10. {
  11. private UI_MergeGameUI _ui;
  12. private ValueBarController _valueBarController;
  13. private List<List<GComponent>> itemList = new List<List<GComponent>>();
  14. private GComponent guideDouBaoBtn;
  15. private GComponent guideAfuBtn;
  16. private List<List<int>> idList = new List<List<int>>();
  17. private int itemNum;
  18. private int maxLv;
  19. private System.Random rand;
  20. private int _gameID;
  21. private int _res;
  22. //当前拖拽的index;
  23. private int indexID;
  24. //开始拖拽的坐标
  25. private float startX;
  26. private float startY;
  27. private int indexX;
  28. private int indexY;
  29. //当前任务id;后台获取数据
  30. private int taskId;
  31. //当前点击id信息
  32. private int materialID;
  33. private int propID = 3000020;
  34. public override void Dispose()
  35. {
  36. if (_valueBarController != null)
  37. {
  38. _valueBarController.Dispose();
  39. _valueBarController = null;
  40. }
  41. if (_ui != null)
  42. {
  43. _ui.Dispose();
  44. _ui = null;
  45. }
  46. base.Dispose();
  47. }
  48. protected override void OnInit()
  49. {
  50. base.OnInit();
  51. packageName = UI_MergeGameUI.PACKAGE_NAME;
  52. _ui = UI_MergeGameUI.Create();
  53. this.viewCom = _ui.target;
  54. isfullScreen = true;
  55. _valueBarController = new ValueBarController(_ui.m_valueBar);
  56. _ui.m_backBtn.onClick.Add(Hide);
  57. _ui.m_rewardGet.onClick.Add(SubmitTask);
  58. _ui.m_MergeTipBtn.onClick.Add(ShowMergeRouteTips);
  59. _ui.m_shopBtn.onClick.Add(ShowShopBtn);
  60. _ui.m_sellBtn.target.onClick.Add(OnClickSellBtn);
  61. _ui.target.onClick.Add(OnClickHideTips);
  62. _ui.m_btnProp.target.onClick.Add(OnItemTips);
  63. }
  64. protected override void OnShown()
  65. {
  66. base.OnShown();
  67. _valueBarController.OnShown();
  68. _valueBarController.UpdateList(new List<int>() {propID});
  69. //进入这个界面的时候向后台获取任务id和历史id列表
  70. idList = MiniGameDateManager.Instance.GetIdListToLL();
  71. UpdateView();
  72. UpdateList();
  73. UpdateTask();
  74. UpdateItemData();
  75. _ui.m_guildDouBaoBtn.target.touchable = false;
  76. Timers.inst.AddUpdate(CheckGuide);
  77. }
  78. protected override void OnHide()
  79. {
  80. for (int i = 0; i < itemNum; i++)
  81. {
  82. for (int j = 0; j < itemNum; j++)
  83. {
  84. itemList[i][j].Dispose();
  85. itemList[i][j] = null;
  86. }
  87. }
  88. idList.Clear();
  89. itemList.Clear();
  90. base.OnHide();
  91. }
  92. protected override void AddEventListener()
  93. {
  94. base.AddEventListener();
  95. }
  96. protected override void RemoveEventListener()
  97. {
  98. base.RemoveEventListener();
  99. }
  100. private void UpdateData()
  101. {
  102. }
  103. private void UpdateView()
  104. {
  105. itemNum = 5;
  106. taskId = MiniGameDateManager.Instance.taskID;
  107. _res = MergeGameArray.Instance.GetCfg(taskId).resType;
  108. maxLv = 5;
  109. materialID = 0;
  110. rand = new System.Random();
  111. _ui.m_rewardGet.visible = false;
  112. _ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
  113. //_ui.m_newMaterial.target.visible = false;
  114. _ui.m_name.text = "";
  115. _ui.m_desc.text = "";
  116. _ui.m_bg.url = ResPathUtil.GetBgImgPath("jbnf_xyxbj");
  117. }
  118. private void UpdateList()
  119. {
  120. for (int i = 0; i < itemNum; i++)
  121. {
  122. itemList.Add(new List<GComponent>());
  123. //idList.Add(new List<int>());
  124. for (int j = 0; j < itemNum; j++)
  125. {
  126. //idList[i].Add(j);
  127. itemList[i].Add(UIPackage.CreateObject(UI_MergeGameUI.PACKAGE_NAME, "MergeGameItemUI").asCom);
  128. _ui.m_rangeDown.AddChild(itemList[i][j]);
  129. //对两个按钮单独处理
  130. if (i == itemNum - 1)
  131. {
  132. itemList[i][j].data = -1;
  133. //idList[i][j] = -1;
  134. itemList[i][j].SetPosition((_ui.m_rangeDown.width / 10.0f) * (1 + (j * 2.0f)), (_ui.m_rangeDown.height / 10) * (1 + (i * 2.0f)), 0);
  135. if (j == 0)
  136. {
  137. guideAfuBtn = itemList[i][j];
  138. itemList[i][j].GetChild("icon").icon = "ui://MiniGame/jbnf_doubao_icon";
  139. itemList[i][j].onClick.Add(OnClickAFuBtn);
  140. continue;
  141. }
  142. if ( j == itemNum - 1)
  143. {
  144. guideAfuBtn = itemList[i][j];
  145. itemList[i][j].GetChild("icon").icon = "ui://MiniGame/jbnf_afu_icon";
  146. itemList[i][j].onClick.Add(OnClickDouBaoBtn);
  147. continue;
  148. }
  149. }
  150. //表示id;这里后续要改,默认有两个基础材料
  151. //idList[i][j] = 0;
  152. //if (i == 1 && j == 2)
  153. //{
  154. // idList[i][j] = 1;
  155. //}
  156. //if(i== 2 && j== 2)
  157. //{
  158. // idList[i][j] = 1;
  159. //}
  160. //
  161. itemList[i][j].data = idList[i][j];
  162. itemList[i][j].draggable = true;
  163. itemList[i][j].onDragStart.Add(onDragStart);
  164. itemList[i][j].onDragEnd.Add(onDragEnd);
  165. itemList[i][j].onClick.Add(OnClickItem);
  166. itemList[i][j].dragBounds = new Rect(_ui.m_rangeTop.x + 90, _ui.m_rangeTop.y + 90, _ui.m_rangeTop.width, _ui.m_rangeTop.height);
  167. itemList[i][j].SetPosition( (_ui.m_rangeDown.width / 10.0f) * (1+ (j * 2.0f)), (_ui.m_rangeDown.height / 10) * (1+(i * 2.0f)) , 0);
  168. if (idList[i][j] == 0)
  169. {
  170. itemList[i][j].GetChild("icon").icon = "";
  171. itemList[i][j].draggable = false;
  172. }
  173. else
  174. {
  175. itemList[i][j].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, idList[i][j]).resName, "MergeGame");
  176. }
  177. }
  178. }
  179. }
  180. private void onDragStart(EventContext context)
  181. {
  182. GObject item = context.sender as GObject;
  183. int itemInfo = (int)(context.sender as GObject).data;
  184. indexY = Math.Min(itemNum - 1, (int)(item.x / (_ui.m_rangeDown.width / 5)));
  185. indexX = Math.Min(itemNum - 1, (int)(item.y / (_ui.m_rangeDown.height / 5)));
  186. startX = item.x;
  187. startY = item.y;
  188. indexID = itemInfo;
  189. _ui.m_rangeDown.RemoveChild(item);
  190. _ui.m_rangeTop.AddChild(item);
  191. }
  192. private async void onDragEnd(EventContext context)
  193. {
  194. GObject item = context.sender as GObject;
  195. List<int> afterIDList = MiniGameDateManager.Instance.GetListByll(idList);
  196. int endIndexY = Math.Min(itemNum - 1 , (int)(item.x / (_ui.m_rangeDown.width/5)));
  197. int endIndexX = Math.Min(itemNum - 1 ,(int)(item.y / (_ui.m_rangeDown.height/5)));
  198. int itemEndInfo = (int)itemList[endIndexX][endIndexY].data;
  199. //合成规则:相同合成,但是材料只有五级,5和5不能合成6, 6属于另一类材料的一级
  200. if (itemEndInfo == indexID && (indexX != endIndexX || indexY != endIndexY) && (itemEndInfo % maxLv != 0))
  201. {
  202. indexID = 0;
  203. idList[indexX][indexY] = 0;
  204. itemList[indexX][indexY].data = 0;
  205. itemList[indexX][indexY].GetChild("icon").icon = "";
  206. idList[endIndexX][endIndexY] = itemEndInfo + 1;
  207. itemList[endIndexX][endIndexY].data = itemEndInfo + 1;
  208. itemList[endIndexX][endIndexY].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, itemEndInfo + 1).resName, "MergeGame");
  209. ShowNewMaterialView(endIndexX, endIndexY);
  210. UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[endIndexX][endIndexY]);
  211. itemUI.m_t0.Play();
  212. UI_MergeGameItemUI.ProxyEnd();
  213. if(InspectionTasks())
  214. {
  215. _ui.m_rewardGet.visible = true;
  216. }
  217. else
  218. {
  219. _ui.m_rewardGet.visible = false;
  220. }
  221. bool result = await MiniGameProxy.ReqMergeGame(indexID, itemEndInfo, afterIDList, MiniGameDateManager.Instance.GetListByll(idList));
  222. if(!result)
  223. {
  224. idList = MiniGameDateManager.Instance.GetIdListToLL();
  225. UpdateList();
  226. }
  227. }
  228. if (itemEndInfo != indexID && itemEndInfo == 0)
  229. {
  230. idList[indexX][indexY] = 0;
  231. itemList[indexX][indexY].data = 0;
  232. itemList[indexX][indexY].GetChild("icon").icon = "";
  233. idList[endIndexX][endIndexY] = indexID;
  234. itemList[endIndexX][endIndexY].data = indexID;
  235. itemList[endIndexX][endIndexY].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, indexID).resName, "MergeGame");
  236. itemEndInfo = indexID;
  237. indexID = 0;
  238. bool result = await MiniGameProxy.ReqMergeGame(indexID, itemEndInfo, afterIDList, MiniGameDateManager.Instance.GetListByll(idList));
  239. if (!result)
  240. {
  241. idList = MiniGameDateManager.Instance.GetIdListToLL();
  242. UpdateList();
  243. }
  244. }
  245. item.x = startX;
  246. item.y = startY;
  247. if(indexID == 0)
  248. {
  249. item.draggable = false;
  250. }
  251. if(itemEndInfo > 0 )
  252. {
  253. itemList[endIndexX][endIndexY].draggable = true;
  254. }
  255. startX = 0;
  256. startY = 0;
  257. indexX = 0;
  258. indexY = 0;
  259. indexID = 0;
  260. _ui.m_rangeTop.RemoveChild(item);
  261. _ui.m_rangeDown.AddChild(item);
  262. }
  263. private void OnClickItem(EventContext context)
  264. {
  265. GObject item = context.sender as GObject;
  266. int id = (int)item.data;
  267. if(id <= 0)
  268. {
  269. return;
  270. }
  271. indexY = Math.Min(itemNum - 1, (int)(item.x / (_ui.m_rangeDown.width / 5)));
  272. indexX = Math.Min(itemNum - 1, (int)(item.y / (_ui.m_rangeDown.height / 5)));
  273. materialID = id;
  274. _ui.m_name.text = id.ToString();
  275. _ui.m_desc.text = id.ToString();
  276. ItemCfg itemReward = ItemCfgArray.Instance.GetCfg(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, id).bonusSellArr[0][0]);
  277. _ui.m_sellBtn.target.GetChild("sellReward").icon = ResPathUtil.GetCommonGameResPath(itemReward.res);
  278. _ui.m_sellBtn.target.GetChild("sellGetNum").text = MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, id).bonusSellArr[0][1].ToString();
  279. }
  280. private void OnClickSellBtn()
  281. {
  282. if(materialID == 0)
  283. {
  284. return;
  285. }
  286. //移除
  287. _ui.m_name.text = "";
  288. _ui.m_desc.text = "";
  289. _ui.m_sellBtn.target.GetChild("sellReward").icon = "";
  290. _ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
  291. materialID = 0;
  292. idList[indexX][indexY] = 0;
  293. itemList[indexX][indexY].data = 0;
  294. UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[indexX][indexY]);
  295. itemUI.m_t2.Play();
  296. itemUI.m_t3.Play();
  297. UI_MergeGameItemUI.ProxyEnd();
  298. indexX = 0;
  299. indexY = 0;
  300. //获得奖励
  301. }
  302. private async void OnClickAFuBtn()
  303. {
  304. bool gameOver = false;
  305. for (int i = 0; i < itemNum; i++)
  306. {
  307. for (int j = 0; j < itemNum; j++)
  308. {
  309. if (idList[i][j] == 0)
  310. {
  311. gameOver = true;
  312. break;
  313. }
  314. }
  315. }
  316. if (!gameOver)
  317. {
  318. PromptController.Instance.ShowFloatTextPrompt("没有存放空间!");
  319. return;
  320. }
  321. bool result = await MiniGameProxy.ReqMergeGameBtn(2,taskId);
  322. if(result)
  323. {
  324. int x = MatchingCompetitionDataManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[1] / itemNum;
  325. int y = MatchingCompetitionDataManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[1] % itemNum;
  326. int num = MatchingCompetitionDataManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[0];
  327. if (idList[x][y] == 0)
  328. {
  329. idList[x][y] = num;
  330. itemList[x][y].data = num;
  331. itemList[x][y].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, num).resName, "MergeGame");
  332. itemList[x][y].draggable = true;
  333. UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[x][y]);
  334. itemUI.m_t1.Play();
  335. UI_MergeGameItemUI.ProxyEnd();
  336. }
  337. idList = MiniGameDateManager.Instance.GetIdListToLL();
  338. }
  339. else
  340. {
  341. idList = MiniGameDateManager.Instance.GetIdListToLL();
  342. UpdateList();
  343. }
  344. }
  345. private async void OnClickDouBaoBtn()
  346. {
  347. bool gameOver = false;
  348. for (int i = 0; i < itemNum; i++)
  349. {
  350. for (int j = 0; j < itemNum; j++)
  351. {
  352. if (idList[i][j] == 0)
  353. {
  354. gameOver = true;
  355. break;
  356. }
  357. }
  358. }
  359. if (!gameOver)
  360. {
  361. PromptController.Instance.ShowFloatTextPrompt("没有存放空间!");
  362. return;
  363. }
  364. bool result = await MiniGameProxy.ReqMergeGameBtn(1,taskId);
  365. if (result)
  366. {
  367. int x = MatchingCompetitionDataManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[1] / itemNum;
  368. int y = MatchingCompetitionDataManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[1] % itemNum;
  369. int num = MatchingCompetitionDataManager.Instance.GetIDListByString(MiniGameDateManager.Instance.ItemIdVPosition)[0];
  370. if (idList[x][y] == 0)
  371. {
  372. idList[x][y] = num;
  373. itemList[x][y].data = num;
  374. itemList[x][y].draggable = true;
  375. itemList[x][y].GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, num).resName, "MergeGame");
  376. UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[x][y]);
  377. itemUI.m_t1.Play();
  378. UI_MergeGameItemUI.ProxyEnd();
  379. }
  380. idList = MiniGameDateManager.Instance.GetIdListToLL();
  381. }
  382. else
  383. {
  384. idList = MiniGameDateManager.Instance.GetIdListToLL();
  385. UpdateList();
  386. }
  387. }
  388. private void UpdateTask()
  389. {
  390. if(MiniGameDateManager.Instance.CurLevelStatus == true)
  391. {
  392. _ui.m_taskShow.visible = false;
  393. _ui.m_taskEnd.visible = true;
  394. }
  395. else
  396. {
  397. _ui.m_taskShow.visible = true;
  398. _ui.m_taskEnd.visible = false;
  399. }
  400. _ui.m_rewardNum.text = String.Format("+{0}", MergeGameArray.Instance.GetCfg(taskId).bonusWinArr[0][1]);
  401. ItemCfg itemReward = ItemCfgArray.Instance.GetCfg(MergeGameArray.Instance.GetCfg(taskId).bonusWinArr[0][0]);
  402. _ui.m_rewardIcon.url = ResPathUtil.GetCommonGameResPath(itemReward.res);
  403. for (int k = 0; k < MergeGameArray.Instance.GetCfg(taskId).targetIdArr.Length; k++)
  404. {
  405. int targetID = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][0];
  406. int targetNum = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][1];
  407. switch (k)
  408. {
  409. case 0:
  410. _ui.m_rewardOne.target.visible = true;
  411. _ui.m_rewardTwo.target.visible = false;
  412. _ui.m_rewardOne.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, targetID).resName, "MergeGame");
  413. _ui.m_rewardOne.m_Count.text = targetNum.ToString();
  414. break;
  415. case 1:
  416. _ui.m_rewardTwo.target.visible = true;
  417. _ui.m_rewardTwo.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, targetID).resName, "MergeGame");
  418. _ui.m_rewardTwo.m_Count.text = targetNum.ToString();
  419. break;
  420. default:
  421. break;
  422. }
  423. }
  424. if (InspectionTasks())
  425. {
  426. _ui.m_rewardGet.visible = true;
  427. }
  428. else
  429. {
  430. _ui.m_rewardGet.visible = false;
  431. }
  432. _ui.m_sellBtn.target.GetChild("sellGetNum").text = "";
  433. _ui.m_name.text = "";
  434. _ui.m_desc.text = "";
  435. materialID = 0;
  436. }
  437. //提交任务
  438. private async void SubmitTask()
  439. {
  440. bool result = await MiniGameProxy.ReqMergeGameLevelPass(taskId);
  441. if(result)
  442. {
  443. //for (int k = 0; k < MergeGameArray.Instance.GetCfg(taskId).targetIdArr.Length; k++)
  444. //{
  445. // int targetID = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][0];
  446. // int targetNum = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][1];
  447. // for (int i = 0; i < itemNum; i++)
  448. // {
  449. // for (int j = 0; j < itemNum; j++)
  450. // {
  451. // if (idList[i][j] == targetID)
  452. // {
  453. // idList[i][j] = 0;
  454. // itemList[i][j].data = 0;
  455. // //UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(itemList[i][j]);
  456. // //itemUI.m_t2.Play();
  457. // //itemUI.m_t3.Play();
  458. // //UI_MergeGameItemUI.ProxyEnd();
  459. // targetNum--;
  460. // if (targetNum == 0)
  461. // {
  462. // break;
  463. // }
  464. // }
  465. // }
  466. // if (targetNum == 0)
  467. // {
  468. // break;
  469. // }
  470. // }
  471. //}
  472. //向后台发送任务ID,获得奖励
  473. taskId = MiniGameDateManager.Instance.taskID;
  474. idList = MiniGameDateManager.Instance.GetIdListToLL();
  475. UpdateTask();
  476. UpdateList();
  477. }
  478. else
  479. {
  480. Debug.LogError("489有问题");
  481. }
  482. }
  483. //检查是否达到提交要求
  484. private bool InspectionTasks()
  485. {
  486. bool isTarged = true;
  487. for (int k = 0; k < MergeGameArray.Instance.GetCfg(taskId).targetIdArr.Length; k++)
  488. {
  489. int targetID = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][0];
  490. int targetNum = MergeGameArray.Instance.GetCfg(taskId).targetIdArr[k][1];
  491. int currentNum = 0;
  492. for (int i = 0; i < itemNum; i++)
  493. {
  494. for (int j = 0; j < itemNum; j++)
  495. {
  496. if (idList[i][j] == targetID)
  497. {
  498. currentNum++;
  499. if (currentNum == targetNum)
  500. {
  501. break;
  502. }
  503. }
  504. }
  505. if (currentNum == targetNum)
  506. {
  507. break;
  508. }
  509. }
  510. if (currentNum == targetNum && isTarged)
  511. {
  512. isTarged = true;
  513. }
  514. else
  515. {
  516. isTarged = false;
  517. }
  518. }
  519. return isTarged;
  520. }
  521. private void ShowNewMaterialView(int i ,int j)
  522. {
  523. //判断是否是新材料。再显示
  524. if(MiniGameDateManager.Instance.NewItemIdDic.ContainsKey(idList[i][j]))
  525. {
  526. if(MiniGameDateManager.Instance.NewItemIdDic[idList[i][j]]!= 1)
  527. {
  528. return;
  529. }
  530. }
  531. _ui.m_newMaterial.target.x = itemList[i][j].x + _ui.m_rangeDown.x;
  532. _ui.m_newMaterial.target.y = itemList[i][j].y + _ui.m_rangeDown.y;
  533. _ui.m_newMaterial.target.visible = true;
  534. _ui.m_newMaterial.target.GetChild("icon").icon = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, idList[i][j]).resName,"MergeGame");
  535. UI_MergeGameItemUI itemUI = UI_MergeGameItemUI.Proxy(_ui.m_newMaterial.target);
  536. itemUI.m_t0.Play();
  537. UI_MergeGameItemUI.ProxyEnd();
  538. }
  539. private void OnClickHideTips()
  540. {
  541. if(_ui.m_newMaterial.target.visible == true)
  542. {
  543. _ui.m_newMaterial.target.visible = false;
  544. }
  545. }
  546. private void ShowMergeRouteTips()
  547. {
  548. ViewManager.Show<MergeGameMaterialTipView>(new object[]{ _res });
  549. }
  550. private void ShowShopBtn()
  551. {
  552. ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_EXCHANGE, ConstStoreSubId.STORE_ACTIVITY_EXCHANGE });
  553. }
  554. private void UpdateItemData()
  555. {
  556. _ui.m_btnProp.target.visible = false;
  557. //ItemCfg itemcfg = ItemCfgArray.Instance.GetCfg(propID);
  558. //_ui.m_btnProp.target.icon = ResPathUtil.GetIconPath(itemcfg.res,"png");
  559. //ItemData item;
  560. //if (BagDataManager.Instance.GetBagData().TryGetValue(propID, out item))
  561. //{
  562. // _ui.m_btnProp.target.title = item.num.ToString();
  563. //}
  564. //else
  565. //{
  566. // _ui.m_btnProp.target.title = "0";
  567. //}
  568. }
  569. private void OnItemTips()
  570. {
  571. object[] sourceDatas = new object[] { propID, null };
  572. GoodsItemTipsController.ShowItemTips(propID, sourceDatas);
  573. }
  574. private void CheckGuide(object param)
  575. {
  576. if (GuideDataManager.IsGuideFinish(ConstGuideId.FIELD) <= 0)
  577. {
  578. UpdateCheckGuide(null);
  579. }
  580. else
  581. {
  582. Timers.inst.Remove(CheckGuide);
  583. }
  584. }
  585. protected void UpdateCheckGuide(object param)
  586. {
  587. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  588. GuideController.TryGuide(guideDouBaoBtn, ConstGuideId.FIELD, 1, "点击豆包按钮获取材料!");
  589. GuideController.TryGuide(guideAfuBtn, ConstGuideId.FIELD, 2, "点击阿福按钮获取材料!");
  590. GuideController.TryGuide(null, ConstGuideId.FIELD, 3, "拖拽相同材料进行合成!", -1, true, _ui.target.height - 600);
  591. GuideController.TryGuide(_ui.m_rewardGet, ConstGuideId.FIELD, 4, "提交对应材料获得物品!");
  592. GuideController.TryCompleteGuide(ConstGuideId.FIELD, 5);
  593. }
  594. }
  595. }