SignManager.cs 24 KB

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