using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml; using Sfs2X.Entities.Data; using UnityEngine; using UnityEngine.UI; using Random = UnityEngine.Random; public class ChestData { #region Config public int Value; public int Round; public int RemainValue; public int RemainRound; public int DatabaseRoomID; public long ID; public long Owner; public DateTime ActivatedTime; public ChestType ChestType; public Vector3 Position; public static int SystemRoomDatabaseID = 1; private static bool Initialized; //private static float XMin; //private static float XMax; //private static float YMin; //private static float YMax; private static Vector3 DefaultPosition; private static Vector3 ChestDepthOffset = new Vector3(0, 0, 0.98f); #endregion public ChestData(ISFSObject arg) { if (!Initialized) { Initialize(); } ID = arg.GetLong(gd_chest.ID); Value = arg.GetInt(gd_chest.Value); Round = arg.GetInt(gd_chest.Round); RemainValue = arg.GetInt(gd_chest.RemainValue); RemainRound = arg.GetInt(gd_chest.RemainRound); DatabaseRoomID = arg.GetInt(gd_chest.DatabaseRoomID); Owner = arg.GetLong(gd_chest.Owner); ActivatedTime = DateUtil.GetTimeFromSecends(arg.GetLong(gd_chest.ActivatedTime).ToString()); ChestType = (ChestType) arg.GetInt(gd_chest.Type); Vector3 defaultPosition = DefaultPosition + ChestDepthOffset; if (arg.ContainsKey(gd_chest.Position)) { string vectorStr = arg.GetUtfString(gd_chest.Position); if (vectorStr == "null") { Position = defaultPosition; } else { Position = arg.GetUtfString(gd_chest.Position).StringToVector() + ChestDepthOffset; } } else { Position = defaultPosition; } } private static void Initialize() { Initialized = true; DefaultPosition = ManaReso.Get("PlazaRoomChestPos").position; //XMin = ManaReso.Get("ChestLowerLeft").position.x; //YMin = ManaReso.Get("ChestLowerLeft").position.y; //XMax = ManaReso.Get("ChestUpperRight").position.x; //YMax = ManaReso.Get("ChestUpperRight").position.y; } } public class ChestMge : Regist { #region Config private static Text Desc; private static Text BtnLab; private static Text SliderValueLab; private static Slider Slider; private static Button Btn; private static InputField InputField; private static string RefundNodeName = "Refund"; private static string ReceivedNodeName = "Received"; public static List PlazaRoomChests = new List(); private static List RefundRoomIDs = new List(); private static Dictionary ChestRoomDictionary = new Dictionary(); #endregion public override void RegistValueA() { XmlNodeList RefundNodes = ManaData.PlayerNode.SelectNodes(RefundNodeName); XmlNodeList ReceivedNodes = ManaData.PlayerNode.SelectNodes(ReceivedNodeName); for (int i = 0; i < RefundNodes.Count; i++) { RefundRoomIDs.Add(int.Parse(RefundNodes[i].InnerText)); } for (int i = 0; i < ReceivedNodes.Count; i++) { string[] strings = ReceivedNodes[i].InnerText.Split('|'); long chestID = long.Parse(strings[0]); ChestRoomDictionary.Add(chestID, int.Parse(strings[1])); } //foreach (var VARIABLE in RefundRoomIDs) //{ // Debug.LogWarning("refund " + VARIABLE); //} //foreach (var VARIABLE in ChestRoomDictionary) //{ // Debug.LogWarning("received " + VARIABLE.Key); //} CheckRefund(); GetChestExpireStatus(); } public override void RegistReference() { Btn = ManaReso.Get