ManaSign.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System;
  4. using System.Xml;
  5. using System.Linq;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using Random = UnityEngine.Random;
  9. public class Sign
  10. {
  11. #region 变量
  12. public int Coin
  13. {
  14. get
  15. {
  16. if (RoundBuff.Equal(-1))
  17. {
  18. return Coin_;
  19. }
  20. else
  21. {
  22. return (int)(Coin_*RoundBuff*ManaSign.SignRound);
  23. }
  24. }
  25. set { Coin_ = value; }
  26. }
  27. public int Diamond
  28. {
  29. get
  30. {
  31. if (RoundBuff.Equal(-1))
  32. {
  33. return Diamond_;
  34. }
  35. else
  36. {
  37. return (int)(Diamond_ * RoundBuff * ManaSign.SignRound);
  38. }
  39. }
  40. set { Diamond_ = value; }
  41. }
  42. public int Coin_;
  43. public int Diamond_;
  44. public float RoundBuff;
  45. public bool IsLottery;
  46. public Text Lab1;
  47. public Text Lab2;
  48. public Image Icon;
  49. public Image Mark;
  50. public Vector2 OriginSize;
  51. public List<int> FlowerList = new List<int>();
  52. #endregion
  53. public Sign(int index, Transform tra, XmlAttributeCollection attribute)
  54. {
  55. Dictionary<string, Transform> dic = new Dictionary<string, Transform>();
  56. Auxiliary.CompileDic(tra, dic);
  57. Lab1 = dic["Lab1"].GetComponent<Text>();
  58. Lab2 = dic["Lab2"].GetComponent<Text>();
  59. Icon = dic["Icon1"].GetComponent<Image>();
  60. Mark = dic["Icon2"].GetComponent<Image>();
  61. OriginSize = Icon.rectTransform.sizeDelta;
  62. Lab2.text = index.ToString();
  63. Coin = Auxiliary.IntParse(attribute[4].Value, 0);
  64. IsLottery = Auxiliary.BoolParse(attribute[1].Value, false);
  65. Diamond = Auxiliary.IntParse(attribute[3].Value, 0);
  66. FlowerList = Auxiliary.IntListParse(',', attribute[2].Value, new List<int>());
  67. RoundBuff = Auxiliary.FloatParse(attribute[5].Value, -1);
  68. SetUI();
  69. }
  70. public void Get()
  71. {
  72. if (IsLottery)
  73. {
  74. Lottery.EnterAnimation(true);
  75. return;
  76. }
  77. ManaAudio.PlayClip(Clip.CurrentClip);
  78. Mark.SetActive(true);
  79. ResetSign();
  80. ManaReso.SetActive("Bb_Get", false);
  81. ManaReso.SetActive("Bb_Rotate", true);
  82. ManaReso.SetActive("Bb_Confirm", true);
  83. if (FlowerList.Valid())
  84. {
  85. for (int i = 0; i < FlowerList.Count; i++)
  86. {
  87. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[FlowerList[i]];
  88. if (flowerInfo.Unlock == false)
  89. {
  90. ManaReso.SetText("Bb_InfoLabA", flowerInfo.Name);
  91. ManaReso.SetActive("Bb_IconA", true);
  92. ManaReso.SetSprite("Bb_IconA0", flowerInfo.Icon);
  93. ManaReso.Get<Image>("Bb_IconA0").Resize(true, 0.8125f, 0.8125f);
  94. flowerInfo.Add();
  95. return;
  96. }
  97. }
  98. }
  99. if (Diamond > 0)
  100. {
  101. ManaReso.SetText("Bb_InfoLabB", Diamond.ToString());
  102. ManaReso.SetSprite("Bb_IconB", ManaReso.LoadSprite("钻石", Folder.UI));
  103. ManaReso.SetActive("Bb_IconB", true);
  104. ManaCenter.AddDiamond(Diamond, StaticsManager.ItemID.获得钻石, StaticsManager.ConsumeModule.Checkin);
  105. }
  106. else if (Coin > 0)
  107. {
  108. ManaReso.SetText("Bb_InfoLabB", Coin.ToString());
  109. ManaReso.SetSprite("Bb_IconB", ManaReso.LoadSprite("金币", Folder.UI));
  110. ManaReso.SetActive("Bb_IconB", true);
  111. ManaCenter.AddCoin(Coin, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.Checkin);
  112. }
  113. else
  114. {
  115. throw new Exception();
  116. }
  117. }
  118. public void SetUI()
  119. {
  120. if (IsLottery)
  121. {
  122. Icon.sprite = ManaReso.LoadSprite("礼包", Folder.Atlas);
  123. Icon.Resize(true, 0.3f, 0.3f);
  124. return;
  125. }
  126. if (FlowerList.Valid())
  127. {
  128. for (int i = 0; i < FlowerList.Count; i++)
  129. {
  130. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[FlowerList[i]];
  131. if (flowerInfo.Unlock == false)
  132. {
  133. Icon.sprite = flowerInfo.Icon;
  134. Icon.Resize(true, 0.1875f, 0.1875f);
  135. return;
  136. }
  137. }
  138. }
  139. if (Diamond > 0)
  140. {
  141. Icon.sprite = ManaReso.LoadSprite("钻石", Folder.UI);
  142. Icon.Resize(false, OriginSize);
  143. Lab1.text = Diamond.ToString();
  144. }
  145. else if (Coin > 0)
  146. {
  147. Icon.sprite = ManaReso.LoadSprite("金币", Folder.UI);
  148. Icon.Resize(false, OriginSize);
  149. Lab1.text = Coin.ToString();
  150. }
  151. }
  152. public static void ResetSign()
  153. {
  154. ManaSign.SignTime = ManaServer.Time;
  155. ManaSign.SignIndex++;
  156. if (ManaSign.SignIndex == 22)
  157. {
  158. ManaSign.SignIndex = 1;
  159. ManaSign.SignRound++;
  160. ManaReso.Get("B_SignIn").GetTweenCG().AddEventOnetime
  161. (
  162. EventType.BackwardFinish,
  163. () =>
  164. {
  165. foreach (var kv in ManaSign.SignDic)
  166. {
  167. kv.Value.SetUI();
  168. kv.Value.Mark.SetActive(false);
  169. }
  170. }
  171. );
  172. }
  173. }
  174. }
  175. public class Lottery
  176. {
  177. #region Var
  178. public int PosIndex;
  179. public int Type;
  180. public int Value;
  181. public Text Lab;
  182. public Image Icon1;
  183. public Image Icon2;
  184. public Image Icon3;
  185. public Button Button;
  186. public Transform BK;
  187. public Transform Item;
  188. public static bool ResetSign = false;
  189. public static List<int> TempTypeList = new List<int>();
  190. public static List<int> TempValueList = new List<int>();
  191. public static List<Lottery> TempLotteryList = new List<Lottery>();
  192. public static List<int> TypeList = new List<int>();
  193. public static List<float> RateList = new List<float>();
  194. public static List<Vector3> PosList = new List<Vector3>();
  195. public static List<List<int>> LeftBorderDList = new List<List<int>>();
  196. public static List<List<int>> RightBorderDList = new List<List<int>>();
  197. #endregion
  198. public static void Configure(List<XmlAttributeCollection> attributeList)
  199. {
  200. PosList.Add(ManaReso.Get("Bc_LotteryItem1").position);
  201. PosList.Add(ManaReso.Get("Bc_LotteryItem2").position);
  202. PosList.Add(ManaReso.Get("Bc_LotteryItem3").position);
  203. for (int i = 0; i < attributeList.Count; i++)
  204. {
  205. RateList.Add((float) Auxiliary.FmlParse(attributeList[i][2].Value));
  206. TypeList.Add((int) Auxiliary.FmlParse(attributeList[i][1].Value));
  207. List<string> leftBorderStrList = Auxiliary.StringListParse(',', attributeList[i][3].Value, null);
  208. List<string> rightBorderStrList = Auxiliary.StringListParse(',', attributeList[i][4].Value, null);
  209. List<int> leftBorderList = new List<int>();
  210. List<int> rightBorderList = new List<int>();
  211. for (int j = 0; j < leftBorderStrList.Count; j++)
  212. {
  213. leftBorderList.Add((int)Auxiliary.FmlParse(leftBorderStrList[j], "l", (ManaCenter.Level+1).ToString()));
  214. rightBorderList.Add((int)Auxiliary.FmlParse(rightBorderStrList[j], "l", (ManaCenter.Level+1).ToString()));
  215. }
  216. LeftBorderDList.Add(leftBorderList);
  217. RightBorderDList.Add(rightBorderList);
  218. }
  219. }
  220. public static Lottery CreateLottery(int type, int posIndex, Transform lotteryItem)
  221. {
  222. Lottery lottery = new Lottery();
  223. lottery.Type = type;
  224. lottery.Value = Random.Range(LeftBorderDList[0][0], RightBorderDList[0][0] + 1);
  225. if (lottery.Type == 3)
  226. {
  227. #region
  228. List<int> flowerIDs = new List<int>();
  229. for (int j = 0; j < LeftBorderDList[type - 1].Count; j++)
  230. {
  231. for (int k = LeftBorderDList[type - 1][j]; k < RightBorderDList[type - 1][j] + 1; k++)
  232. {
  233. if (!TempValueList.Contains(k))
  234. {
  235. flowerIDs.Add(k);
  236. }
  237. }
  238. }
  239. lottery.Value = Award.SelectAwardFlowerID(flowerIDs);
  240. TempValueList.Add(lottery.Value);
  241. #endregion
  242. }
  243. else if (lottery.Type == 4)
  244. {
  245. #region
  246. bool allBought = true;
  247. for (int j = 0; j < LeftBorderDList[type - 1].Count; j++)
  248. {
  249. for (int k = LeftBorderDList[type - 1][j]; k < RightBorderDList[type - 1][j] + 1; k++)
  250. {
  251. if (!ManaPlayer.CloseUnitDic[k].Bought && !TempValueList.Contains(k))
  252. {
  253. allBought = false;
  254. goto exit;
  255. }
  256. }
  257. }
  258. exit :
  259. if (allBought)
  260. {
  261. int index = Random.Range(0, LeftBorderDList[type - 1].Count);
  262. lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
  263. CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
  264. lottery.Value = (int) closeUnit.BuyAmt/5;
  265. if (closeUnit.BuyCurrent == Current.Coin)
  266. {
  267. lottery.Type = 1;
  268. }
  269. else if (closeUnit.BuyCurrent == Current.Diamond)
  270. {
  271. lottery.Type = 2;
  272. }
  273. }
  274. else
  275. {
  276. int anticrush = 0;
  277. do
  278. {
  279. if (anticrush++ > 10000)
  280. {
  281. throw new Exception();
  282. }
  283. int index = Random.Range(0, LeftBorderDList[type - 1].Count);
  284. lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
  285. } while (ManaPlayer.CloseUnitDic[lottery.Value].Bought || TempValueList.Contains(lottery.Value));
  286. TempValueList.Add(lottery.Value);
  287. }
  288. #endregion
  289. }
  290. else
  291. {
  292. int index = Random.Range(0, LeftBorderDList[type - 1].Count);
  293. lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
  294. }
  295. lottery.PosIndex = posIndex;
  296. lottery.Item = lotteryItem;
  297. lottery.BK = lotteryItem.GetChild(0);
  298. lottery.Icon1 = lotteryItem.GetChild(1).GetChild(0).GetComponent<Image>();
  299. lottery.Icon2 = lotteryItem.GetChild(1).GetChild(1).GetComponent<Image>();
  300. lottery.Icon3 = lotteryItem.GetChild(1).GetChild(2).GetComponent<Image>();
  301. lottery.Lab = lotteryItem.GetChild(1).GetChild(3).GetComponent<Text>();
  302. lottery.Button = lotteryItem.GetChild(1).GetChild(4).GetComponent<Button>();
  303. lottery.BK.SetActive(false);
  304. if (lottery.Type == 1)
  305. {
  306. lottery.Icon1.SetActive(false);
  307. lottery.Icon3.SetActive(false);
  308. lottery.Icon2.sprite = ManaReso.LoadSprite("金币", Folder.UI);
  309. lottery.Icon2.Resize(true, 1, 1);
  310. lottery.Icon2.transform.localPosition = new Vector3(0, 7.5f, 0);
  311. lottery.Lab.SetActive(true);
  312. lottery.Lab.text = lottery.Value.ToString();
  313. }
  314. else if (lottery.Type == 2)
  315. {
  316. lottery.Icon1.SetActive(false);
  317. lottery.Icon3.SetActive(false);
  318. lottery.Icon2.sprite = ManaReso.LoadSprite("钻石", Folder.UI);
  319. lottery.Icon2.Resize(true, 1, 1);
  320. lottery.Icon2.transform.localPosition = new Vector3(0, 7.5f, 0);
  321. lottery.Lab.SetActive(true);
  322. lottery.Lab.text = lottery.Value.ToString();
  323. }
  324. else if (lottery.Type == 3)
  325. {
  326. lottery.Icon1.SetActive(false);
  327. lottery.Icon3.SetActive(false);
  328. lottery.Icon2.sprite = ManaGarden.FlowerInfoDic[lottery.Value].Icon;
  329. lottery.Icon2.Resize(true, 0.3125f, 0.3125f);
  330. lottery.Icon2.transform.localPosition = new Vector3();
  331. lottery.Lab.SetActive(false);
  332. }
  333. else if (lottery.Type == 4)
  334. {
  335. CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
  336. float newSize = closeUnit.PixelSize/closeUnit.Sprites[0].rect.width;
  337. closeUnit.SetUpUI(newSize, new Vector2(), lottery.Icon1, lottery.Icon3, lottery.Icon2);
  338. lottery.Lab.SetActive(false);
  339. //lottery.Icon2.sprite = closeUnit.Sprites[0];
  340. //lottery.Icon2.Resize(true, newSize, newSize);
  341. //lottery.Icon2.transform.localPosition = new Vector2(0, closeUnit.IconOffset);
  342. //lottery.Lab.SetActive(false);
  343. //if (closeUnit.Sprites.Length > 1)
  344. //{
  345. // lottery.Icon1.SetActive(true);
  346. // lottery.Icon1.sprite = closeUnit.Sprites[1];
  347. // lottery.Icon1.Resize(true, newSize, newSize);
  348. // lottery.Icon1.transform.localPosition = new Vector2(0, closeUnit.IconOffset) + closeUnit.IconOffset1*newSize;
  349. //}
  350. //else
  351. //{
  352. // lottery.Icon1.SetActive(false);
  353. //}
  354. }
  355. lottery.Button.onClick = new Button.ButtonClickedEvent();
  356. lottery.Button.onClick.AddListener(() => { OnClick(posIndex); });
  357. return lottery;
  358. }
  359. public static void EnterAnimation(bool resetSign)
  360. {
  361. ResetSign = resetSign;
  362. ManaReso.Get("Bc_Lottery").TweenForCG();
  363. ManaReso.Get("Ba_Notice0").TweenBacCG();
  364. float random = Random.Range(0f, 1f);
  365. for (int i = 0; i < RateList.Count; i++)
  366. {
  367. if (random <= RateList.MySum(f => f, i + 1))
  368. {
  369. TempTypeList.Add(TypeList[i]);
  370. TempTypeList.AddRange(TypeList.Random(2, true, false, type => !TempTypeList.Contains(type)));
  371. break;
  372. }
  373. }
  374. TempLotteryList.Add(CreateLottery(TempTypeList[0], 0, ManaReso.Get("Bc_LotteryItem1")));
  375. TempLotteryList.Add(CreateLottery(TempTypeList[1], 1, ManaReso.Get("Bc_LotteryItem2")));
  376. TempLotteryList.Add(CreateLottery(TempTypeList[2], 2, ManaReso.Get("Bc_LotteryItem3")));
  377. List<Vector3> posList = PosList.Disturb();
  378. TempLotteryList[0].Item.position = posList[0];
  379. TempLotteryList[1].Item.position = posList[1];
  380. TempLotteryList[2].Item.position = posList[2];
  381. Button button1 = ManaReso.Get<Button>("Bc_LotteryBack1");
  382. Button button2 = ManaReso.Get<Button>("Bc_LotteryBack2");
  383. Button button3 = ManaReso.Get<Button>("Bc_LotteryBack3");
  384. button1.interactable = false;
  385. button2.interactable = false;
  386. button3.interactable = false;
  387. Auxiliary.Instance.DelayCall
  388. (
  389. () =>
  390. {
  391. ManaReso.Get("Bc_LotteryItem1").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
  392. ManaReso.Get("Bc_LotteryItem2").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
  393. ManaReso.Get("Bc_LotteryItem3").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
  394. },
  395. 1f
  396. );
  397. Auxiliary.Instance.DelayCall
  398. (
  399. () =>
  400. {
  401. ManaReso.Get("Bc_LotteryItem1").TweenForEuler();
  402. ManaReso.Get("Bc_LotteryItem2").TweenForEuler();
  403. ManaReso.Get("Bc_LotteryItem3").TweenForEuler();
  404. },
  405. 1.5f
  406. );
  407. Auxiliary.Instance.DelayCall
  408. (
  409. () =>
  410. {
  411. button1.interactable = true;
  412. button2.interactable = true;
  413. button3.interactable = true;
  414. ManaReso.Get("Bc_LotteryItem1").Move2D(PosList[0], 0.25f, false, Curve.EaseOutQuad);
  415. ManaReso.Get("Bc_LotteryItem2").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
  416. ManaReso.Get("Bc_LotteryItem3").Move2D(PosList[2], 0.25f, false, Curve.EaseOutQuad);
  417. },
  418. 2f
  419. );
  420. Auxiliary.Instance.DelayCall
  421. (
  422. () =>
  423. {
  424. ManaReso.Get("Bc_Lab").TweenForCG();
  425. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab"));
  426. },
  427. 2.5f
  428. );
  429. }
  430. public static void EndAnimation()
  431. {
  432. TempTypeList = new List<int>();
  433. TempValueList = new List<int>();
  434. TempLotteryList = new List<Lottery>();
  435. ManaReso.Get("Bc_Lab").TweenBacCG();
  436. ManaReso.Get("Bc_Confirm").TweenBacCG();
  437. ManaReso.Get("Ba_Notice0").TweenForCG();
  438. ManaReso.Get("B_SignIn").TweenBacCG();
  439. ManaReso.Get("Ba_Notice").TweenBacCG();
  440. ManaReso.Get("Bb_SignIn").TweenBacCG();
  441. ManaReso.Get("Bc_Lottery").TweenBacCG();
  442. ManaAudio.PlayClip(Clip.BtnClip);
  443. }
  444. public static void OnClick(int index)
  445. {
  446. ManaAudio.PlayClip(Clip.CurrentClip);
  447. ManaReso.Get<Button>("Bc_LotteryBack1").interactable = false;
  448. ManaReso.Get<Button>("Bc_LotteryBack2").interactable = false;
  449. ManaReso.Get<Button>("Bc_LotteryBack3").interactable = false;
  450. TempLotteryList[0].Item.TweenBacEuler();
  451. TempLotteryList[0].BK.SetActive(true);
  452. TempLotteryList[0].GetAward();
  453. List<Vector3> posList = new List<Vector3>(PosList);
  454. posList.Remove(PosList[index]);
  455. posList = posList.Disturb();
  456. TempLotteryList[0].Item.position = PosList[index];
  457. TempLotteryList[1].Item.position = posList[0];
  458. TempLotteryList[2].Item.position = posList[1];
  459. Auxiliary.Instance.DelayCall
  460. (
  461. () =>
  462. {
  463. ManaReso.Get("Bc_Confirm").TweenForCG();
  464. ManaReso.Get("Bc_LotteryItem1").TweenBacEuler();
  465. ManaReso.Get("Bc_LotteryItem2").TweenBacEuler();
  466. ManaReso.Get("Bc_LotteryItem3").TweenBacEuler();
  467. },
  468. 1f
  469. );
  470. }
  471. public void GetAward()
  472. {
  473. if (ResetSign)
  474. {
  475. Sign.ResetSign();
  476. }
  477. BK.SetActive(true);
  478. if (Type == 1)
  479. {
  480. ManaCenter.AddCoin(Value, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.Checkin);
  481. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab1") + Language.GetStr("Common", "Coin") + " " + Value);
  482. }
  483. else if (Type == 2)
  484. {
  485. ManaCenter.AddDiamond(Value, StaticsManager.ItemID.获得钻石, StaticsManager.ConsumeModule.Checkin);
  486. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab1") + Language.GetStr("Common", "Diamond") + " " + Value);
  487. }
  488. else if (Type == 3)
  489. {
  490. ManaGarden.FlowerInfoDic[Value].Add();
  491. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab1") + " " + ManaGarden.FlowerInfoDic[Value].Name);
  492. }
  493. else if (Type == 4)
  494. {
  495. ManaPlayer.CloseUnitDic[Value].Unlock();
  496. ManaPlayer.BoughtCloseList.UniqueAdd(Value);
  497. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab1") + " " + ManaPlayer.CloseUnitDic[Value].Name);
  498. }
  499. }
  500. }
  501. public class ManaSign : Regist
  502. {
  503. #region 变量
  504. public static int SignIndex;
  505. public static int SignRound;
  506. public static DateTime SignTime;
  507. public static Dictionary<int, Sign> SignDic = new Dictionary<int, Sign>();
  508. #endregion
  509. public static bool ShowOfflinePanel()
  510. {
  511. if (ManaTutorial.TutorialA)
  512. {
  513. return false;
  514. }
  515. if (ShowOfflineIncomReward())
  516. {
  517. return true;
  518. }
  519. if (ShowMailReward())
  520. {
  521. return true;
  522. }
  523. if (ShowSignReward())
  524. {
  525. return true;
  526. }
  527. if (ShowNotification())
  528. {
  529. return true;
  530. }
  531. if (ManaNickName.ShowNickNameSettingPanelFirstTime())
  532. {
  533. return false;
  534. }
  535. return false;
  536. }
  537. public static bool ShowOfflineIncomReward()
  538. {
  539. if (ManaCenter.OfflineLock)
  540. {
  541. ManaReso.Get("C_Group").TweenBacCG();
  542. ManaReso.Get("B_SignIn").TweenForCG();
  543. ManaReso.Get("Ba_Notice").TweenForCG();
  544. return true;
  545. }
  546. return false;
  547. }
  548. public static bool ShowMailReward()
  549. {
  550. ManaServer.DecodeMailXml(ManaServer.MailXml);
  551. if (ManaServer.MailRewardList.Count > 0)
  552. {
  553. ManaServer.GetMailReward();
  554. ManaReso.Get("C_Group").TweenBacCG();
  555. ManaReso.Get("B_SignIn").TweenForCG();
  556. ManaReso.Get("Bd_Mail0").TweenForCG();
  557. return true;
  558. }
  559. return false;
  560. }
  561. public static bool ShowSignReward()
  562. {
  563. if (ManaData.GetPlayerBool("QuitFlag") && ManaServer.Connect)
  564. {
  565. int daySpan = ManaServer.Time.Day - ManaSign.SignTime.Day;
  566. int yearSpan = ManaServer.Time.Year - ManaSign.SignTime.Year;
  567. int monthSpan = ManaServer.Time.Month - ManaSign.SignTime.Month;
  568. if (daySpan >= 1 || yearSpan >= 1 || monthSpan >= 1)
  569. {
  570. ManaReso.Get("B_SignIn").TweenForCG();
  571. ManaReso.Get("Bb_SignIn").TweenForCG();
  572. return true;
  573. }
  574. }
  575. return false;
  576. }
  577. public static bool ShowNotification()
  578. {
  579. if (ManaServer.NotificationIndex > ManaData.GetPlayerInt("NotificationIndex") && ManaServer.NotificationReady)
  580. {
  581. ManaReso.Get("B_SignIn").TweenBacCG();
  582. ManaData.SavePlayerInt("NotificationIndex", ManaServer.NotificationIndex);
  583. ManaNotify.Show();
  584. return true;
  585. }
  586. else
  587. {
  588. return false;
  589. }
  590. }
  591. public static void GetSignReward()
  592. {
  593. SignDic[SignIndex].Get();
  594. ManaCenter.SignAmt++;
  595. }
  596. public override void RegistValueB()
  597. {
  598. SignTime = DateTime.Parse(ManaData.GetPlayerString("SignTime"));
  599. SignIndex = ManaData.GetPlayerInt("SignIndex");
  600. SignRound = ManaData.GetPlayerInt("SignRound");
  601. Transform par = ManaReso.Get("Bb_Grid");
  602. List<XmlAttributeCollection> attributeList = ManaData.GetSignConfig();
  603. for (int i = 0; i < attributeList.Count; i++)
  604. {
  605. Transform tra = ManaReso.Get("SignItem", Folder.UI, false, par, false, ObjType.SignItem);
  606. SignDic.Add(i + 1, new Sign(i + 1, tra, attributeList[i]));
  607. }
  608. for (int i = 1; i < SignIndex; i++)
  609. {
  610. SignDic[i].Mark.SetActive(true);
  611. }
  612. Lottery.Configure(ManaData.GetLotteryConfig());
  613. }
  614. }