MainUIView.cs 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036
  1. using FairyGUI;
  2. using UI.Main;
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. using ET;
  6. using System;
  7. using System.Linq;
  8. using UI.CommonGame;
  9. namespace GFGGame
  10. {
  11. public class MainUIView : BaseView
  12. {
  13. private UI_MainUI _ui;
  14. private GameObject _scenePrefab;
  15. private GameObject _sceneObject;
  16. private ValueBarController _valueBarController;
  17. private SwipeGesture swipeGesture;
  18. private const int swipeDistance = 100;
  19. private bool isOpen = false;
  20. private int _actLuckyBoxId = 0;
  21. private int _actLimitChargeId = 0;
  22. private List<AdCfg> _adIds = new List<AdCfg>();
  23. private Vector2 _startPos;
  24. private Vector2 _endPos;
  25. private GButton _btnGongGao;
  26. private GButton _btnHaoYou;
  27. private GButton _btnYouJian;
  28. private GButton _btnRenWu;
  29. private GButton _btnPengYouQuan;
  30. private GButton _btnJInShu;
  31. private GButton _btnTianGong;
  32. private GButton _btnLeague;
  33. private GButton _btnStore;
  34. private GButton _btnTuJian;
  35. private GButton _btnStudio;
  36. private GButton _btnField;
  37. private GButton _btnBag;
  38. private GButton _btnActivityDay7;
  39. private GameObject _effectObj4;
  40. private GoWrapper _wrapper4;
  41. private GameObject _effectObj4_1;
  42. private GoWrapper _wrapper4_1;
  43. private GameObject _effectObj5;
  44. private GoWrapper _wrapper5;
  45. private GameObject _effectObj6;
  46. private GoWrapper _wrapper6;
  47. private GameObject _effectObj7;
  48. private GoWrapper _wrapper7;
  49. private List<GameObject> _effects = new List<GameObject>();
  50. private List<GoWrapper> _wrappers = new List<GoWrapper>();
  51. private List<GameObject> _effects1 = new List<GameObject>();
  52. private List<GoWrapper> _wrappers1 = new List<GoWrapper>();
  53. private UI_ButtonModle1[] _btns;
  54. public override void Dispose()
  55. {
  56. if (_valueBarController != null)
  57. {
  58. _valueBarController.Dispose();
  59. _valueBarController = null;
  60. }
  61. for (int i = 0; i < _effects.Count; i++)
  62. {
  63. SceneController.DestroyObjectFromView(_effects[i], _wrappers[i]);
  64. SceneController.DestroyObjectFromView(_effects1[i], _wrappers1[i]);
  65. }
  66. SceneController.DestroyObjectFromView(_effectObj4, _wrapper4);
  67. SceneController.DestroyObjectFromView(_effectObj4_1, _wrapper4_1);
  68. SceneController.DestroyObjectFromView(_effectObj5, _wrapper5);
  69. if (_sceneObject != null)
  70. {
  71. GameObject.Destroy(_sceneObject);
  72. _sceneObject = null;
  73. }
  74. if (_ui != null)
  75. {
  76. _ui.Dispose();
  77. _ui = null;
  78. }
  79. base.Dispose();
  80. }
  81. protected override void Init()
  82. {
  83. base.Init();
  84. packageName = UI_MainUI.PACKAGE_NAME;
  85. _ui = UI_MainUI.Create();
  86. viewCom = _ui.target;
  87. isfullScreen = true;
  88. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneMain"));
  89. }
  90. protected override void OnInit()
  91. {
  92. base.OnInit();
  93. _valueBarController = new ValueBarController(_ui.m_valueBar);
  94. _btnGongGao = _ui.m_list.GetChild("btnGongGao").asButton;
  95. _btnHaoYou = _ui.m_list.GetChild("btnHaoYou").asButton;
  96. _btnYouJian = _ui.m_list.GetChild("btnYouJian").asButton;
  97. _btnRenWu = _ui.m_list.GetChild("btnRenWu").asButton;
  98. _btnPengYouQuan = _ui.m_list.GetChild("btnPengYouQuan").asButton;
  99. _btnLeague = _ui.m_list.GetChild("btnLeague").asButton;
  100. _btnStore = _ui.m_list.GetChild("btnStore").asButton;
  101. _btnTianGong = _ui.m_list.GetChild("btnTianGong").asButton;
  102. _btnTuJian = _ui.m_list.GetChild("btnTuJian").asButton;
  103. _btnJInShu = _ui.m_list.GetChild("btnJInShu").asButton;
  104. // _btnStudio = _ui.m_list.GetChild("btnStudio").asButton;
  105. // _btnField = _ui.m_list.GetChild("btnField").asButton;
  106. _btnBag = _ui.m_list.GetChild("btnBag").asButton;
  107. _btnActivityDay7 = _ui.m_btnActivityDay7.target;
  108. // _btnGongGao.visible = false;
  109. // _btnHaoYou.visible = false;
  110. // _btnRenWu.visible = false;
  111. _btnPengYouQuan.visible = false;
  112. _btnJInShu.visible = false;
  113. _btnTianGong.visible = false;
  114. _btns = new UI_ButtonModle1[] { _ui.m_btnHuanZhuang, _ui.m_btnZhaiXing, _ui.m_btnXiuFang, _ui.m_btnCiPai };
  115. _ui.m_btnMain.target.onClick.Add(OnClickBtnMain);
  116. _ui.m_btnHuanZhuang.target.onClick.Add(OnClickBtnHuanZhuang);
  117. _ui.m_btnZhaiXing.target.onClick.Add(OnClickBtnZhaiXing);
  118. // _ui.m_btnDailyLogin.target.onClick.Add(OnClickBtnDailyLogin);
  119. _ui.m_btnXiuFang.target.onClick.Add(OnClickBtnXiuFang);
  120. _ui.m_btnCiPai.target.onClick.Add(OnClickBtnCiPai);
  121. _ui.m_btnStudio.target.onClick.Add(OnClickBtnStudio);
  122. _ui.m_btnField.target.onClick.Add(OnClickBtnField);
  123. _ui.m_headBar.target.onClick.Add(OnClickHeadBar);
  124. _ui.m_btnPoem.target.onClick.Add(OnClickBtnPoem);
  125. _ui.m_btnArena.target.onClick.Add(OnClickBtnArena);
  126. _ui.m_btnTravel.target.onClick.Add(OnClickBtnTravel);
  127. _ui.m_btnDailyWelfare.target.onClick.Add(OnClickBtnDailyWelfare);
  128. _ui.m_btnActivityLuckyBox.target.onClick.Add(OnClickBtnActivityLuckyBox);
  129. _btnLeague.onClick.Add(OnClickBtnLeague);
  130. _btnStore.onClick.Add(OnClickBtnStore);
  131. _btnTuJian.onClick.Add(OnClickBtnTuJian);
  132. _btnYouJian.onClick.Add(OnClickBtnYouJian);
  133. _btnHaoYou.onClick.Add(OnClickBtnHaoYou);
  134. _btnGongGao.onClick.Add(OnClickBtnGongGao);
  135. _btnRenWu.onClick.Add(OnClickBtnRenWu);
  136. _btnActivityDay7.onClick.Add(OnClickBtnDay7);
  137. _ui.m_btnFirstRecharge.target.onClick.Add(OnClickBtnFirstRecharge);
  138. // _btnStudio.onClick.Add(OnClickBtnStudio);
  139. // _btnField.onClick.Add(OnClickBtnField);
  140. _btnBag.onClick.Add(OnClickBtnBag);
  141. _ui.m_btnGiftBag1.target.onClick.Add(OnClickBtnGiftBag2);
  142. _ui.m_btnGiftBag2.target.onClick.Add(OnClickBtnGiftBag1);
  143. _ui.m_loaRight.target.onClick.Add(MoveLeft);
  144. _ui.m_loaLeft.target.onClick.Add(MoveRight);
  145. _ui.m_comListAd.m_listAd.itemRenderer = RenderListAdItem;
  146. _ui.m_comListAd.m_listAd.SetVirtualAndLoop();
  147. _ui.m_comListAd.m_listAd.scrollPane.onScrollEnd.Add(OnListAdScrollEnd);
  148. _ui.m_comListAd.m_listAd.scrollPane.decelerationRate = 0.8f;
  149. swipeGesture = new SwipeGesture(_ui.target);
  150. swipeGesture.onAction.Add(OnSwipe);
  151. swipeGesture.onBegin.Add(OnSwipeBegin);
  152. swipeGesture.onEnd.Add(OnSwipeEnd);
  153. swipeGesture.actionDistance = swipeDistance;
  154. _ui.m_list.ResizeToFit();
  155. _ui.m_btnChange.target.onClick.Add(OnBtnChangClick);
  156. _ui.m_btnChange.m_c1.selectedIndex = 1;
  157. _ui.m_btnChange.target.selected = true;
  158. GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.OPEN_TAGS);
  159. // StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_GUIDE + cfg.id, 0).Coroutine();
  160. // StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_GUIDE + cfg.id, 1).Coroutine();
  161. AddEffect();
  162. }
  163. protected override void AddEventListener()
  164. {
  165. base.AddEventListener();
  166. EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, OnNumericChange);
  167. EventAgent.AddEventListener(ConstMessage.STORY_LEVEL_CHANGE, CheckFunOpen);
  168. EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  169. EventAgent.AddEventListener(ConstMessage.CHANGE_ROLE_HEAD, UpdateHead);
  170. }
  171. protected override void OnShown()
  172. {
  173. base.OnShown();
  174. MainDataManager.Instance.CanSwipe = false;
  175. GRoot.inst.touchable = false;
  176. _ui.m_loaGuidestudio.visible = true;
  177. _ui.m_headBar.m_txtName.text = RoleDataManager.roleName;
  178. if (_sceneObject == null)
  179. {
  180. _sceneObject = GameObject.Instantiate(_scenePrefab);
  181. }
  182. CheckFunOpen();
  183. UpdateRedDot();
  184. SceneController.UpdateMainScene(_sceneObject);
  185. UpdateRoleLvl();
  186. UpdateHead();
  187. UpdateBtnFirstRecharge();
  188. _valueBarController.OnShown();
  189. long lastTime =
  190. GameGlobal.lastLoginTime; // GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
  191. if (!TimeUtil.CheckIsSameTime(lastTime * 1000, TimeHelper.ClientNow()) &&
  192. ActivityDataManager.Instance.sevenDayLoginBonusStatus == ConstBonusStatus.CAN_GET &&
  193. GuideDataManager.currentGuideId <= 0)
  194. {
  195. ViewManager.Show<SevenDayLoginView>();
  196. GameGlobal.lastLoginTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
  197. }
  198. SetPos();
  199. GetAdIds();
  200. _ui.m_comListAd.target.visible = _ui.m_comListAd.m_listAd.numItems > 0;
  201. if (_ui.m_comListAd.target.visible)
  202. {
  203. Timers.inst.Remove(UpdateAdListTime);
  204. Timers.inst.Add(3, 0, UpdateAdListTime);
  205. }
  206. Timers.inst.Remove(Update);
  207. Timers.inst.Remove(CheckGuide);
  208. Timers.inst.AddUpdate(CheckGuide);
  209. Timers.inst.AddUpdate(Update);
  210. }
  211. protected override void OnHide()
  212. {
  213. base.OnHide();
  214. if (_sceneObject != null)
  215. {
  216. GameObject.Destroy(_sceneObject);
  217. _sceneObject = null;
  218. }
  219. _valueBarController.OnHide();
  220. Timers.inst.Remove(Update);
  221. Timers.inst.Remove(CheckGuide);
  222. Timers.inst.Remove(UpdateAdListTime);
  223. }
  224. protected override void RemoveEventListener()
  225. {
  226. base.RemoveEventListener();
  227. EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, OnNumericChange);
  228. EventAgent.RemoveEventListener(ConstMessage.STORY_LEVEL_CHANGE, CheckFunOpen);
  229. EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  230. EventAgent.RemoveEventListener(ConstMessage.CHANGE_ROLE_HEAD, UpdateHead);
  231. }
  232. private void AddEffect()
  233. {
  234. // string resPath0 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_xf_tx");
  235. // string resPath3 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_dj");
  236. // for (int i = 0; i < _btns.Length; i++)
  237. // {
  238. // GameObject gameObject0;
  239. // GoWrapper wrapper0;
  240. // GameObject gameObject1;
  241. // GoWrapper wrapper1;
  242. // SceneController.AddObjectToView(null, null, _btns[i].m_holder, resPath0, out gameObject0, out wrapper0);
  243. // SceneController.AddObjectToView(null, null, _btns[i].m_holder1, resPath3, out gameObject1, out wrapper1);
  244. // _effects.Add(gameObject0);
  245. // _wrappers.Add(wrapper0);
  246. // _effects1.Add(gameObject1);
  247. // _wrappers1.Add(wrapper1);
  248. // }
  249. string resPath1 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_zzl_d");
  250. string resPath3 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_zzl");
  251. SceneController.AddObjectToView(_effectObj4, _wrapper4, _ui.m_btnMain.m_holder, resPath1, out _effectObj4,
  252. out _wrapper4);
  253. SceneController.AddObjectToView(_effectObj4_1, _wrapper4_1, _ui.m_btnMain.m_holder1, resPath3,
  254. out _effectObj4_1, out _wrapper4_1);
  255. string resPath4 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_jt");
  256. SceneController.AddObjectToView(_effectObj6, _wrapper6, _ui.m_loaLeft.m_holder, resPath4, out _effectObj6,
  257. out _wrapper6);
  258. SceneController.AddObjectToView(_effectObj7, _wrapper7, _ui.m_loaRight.m_holder, resPath4, out _effectObj7,
  259. out _wrapper7);
  260. // string resPath2 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_tx");
  261. // SceneController.AddObjectToView(_effectObj5, _wrapper5, _ui.m_headBar.m_holder, resPath2, out _effectObj5, out _wrapper5);
  262. }
  263. private void SetPos()
  264. {
  265. GameObject Scene = _sceneObject.transform.Find("Scene").gameObject;
  266. GameObject Bg = _sceneObject.transform.Find("Bg").gameObject;
  267. GameObject Bg1 = _sceneObject.transform.Find("Bg1").gameObject;
  268. if (MainDataManager.Instance.ViewType == 0)
  269. {
  270. Scene.SetActive(true);
  271. Bg.SetActive(true);
  272. Bg1.SetActive(false);
  273. _ui.m_t3.Play();
  274. ;
  275. }
  276. else if (MainDataManager.Instance.ViewType == 1)
  277. {
  278. Scene.SetActive(false);
  279. Bg.SetActive(false);
  280. Bg1.SetActive(true);
  281. _ui.m_t4.Play();
  282. // _sceneObject.transform.position = new Vector2(-GRoot.inst.width / 100f, 0);
  283. }
  284. }
  285. private void OnSwipeBegin()
  286. {
  287. Vector2 pos = Input.mousePosition;
  288. pos.y = Screen.height - pos.y;
  289. _startPos = _ui.target.GlobalToLocal(pos);
  290. }
  291. private void OnSwipeEnd()
  292. {
  293. Vector2 pos = Input.mousePosition;
  294. pos.y = Screen.height - pos.y;
  295. _endPos = _ui.target.GlobalToLocal(pos);
  296. }
  297. private void OnSwipe(EventContext context)
  298. {
  299. if (!MainDataManager.Instance.CanSwipe) return;
  300. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.MAIN_SECOND_VIEW, false)) return;
  301. if (MainDataManager.Instance.ViewType == 0 && _ui.m_comListAd.m_listAd.numItems > 0//滚动广告区域不可切换页面
  302. && _startPos.x > _ui.m_comListAd.target.x && _startPos.x < (_ui.m_comListAd.target.x + _ui.m_comListAd.target.width)
  303. && _startPos.y > _ui.m_comListAd.target.y && _startPos.y < (_ui.m_comListAd.target.y + _ui.m_comListAd.target.height)) return;
  304. // || _endPos.x < (_ui.m_comListAd.target.x + _ui.m_comListAd.target.width)
  305. // && _endPos.y > _ui.m_comListAd.target.y && _endPos.y < (_ui.m_comListAd.target.y + _ui.m_comListAd.target.height))
  306. SwipeGesture swipeture = (SwipeGesture)context.sender;
  307. if (MainDataManager.Instance.ViewType == 0 && swipeture.position.x < 0 &&
  308. swipeture.position.y < -swipeture.position.x && swipeture.position.y > swipeture.position.x)
  309. {
  310. MoveLeft();
  311. }
  312. else if (MainDataManager.Instance.ViewType == 1 && swipeture.position.x > 0 &&
  313. swipeture.position.y > -swipeture.position.x && swipeture.position.y < swipeture.position.x)
  314. {
  315. MoveRight();
  316. }
  317. }
  318. private void MoveLeft()
  319. {
  320. _ui.target.touchable = false;
  321. TryCompleteGuide();
  322. Timers.inst.Add(0.5f, 1, ChangeSceneBg);
  323. _ui.m_t1.Play(() =>
  324. {
  325. _ui.target.touchable = true;
  326. MainDataManager.Instance.ViewType = 1;
  327. });
  328. }
  329. private void ChangeSceneBg(object param)
  330. {
  331. _sceneObject.transform.Find("Scene").gameObject.SetActive(false);
  332. _sceneObject.transform.Find("Bg").gameObject.SetActive(false);
  333. _sceneObject.transform.Find("Bg1").gameObject.SetActive(true);
  334. }
  335. private void MoveRight()
  336. {
  337. _ui.target.touchable = false;
  338. Timers.inst.Add(0.5f, 1, ChangeSceneBg1);
  339. _ui.m_t2.Play(() =>
  340. {
  341. _ui.target.touchable = true;
  342. MainDataManager.Instance.ViewType = 0;
  343. });
  344. }
  345. private void ChangeSceneBg1(object param)
  346. {
  347. _sceneObject.transform.Find("Scene").gameObject.SetActive(true);
  348. _sceneObject.transform.Find("Bg").gameObject.SetActive(true);
  349. _sceneObject.transform.Find("Bg1").gameObject.SetActive(false);
  350. }
  351. private void OnBtnChangClick()
  352. {
  353. int count = 0;
  354. for (int i = 0; i < _ui.m_list.numItems; i++)
  355. {
  356. if (_ui.m_list.GetChildAt(i).visible == true) count++;
  357. }
  358. int oneItemHeight = 97 + _ui.m_list.lineGap;
  359. float height = count * oneItemHeight;
  360. if (_ui.m_btnChange.target.selected == true)
  361. {
  362. _ui.m_btnChange.m_c1.selectedIndex = 1;
  363. GTween.To(_ui.m_list.height, height, 0.4f).SetTarget(_ui.m_list)
  364. .OnUpdate((GTweener t) => { _ui.m_list.height = t.value.x; }).SetEase(EaseType.QuintInOut);
  365. // _ui.m_list.ResizeToFit();
  366. // _ui.m_btnChange.m_c1.selectedIndex = 1;
  367. }
  368. else
  369. {
  370. _ui.m_btnChange.m_c1.selectedIndex = 0;
  371. GTween.To(_ui.m_list.height, oneItemHeight, 0.4f).SetTarget(_ui.m_list)
  372. .OnUpdate((GTweener t) => { _ui.m_list.height = t.value.x; }).SetEase(EaseType.QuintInOut);
  373. // _ui.m_list.height = 0;
  374. // _ui.m_btnChange.m_c1.selectedIndex = 0;
  375. }
  376. }
  377. private void OnClickBtnMain()
  378. {
  379. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 1);
  380. if (isOpen) return;
  381. isOpen = true;
  382. // _ui.m_btnMain.m_holder1.visible = true;
  383. // Timers.inst.Add(effectTime, 1, (param) =>
  384. // {
  385. // _ui.m_btnMain.m_holder1.visible = false;
  386. // this.Hide();
  387. ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW, null,
  388. new object[] { ViewName.MAINUI_VIEW, this.viewData });
  389. isOpen = false;
  390. ;
  391. // });
  392. }
  393. private void OnClickBtnHuanZhuang()
  394. {
  395. if (isOpen) return;
  396. isOpen = true;
  397. _ui.m_btnHuanZhuang.m_holder1.visible = true;
  398. // Timers.inst.Add(effectTime, 1, (param) =>
  399. // {
  400. _ui.m_btnHuanZhuang.m_holder1.visible = false;
  401. this.Hide();
  402. ViewManager.Show(ViewName.DRESS_UP_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  403. isOpen = false;
  404. // });
  405. }
  406. private void OnClickBtnZhaiXing()
  407. {
  408. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZAI_XING, 1);
  409. if (isOpen) return;
  410. isOpen = true;
  411. _ui.m_btnZhaiXing.m_holder1.visible = true;
  412. // Timers.inst.Add(effectTime, 1, (param) =>
  413. // {
  414. _ui.m_btnZhaiXing.m_holder1.visible = false;
  415. ViewManager.Show(ViewName.LUCKY_BOX_VIEW, null, null, false, true);
  416. isOpen = false;
  417. // });
  418. }
  419. private void OnClickBtnXiuFang()
  420. {
  421. if (isOpen) return;
  422. isOpen = true;
  423. _ui.m_btnXiuFang.m_holder1.visible = true;
  424. // Timers.inst.Add(effectTime, 1, (param) =>
  425. // {
  426. _ui.m_btnXiuFang.m_holder1.visible = false;
  427. ViewManager.Show(ViewName.XIU_FANG_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  428. isOpen = false;
  429. // });
  430. }
  431. private void OnClickBtnDailyLogin()
  432. {
  433. // if (isOpen) return;
  434. // isOpen = true;
  435. // _ui.m_btnDailyLogin.m_holder.visible = true;
  436. // Timers.inst.Add(effectTime, 1, (param) =>
  437. // {
  438. // _ui.m_btnDailyLogin.m_holder.visible = false;
  439. // List<string> list = new List<string>();
  440. // list.Add("StudioView");
  441. // list.Add("XiuFangView");
  442. // ViewManager.Show<FunctionOpenView>(list);
  443. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_DNEG_LU, 1);
  444. ViewManager.Show<SevenDayLoginView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  445. // isOpen = false;
  446. // });
  447. }
  448. private void OnClickBtnDailyWelfare()
  449. {
  450. // if (isOpen) return;
  451. // isOpen = true;
  452. // _ui.m_btnDailyLogin.m_holder.visible = true;
  453. // Timers.inst.Add(effectTime, 1, (param) =>
  454. // {
  455. // _ui.m_btnDailyLogin.m_holder.visible = false;
  456. // List<string> list = new List<string>();
  457. // list.Add("StudioView");
  458. // list.Add("XiuFangView");
  459. // ViewManager.Show<FunctionOpenView>(list);
  460. // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_DNEG_LU, 1);
  461. ViewManager.Show<DailyWelfareView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  462. // isOpen = false;
  463. // });
  464. }
  465. private void OnClickBtnActivityLuckyBox()
  466. {
  467. ViewManager.Show<ActivityThemeLuckyBoxView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData },
  468. true);
  469. }
  470. private void OnClickBtnCiPai()
  471. {
  472. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CI_PAI, 1);
  473. if (isOpen) return;
  474. isOpen = true;
  475. _ui.m_btnCiPai.m_holder1.visible = true;
  476. // Timers.inst.Add(effectTime, 1, (param) =>
  477. // {
  478. _ui.m_btnCiPai.m_holder1.visible = false;
  479. CardDataManager.isFilter = false;
  480. ViewManager.Show(ViewName.CARD_DETAIL_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  481. isOpen = false;
  482. // });
  483. }
  484. private void OnClickBtnStudio()
  485. {
  486. ViewManager.Show<StudioView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  487. }
  488. private void OnClickBtnField()
  489. {
  490. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.TIAN_YE_DIAO_CHA, 1);
  491. ViewManager.Show<FieldView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  492. }
  493. private void OnClickBtnPoem()
  494. {
  495. // LogServerHelper.SendNodeLog((int)PlayParticipationEnum.TIAN_YE_DIAO_CHA, 1);
  496. ViewManager.Show<PoemView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  497. }
  498. private void OnClickBtnArena()
  499. {
  500. // LogServerHelper.SendNodeLog((int)PlayParticipationEnum.TIAN_YE_DIAO_CHA, 1);
  501. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ArenaView).Name))
  502. {
  503. return;
  504. }
  505. if (!ArenaDataManager.Instance.IsSeasonOpen)
  506. {
  507. PromptController.Instance.ShowFloatTextPrompt("赛季未开始");
  508. return;
  509. }
  510. ViewManager.Show<ArenaView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData }, true);
  511. ViewManager.Show<ArenaLoadingView>();
  512. }
  513. private void OnClickBtnTravel()
  514. {
  515. // LogServerHelper.SendNodeLog((int)PlayParticipationEnum.TIAN_YE_DIAO_CHA, 1);
  516. ViewManager.Show<TravelView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  517. }
  518. private void OnClickBtnBag()
  519. {
  520. ViewManager.Show<BagView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  521. }
  522. private void OnClickBtnLeague()
  523. {
  524. // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 1);
  525. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(LeagueView).Name)) return;
  526. // if (LeagueDataManager.Instance.Type == 0)
  527. // {
  528. // PromptController.Instance.ShowFloatTextPrompt("数据来的有点慢,稍后再试下吧");
  529. // return;
  530. // }
  531. if (LeagueDataManager.Instance.Type == 1) //已加入联盟
  532. {
  533. ViewManager.Show<LeagueView>();
  534. }
  535. else //未加入联盟
  536. {
  537. ViewManager.Show<LeagueJoinView>();
  538. }
  539. }
  540. private void OnClickBtnStore()
  541. {
  542. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 1);
  543. ViewManager.Show<StoreView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  544. }
  545. private void OnClickBtnTuJian()
  546. {
  547. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.TU_JIAN, 1);
  548. ViewManager.Show(ViewName.FIELD_GUIDE_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  549. }
  550. private void OnClickBtnYouJian()
  551. {
  552. ViewManager.Show<MailView>();
  553. }
  554. private void OnClickBtnHaoYou()
  555. {
  556. ViewManager.Show<FriendView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData }, true);
  557. }
  558. private void OnClickBtnGongGao()
  559. {
  560. // /null, new object[] { ViewName.MAINUI_VIEW, this.viewData }
  561. ViewManager.Show<NoticeView>();
  562. }
  563. private void OnClickBtnRenWu()
  564. {
  565. ViewManager.Show<TaskView>(null, new[] { ViewName.MAINUI_VIEW, this.viewData });
  566. // ViewManager.Show<ActivityDay7View>(null, new[] { ViewName.MAINUI_VIEW, this.viewData });
  567. // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_REN_WU, 1);
  568. // ViewManager.Show<DailyTaskView>();
  569. }
  570. private void OnClickBtnDay7()
  571. {
  572. ViewManager.Show<ActivityDay7View>(null, new[] { ViewName.MAINUI_VIEW, this.viewData });
  573. }
  574. private void OnClickBtnFirstRecharge()
  575. {
  576. ViewManager.Show<FirstChargeBonusView>();
  577. }
  578. private void OnClickHeadBar()
  579. {
  580. ViewManager.Show(ViewName.ROLE_INFO_VIEW);
  581. }
  582. //列表
  583. private void OnClickBtnGiftBag1()
  584. {
  585. var activityInfoByTypeList =
  586. ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB1);
  587. var list = activityInfoByTypeList
  588. .Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
  589. if (list.Count == 0)
  590. {
  591. PromptController.Instance.ShowFloatTextPrompt("活动已结束");
  592. }
  593. else
  594. {
  595. ViewManager.Show<SpecialOfferGiftBoxView>();
  596. }
  597. }
  598. //圆形
  599. private void OnClickBtnGiftBag2()
  600. {
  601. var activityInfoByTypeList =
  602. ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB2);
  603. var list = activityInfoByTypeList
  604. .Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
  605. if (list.Count == 0)
  606. {
  607. PromptController.Instance.ShowFloatTextPrompt("活动已结束");
  608. }
  609. else
  610. {
  611. ViewManager.Show<RushSaleGiftBoxView>(new object[] { ActivityType.XSLB2, this.viewData });
  612. }
  613. }
  614. private void UpGiftBox1()
  615. {
  616. var activityInfoByTypeList =
  617. ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB1);
  618. var list = activityInfoByTypeList
  619. .Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
  620. if (list.Count == 0)
  621. {
  622. _ui.m_btnGiftBag1.target.visible = false;
  623. }
  624. else
  625. {
  626. _ui.m_btnGiftBag1.m_txtTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].EndTime);
  627. _ui.m_btnGiftBag1.target.visible = true;
  628. }
  629. }
  630. private void UpGiftBox2()
  631. {
  632. var activityInfoByTypeList =
  633. ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB2);
  634. var list = activityInfoByTypeList
  635. .Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
  636. if (list.Count == 0)
  637. {
  638. _ui.m_btnGiftBag2.target.visible = false;
  639. }
  640. else
  641. {
  642. _ui.m_btnGiftBag2.m_txtTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].EndTime);
  643. _ui.m_btnGiftBag2.target.visible = true;
  644. }
  645. }
  646. private void Update(object param)
  647. {
  648. ShowExitAlert();
  649. int actLuckyBoxId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitLuckyBox);
  650. _ui.m_btnActivityLuckyBox.target.visible = actLuckyBoxId > 0;
  651. if (actLuckyBoxId > 0)
  652. {
  653. if (actLuckyBoxId != _actLuckyBoxId)
  654. {
  655. ActivitySProxy.ReqGetTimeLimitLuckyBoxInfo(actLuckyBoxId).Coroutine();
  656. _actLuckyBoxId = actLuckyBoxId;
  657. }
  658. ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(actLuckyBoxId);
  659. _ui.m_btnActivityLuckyBox.target.title = activityOpenCfg.themeName;
  660. _ui.m_btnActivityLuckyBox.target.icon = "ui://Main/zjm_tb_" + activityOpenCfg.res;
  661. long time = TimeUtil.DateTimeToTimestamp(activityOpenCfg.endTime) - TimeHelper.ServerNow();
  662. _ui.m_btnActivityLuckyBox.m_txtTime.text = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time);
  663. }
  664. List<int> actListChargeIds = ActivityGlobalDataManager.Instance.GetActivityInfoIdsByType(ConstLimitTimeActivityType.ActLimitChargeId);
  665. int actLimitChargeId = actListChargeIds.Count > 0 ? actListChargeIds[0] : 0;
  666. if (_actLimitChargeId != actLimitChargeId)
  667. {
  668. ActivityDataManager.Instance.actLimitChargeId = actLimitChargeId;
  669. _ui.m_btnDailyWelfare.target.visible = actLimitChargeId > 0 ||
  670. FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DailyWelfareView).Name, false) && (
  671. FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DailySignView).Name, false) ||
  672. FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DailySupplyView).Name, false) ||
  673. !(!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(SevenDayLoginView).Name, false) ||
  674. (ActivityDataManager.Instance.sevenDayLoginLoginId >= 7 && ActivityDataManager.Instance.sevenDayLoginBonusStatus == ConstBonusStatus.GOT)));
  675. }
  676. _ui.m_btnActivityDay7.target.visible = ActivityDay7DataManager.Instance.CheckOpen();
  677. if (_ui.m_btnActivityDay7.target.visible)
  678. {
  679. long time = ActivityDay7DataManager.Instance.GetEndTime() - TimeHelper.ServerNow();
  680. _ui.m_btnActivityDay7.m_txtTime.text = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time);
  681. }
  682. //特惠礼包/限时礼包窗口内的倒计时
  683. UpGiftBox1();
  684. UpGiftBox2();
  685. if (ViewManager.isViewOpen(nameof(SpecialOfferGiftBoxView)))
  686. {
  687. var specialOfferGiftBoxView =
  688. ViewManager.GetUIView(nameof(SpecialOfferGiftBoxView)) as SpecialOfferGiftBoxView;
  689. specialOfferGiftBoxView?.UpTime();
  690. }
  691. if (ViewManager.isViewOpen(nameof(RushSaleGiftBoxView)))
  692. {
  693. var rushSaleGiftBoxView =
  694. ViewManager.GetUIView(nameof(RushSaleGiftBoxView)) as RushSaleGiftBoxView;
  695. rushSaleGiftBoxView?.UpTime();
  696. }
  697. }
  698. private void ShowExitAlert()
  699. {
  700. if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
  701. {
  702. AlertSystem.Show("我会想你的")
  703. .SetLeftButton(true, "继续游戏")
  704. .SetRightButton(true, "退出游戏", (object data) => { Application.Quit(); });
  705. }
  706. }
  707. private void OnNumericChange(EventContext context)
  708. {
  709. var numericType = (int)context.data;
  710. if (numericType == NumericType.Lvl)
  711. {
  712. UpdateRoleLvl();
  713. CheckFunOpen();
  714. }
  715. if (numericType == NumericType.FirstRechargeBonusStatus || numericType == NumericType.RechargeTotal)
  716. {
  717. UpdateBtnFirstRecharge();
  718. }
  719. }
  720. private void UpdateBtnFirstRecharge()
  721. {
  722. _ui.m_btnFirstRecharge.target.visible = ActivityDataManager.Instance.firstChargeBonusStatus != ConstBonusStatus.GOT;
  723. if (_ui.m_btnFirstRecharge.target.visible)
  724. {
  725. bool canget = ActivityDataManager.Instance.firstChargeBonusStatus == ConstBonusStatus.CAN_GET;
  726. RedDotController.Instance.SetComRedDot(_ui.m_btnFirstRecharge.target, canget);
  727. }
  728. }
  729. private void UpdateRoleLvl()
  730. {
  731. _ui.m_headBar.m_txtLvl.text = "" + GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  732. }
  733. private void UpdateHead()
  734. {
  735. RoleInfoManager.Instance.UpdateHead(_ui.m_headBar.m_comHead, RoleDataManager.headId,
  736. RoleDataManager.headBorderId);
  737. }
  738. /// <summary>
  739. /// 获取当前开启的滚动广告列表
  740. /// </summary>
  741. private void GetAdIds()
  742. {
  743. _adIds.Clear();
  744. for (int i = 0; i < AdCfgArray.Instance.dataArray.Length; i++)
  745. {
  746. AdCfg adCfg = AdCfgArray.Instance.dataArray[i];
  747. if (adCfg.activityId > 0 && ActivityGlobalDataManager.Instance.GetActivityInfo(adCfg.activityId) == null) continue;
  748. if (!string.IsNullOrEmpty(adCfg.startTime) && !string.IsNullOrEmpty(adCfg.endTime))
  749. {
  750. long startTime = TimeUtil.DateTimeToTimestamp(adCfg.startTime);
  751. long endTime = TimeUtil.DateTimeToTimestamp(adCfg.endTime);
  752. if (TimeHelper.ServerNow() < startTime || TimeHelper.ServerNow() > endTime) continue;
  753. }
  754. _adIds.Add(adCfg);
  755. }
  756. _ui.m_comListAd.m_listAd.numItems = _adIds.Count;
  757. _ui.m_comListAd.m_listAdSelect.numItems = _adIds.Count;
  758. if (_ui.m_comListAd.m_listAd.numItems > 0)
  759. {
  760. _ui.m_comListAd.m_listAd.ScrollToView(0);
  761. _ui.m_comListAd.m_listAdSelect.selectedIndex = 0;
  762. }
  763. }
  764. private void UpdateAdListTime(object param)
  765. {
  766. int itemIndex = _ui.m_comListAd.m_listAd.ChildIndexToItemIndex(0) + 1;
  767. itemIndex = itemIndex == _ui.m_comListAd.m_listAd.numItems ? 0 : itemIndex;
  768. _ui.m_comListAd.m_listAdSelect.selectedIndex = itemIndex;
  769. _ui.m_comListAd.m_listAd.scrollPane.ScrollRight(0.8f, true);
  770. }
  771. private void RenderListAdItem(int index, GObject obj)
  772. {
  773. UI_ListAdItem item = UI_ListAdItem.Proxy(obj);
  774. item.m_loaRes.url = "ui://Main/guanggao_" + _adIds[index].res;
  775. if (item.m_loaRes.data == null)
  776. {
  777. item.m_loaRes.onClick.Add(OnBtnAdJump);
  778. }
  779. item.m_loaRes.data = _adIds[index].jumpId;
  780. UI_ListAdItem.ProxyEnd();
  781. }
  782. private void OnBtnAdJump(EventContext context)
  783. {
  784. string jumpId = (context.sender as GObject).data.ToString();
  785. ViewManager.Show($"GFGGame.{jumpId}");
  786. }
  787. private void OnListAdScrollEnd()
  788. {
  789. int itemIndex = _ui.m_comListAd.m_listAd.ChildIndexToItemIndex(0);
  790. _ui.m_comListAd.m_listAdSelect.selectedIndex = itemIndex;
  791. }
  792. private void CheckFunOpen()
  793. {
  794. _ui.m_btnXiuFang.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(XiuFangView).Name, false);
  795. _ui.m_btnHuanZhuang.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DressUpView).Name, false);
  796. _ui.m_btnCiPai.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(CardDetailView).Name, false);
  797. _ui.m_btnZhaiXing.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(LuckyBoxView).Name, false);
  798. _ui.m_btnMain.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StoryChapterListView).Name, false);
  799. _ui.m_btnStudio.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioView).Name, false);
  800. _ui.m_btnField.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FieldView).Name, false);
  801. _ui.m_btnPoem.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(PoemView).Name, false);
  802. _ui.m_btnTravel.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(TravelView).Name, false);
  803. _ui.m_btnArena.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ArenaView).Name, false);
  804. _ui.m_btnActivityLuckyBox.target.visible = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitLuckyBox) > 0;
  805. // _ui.m_btnDailyLogin.target.visible = !(!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(SevenDayLoginView).Name, false)
  806. // || (ActivityDataManager.Instance.sevenDayLoginLoginId >= 7 && ActivityDataManager.Instance.sevenDayLoginBonusStatus == ConstBonusStatus.GOT));
  807. List<int> actListChargeIds = ActivityGlobalDataManager.Instance.GetActivityInfoIdsByType(ConstLimitTimeActivityType.ActLimitChargeId);
  808. int actLimitChargeId = actListChargeIds.Count > 0 ? actListChargeIds[0] : 0;
  809. // int actLimitChargeId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitChargeId);
  810. _ui.m_btnDailyWelfare.target.visible = actLimitChargeId > 0 ||
  811. FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DailyWelfareView).Name, false) && (
  812. FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DailySignView).Name, false) ||
  813. FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DailySupplyView).Name, false) ||
  814. !(!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(SevenDayLoginView).Name, false) ||
  815. (ActivityDataManager.Instance.sevenDayLoginLoginId >= 7 && ActivityDataManager.Instance.sevenDayLoginBonusStatus == ConstBonusStatus.GOT)));
  816. _btnGongGao.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(NoticeView).Name, false);
  817. _btnHaoYou.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FriendView).Name, false);
  818. _btnYouJian.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(MailView).Name, false);
  819. _btnLeague.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(LeagueView).Name, false);
  820. _btnStore.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StoreView).Name, false);
  821. _btnTuJian.visible =
  822. FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FieldGuideView).Name, false);
  823. _btnActivityDay7.visible = ActivityDay7DataManager.Instance.CheckOpen();
  824. }
  825. private void UpdateRedDot()
  826. {
  827. RedDotController.Instance.SetComRedDot(_btnGongGao, RedDotDataManager.Instance.GetNoticeRed());
  828. RedDotController.Instance.SetComRedDot(_btnRenWu, RedDotDataManager.Instance.GetTaskRed());
  829. // RedDotController.Instance.SetComRedDot(_ui.m_btnDailyLogin.target,
  830. // RedDotDataManager.Instance.GetDailyLoginRed());
  831. RedDotController.Instance.SetComRedDot(_btnYouJian, RedDotDataManager.Instance.GetMailRed());
  832. RedDotController.Instance.SetComRedDot(_btnTuJian,
  833. RedDotDataManager.Instance.GetFieldGuideRed() || RedDotDataManager.Instance.GetTravelGuideRed());
  834. RedDotController.Instance.SetComRedDot(_btnHaoYou, RedDotDataManager.Instance.GetFriendRed());
  835. RedDotController.Instance.SetComRedDot(_btnStore, RedDotDataManager.Instance.GetChargeAddUpReward());
  836. RedDotController.Instance.SetComRedDot(_ui.m_btnField.target, RedDotDataManager.Instance.GetFieldRed(), "",
  837. 10);
  838. RedDotController.Instance.SetComRedDot(_ui.m_btnStudio.target,
  839. RedDotDataManager.Instance.GetStudioFilingRed(), "", -38);
  840. RedDotController.Instance.SetComRedDot(_ui.m_headBar.target,
  841. RedDotDataManager.Instance.GetHeadRed() || RedDotDataManager.Instance.GetHeadBorderRed(), "", 5, 7);
  842. RedDotController.Instance.SetComRedDot(_ui.m_btnTravel.target, RedDotDataManager.Instance.GetTravelRed(),
  843. "", -38);
  844. }
  845. private void CheckGuide(object param)
  846. {
  847. MainDataManager.Instance.CanSwipe = true;
  848. GRoot.inst.touchable = true;
  849. if (GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0
  850. || GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_DECOMPOSE) <= 0
  851. || GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_SYNTHETIC) <= 0
  852. || GuideDataManager.IsGuideFinish(ConstGuideId.UP_CARD_LV) <= 0
  853. || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER) <= 0
  854. || GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_FILING) <= 0
  855. || GuideDataManager.IsGuideFinish(ConstGuideId.FIELD) <= 0
  856. || GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_METAL) <= 0
  857. || GuideDataManager.IsGuideFinish(ConstGuideId.SUIT_LIST_VIEW) <= 0)
  858. {
  859. UpdateToCheckGuide(null);
  860. }
  861. else
  862. {
  863. _ui.m_loaGuidestudio.visible = false;
  864. Timers.inst.Remove(CheckGuide);
  865. }
  866. }
  867. protected override void UpdateToCheckGuide(object param)
  868. {
  869. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  870. if (MainDataManager.Instance.ViewType == 0)
  871. {
  872. GuideController.TryGuide(_ui.m_btnHuanZhuang.target, ConstGuideId.FREEDOM_DRESS, 2, "在这里,自由搭配服饰和分享哦~", -1, false);
  873. GuideController.TryGuide(_ui.m_btnMain.target, ConstGuideId.ENTER_CHAPTER, 3, "海市蜃楼,镜花水月,是所有故事开始的地方。", -1, false);
  874. GuideController.TryGuide(_ui.m_btnXiuFang.target, ConstGuideId.CLOTHING_DECOMPOSE, 2, "绣坊里增添了新功能。", -1, false);
  875. GuideController.TryGuide(_ui.m_btnXiuFang.target, ConstGuideId.CLOTHING_SYNTHETIC, 1, "进入绣坊界面。", -1, false);
  876. GuideController.TryCompleteGuide(ConstGuideId.CLOTHING_SYNTHETIC, 7);
  877. GuideController.TryGuide(_ui.m_btnCiPai.target, ConstGuideId.UP_CARD_LV, 2, "“词牌”可进行升级和管理。", -1, false);
  878. GuideController.TryGuide(_ui.m_btnXiuFang.target, ConstGuideId.SUIT_LIST_VIEW, 1,
  879. "获得“天衣”服饰后,可进行养护和焕新,到绣坊看看。");
  880. bool isStudioMetalGuide = GuideController.TryGuide(null, ConstGuideId.STUDIO_METAL, 2, "向左滑动界面。", -1,
  881. false, _ui.target.height - 700);
  882. bool isStudioFilingGuide = GuideController.TryGuide(null, ConstGuideId.STUDIO_FILING, 2, "向左滑动界面。", -1,
  883. false, _ui.target.height - 700);
  884. bool isFieldGuide = GuideController.TryGuide(null, ConstGuideId.FIELD, 1, "向左滑动界面。", -1, false,
  885. _ui.target.height - 700);
  886. if (isStudioMetalGuide || isStudioFilingGuide || isFieldGuide)
  887. {
  888. _ui.m_loaGuidestudio.visible = true;
  889. MainDataManager.Instance.CanSwipe = true;
  890. }
  891. else
  892. {
  893. _ui.m_loaGuidestudio.visible = false;
  894. }
  895. }
  896. if (MainDataManager.Instance.ViewType == 1)
  897. {
  898. _ui.m_loaGuidestudio.visible = false;
  899. GuideController.TryGuide(_ui.m_btnStudio.target, ConstGuideId.STUDIO_METAL, 3, "工作室开门啦,进去看看~");
  900. GuideController.TryGuide(_ui.m_btnStudio.target, ConstGuideId.STUDIO_FILING, 3, "工作室有新的任务啦。");
  901. GuideController.TryGuide(_ui.m_btnField.target, ConstGuideId.FIELD, 2, "外出进行历史考察,会有意想不到的收获哦。");
  902. }
  903. }
  904. }
  905. }