ManaSign.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System;
  4. using System.Xml;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.Linq;
  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();
  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.65f, 0.65f);
  94. flowerInfo.Unlock = true;
  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.15f, 0.15f);
  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 Button Button;
  185. public Transform BK;
  186. public Transform Item;
  187. public static List<int> TempTypeList = new List<int>();
  188. public static List<int> TempValueList = new List<int>();
  189. public static List<Lottery> TempLotteryList = new List<Lottery>();
  190. public static List<int> TypeList = new List<int>();
  191. public static List<float> RateList = new List<float>();
  192. public static List<Vector3> PosList = new List<Vector3>();
  193. public static List<List<int>> LeftBorderDList = new List<List<int>>();
  194. public static List<List<int>> RightBorderDList = new List<List<int>>();
  195. #endregion
  196. public static void Configure(List<XmlAttributeCollection> attributeList)
  197. {
  198. PosList.Add(ManaReso.Get("Bc_LotteryItem1").position);
  199. PosList.Add(ManaReso.Get("Bc_LotteryItem2").position);
  200. PosList.Add(ManaReso.Get("Bc_LotteryItem3").position);
  201. for (int i = 0; i < attributeList.Count; i++)
  202. {
  203. RateList.Add((float) Auxiliary.FmlParse(attributeList[i][2].Value));
  204. TypeList.Add((int) Auxiliary.FmlParse(attributeList[i][1].Value));
  205. List<string> leftBorderStrList = Auxiliary.StringListParse(',', attributeList[i][3].Value, null);
  206. List<string> rightBorderStrList = Auxiliary.StringListParse(',', attributeList[i][4].Value, null);
  207. List<int> leftBorderList = new List<int>();
  208. List<int> rightBorderList = new List<int>();
  209. for (int j = 0; j < leftBorderStrList.Count; j++)
  210. {
  211. leftBorderList.Add((int)Auxiliary.FmlParse(leftBorderStrList[j], "l", ManaCenter.Level.ToString()));
  212. rightBorderList.Add((int)Auxiliary.FmlParse(rightBorderStrList[j], "l", ManaCenter.Level.ToString()));
  213. }
  214. LeftBorderDList.Add(leftBorderList);
  215. RightBorderDList.Add(rightBorderList);
  216. }
  217. }
  218. public static Lottery CreateLottery(int type, int posIndex, Transform lotteryItem)
  219. {
  220. Lottery lottery = new Lottery();
  221. lottery.Type = type;
  222. lottery.Value = Random.Range(LeftBorderDList[0][0], RightBorderDList[0][0] + 1);
  223. if (lottery.Type == 3)
  224. {
  225. #region
  226. bool allUnlock = true;
  227. for (int j = 0; j < LeftBorderDList[type - 1].Count; j++)
  228. {
  229. for (int k = LeftBorderDList[type - 1][j]; k < RightBorderDList[type - 1][j] + 1; k++)
  230. {
  231. if (!ManaGarden.FlowerInfoDic[k].Unlock && !TempValueList.Contains(k))
  232. {
  233. allUnlock = false;
  234. goto exit;
  235. }
  236. }
  237. }
  238. exit :
  239. if (allUnlock)
  240. {
  241. int index = Random.Range(0, LeftBorderDList[type - 1].Count);
  242. lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
  243. FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[lottery.Value];
  244. lottery.Value = flowerInfo.UnlockAmt/5;
  245. if (flowerInfo.UnlockCur == Current.Coin)
  246. {
  247. lottery.Type = 1;
  248. }
  249. else if (flowerInfo.UnlockCur == Current.Diamond)
  250. {
  251. lottery.Type = 2;
  252. }
  253. }
  254. else
  255. {
  256. int anticrush = 0;
  257. do
  258. {
  259. if (anticrush++ > 10000)
  260. {
  261. throw new Exception();
  262. }
  263. int index = Random.Range(0, LeftBorderDList[type - 1].Count);
  264. lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
  265. } while (ManaGarden.FlowerInfoDic[lottery.Value].Unlock || TempValueList.Contains(lottery.Value));
  266. TempValueList.Add(lottery.Value);
  267. }
  268. #endregion
  269. }
  270. else if (lottery.Type == 4)
  271. {
  272. #region
  273. bool allBought = true;
  274. for (int j = 0; j < LeftBorderDList[type - 1].Count; j++)
  275. {
  276. for (int k = LeftBorderDList[type - 1][j]; k < RightBorderDList[type - 1][j] + 1; k++)
  277. {
  278. if (!ManaPlayer.CloseUnitDic[k].Bought && !TempValueList.Contains(k))
  279. {
  280. allBought = false;
  281. goto exit;
  282. }
  283. }
  284. }
  285. exit :
  286. if (allBought)
  287. {
  288. int index = Random.Range(0, LeftBorderDList[type - 1].Count);
  289. lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
  290. CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
  291. lottery.Value = (int) closeUnit.BuyAmt/5;
  292. if (closeUnit.BuyCurrent == Current.Coin)
  293. {
  294. lottery.Type = 1;
  295. }
  296. else if (closeUnit.BuyCurrent == Current.Diamond)
  297. {
  298. lottery.Type = 2;
  299. }
  300. }
  301. else
  302. {
  303. int anticrush = 0;
  304. do
  305. {
  306. if (anticrush++ > 10000)
  307. {
  308. throw new Exception();
  309. }
  310. int index = Random.Range(0, LeftBorderDList[type - 1].Count);
  311. lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
  312. } while (ManaPlayer.CloseUnitDic[lottery.Value].Bought || TempValueList.Contains(lottery.Value));
  313. TempValueList.Add(lottery.Value);
  314. }
  315. #endregion
  316. }
  317. else
  318. {
  319. int index = Random.Range(0, LeftBorderDList[type - 1].Count);
  320. lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
  321. }
  322. lottery.PosIndex = posIndex;
  323. lottery.Item = lotteryItem;
  324. lottery.BK = lotteryItem.GetChild(0);
  325. lottery.Icon1 = lotteryItem.GetChild(1).GetChild(0).GetComponent<Image>();
  326. lottery.Icon2 = lotteryItem.GetChild(1).GetChild(1).GetComponent<Image>();
  327. lottery.Lab = lotteryItem.GetChild(1).GetChild(2).GetComponent<Text>();
  328. lottery.Button = lotteryItem.GetChild(1).GetChild(3).GetComponent<Button>();
  329. lottery.BK.SetActive(false);
  330. if (lottery.Type == 1)
  331. {
  332. lottery.Icon1.SetActive(false);
  333. lottery.Icon2.sprite = ManaReso.LoadSprite("金币", Folder.UI);
  334. lottery.Icon2.Resize(true, 1, 1);
  335. lottery.Icon2.transform.localPosition = new Vector3(0, 7.5f, 0);
  336. lottery.Lab.SetActive(true);
  337. lottery.Lab.text = lottery.Value.ToString();
  338. }
  339. else if (lottery.Type == 2)
  340. {
  341. lottery.Icon1.SetActive(false);
  342. lottery.Icon2.sprite = ManaReso.LoadSprite("钻石", Folder.UI);
  343. lottery.Icon2.Resize(true, 1, 1);
  344. lottery.Icon2.transform.localPosition = new Vector3(0, 7.5f, 0);
  345. lottery.Lab.SetActive(true);
  346. lottery.Lab.text = lottery.Value.ToString();
  347. }
  348. else if (lottery.Type == 3)
  349. {
  350. lottery.Icon1.SetActive(false);
  351. lottery.Icon2.sprite = ManaGarden.FlowerInfoDic[lottery.Value].Icon;
  352. lottery.Icon2.Resize(true, 0.25f, 0.25f);
  353. lottery.Icon2.transform.localPosition = new Vector3();
  354. lottery.Lab.SetActive(false);
  355. }
  356. else if (lottery.Type == 4)
  357. {
  358. CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
  359. float newSize = closeUnit.PixelSize/closeUnit.Sprites[0].rect.width;
  360. lottery.Icon2.sprite = closeUnit.Sprites[0];
  361. lottery.Icon2.Resize(true, newSize, newSize);
  362. lottery.Icon2.transform.localPosition = new Vector2(0, closeUnit.IconOffset);
  363. lottery.Lab.SetActive(false);
  364. if (closeUnit.Sprites.Length > 1)
  365. {
  366. lottery.Icon1.SetActive(true);
  367. lottery.Icon1.sprite = closeUnit.Sprites[1];
  368. lottery.Icon1.Resize(true, newSize, newSize);
  369. lottery.Icon1.transform.localPosition = new Vector2(0, closeUnit.IconOffset) + closeUnit.IconOffset1*newSize;
  370. }
  371. else
  372. {
  373. lottery.Icon1.SetActive(false);
  374. }
  375. }
  376. lottery.Button.onClick = new Button.ButtonClickedEvent();
  377. lottery.Button.onClick.AddListener(() => { OnClick(posIndex); });
  378. return lottery;
  379. }
  380. public static void EnterAnimation()
  381. {
  382. ManaReso.Get("Bc_Lottery").TweenForCG();
  383. ManaReso.Get("Ba_Notice0").TweenBacCG();
  384. float random = Random.Range(0f, 1f);
  385. for (int i = 0; i < RateList.Count; i++)
  386. {
  387. if (random <= RateList.MySum(f => f, i + 1))
  388. {
  389. TempTypeList.Add(TypeList[i]);
  390. TempTypeList.AddRange(TypeList.Random(2, true, false, type => !TempTypeList.Contains(type)));
  391. break;
  392. }
  393. }
  394. TempLotteryList.Add(CreateLottery(TempTypeList[0], 0, ManaReso.Get("Bc_LotteryItem1")));
  395. TempLotteryList.Add(CreateLottery(TempTypeList[1], 1, ManaReso.Get("Bc_LotteryItem2")));
  396. TempLotteryList.Add(CreateLottery(TempTypeList[2], 2, ManaReso.Get("Bc_LotteryItem3")));
  397. List<Vector3> posList = PosList.Disturb();
  398. TempLotteryList[0].Item.position = posList[0];
  399. TempLotteryList[1].Item.position = posList[1];
  400. TempLotteryList[2].Item.position = posList[2];
  401. Button button1 = ManaReso.Get<Button>("Bc_LotteryBack1");
  402. Button button2 = ManaReso.Get<Button>("Bc_LotteryBack2");
  403. Button button3 = ManaReso.Get<Button>("Bc_LotteryBack3");
  404. button1.interactable = false;
  405. button2.interactable = false;
  406. button3.interactable = false;
  407. Auxiliary.Instance.DelayCall
  408. (
  409. () =>
  410. {
  411. ManaReso.Get("Bc_LotteryItem1").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
  412. ManaReso.Get("Bc_LotteryItem2").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
  413. ManaReso.Get("Bc_LotteryItem3").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
  414. },
  415. 1f
  416. );
  417. Auxiliary.Instance.DelayCall
  418. (
  419. () =>
  420. {
  421. ManaReso.Get("Bc_LotteryItem1").TweenForEuler();
  422. ManaReso.Get("Bc_LotteryItem2").TweenForEuler();
  423. ManaReso.Get("Bc_LotteryItem3").TweenForEuler();
  424. },
  425. 1.5f
  426. );
  427. Auxiliary.Instance.DelayCall
  428. (
  429. () =>
  430. {
  431. button1.interactable = true;
  432. button2.interactable = true;
  433. button3.interactable = true;
  434. ManaReso.Get("Bc_LotteryItem1").Move2D(PosList[0], 0.25f, false, Curve.EaseOutQuad);
  435. ManaReso.Get("Bc_LotteryItem2").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
  436. ManaReso.Get("Bc_LotteryItem3").Move2D(PosList[2], 0.25f, false, Curve.EaseOutQuad);
  437. },
  438. 2f
  439. );
  440. Auxiliary.Instance.DelayCall
  441. (
  442. () =>
  443. {
  444. ManaReso.Get("Bc_Lab").TweenForCG();
  445. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab"));
  446. },
  447. 2.5f
  448. );
  449. }
  450. public static void EndAnimation()
  451. {
  452. TempTypeList = new List<int>();
  453. TempValueList = new List<int>();
  454. TempLotteryList = new List<Lottery>();
  455. ManaReso.Get("Bc_Lab").TweenBacCG();
  456. ManaReso.Get("Bc_Confirm").TweenBacCG();
  457. ManaReso.Get("Ba_Notice0").TweenForCG();
  458. ManaReso.Get("B_SignIn").TweenBacCG();
  459. ManaReso.Get("Ba_Notice").TweenBacCG();
  460. ManaReso.Get("Bb_SignIn").TweenBacCG();
  461. ManaReso.Get("Bc_Lottery").TweenBacCG();
  462. ManaAudio.PlayClip(Clip.BtnClip);
  463. }
  464. public static void OnClick(int index)
  465. {
  466. ManaAudio.PlayClip(Clip.CurrentClip);
  467. ManaReso.Get<Button>("Bc_LotteryBack1").interactable = false;
  468. ManaReso.Get<Button>("Bc_LotteryBack2").interactable = false;
  469. ManaReso.Get<Button>("Bc_LotteryBack3").interactable = false;
  470. TempLotteryList[0].Item.TweenBacEuler();
  471. TempLotteryList[0].BK.SetActive(true);
  472. TempLotteryList[0].GetAward();
  473. List<Vector3> posList = new List<Vector3>(PosList);
  474. posList.Remove(PosList[index]);
  475. posList = posList.Disturb();
  476. TempLotteryList[0].Item.position = PosList[index];
  477. TempLotteryList[1].Item.position = posList[0];
  478. TempLotteryList[2].Item.position = posList[1];
  479. Auxiliary.Instance.DelayCall
  480. (
  481. () =>
  482. {
  483. ManaReso.Get("Bc_Confirm").TweenForCG();
  484. ManaReso.Get("Bc_LotteryItem1").TweenBacEuler();
  485. ManaReso.Get("Bc_LotteryItem2").TweenBacEuler();
  486. ManaReso.Get("Bc_LotteryItem3").TweenBacEuler();
  487. },
  488. 1f
  489. );
  490. }
  491. public void GetAward()
  492. {
  493. Sign.ResetSign();
  494. BK.SetActive(true);
  495. if (Type == 1)
  496. {
  497. ManaCenter.AddCoin(Value, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.Checkin);
  498. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab1") + Language.GetStr("Common", "Coin") + Value);
  499. }
  500. else if (Type == 2)
  501. {
  502. ManaCenter.AddDiamond(Value, StaticsManager.ItemID.获得钻石, StaticsManager.ConsumeModule.Checkin);
  503. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab1") + Language.GetStr("Common", "Diamond") + Value);
  504. }
  505. else if (Type == 3)
  506. {
  507. ManaGarden.FlowerInfoDic[Value].Unlock = true;
  508. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab1") + ManaGarden.FlowerInfoDic[Value].Name);
  509. }
  510. else if (Type == 4)
  511. {
  512. ManaPlayer.CloseUnitDic[Value].Unlock();
  513. ManaPlayer.BoughtCloseList.UniqueAdd(Value);
  514. ManaReso.SetText("Bc_Lab", Language.GetStr("UI", "Bc_Lab1") + ManaPlayer.CloseUnitDic[Value].Name);
  515. }
  516. }
  517. }
  518. public class ManaSign : Regist
  519. {
  520. #region 变量
  521. public static int SignIndex;
  522. public static int SignRound;
  523. public static DateTime SignTime;
  524. public static Dictionary<int, Sign> SignDic = new Dictionary<int, Sign>();
  525. #endregion
  526. public static bool ShowOfflineReward()
  527. {
  528. if (ShowOfflineIncomReward())
  529. {
  530. return true;
  531. }
  532. if (ShowMailReward())
  533. {
  534. return true;
  535. }
  536. if (ShowSignReward())
  537. {
  538. return true;
  539. }
  540. return false;
  541. }
  542. public static bool ShowOfflineIncomReward()
  543. {
  544. if (ManaCenter.OfflineLock)
  545. {
  546. if (!ManaTutorial.TutorialA)
  547. {
  548. ManaReso.Get("C_Group").TweenBacCG();
  549. ManaReso.Get("B_SignIn").TweenForCG();
  550. ManaReso.Get("Ba_Notice").TweenForCG();
  551. return true;
  552. }
  553. }
  554. return false;
  555. }
  556. public static bool ShowMailReward()
  557. {
  558. ManaServer.DecodeMailXml(ManaServer.MailXml);
  559. if (ManaServer.MailRewardList.Count > 0)
  560. {
  561. if (!ManaTutorial.TutorialA)
  562. {
  563. ManaServer.GetMailReward();
  564. ManaReso.Get("C_Group").TweenBacCG();
  565. ManaReso.Get("B_SignIn").TweenForCG();
  566. ManaReso.Get("Bd_Mail0").TweenForCG();
  567. return true;
  568. }
  569. }
  570. return false;
  571. }
  572. public static bool ShowSignReward()
  573. {
  574. if (!ManaTutorial.TutorialA && ManaData.GetPlayerBool("QuitFlag") && ManaServer.Connect)
  575. {
  576. int daySpan = ManaServer.Time.Day - ManaSign.SignTime.Day;
  577. int yearSpan = ManaServer.Time.Year - ManaSign.SignTime.Year;
  578. int monthSpan = ManaServer.Time.Month - ManaSign.SignTime.Month;
  579. if (daySpan >= 1 || yearSpan >= 1 || monthSpan >= 1)
  580. {
  581. ManaReso.Get("B_SignIn").TweenForCG();
  582. ManaReso.Get("Bb_SignIn").TweenForCG();
  583. return true;
  584. }
  585. }
  586. return false;
  587. }
  588. public static void GetSignReward()
  589. {
  590. SignDic[SignIndex].Get();
  591. ManaCenter.SignAmt++;
  592. }
  593. public override void RegistValueB()
  594. {
  595. SignTime = DateTime.Parse(ManaData.GetPlayerString("SignTime"));
  596. SignIndex = ManaData.GetPlayerInt("SignIndex");
  597. SignRound = ManaData.GetPlayerInt("SignRound");
  598. Transform par = ManaReso.Get("Bb_Grid");
  599. List<XmlAttributeCollection> attributeList = ManaData.GetSignConfig();
  600. for (int i = 0; i < attributeList.Count; i++)
  601. {
  602. Transform tra = ManaReso.Get("SignItem", Folder.UI, false, par, false, ObjType.SignItem);
  603. SignDic.Add(i + 1, new Sign(i + 1, tra, attributeList[i]));
  604. }
  605. for (int i = 1; i < SignIndex; i++)
  606. {
  607. SignDic[i].Mark.SetActive(true);
  608. }
  609. Lottery.Configure(ManaData.GetLotteryConfig());
  610. }
  611. }
  612. #region DebugList
  613. //签到的循环与存档
  614. #endregion