ManaSign.cs 24 KB

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