123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815 |
- using UnityEngine;
- using UnityEngine.UI;
- using System;
- using System.Xml;
- using System.Linq;
- using System.Collections;
- using System.Collections.Generic;
- using Random = UnityEngine.Random;
- public class SignItemLabel
- {
- public static string Amount = "Amount";
- public static string Index = "Index";
- public static string Award = "Award";
- public static string Tick = "Tick";
- }
- public class SignItem
- {
- #region Config
- public int Coin
- {
- get
- {
- if (RoundBuff.Equal(-1))
- {
- return coin;
- }
- else
- {
- return (int)(coin*RoundBuff*SignManager.SignRound);
- }
- }
- set { coin = value; }
- }
- public int coin;
- public int Diamond
- {
- get
- {
- if (RoundBuff.Equal(-1))
- {
- return diamond;
- }
- else
- {
- return (int)(diamond * RoundBuff * SignManager.SignRound);
- }
- }
- set { diamond = value; }
- }
- public int diamond;
- public float RoundBuff; //第几轮 每签21次加一轮
- public bool LotteryAwardFlag;
- public Text AmountText;
- public Text IndexText;
- public Image Award;
- public Image Tick;
- public Vector2 OriginSpriteSize;
- public List<int> AwardFlowerIDs = new List<int>();
- public static int MaxSignIndex = 22;
- #endregion
- public SignItem(int index, Transform tra, XmlAttributeCollection attribute)
- {
- Dictionary<string, Transform> dic = new Dictionary<string, Transform>();
- Auxiliary.CompileDic(tra, dic);
- AmountText = dic[SignItemLabel.Amount].GetComponent<Text>();
- IndexText = dic[SignItemLabel.Index].GetComponent<Text>();
- Award = dic[SignItemLabel.Award].GetComponent<Image>();
- Tick = dic[SignItemLabel.Tick].GetComponent<Image>();
- OriginSpriteSize = Award.rectTransform.sizeDelta;
- IndexText.text = index.ToString();
- Coin = Auxiliary.StringToInt(attribute[4].Value, 0);
- LotteryAwardFlag = Auxiliary.StringToBool(attribute[1].Value, false);
- Diamond = Auxiliary.StringToInt(attribute[3].Value, 0);
- AwardFlowerIDs = Auxiliary.StringToInts(',', attribute[2].Value, new List<int>());
- RoundBuff = Auxiliary.StringToFloat(attribute[5].Value, -1);
- SetupUI();
- }
- public void Get()
- {
- if (LotteryAwardFlag)
- {
- Lottery.PlayAnimation(true);
- return;
- }
- AudioManager.PlayClip(AudioLabel.GetCurrent);
- Tick.SetActive(true);
- ResetSignRound();
- ResourceManager.SetActive(CanvasLabel.Bb_Get, false);
- ResourceManager.SetActive(CanvasLabel.Bb_Rotate, true);
- ResourceManager.SetActive(CanvasLabel.Bb_Confirm, true);
- if (AwardFlowerIDs.Valid())
- {
- for (int i = 0; i < AwardFlowerIDs.Count; i++)
- {
- FlowerInfo flowerInfo = GardenManager.FlowerInfoDictionary[AwardFlowerIDs[i]];
- if (flowerInfo.Unlock == false)
- {
- ResourceManager.SetText(CanvasLabel.Bb_InfoLabA, flowerInfo.Name);
- ResourceManager.SetActive(CanvasLabel.Bb_IconA, true);
- ResourceManager.SetSprite(CanvasLabel.Bb_IconA0, flowerInfo.Icon);
-
- ResourceManager.Get<Image>(CanvasLabel.Bb_IconA0).Resize(true, 0.8125f, 0.8125f);
- flowerInfo.Add();
- return;
- }
- }
- }
- if (Diamond > 0)
- {
- ResourceManager.SetText(CanvasLabel.Bb_InfoLabB, Diamond.ToString());
- ResourceManager.SetSprite(CanvasLabel.Bb_IconB, Lib.DiamondSprite);
- ResourceManager.SetActive(CanvasLabel.Bb_IconB, true);
- Manager.AddDiamond(Diamond, StaticsManager.ItemID.获得钻石, StaticsManager.ConsumeModule.Checkin);
- }
- else if (Coin > 0)
- {
- ResourceManager.SetText(CanvasLabel.Bb_InfoLabB, Coin.ToString());
- ResourceManager.SetSprite(CanvasLabel.Bb_IconB, Lib.GoldSprite);
- ResourceManager.SetActive(CanvasLabel.Bb_IconB, true);
- Manager.AddCoin(Coin, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.Checkin);
- }
- else
- {
- throw new Exception();
- }
- }
- public void SetupUI()
- {
- if (LotteryAwardFlag)
- {
- Award.sprite = Lib.PackSprite;
- Award.Resize(true, 0.3f, 0.3f);
- return;
- }
- if (AwardFlowerIDs.Valid())
- {
- for (int i = 0; i < AwardFlowerIDs.Count; i++)
- {
- FlowerInfo flowerInfo = GardenManager.FlowerInfoDictionary[AwardFlowerIDs[i]];
- if (flowerInfo.Unlock == false)
- {
- Award.sprite = flowerInfo.Icon;
- Award.Resize(true, 0.1875f, 0.1875f);
- return;
- }
- }
- }
-
- if (Diamond > 0)
- {
- Award.sprite = Lib.DiamondSprite;
- Award.Resize(false, OriginSpriteSize);
- AmountText.text = Diamond.ToString();
- }
- else if (Coin > 0)
- {
- Award.sprite = Lib.GoldSprite;
- Award.Resize(false, OriginSpriteSize);
- AmountText.text = Coin.ToString();
- }
- }
- public static void ResetSignRound()
- {
- SignManager.LastSignTime = HttpManager.CurrentDateTime;
- SignManager.SignIndex++;
- if (SignManager.SignIndex == MaxSignIndex)
- {
- SignManager.SignIndex = 1;
- SignManager.SignRound++;
- ResourceManager.Get(CanvasLabel.B_SignIn).GetTweenCG().AddEventOnetime
- (
- EventType.BackwardFinish,
- () =>
- {
- foreach (var kv in SignManager.SignItemDictionary)
- {
- kv.Value.SetupUI();
- kv.Value.Tick.SetActive(false);
- }
- }
- );
- }
- }
- }
- public class Lottery
- {
- private enum LotteryType
- {
- Coin=1,
- Diamond=2,
- Flower=3,
- Close=4,
- }
- #region Config
- public int Index;
- public int Type;
- public int Value;
- public Text DescriptionText;
- public Image Icon1;
- public Image Icon2;
- public Image Icon3;
- public Button Button;
- public Transform BK;
- public Transform Item;
- public static List<int> TempTypeList = new List<int>();
- public static List<int> TempValueList = new List<int>();
- public static List<Lottery> TempLotteryList = new List<Lottery>();
- public static List<int> TypeList = new List<int>();
- public static List<float> RateList = new List<float>();
- public static List<List<int>> LeftBorderIDList = new List<List<int>>();
- public static List<List<int>> RightBorderIDList = new List<List<int>>();
- public static List<Vector3> PosList = new List<Vector3>();
- public static bool ResetSignRound = false;
- #endregion
- public static void Init(List<XmlAttributeCollection> attributeList)
- {
- PosList.Add(ResourceManager.Get(CanvasLabel.Bc_LotteryItem1).position);
- PosList.Add(ResourceManager.Get(CanvasLabel.Bc_LotteryItem2).position);
- PosList.Add(ResourceManager.Get(CanvasLabel.Bc_LotteryItem3).position);
- for (int i = 0; i < attributeList.Count; i++)
- {
- RateList.Add((float) Auxiliary.FmlParse(attributeList[i][2].Value));
- TypeList.Add((int) Auxiliary.FmlParse(attributeList[i][1].Value));
- List<string> leftBorderStrList = Auxiliary.StringToStrings(',', attributeList[i][3].Value, null);
- List<string> rightBorderStrList = Auxiliary.StringToStrings(',', attributeList[i][4].Value, null);
- List<int> leftBorderList = new List<int>();
- List<int> rightBorderList = new List<int>();
- for (int j = 0; j < leftBorderStrList.Count; j++)
- {
- leftBorderList.Add((int)Auxiliary.FmlParse(leftBorderStrList[j], "l", (Manager.GardenLevel+1).ToString()));
- rightBorderList.Add((int)Auxiliary.FmlParse(rightBorderStrList[j], "l", (Manager.GardenLevel+1).ToString()));
- }
- LeftBorderIDList.Add(leftBorderList);
- RightBorderIDList.Add(rightBorderList);
- }
- }
- public static Lottery CreateLottery(int type, int posIndex, Transform lotteryItem)
- {
- Lottery lottery = new Lottery();
- lottery.Type = type;
- lottery.Value = Random.Range(LeftBorderIDList[0][0], RightBorderIDList[0][0] + 1);
- if (lottery.Type == LotteryType.Flower.GetHashCode())
- {
- #region
- List<int> flowerIDs = new List<int>();
- for (int j = 0; j < LeftBorderIDList[type - 1].Count; j++)
- {
- for (int k = LeftBorderIDList[type - 1][j]; k < RightBorderIDList[type - 1][j] + 1; k++)
- {
- if (!TempValueList.Contains(k))
- {
- flowerIDs.Add(k);
- }
- }
- }
- lottery.Value = MinigameAward.SelectUnlockFlowerID(flowerIDs);
- TempValueList.Add(lottery.Value);
- #endregion
- }
- else if (lottery.Type == LotteryType.Close.GetHashCode())
- {
- #region
- bool allBought = true;
- for (int j = 0; j < LeftBorderIDList[type - 1].Count; j++)
- {
- for (int k = LeftBorderIDList[type - 1][j]; k < RightBorderIDList[type - 1][j] + 1; k++)
- {
- if (!PlayerManager.CloseItemDictionary[k].IsBought && !TempValueList.Contains(k))
- {
- allBought = false;
- goto exit;
- }
- }
- }
- exit :
- if (allBought)
- {
- int index = Random.Range(0, LeftBorderIDList[type - 1].Count);
- lottery.Value = Random.Range(LeftBorderIDList[type - 1][index], RightBorderIDList[type - 1][index] + 1);
- CloseItem closeItem = PlayerManager.CloseItemDictionary[lottery.Value];
- lottery.Value = (int) closeItem.BuyCost/5;
- if (closeItem.BuyCurrent == Current.Coin)
- {
- lottery.Type = LotteryType.Coin.GetHashCode();
- }
- else if (closeItem.BuyCurrent == Current.Diamond)
- {
- lottery.Type = LotteryType.Diamond.GetHashCode();
- }
- }
- else
- {
- int anticrush = 0;
- do
- {
- if (anticrush++ > 10000)
- {
- throw new Exception();
- }
- int index = Random.Range(0, LeftBorderIDList[type - 1].Count);
- lottery.Value = Random.Range(LeftBorderIDList[type - 1][index], RightBorderIDList[type - 1][index] + 1);
- } while (PlayerManager.CloseItemDictionary[lottery.Value].IsBought || TempValueList.Contains(lottery.Value));
- TempValueList.Add(lottery.Value);
- }
- #endregion
- }
- else
- {
- int index = Random.Range(0, LeftBorderIDList[type - 1].Count);
- lottery.Value = Random.Range(LeftBorderIDList[type - 1][index], RightBorderIDList[type - 1][index] + 1);
- }
- lottery.Index = posIndex;
- lottery.Item = lotteryItem;
- lottery.BK = lotteryItem.GetChild(0);
- lottery.Icon1 = lotteryItem.GetChild(1).GetChild(0).GetComponent<Image>();
- lottery.Icon2 = lotteryItem.GetChild(1).GetChild(1).GetComponent<Image>();
- lottery.Icon3 = lotteryItem.GetChild(1).GetChild(2).GetComponent<Image>();
- lottery.DescriptionText = lotteryItem.GetChild(1).GetChild(3).GetComponent<Text>();
- lottery.Button = lotteryItem.GetChild(1).GetChild(4).GetComponent<Button>();
- lottery.BK.SetActive(false);
- if (lottery.Type == LotteryType.Coin.GetHashCode())
- {
- lottery.Icon1.SetActive(false);
- lottery.Icon2.SetActive(true);
- lottery.Icon3.SetActive(false);
- lottery.Icon2.sprite = Lib.GoldSprite;
- lottery.Icon2.Resize(true, 1, 1);
- lottery.Icon2.transform.localPosition = new Vector3(0, 7.5f, 0);
- lottery.DescriptionText.SetActive(true);
- lottery.DescriptionText.text = lottery.Value.ToString();
- }
- else if (lottery.Type == LotteryType.Diamond.GetHashCode())
- {
- lottery.Icon1.SetActive(false);
- lottery.Icon2.SetActive(true);
- lottery.Icon3.SetActive(false);
- lottery.Icon2.sprite = Lib.DiamondSprite;
- lottery.Icon2.Resize(true, 1, 1);
- lottery.Icon2.transform.localPosition = new Vector3(0, 7.5f, 0);
- lottery.DescriptionText.SetActive(true);
- lottery.DescriptionText.text = lottery.Value.ToString();
- }
- else if (lottery.Type == LotteryType.Flower.GetHashCode())
- {
- lottery.Icon1.SetActive(false);
- lottery.Icon2.SetActive(true);
- lottery.Icon3.SetActive(false);
- lottery.Icon2.sprite = GardenManager.FlowerInfoDictionary[lottery.Value].Icon;
- lottery.Icon2.Resize(true, 0.3125f, 0.3125f);
- lottery.Icon2.transform.localPosition = new Vector3();
- lottery.DescriptionText.SetActive(false);
- }
- else if (lottery.Type == LotteryType.Close.GetHashCode())
- {
- CloseItem closeItem = PlayerManager.CloseItemDictionary[lottery.Value];
- float newSize = closeItem.PixelSize/closeItem.Sprites[0].rect.width;
- closeItem.SetupUI(newSize, new Vector2(), lottery.Icon1, lottery.Icon3, lottery.Icon2);
- lottery.DescriptionText.SetActive(false);
- }
- lottery.Button.onClick = new Button.ButtonClickedEvent();
- lottery.Button.onClick.AddListener(() => { OnClick(posIndex); });
- return lottery;
- }
- public static void PlayAnimation(bool resetSign)
- {
- ResetSignRound = resetSign;
- ResourceManager.Get(CanvasLabel.Bc_Lottery).TweenForCG();
- ResourceManager.Get(CanvasLabel.Ba_Notice0).TweenBacCG();
- float random = Random.Range(0f, 1f);
- for (int i = 0; i < RateList.Count; i++)
- {
- if (random <= RateList.MySum(f => f, i + 1))
- {
- TempTypeList.Add(TypeList[i]);
- TempTypeList.AddRange(TypeList.Random(2, true, false, type => !TempTypeList.Contains(type)));
- break;
- }
- }
- TempLotteryList.Add(CreateLottery(TempTypeList[0], 0, ResourceManager.Get(CanvasLabel.Bc_LotteryItem1)));
- TempLotteryList.Add(CreateLottery(TempTypeList[1], 1, ResourceManager.Get(CanvasLabel.Bc_LotteryItem2)));
- TempLotteryList.Add(CreateLottery(TempTypeList[2], 2, ResourceManager.Get(CanvasLabel.Bc_LotteryItem3)));
- List<Vector3> posList = PosList.Disturb();
- TempLotteryList[0].Item.position = posList[0];
- TempLotteryList[1].Item.position = posList[1];
- TempLotteryList[2].Item.position = posList[2];
- Button button1 = ResourceManager.Get<Button>(CanvasLabel.Bc_LotteryBack1);
- Button button2 = ResourceManager.Get<Button>(CanvasLabel.Bc_LotteryBack2);
- Button button3 = ResourceManager.Get<Button>(CanvasLabel.Bc_LotteryBack3);
- button1.interactable = false;
- button2.interactable = false;
- button3.interactable = false;
- Auxiliary.Instance.DelayCall
- (
- () =>
- {
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem1).Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem2).Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem3).Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
- },
- 1f
- );
- Auxiliary.Instance.DelayCall
- (
- () =>
- {
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem1).TweenForEuler();
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem2).TweenForEuler();
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem3).TweenForEuler();
- },
- 1.5f
- );
- Auxiliary.Instance.DelayCall
- (
- () =>
- {
- button1.interactable = true;
- button2.interactable = true;
- button3.interactable = true;
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem1).Move2D(PosList[0], 0.25f, false, Curve.EaseOutQuad);
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem2).Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem3).Move2D(PosList[2], 0.25f, false, Curve.EaseOutQuad);
- },
- 2f
- );
- Auxiliary.Instance.DelayCall
- (
- () =>
- {
- ResourceManager.Get(CanvasLabel.Bc_Lab).TweenForCG();
- ResourceManager.SetText(CanvasLabel.Bc_Lab, Language.GetStr(LanguageLabel.UI__Bc_Lab));
- },
- 2.5f
- );
- }
- public static void EndAnimation()
- {
- TempTypeList = new List<int>();
- TempValueList = new List<int>();
- TempLotteryList = new List<Lottery>();
- ResourceManager.Get(CanvasLabel.Bc_Lab).TweenBacCG();
- ResourceManager.Get(CanvasLabel.Bc_Confirm).TweenBacCG();
- ResourceManager.Get(CanvasLabel.Ba_Notice0).TweenForCG();
- ResourceManager.Get(CanvasLabel.B_SignIn).TweenBacCG();
- ResourceManager.Get(CanvasLabel.Ba_Notice).TweenBacCG();
- ResourceManager.Get(CanvasLabel.Bb_SignIn).TweenBacCG();
- ResourceManager.Get(CanvasLabel.Bc_Lottery).TweenBacCG();
- AudioManager.PlayClip(AudioLabel.ClickButton);
- }
- public static void OnClick(int index)
- {
- AudioManager.PlayClip(AudioLabel.GetCurrent);
- ResourceManager.Get<Button>(CanvasLabel.Bc_LotteryBack1).interactable = false;
- ResourceManager.Get<Button>(CanvasLabel.Bc_LotteryBack2).interactable = false;
- ResourceManager.Get<Button>(CanvasLabel.Bc_LotteryBack3).interactable = false;
- TempLotteryList[0].Item.TweenBacEuler();
- TempLotteryList[0].BK.SetActive(true);
- TempLotteryList[0].GetAward();
- List<Vector3> posList = new List<Vector3>(PosList);
- posList.Remove(PosList[index]);
- posList = posList.Disturb();
- TempLotteryList[0].Item.position = PosList[index];
- TempLotteryList[1].Item.position = posList[0];
- TempLotteryList[2].Item.position = posList[1];
- Auxiliary.Instance.DelayCall
- (
- () =>
- {
- ResourceManager.Get(CanvasLabel.Bc_Confirm).TweenForCG();
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem1).TweenBacEuler();
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem2).TweenBacEuler();
- ResourceManager.Get(CanvasLabel.Bc_LotteryItem3).TweenBacEuler();
- },
- 1f
- );
- }
- public void GetAward()
- {
- if (ResetSignRound)
- {
- SignItem.ResetSignRound();
- }
- BK.SetActive(true);
- if (Type == LotteryType.Coin.GetHashCode())
- {
- Manager.AddCoin(Value, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.Checkin);
- ResourceManager.SetText(CanvasLabel.Bc_Lab, Language.GetStr(LanguageLabel.UI__Bc_Lab1) + Language.GetStr(LanguageLabel.Common__Coin) + " " + Value);
- }
- else if (Type == LotteryType.Diamond.GetHashCode())
- {
- Manager.AddDiamond(Value, StaticsManager.ItemID.获得钻石, StaticsManager.ConsumeModule.Checkin);
- ResourceManager.SetText(CanvasLabel.Bc_Lab, Language.GetStr(LanguageLabel.UI__Bc_Lab1) + Language.GetStr(LanguageLabel.Common__Diamond) + " " + Value);
- }
- else if (Type == LotteryType.Flower.GetHashCode())
- {
- GardenManager.FlowerInfoDictionary[Value].Add();
- ResourceManager.SetText(CanvasLabel.Bc_Lab, Language.GetStr(LanguageLabel.UI__Bc_Lab1) + " " + GardenManager.FlowerInfoDictionary[Value].Name);
- }
- else if (Type == LotteryType.Close.GetHashCode())
- {
- PlayerManager.CloseItemDictionary[Value].Unlock();
- PlayerManager.BoughtCloseIDs.UniqueAdd(Value);
- ResourceManager.SetText(CanvasLabel.Bc_Lab, Language.GetStr(LanguageLabel.UI__Bc_Lab1) + " " + PlayerManager.CloseItemDictionary[Value].Name);
- }
- }
- }
- public class SignManager : Regist
- {
- #region Config
- public static int SignIndex;
- public static int SignRound;
- public static DateTime LastSignTime;
- public static Dictionary<int, SignItem> SignItemDictionary = new Dictionary<int, SignItem>();
- #endregion
- public static bool ShowPanels()
- {
- if (TutorialManager.NewplayerTutorial)
- {
- return false;
- }
- if (ShowOfflineIncomPanel())
- {
- return true;
- }
- if (ShowMailRewardPanel())
- {
- return true;
- }
- if (ShowSignPanel())
- {
- return true;
- }
- if (ShowAnnouncePanel())
- {
- return true;
- }
- if (NickNameManager.ShowNickNameSettingPanelFirstTime())
- {
- return false;
- }
- return false;
- }
- public static bool ShowOfflineIncomPanel()
- {
- if (Manager.OfflineFlag)
- {
- ResourceManager.Get(CanvasLabel.C_Group).TweenBacCG();
- ResourceManager.Get(CanvasLabel.B_SignIn).TweenForCG();
- ResourceManager.Get(CanvasLabel.Ba_Notice).TweenForCG();
- return true;
- }
- return false;
- }
- public static bool ShowMailRewardPanel()
- {
- HttpManager.DecodeMailXmlStr(HttpManager.MailXmlStr);
- if (HttpManager.MailRewardList.Count > 0)
- {
- HttpManager.GetAllMailReward();
- ResourceManager.Get(CanvasLabel.C_Group).TweenBacCG();
- ResourceManager.Get(CanvasLabel.B_SignIn).TweenForCG();
- ResourceManager.Get(CanvasLabel.Bd_Mail0).TweenForCG();
- return true;
- }
- return false;
- }
- public static bool ShowSignPanel()
- {
- if (ConfigManager.GetBoolFormConfig(PlayerConfigLabel.QuitFlag) && HttpManager.IsConnect)
- {
- int daySpan = HttpManager.CurrentDateTime.Day - LastSignTime.Day;
- int yearSpan = HttpManager.CurrentDateTime.Year - LastSignTime.Year;
- int monthSpan = HttpManager.CurrentDateTime.Month - LastSignTime.Month;
- if (daySpan >= 1 || yearSpan >= 1 || monthSpan >= 1)
- {
- ResourceManager.Get(CanvasLabel.B_SignIn).TweenForCG();
- ResourceManager.Get(CanvasLabel.Bb_SignIn).TweenForCG();
- return true;
- }
- }
- return false;
- }
- public static bool ShowAnnouncePanel()
- {
- //ConfigManager.SaveIntToConfig(PlayerConfigLabel.NotificationIndex, -1);
- if (HttpManager.AnnounceIndex > ConfigManager.GetIntFormConfig(PlayerConfigLabel.NotificationIndex) && HttpManager.IsAnnounceReady)
- {
- ResourceManager.Get(CanvasLabel.B_SignIn).TweenBacCG();
- ConfigManager.SaveIntToConfig(PlayerConfigLabel.NotificationIndex, HttpManager.AnnounceIndex);
- AnnounceManager.ShowAnnouncePanel();
- return true;
- }
- else
- {
- return false;
- }
- }
- public static void GetSignAward()
- {
- SignItemDictionary[SignIndex].Get();
- Manager.SignAmt++;
- }
- public override void SecondInit()
- {
- LastSignTime = DateTime.Parse(ConfigManager.GetStringFormConfig(PlayerConfigLabel.SignTime));
- SignIndex = ConfigManager.GetIntFormConfig(PlayerConfigLabel.SignIndex);
- SignRound = ConfigManager.GetIntFormConfig(PlayerConfigLabel.SignRound);
- Transform par = ResourceManager.Get(CanvasLabel.Bb_Grid);
- List<XmlAttributeCollection> attributeList = ConfigManager.GetSignConfig();
- for (int i = 0; i < attributeList.Count; i++)
- {
- Transform tra = ResourceManager.Get(ResourceLabel.SignItem, Folder.UI, false, par, false, ObjType.SignItem);
- SignItemDictionary.Add(i + 1, new SignItem(i + 1, tra, attributeList[i]));
- }
- for (int i = 1; i < SignIndex; i++)
- {
- SignItemDictionary[i].Tick.SetActive(true);
- }
- Lottery.Init(ConfigManager.GetLotteryConfig());
- }
- }
|