using LitJson; using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; using System; using System.Xml; using System.Collections; using System.Collections.Generic; using Random = UnityEngine.Random; public enum ArchiveSource { Fake, Random, SerialNumber, } public class VisitData { //public bool Praised; public JsonData JsonData; public XmlDocument Document; public VisitData(JsonData jsonData, XmlDocument document) { JsonData = jsonData; Document = document; } } public class VisitManager : Regist { #region Config #region 配置 public static int Cost { get { return Cost_; } set { Cost_ = value; ResourceManager.Get(ObjectLabel.C_CostLab).text = TransferLabel.CoinSprite + Cost; } } public static int Cost_; public static int CoolTime; public static float FancyRate; public static float AwardRate; public static float CreateRate; public static string CostFml; public static string AwardMinFml; public static string AwardMaxFml; #endregion public static float PullTimer; public static List UsedDataList = new List(); public static List UnusedDataList = new List(); public static bool InVisit; public static bool Complete; public static bool LoadComplete; public static bool TweenComplete; public static int Slot; public static int Level; public static XmlNode Node; public static XmlDocument Document; public static int VisiteePraise; public static string VisiteeSerialNumber; public static bool OriginBird; public static bool OriginTree; public static bool OriginRainbow; public static List VisitPlantList; public static List OriginPlantList; public static List OriginElfList; #endregion private int MaxStachAmt = 8; private float PullArchiveTime = 0.5f; public void Update() { if (UnusedDataList.Count > MaxStachAmt) { return; } PullTimer += Time.deltaTime; if (PullTimer >= PullArchiveTime) { PullTimer = 0; HttpManager.RandomLoad ( data => { PullArchiveCallback(data, null, SavePulledArchive); } ); } } public static void Initialize() { XmlAttributeCollection attribute = ConfigManager.GetVisitConfig(); CostFml = attribute[5].Value; Cost = Mathf.FloorToInt((float)Auxiliary.FmlParse(CostFml, "l", Manager.Level.ToString())); AwardMinFml = attribute[2].Value; AwardMaxFml = attribute[3].Value; CoolTime = int.Parse(attribute[4].Value); FancyRate = float.Parse(attribute[7].Value); AwardRate = float.Parse(attribute[1].Value); CreateRate = float.Parse(attribute[6].Value); #region 倒计时 if (CoolTime != 0) { Text text = ResourceManager.Get(ObjectLabel.C_VisitLab); List delayList = new List(); List durationList = new List(); List pairList = new List(); List actionList = new List(); Vector3 v1 = new Vector3(0.75f, 0.75f, 0.75f); Vector3 v2 = new Vector3(0.4f, 0.4f, 0.4f); Vector3 v3 = new Vector3(0, 0, 0); for (int i = 0; i < CoolTime - 1; i++) { delayList.Add(0.5f); delayList.Add(0); } delayList.Add(0.5f); for (int i = 0; i < CoolTime; i++) { durationList.Add(0.25f); durationList.Add(0.25f); pairList.Add(new VecPair(v1, v2)); pairList.Add(new VecPair(v2, v3)); var tempInt = i; actionList.Add ( () => { text.text = (CoolTime - tempInt).ToString(); AudioManager.PlayClip(AudioLabel.ClickButton); } ); actionList.Add(null); } TweenRoot tween = ResourceManager.Get(ObjectLabel.C_VisitLab).CreateStreamScale ( delayList, durationList, pairList, true, false, Curve.EaseOutQuad, false, actionList ); tween.OnForwardFinish += () => { AudioManager.PlayClip(AudioLabel.Bubble); }; } #endregion Complete = true; } public static void ExitVisiteeGarden() { ResourceManager.Get(ObjectLabel.I_BlackMask).TweenForCG(); HideTip (); ResourceManager.SetActive(ObjectLabel.C_Visit, true); ResourceManager.SetActive(ObjectLabel.C_Coin, true); ResourceManager.SetActive(ObjectLabel.C_Group1, true); ResourceManager.SetActive(ObjectLabel.C_Group2, true); ResourceManager.Get