MainUIView.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. using FairyGUI;
  2. using UI.Main;
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. using ET;
  6. using System;
  7. using UI.CommonGame;
  8. namespace GFGGame
  9. {
  10. public class MainUIView : BaseView
  11. {
  12. private UI_MainUI _ui;
  13. private GameObject _scenePrefab;
  14. private GameObject _sceneObject;
  15. private ValueBarController _valueBarController;
  16. private SwipeGesture swipeGesture;
  17. private const int swipeDistance = 100;
  18. private bool isOpen = false;
  19. private GButton _btnGongGao;
  20. private GButton _btnHaoYou;
  21. private GButton _btnYouJian;
  22. private GButton _btnRenWu;
  23. private GButton _btnPengYouQuan;
  24. private GButton _btnJInShu;
  25. private GButton _btnTianGong;
  26. private GButton _btnLeague;
  27. private GButton _btnStore;
  28. private GButton _btnTuJian;
  29. private GButton _btnStudio;
  30. private GButton _btnField;
  31. private GButton _btnBag;
  32. private GameObject _effectObj4;
  33. private GoWrapper _wrapper4;
  34. private GameObject _effectObj4_1;
  35. private GoWrapper _wrapper4_1;
  36. private GameObject _effectObj5;
  37. private GoWrapper _wrapper5;
  38. private GameObject _effectObj6;
  39. private GoWrapper _wrapper6;
  40. private GameObject _effectObj7;
  41. private GoWrapper _wrapper7;
  42. private List<GameObject> _effects = new List<GameObject>();
  43. private List<GoWrapper> _wrappers = new List<GoWrapper>();
  44. private List<GameObject> _effects1 = new List<GameObject>();
  45. private List<GoWrapper> _wrappers1 = new List<GoWrapper>();
  46. private UI_ButtonModle1[] _btns;
  47. public override void Dispose()
  48. {
  49. if (_valueBarController != null)
  50. {
  51. _valueBarController.Dispose();
  52. _valueBarController = null;
  53. }
  54. for (int i = 0; i < _effects.Count; i++)
  55. {
  56. SceneController.DestroyObjectFromView(_effects[i], _wrappers[i]);
  57. SceneController.DestroyObjectFromView(_effects1[i], _wrappers1[i]);
  58. }
  59. SceneController.DestroyObjectFromView(_effectObj4, _wrapper4);
  60. SceneController.DestroyObjectFromView(_effectObj4_1, _wrapper4_1);
  61. SceneController.DestroyObjectFromView(_effectObj5, _wrapper5);
  62. if (_sceneObject != null)
  63. {
  64. GameObject.Destroy(_sceneObject);
  65. _sceneObject = null;
  66. }
  67. if (_ui != null)
  68. {
  69. _ui.Dispose();
  70. _ui = null;
  71. }
  72. base.Dispose();
  73. }
  74. protected override void Init()
  75. {
  76. base.Init();
  77. packageName = UI_MainUI.PACKAGE_NAME;
  78. _ui = UI_MainUI.Create();
  79. viewCom = _ui.target;
  80. isfullScreen = true;
  81. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneMain"));
  82. }
  83. protected override void OnInit()
  84. {
  85. base.OnInit();
  86. _valueBarController = new ValueBarController(_ui.m_valueBar);
  87. _btnGongGao = _ui.m_list.GetChild("btnGongGao").asButton;
  88. _btnHaoYou = _ui.m_list.GetChild("btnHaoYou").asButton;
  89. _btnYouJian = _ui.m_list.GetChild("btnYouJian").asButton;
  90. _btnRenWu = _ui.m_list.GetChild("btnRenWu").asButton;
  91. _btnPengYouQuan = _ui.m_list.GetChild("btnPengYouQuan").asButton;
  92. _btnLeague = _ui.m_list.GetChild("btnLeague").asButton;
  93. _btnStore = _ui.m_list.GetChild("btnStore").asButton;
  94. _btnTianGong = _ui.m_list.GetChild("btnTianGong").asButton;
  95. _btnTuJian = _ui.m_list.GetChild("btnTuJian").asButton;
  96. _btnJInShu = _ui.m_list.GetChild("btnJInShu").asButton;
  97. // _btnStudio = _ui.m_list.GetChild("btnStudio").asButton;
  98. // _btnField = _ui.m_list.GetChild("btnField").asButton;
  99. _btnBag = _ui.m_list.GetChild("btnBag").asButton;
  100. // _btnGongGao.visible = false;
  101. // _btnHaoYou.visible = false;
  102. // _btnRenWu.visible = false;
  103. _btnPengYouQuan.visible = false;
  104. _btnJInShu.visible = false;
  105. _btnTianGong.visible = false;
  106. _btns = new UI_ButtonModle1[] { _ui.m_btnHuanZhuang, _ui.m_btnZhaiXing, _ui.m_btnXiuFang, _ui.m_btnCiPai };
  107. _ui.m_btnMain.target.onClick.Add(OnClickBtnMain);
  108. _ui.m_btnHuanZhuang.target.onClick.Add(OnClickBtnHuanZhuang);
  109. _ui.m_btnZhaiXing.target.onClick.Add(OnClickBtnZhaiXing);
  110. _ui.m_btnDailyLogin.target.onClick.Add(OnClickBtnDailyLogin);
  111. _ui.m_btnXiuFang.target.onClick.Add(OnClickBtnXiuFang);
  112. _ui.m_btnCiPai.target.onClick.Add(OnClickBtnCiPai);
  113. _ui.m_btnStudio.target.onClick.Add(OnClickBtnStudio);
  114. _ui.m_btnField.target.onClick.Add(OnClickBtnField);
  115. _ui.m_headBar.target.onClick.Add(OnClickHeadBar);
  116. _ui.m_btnPoem.target.onClick.Add(OnClickBtnPoem);
  117. _ui.m_btnArena.target.onClick.Add(OnClickBtnArena);
  118. _ui.m_btnTravel.target.onClick.Add(OnClickBtnTravel);
  119. _ui.m_btnDailyWelfare.target.onClick.Add(OnClickBtnDailyWelfare);
  120. _btnLeague.onClick.Add(OnClickBtnLeague);
  121. _btnStore.onClick.Add(OnClickBtnStore);
  122. _btnTuJian.onClick.Add(OnClickBtnTuJian);
  123. _btnYouJian.onClick.Add(OnClickBtnYouJian);
  124. _btnHaoYou.onClick.Add(OnClickBtnHaoYou);
  125. _btnGongGao.onClick.Add(OnClickBtnGongGao);
  126. _btnRenWu.onClick.Add(OnClickBtnRenWu);
  127. // _btnStudio.onClick.Add(OnClickBtnStudio);
  128. // _btnField.onClick.Add(OnClickBtnField);
  129. _btnBag.onClick.Add(OnClickBtnBag);
  130. _ui.m_loaRight.target.onClick.Add(MoveLeft);
  131. _ui.m_loaLeft.target.onClick.Add(MoveRight);
  132. swipeGesture = new SwipeGesture(_ui.target);
  133. swipeGesture.onAction.Add(OnSwipe);
  134. swipeGesture.actionDistance = swipeDistance;
  135. _ui.m_list.ResizeToFit();
  136. _ui.m_btnChange.target.onClick.Add(OnBtnChangClick);
  137. _ui.m_btnChange.m_c1.selectedIndex = 1;
  138. _ui.m_btnChange.target.selected = true;
  139. GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.OPEN_TAGS);
  140. // StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_GUIDE + cfg.id, 0).Coroutine();
  141. // StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_GUIDE + cfg.id, 1).Coroutine();
  142. AddEffect();
  143. }
  144. protected override void AddEventListener()
  145. {
  146. base.AddEventListener();
  147. EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, OnNumericChange);
  148. EventAgent.AddEventListener(ConstMessage.STORY_LEVEL_CHANGE, CheckFunOpen);
  149. EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  150. EventAgent.AddEventListener(ConstMessage.CHANGE_ROLE_HEAD, UpdateHead);
  151. }
  152. protected override void OnShown()
  153. {
  154. base.OnShown();
  155. MainDataManager.Instance.CanSwipe = false;
  156. GRoot.inst.touchable = false;
  157. _ui.m_loaGuidestudio.visible = true;
  158. _ui.m_headBar.m_txtName.text = RoleDataManager.roleName;
  159. if (_sceneObject == null)
  160. {
  161. _sceneObject = GameObject.Instantiate(_scenePrefab);
  162. }
  163. CheckFunOpen();
  164. UpdateRedDot();
  165. SceneController.UpdateMainScene(_sceneObject);
  166. UpdateRoleLvl();
  167. UpdateHead();
  168. _valueBarController.OnShown();
  169. long lastTime = GameGlobal.lastLoginTime;// GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
  170. if (!TimeUtil.CheckIsSameTime(lastTime * 1000, TimeHelper.ClientNow()) && ActivityDataManager.Instance.sevenDayLoginBonusStatus == ConstBonusStatus.CAN_GET && GuideDataManager.currentGuideId <= 0)
  171. {
  172. ViewManager.Show<SevenDayLoginView>();
  173. GameGlobal.lastLoginTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
  174. }
  175. SetPos();
  176. Timers.inst.AddUpdate(CheckGuide);
  177. Timers.inst.AddUpdate(Update);
  178. }
  179. protected override void OnHide()
  180. {
  181. base.OnHide();
  182. if (_sceneObject != null)
  183. {
  184. GameObject.Destroy(_sceneObject);
  185. _sceneObject = null;
  186. }
  187. _valueBarController.OnHide();
  188. Timers.inst.Remove(Update);
  189. Timers.inst.Remove(CheckGuide);
  190. }
  191. protected override void RemoveEventListener()
  192. {
  193. base.RemoveEventListener();
  194. EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, OnNumericChange);
  195. EventAgent.RemoveEventListener(ConstMessage.STORY_LEVEL_CHANGE, CheckFunOpen);
  196. EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  197. EventAgent.RemoveEventListener(ConstMessage.CHANGE_ROLE_HEAD, UpdateHead);
  198. }
  199. private void AddEffect()
  200. {
  201. // string resPath0 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_xf_tx");
  202. // string resPath3 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_dj");
  203. // for (int i = 0; i < _btns.Length; i++)
  204. // {
  205. // GameObject gameObject0;
  206. // GoWrapper wrapper0;
  207. // GameObject gameObject1;
  208. // GoWrapper wrapper1;
  209. // SceneController.AddObjectToView(null, null, _btns[i].m_holder, resPath0, out gameObject0, out wrapper0);
  210. // SceneController.AddObjectToView(null, null, _btns[i].m_holder1, resPath3, out gameObject1, out wrapper1);
  211. // _effects.Add(gameObject0);
  212. // _wrappers.Add(wrapper0);
  213. // _effects1.Add(gameObject1);
  214. // _wrappers1.Add(wrapper1);
  215. // }
  216. string resPath1 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_zzl_d");
  217. string resPath3 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_zzl");
  218. SceneController.AddObjectToView(_effectObj4, _wrapper4, _ui.m_btnMain.m_holder, resPath1, out _effectObj4, out _wrapper4);
  219. SceneController.AddObjectToView(_effectObj4_1, _wrapper4_1, _ui.m_btnMain.m_holder1, resPath3, out _effectObj4_1, out _wrapper4_1);
  220. string resPath4 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_jt");
  221. SceneController.AddObjectToView(_effectObj6, _wrapper6, _ui.m_loaLeft.m_holder, resPath4, out _effectObj6, out _wrapper6);
  222. SceneController.AddObjectToView(_effectObj7, _wrapper7, _ui.m_loaRight.m_holder, resPath4, out _effectObj7, out _wrapper7);
  223. // string resPath2 = ResPathUtil.GetViewEffectPath("ui_zjm", "ui_zjm_tx");
  224. // SceneController.AddObjectToView(_effectObj5, _wrapper5, _ui.m_headBar.m_holder, resPath2, out _effectObj5, out _wrapper5);
  225. }
  226. private void SetPos()
  227. {
  228. GameObject Scene = _sceneObject.transform.Find("Scene").gameObject;
  229. GameObject Bg = _sceneObject.transform.Find("Bg").gameObject;
  230. GameObject Bg1 = _sceneObject.transform.Find("Bg1").gameObject;
  231. if (MainDataManager.Instance.ViewType == 0)
  232. {
  233. Scene.SetActive(true);
  234. Bg.SetActive(true);
  235. Bg1.SetActive(false);
  236. _ui.m_t3.Play(); ;
  237. }
  238. else if (MainDataManager.Instance.ViewType == 1)
  239. {
  240. Scene.SetActive(false);
  241. Bg.SetActive(false);
  242. Bg1.SetActive(true);
  243. _ui.m_t4.Play();
  244. // _sceneObject.transform.position = new Vector2(-GRoot.inst.width / 100f, 0);
  245. }
  246. }
  247. private void OnSwipe(EventContext context)
  248. {
  249. if (!MainDataManager.Instance.CanSwipe) return;
  250. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.MAIN_SECOND_VIEW, false)) return;
  251. SwipeGesture swipeture = (SwipeGesture)context.sender;
  252. if (MainDataManager.Instance.ViewType == 0 && swipeture.position.x < 0 && swipeture.position.y < -swipeture.position.x && swipeture.position.y > swipeture.position.x)
  253. {
  254. MoveLeft();
  255. }
  256. else if (MainDataManager.Instance.ViewType == 1 && swipeture.position.x > 0 && swipeture.position.y > -swipeture.position.x && swipeture.position.y < swipeture.position.x)
  257. {
  258. MoveRight();
  259. }
  260. }
  261. private void MoveLeft()
  262. {
  263. _ui.target.touchable = false;
  264. TryCompleteGuide();
  265. Timers.inst.Add(0.5f, 1, ChangeSceneBg);
  266. _ui.m_t1.Play(() =>
  267. {
  268. _ui.target.touchable = true;
  269. MainDataManager.Instance.ViewType = 1;
  270. });
  271. }
  272. private void ChangeSceneBg(object param)
  273. {
  274. _sceneObject.transform.Find("Scene").gameObject.SetActive(false);
  275. _sceneObject.transform.Find("Bg").gameObject.SetActive(false);
  276. _sceneObject.transform.Find("Bg1").gameObject.SetActive(true);
  277. }
  278. private void MoveRight()
  279. {
  280. _ui.target.touchable = false;
  281. Timers.inst.Add(0.5f, 1, ChangeSceneBg1);
  282. _ui.m_t2.Play(() =>
  283. {
  284. _ui.target.touchable = true;
  285. MainDataManager.Instance.ViewType = 0;
  286. });
  287. }
  288. private void ChangeSceneBg1(object param)
  289. {
  290. _sceneObject.transform.Find("Scene").gameObject.SetActive(true);
  291. _sceneObject.transform.Find("Bg").gameObject.SetActive(true);
  292. _sceneObject.transform.Find("Bg1").gameObject.SetActive(false);
  293. }
  294. private void OnBtnChangClick()
  295. {
  296. int count = 0;
  297. for (int i = 0; i < _ui.m_list.numItems; i++)
  298. {
  299. if (_ui.m_list.GetChildAt(i).visible == true) count++;
  300. }
  301. int oneItemHeight = 97 + _ui.m_list.lineGap;
  302. float height = count * oneItemHeight;
  303. if (_ui.m_btnChange.target.selected == true)
  304. {
  305. _ui.m_btnChange.m_c1.selectedIndex = 1;
  306. GTween.To(_ui.m_list.height, height, 0.4f).SetTarget(_ui.m_list)
  307. .OnUpdate((GTweener t) =>
  308. {
  309. _ui.m_list.height = t.value.x;
  310. }).SetEase(EaseType.QuintInOut);
  311. // _ui.m_list.ResizeToFit();
  312. // _ui.m_btnChange.m_c1.selectedIndex = 1;
  313. }
  314. else
  315. {
  316. _ui.m_btnChange.m_c1.selectedIndex = 0;
  317. GTween.To(_ui.m_list.height, oneItemHeight, 0.4f).SetTarget(_ui.m_list)
  318. .OnUpdate((GTweener t) =>
  319. {
  320. _ui.m_list.height = t.value.x;
  321. }).SetEase(EaseType.QuintInOut);
  322. // _ui.m_list.height = 0;
  323. // _ui.m_btnChange.m_c1.selectedIndex = 0;
  324. }
  325. }
  326. private void OnClickBtnMain()
  327. {
  328. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 1);
  329. if (isOpen) return;
  330. isOpen = true;
  331. // _ui.m_btnMain.m_holder1.visible = true;
  332. // Timers.inst.Add(effectTime, 1, (param) =>
  333. // {
  334. // _ui.m_btnMain.m_holder1.visible = false;
  335. // this.Hide();
  336. ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  337. isOpen = false; ;
  338. // });
  339. }
  340. private void OnClickBtnHuanZhuang()
  341. {
  342. if (isOpen) return;
  343. isOpen = true;
  344. _ui.m_btnHuanZhuang.m_holder1.visible = true;
  345. // Timers.inst.Add(effectTime, 1, (param) =>
  346. // {
  347. _ui.m_btnHuanZhuang.m_holder1.visible = false;
  348. this.Hide();
  349. ViewManager.Show(ViewName.DRESS_UP_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  350. isOpen = false;
  351. // });
  352. }
  353. private void OnClickBtnZhaiXing()
  354. {
  355. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZAI_XING, 1);
  356. if (isOpen) return;
  357. isOpen = true;
  358. _ui.m_btnZhaiXing.m_holder1.visible = true;
  359. // Timers.inst.Add(effectTime, 1, (param) =>
  360. // {
  361. _ui.m_btnZhaiXing.m_holder1.visible = false;
  362. ViewManager.Show(ViewName.LUCKY_BOX_VIEW, null, null, false, true);
  363. isOpen = false;
  364. // });
  365. }
  366. private void OnClickBtnXiuFang()
  367. {
  368. if (isOpen) return;
  369. isOpen = true;
  370. _ui.m_btnXiuFang.m_holder1.visible = true;
  371. // Timers.inst.Add(effectTime, 1, (param) =>
  372. // {
  373. _ui.m_btnXiuFang.m_holder1.visible = false;
  374. ViewManager.Show(ViewName.XIU_FANG_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  375. isOpen = false;
  376. // });
  377. }
  378. private void OnClickBtnDailyLogin()
  379. {
  380. // if (isOpen) return;
  381. // isOpen = true;
  382. _ui.m_btnDailyLogin.m_holder.visible = true;
  383. // Timers.inst.Add(effectTime, 1, (param) =>
  384. // {
  385. // _ui.m_btnDailyLogin.m_holder.visible = false;
  386. // List<string> list = new List<string>();
  387. // list.Add("StudioView");
  388. // list.Add("XiuFangView");
  389. // ViewManager.Show<FunctionOpenView>(list);
  390. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_DNEG_LU, 1);
  391. ViewManager.Show<SevenDayLoginView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  392. // isOpen = false;
  393. // });
  394. }
  395. private void OnClickBtnDailyWelfare()
  396. {
  397. // if (isOpen) return;
  398. // isOpen = true;
  399. // _ui.m_btnDailyLogin.m_holder.visible = true;
  400. // Timers.inst.Add(effectTime, 1, (param) =>
  401. // {
  402. // _ui.m_btnDailyLogin.m_holder.visible = false;
  403. // List<string> list = new List<string>();
  404. // list.Add("StudioView");
  405. // list.Add("XiuFangView");
  406. // ViewManager.Show<FunctionOpenView>(list);
  407. // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_DNEG_LU, 1);
  408. ViewManager.Show<DailyWelfareView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  409. // isOpen = false;
  410. // });
  411. }
  412. private void OnClickBtnCiPai()
  413. {
  414. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CI_PAI, 1);
  415. if (isOpen) return;
  416. isOpen = true;
  417. _ui.m_btnCiPai.m_holder1.visible = true;
  418. // Timers.inst.Add(effectTime, 1, (param) =>
  419. // {
  420. _ui.m_btnCiPai.m_holder1.visible = false;
  421. CardDataManager.isFilter = false;
  422. ViewManager.Show(ViewName.CARD_DETAIL_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  423. isOpen = false;
  424. // });
  425. }
  426. private void OnClickBtnStudio()
  427. {
  428. ViewManager.Show<StudioView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  429. }
  430. private void OnClickBtnField()
  431. {
  432. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.TIAN_YE_DIAO_CHA, 1);
  433. ViewManager.Show<FieldView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  434. }
  435. private void OnClickBtnPoem()
  436. {
  437. // LogServerHelper.SendNodeLog((int)PlayParticipationEnum.TIAN_YE_DIAO_CHA, 1);
  438. ViewManager.Show<PoemView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  439. }
  440. private void OnClickBtnArena()
  441. {
  442. // LogServerHelper.SendNodeLog((int)PlayParticipationEnum.TIAN_YE_DIAO_CHA, 1);
  443. if (!ArenaDataManager.Instance.IsSeasonOpen)
  444. {
  445. PromptController.Instance.ShowFloatTextPrompt("赛季未开始");
  446. return;
  447. }
  448. if (FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ArenaView).Name))
  449. {
  450. ViewManager.Show<ArenaView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData }, true);
  451. ViewManager.Show<ArenaLoadingView>();
  452. }
  453. }
  454. private void OnClickBtnTravel()
  455. {
  456. // LogServerHelper.SendNodeLog((int)PlayParticipationEnum.TIAN_YE_DIAO_CHA, 1);
  457. ViewManager.Show<TravelView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  458. }
  459. private void OnClickBtnBag()
  460. {
  461. ViewManager.Show<BagView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  462. }
  463. private void OnClickBtnLeague()
  464. {
  465. // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 1);
  466. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(LeagueView).Name)) return;
  467. // if (LeagueDataManager.Instance.Type == 0)
  468. // {
  469. // PromptController.Instance.ShowFloatTextPrompt("数据来的有点慢,稍后再试下吧");
  470. // return;
  471. // }
  472. if (LeagueDataManager.Instance.Type == 1)//已加入联盟
  473. {
  474. ViewManager.Show<LeagueView>();
  475. }
  476. else//未加入联盟
  477. {
  478. ViewManager.Show<LeagueJoinView>();
  479. }
  480. }
  481. private void OnClickBtnStore()
  482. {
  483. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 1);
  484. ViewManager.Show<StoreView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  485. }
  486. private void OnClickBtnTuJian()
  487. {
  488. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.TU_JIAN, 1);
  489. ViewManager.Show(ViewName.FIELD_GUIDE_VIEW, null, new object[] { ViewName.MAINUI_VIEW, this.viewData });
  490. }
  491. private void OnClickBtnYouJian()
  492. {
  493. ViewManager.Show<MailView>();
  494. }
  495. private void OnClickBtnHaoYou()
  496. {
  497. ViewManager.Show<FriendView>(null, new object[] { ViewName.MAINUI_VIEW, this.viewData }, true);
  498. }
  499. private void OnClickBtnGongGao()
  500. {
  501. // /null, new object[] { ViewName.MAINUI_VIEW, this.viewData }
  502. ViewManager.Show<NoticeView>();
  503. }
  504. private void OnClickBtnRenWu()
  505. {
  506. ViewManager.Show<TaskView>(null, new[] { ViewName.MAINUI_VIEW, this.viewData });
  507. // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_REN_WU, 1);
  508. // ViewManager.Show<DailyTaskView>();
  509. }
  510. private void OnClickHeadBar()
  511. {
  512. ViewManager.Show(ViewName.ROLE_INFO_VIEW);
  513. }
  514. private void Update(object param)
  515. {
  516. ShowExitAlert();
  517. }
  518. private void ShowExitAlert()
  519. {
  520. if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
  521. {
  522. AlertSystem.Show("我会想你的")
  523. .SetLeftButton(true, "继续游戏")
  524. .SetRightButton(true, "退出游戏", (object data) =>
  525. {
  526. Application.Quit();
  527. });
  528. }
  529. }
  530. private void OnNumericChange(EventContext context)
  531. {
  532. if ((int)context.data == NumericType.Lvl)
  533. {
  534. UpdateRoleLvl();
  535. CheckFunOpen();
  536. }
  537. }
  538. private void UpdateRoleLvl()
  539. {
  540. _ui.m_headBar.m_txtLvl.text = "" + GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  541. }
  542. private void UpdateHead()
  543. {
  544. RoleInfoManager.Instance.UpdateHead(_ui.m_headBar.m_comHead, RoleDataManager.headId, RoleDataManager.headBorderId);
  545. }
  546. private void CheckFunOpen()
  547. {
  548. _ui.m_btnXiuFang.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(XiuFangView).Name, false);
  549. _ui.m_btnHuanZhuang.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DressUpView).Name, false);
  550. _ui.m_btnCiPai.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(CardDetailView).Name, false);
  551. _ui.m_btnZhaiXing.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(LuckyBoxView).Name, false);
  552. _ui.m_btnMain.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StoryChapterListView).Name, false);
  553. _ui.m_btnStudio.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioView).Name, false);
  554. _ui.m_btnField.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FieldView).Name, false);
  555. _ui.m_btnPoem.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(PoemView).Name, false);
  556. _ui.m_btnTravel.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(TravelView).Name, false);
  557. _ui.m_btnArena.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ArenaView).Name, false);
  558. _ui.m_btnDailyLogin.target.visible = !(!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(SevenDayLoginView).Name, false)
  559. || (ActivityDataManager.Instance.sevenDayLoginLoginId >= 7 && ActivityDataManager.Instance.sevenDayLoginBonusStatus == ConstBonusStatus.GOT));
  560. _ui.m_btnDailyWelfare.target.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DailyWelfareView).Name, false);
  561. _btnGongGao.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(NoticeView).Name, false);
  562. _btnHaoYou.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FriendView).Name, false);
  563. _btnYouJian.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(MailView).Name, false);
  564. _btnLeague.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(LeagueView).Name, false);
  565. _btnStore.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StoreView).Name, false);
  566. _btnTuJian.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FieldGuideView).Name, false);
  567. }
  568. private void UpdateRedDot()
  569. {
  570. RedDotController.Instance.SetComRedDot(_btnGongGao, RedDotDataManager.Instance.GetNoticeRed());
  571. RedDotController.Instance.SetComRedDot(_btnRenWu, RedDotDataManager.Instance.GetTaskRed());
  572. RedDotController.Instance.SetComRedDot(_ui.m_btnDailyLogin.target, RedDotDataManager.Instance.GetDailyLoginRed());
  573. RedDotController.Instance.SetComRedDot(_btnYouJian, RedDotDataManager.Instance.GetMailRed());
  574. RedDotController.Instance.SetComRedDot(_btnTuJian, RedDotDataManager.Instance.GetFieldGuideRed() || RedDotDataManager.Instance.GetTravelGuideRed());
  575. RedDotController.Instance.SetComRedDot(_btnHaoYou, RedDotDataManager.Instance.GetFriendRed());
  576. RedDotController.Instance.SetComRedDot(_btnStore, RedDotDataManager.Instance.GetChargeAddUpReward());
  577. RedDotController.Instance.SetComRedDot(_ui.m_btnField.target, RedDotDataManager.Instance.GetFieldRed(), "", 10);
  578. RedDotController.Instance.SetComRedDot(_ui.m_btnStudio.target, RedDotDataManager.Instance.GetStudioFilingRed(), "", -38);
  579. RedDotController.Instance.SetComRedDot(_ui.m_headBar.target, RedDotDataManager.Instance.GetHeadRed() || RedDotDataManager.Instance.GetHeadBorderRed(), "", 5, 7);
  580. RedDotController.Instance.SetComRedDot(_ui.m_btnTravel.target, RedDotDataManager.Instance.GetTravelRed(), "", -38);
  581. }
  582. private void CheckGuide(object param)
  583. {
  584. MainDataManager.Instance.CanSwipe = true;
  585. GRoot.inst.touchable = true;
  586. if (GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0
  587. || GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_DECOMPOSE) <= 0
  588. || GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_SYNTHETIC) <= 0
  589. || GuideDataManager.IsGuideFinish(ConstGuideId.UP_CARD_LV) <= 0
  590. || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER) <= 0
  591. || GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_FILING) <= 0
  592. || GuideDataManager.IsGuideFinish(ConstGuideId.FIELD) <= 0
  593. || GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_METAL) <= 0
  594. || GuideDataManager.IsGuideFinish(ConstGuideId.SUIT_LIST_VIEW) <= 0)
  595. {
  596. UpdateToCheckGuide(null);
  597. }
  598. else
  599. {
  600. _ui.m_loaGuidestudio.visible = false;
  601. Timers.inst.Remove(CheckGuide);
  602. }
  603. }
  604. protected override void UpdateToCheckGuide(object param)
  605. {
  606. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  607. if (MainDataManager.Instance.ViewType == 0)
  608. {
  609. GuideController.TryGuide(_ui.m_btnHuanZhuang.target, ConstGuideId.FREEDOM_DRESS, 2, "在这里,自由搭配服饰和分享哦~", -1, false);
  610. GuideController.TryGuide(_ui.m_btnMain.target, ConstGuideId.ENTER_CHAPTER, 3, "海市蜃楼,镜花水月,是所有故事开始的地方。", -1, false);
  611. GuideController.TryGuide(_ui.m_btnXiuFang.target, ConstGuideId.CLOTHING_DECOMPOSE, 2, "绣坊里增添了新功能。", -1, false);
  612. GuideController.TryGuide(_ui.m_btnXiuFang.target, ConstGuideId.CLOTHING_SYNTHETIC, 1, "进入绣坊界面。", -1, false);
  613. GuideController.TryCompleteGuide(ConstGuideId.CLOTHING_SYNTHETIC, 7);
  614. GuideController.TryGuide(_ui.m_btnCiPai.target, ConstGuideId.UP_CARD_LV, 2, "“词牌”可进行升级和管理。", -1, false);
  615. GuideController.TryGuide(_ui.m_btnXiuFang.target, ConstGuideId.SUIT_LIST_VIEW, 1, "获得“天衣”服饰后,可进行养护和焕新,到绣坊看看。");
  616. bool isStudioMetalGuide = GuideController.TryGuide(null, ConstGuideId.STUDIO_METAL, 2, "向左滑动界面。", -1, false, _ui.target.height - 700);
  617. bool isStudioFilingGuide = GuideController.TryGuide(null, ConstGuideId.STUDIO_FILING, 2, "向左滑动界面。", -1, false, _ui.target.height - 700);
  618. bool isFieldGuide = GuideController.TryGuide(null, ConstGuideId.FIELD, 1, "向左滑动界面。", -1, false, _ui.target.height - 700);
  619. if (isStudioMetalGuide || isStudioFilingGuide || isFieldGuide)
  620. {
  621. _ui.m_loaGuidestudio.visible = true;
  622. MainDataManager.Instance.CanSwipe = true;
  623. }
  624. else
  625. {
  626. _ui.m_loaGuidestudio.visible = false;
  627. }
  628. }
  629. if (MainDataManager.Instance.ViewType == 1)
  630. {
  631. _ui.m_loaGuidestudio.visible = false;
  632. GuideController.TryGuide(_ui.m_btnStudio.target, ConstGuideId.STUDIO_METAL, 3, "工作室开门啦,进去看看~");
  633. GuideController.TryGuide(_ui.m_btnStudio.target, ConstGuideId.STUDIO_FILING, 3, "工作室有新的任务啦。");
  634. GuideController.TryGuide(_ui.m_btnField.target, ConstGuideId.FIELD, 2, "外出进行历史考察,会有意想不到的收获哦。");
  635. }
  636. }
  637. }
  638. }