示例#1
0
    private LoginLoadingRes.LoadEntityType LoadEntity(LoginLoadingRes.LoadEntityType type)
    {
        object obj = this.loadEntityLock;

        LoginLoadingRes.LoadEntityType result;
        lock (obj)
        {
            if (type != LoginLoadingRes.LoadEntityType.CityPlayer)
            {
                result = LoginLoadingRes.LoadEntityType.None;
            }
            else
            {
                EntityWorld.Instance.CityPlayerEntityPool.Add(new EntityCityPlayer());
                if (EntityWorld.Instance.CityPlayerEntityPool.get_Count() < this.entityCityPlayerCount)
                {
                    result = LoginLoadingRes.LoadEntityType.CityPlayer;
                }
                else
                {
                    result = LoginLoadingRes.LoadEntityType.None;
                }
            }
        }
        return(result);
    }
示例#2
0
    private void CreateEntityCityPlayer()
    {
        LoginLoadingRes.LoadEntityType type = this.GetNextLoadType();
        while (type != LoginLoadingRes.LoadEntityType.None)
        {
            type = this.LoadEntity(type);
            this.currentAllEntityCount++;
            this.SetProgress(LoginLoadingRes.LoadType.Entity, (float)this.currentAllEntityCount / (float)this.allEntityCount);
        }
        object obj = this.loadEntityLock;

        lock (obj)
        {
            if (this.currentAllEntityCount > 0 && this.currentAllEntityCount == this.allEntityCount)
            {
                this.currentAllEntityCount = -1;
                this.SetLoadEnd(LoginLoadingRes.LoadType.Entity);
            }
        }
    }