Example #1
0
        public void CompileStatistics()
        {
            stats = new WorldStats();
            int _internal = 0, external = 0, playing = 0, spectating = 0;

            for (int i = 0, l = this.players.Count; i < l; i++)
            {
                var player = this.players[i];
                if (!player.router.IsExternal)
                {
                    _internal++;
                    continue;
                }
                external++;
                if (player.currentState == 0)
                {
                    playing++;
                }
                else if (player.currentState == PlayerState.Spectating || player.currentState == PlayerState.Roaming)
                {
                    spectating++;
                }
            }
            this.stats.limit      = Settings.listenerMaxConnections - this.handle.listener.connections.Count + external;
            this.stats._internal  = _internal;
            this.stats.external   = external;
            this.stats.playing    = playing;
            this.stats.spectating = spectating;
            this.stats.name       = Settings.serverName;
            this.stats.gamemode   = this.handle.gamemode.Name;
            this.stats.loadTime   = this.handle.avargateTickTime / this.handle.stepMult;
            this.stats.uptime     = Math.Floor((double)((DateTimeOffset.Now.ToUnixTimeMilliseconds() - this.handle.startTime.ToUnixTimeMilliseconds()) / 1000));
        }
Example #2
0
    void Awake()
    {
        SR = GetComponent <SpriteRenderer> ();

        CurrentGenerationAmount = BerryGenerationAmount;
        WorldStatsObject        = GameObject.Find("WorldStats");
        WS = WorldStatsObject.GetComponent <WorldStats> ();
    }
Example #3
0
    void ThreadOfMesh(WorldStats worldStats, int LevelOfDetails, Action <MeshData> callback)
    {
        MeshData meshData = MeshGenerator.GenerateTerrainMesh(worldStats.heightWorld, meshHeightMultiplier, meshHeightCurve, LevelOfDetails);

        lock (meshStatsThreadQueue)
        {
            meshStatsThreadQueue.Enqueue(new WorldThreadingStats <MeshData>(callback, meshData));
        }
    }
Example #4
0
    public void EnteringMeshInput(WorldStats worldStats, int LevelOfDetails, Action <MeshData> callback)
    {
        ThreadStart threadStart = delegate
        {
            ThreadOfMesh(worldStats, LevelOfDetails, callback);
        };

        new Thread(threadStart).Start();
    }
Example #5
0
    void ThreadOfWorld(Vector2 centre, Action <WorldStats> callback)
    {
        WorldStats worldStats = GenerateWorld(centre);

        lock (worldStatsThreadQueue)
        {
            worldStatsThreadQueue.Enqueue(new WorldThreadingStats <WorldStats>(callback, worldStats));
        }
    }
Example #6
0
        void OnWorldInfoReceived(WorldStats worldStats)
        {
            this.worldStats   = worldStats;
            WorldInfoRecieved = true;

            Texture2D texture2D = Texturing.TextureFromColourMap(worldStats.colourWorld, WorldGenerator.worldPartSize, WorldGenerator.worldPartSize);

            meshRenderer.material.mainTexture = texture2D;

            UpdateTerrainChunk();
        }
        private void GetWorldStats()
        {
            var client  = new RestClient("https://coronavirus-monitor.p.rapidapi.com/coronavirus/worldstat.php");
            var request = new RestRequest(Method.GET);

            request.AddHeader("x-rapidapi-key", "b8aff6d2f1msh175bfd4f4620e13p1bb8a1jsnb6ddf78fbc50");
            request.AddHeader("x-rapidapi-host", "coronavirus-monitor.p.rapidapi.com");
            IRestResponse response = client.Execute(request);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var content = response.Content;
                worldStats = JsonConvert.DeserializeObject <WorldStats>(content);
            }
            else
            {
                httpFeedback = response.ErrorMessage;
                backgroundWorker1.CancelAsync();
            }
        }
Example #8
0
    public void RendWorld()
    {
        WorldStats   worldStats = GenerateWorld(Vector2.zero);
        WorldDisplay display    = FindObjectOfType <WorldDisplay>();

        if (drawMode == DrawMode.NoiseWorld)
        {
            display.DrawTexture(Texturing.TextureFromHeightMap(worldStats.heightWorld));
        }
        else if (drawMode == DrawMode.ColourWorld)
        {
            display.DrawTexture(Texturing.TextureFromColourMap(worldStats.colourWorld, worldPartSize, worldPartSize));
        }
        else if (drawMode == DrawMode.Mesh)
        {
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(worldStats.heightWorld, meshHeightMultiplier, meshHeightCurve, ValueLevelOfDetail), Texturing.TextureFromColourMap(worldStats.colourWorld, worldPartSize, worldPartSize));
        }
        else if (drawMode == DrawMode.FallMap)
        {
            display.DrawTexture(Texturing.TextureFromHeightMap(FallGenerator.GenerateFall(worldPartSize)));
        }
    }
Example #9
0
 public void GetStats(out WorldStats stats) => ecs.get_stats(this, out stats);
Example #10
0
 public void Meshing(WorldStats worldStats)
 {
     selectedPart = true;
     worldGenerator.EnteringMeshInput(worldStats, levelDetail, ReceivingMesh);
 }