示例#1
0
        public SpaceInstance(uint InstanceId, SpaceInfo Info, SpaceModel Model)
        {
            this.uint_0                 = InstanceId;
            this.spaceInfo_0            = Info;
            this.concurrentDictionary_0 = new ConcurrentDictionary <uint, SpaceActor>();
            this.spaceModel_0           = Model;
            this.string_0               = string.Empty;
            this.list_2                 = new List <uint> {
                1, 2, 3, 4, 5, 6, 6, 8, 9, 10, 11, 12, 13, 14, 15, 0x10,
                0x11, 0x12, 0x13, 20, 0x15
            };
            this.object_2    = new object();
            this.tileState_0 = new TileState[this.spaceModel_0.Heightmap.SizeX, this.spaceModel_0.Heightmap.SizeY];
            this.list_0      = new List <SpaceActor> [this.spaceModel_0.Heightmap.SizeX, this.spaceModel_0.Heightmap.SizeY];
            SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();

            try
            {
                this.InitializeContestWorker(mySqlClient);
            }
            catch (Exception exception)
            {
                Output.WriteLine("[ContestMgr] An exception has been trhown while trying to start the worker. The thread was already destroyed. Stack trace:\r\n" + exception.ToString(), OutputLevel.CriticalError);
            }
            finally
            {
                if (mySqlClient != null)
                {
                    mySqlClient.Dispose();
                }
            }
            this.RegenerateRelativeHeightmap(false);
        }
示例#2
0
        public static SpaceInfo GetSpaceInfo(uint SpaceId, bool IgnoreCache)
        {
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(SpaceId);

            if (instanceBySpaceId != null)
            {
                return(instanceBySpaceId.Info);
            }
            if (!IgnoreCache)
            {
                SpaceInfo info = smethod_1(SpaceId);
                if (info != null)
                {
                    return(info);
                }
            }
            using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
            {
                client.SetParameter("id", SpaceId);
                string query = "SELECT * FROM escenarios WHERE id = " + SpaceId + " LIMIT 1";
                Console.WriteLine(query);
                DataRow row = client.ExecuteQueryRow(query);
                if (row != null)
                {
                    return(GenerateSpaceInfoFromRow(row));
                }
            }
            return(null);
        }
示例#3
0
 public void Dispose()
 {
     if (!this.bool_0)
     {
         this.Unload();
     }
     this.spaceInfo_0 = null;
 }
示例#4
0
        public static SpaceInstance TryCreateSpaceInstance(uint InstanceId, uint SpaceId)
        {
            SpaceInfo spaceInfo = SpaceInfoLoader.GetSpaceInfo(SpaceId);

            if (spaceInfo == null)
            {
                return(null);
            }
            SpaceModel model = spaceInfo.TryGetModel();

            if (model == null)
            {
                return(null);
            }
            return(new SpaceInstance(InstanceId, spaceInfo, model));
        }
示例#5
0
        private static void smethod_1(Session session_0, uint uint_0, string string_0 = "", bool bool_0 = false)
        {
            SpaceManager.RemoveUserFromSpace(session_0, false);
            SpaceInfo spaceInfo = SpaceInfoLoader.GetSpaceInfo(uint_0);

            if (spaceInfo == null)
            {
                session_0.SendData(SpaceFullComposer.Compose());
            }
            else
            {
                if (spaceInfo.ParentId == 0)
                {
                    int       num   = new Random().Next(0, spaceInfo.SubIds.Count - 1);
                    SpaceInfo info2 = spaceInfo;
                    spaceInfo = SpaceInfoLoader.GetSpaceInfo(info2.SubIds[num]);
                }
                if (spaceInfo == null)
                {
                    session_0.SendData(SpaceFullComposer.Compose());
                }
                else if (spaceInfo.TryGetModel() == null)
                {
                    session_0.SendData(SpaceFullComposer.Compose());
                }
                else if ((spaceInfo.CurrentUsers < spaceInfo.MaxUsers) && (spaceInfo.CurrentUsers < 0x15))
                {
                    session_0.AbsoluteSpaceId   = spaceInfo.UInt32_0;
                    session_0.AbsoluteSpaceName = spaceInfo.Name;
                    session_0.SpaceAuthed       = bool_0 || (spaceInfo.OwnerId == session_0.CharacterId);
                    session_0.SpaceJoined       = false;
                    session_0.SendData(SpaceLoadPublicSceneComposer.Compose(spaceInfo));
                }
                else
                {
                    session_0.SendData(SpaceFullComposer.Compose());
                }
            }
        }