using System; using System.Collections; using System.Collections.Generic; using Sfs2X.Core; using Sfs2X.Entities.Data; using Sfs2X.Requests; using UnityEngine; public class DatabaseManager { private static string DatabaseIDLabel = "D"; private static string LimitLabel = "L"; private static string ResultLabel = "R"; private static GardenSmartFox GardenSmartFox; public static Action OnReceiveRoomData; public DatabaseManager(GardenSmartFox smartFox) { GardenSmartFox = smartFox; smartFox.ExtensionManager.BaseSFSExtension.Instances.Add(this); } public static void GetRoomList(int startID) { SFSObject parameter = new SFSObject(); parameter.PutInt(DatabaseIDLabel, DatabaseID.RoomData.GetHashCode()); parameter.PutInt(LimitLabel, startID); GardenSmartFox.SmartFox.Send(new ExtensionRequest(RequestID.Database.GetHashString(), parameter)); } public void RoomData(BaseEvent baseEvent) { //DebugManager.PrintKeysAndValuesOfBaseEvent("PlazaRoomData", baseEvent); SFSObject sfsObject = (SFSObject) baseEvent.Params["params"]; OnReceiveRoomData.Invoke(sfsObject.GetSFSArray(ResultLabel)); } }