コード例 #1
0
    float OnGUIZone(WorldZone zone, float y)
    {
        float w = 500f;

        y += 30f;
        GUI.Label(new Rect(10f, y, w, 30f), "Zone [" + zone.randomInt + "]: " + (zone.isMainGround ? "Main " : "") + zone.type.ToString() + " -> " + zone.state.ToString() + ">" + zone.requireZoneState.ToString());

        if (!zone.isMainGround)
        {
            y += 15f;
            GUI.Label(new Rect(10f, y, w, 30f), "    On chunks: ");
            for (int c = 0; c < zone.chunks.Count; c++)
            {
                Coord coord = zone.chunks [c];
                y += 15f;
                string dev = "  " + zone.chunkZones [coord].Count + "x [";
                for (int i = 0; i < zone.chunkZones [coord].Count; i++)
                {
                    dev += (i == 0 ? "" : ", ") + (zone.chunkZones [coord] [i].containAllCoords ? " ALL " : zone.chunkZones [coord] [i].coords.Count.ToString());
                }
                GUI.Label(new Rect(10f, y, w, 30f), "   -> " + coord + dev + "]");
            }
        }
        if (zone.state == WorldZoneStates.Created)
        {
            y += 25f;
            GUI.Label(new Rect(10f, y, w, 30f), "    Missings chunks: ");
            List <Coord> missingChunks = zone.GetMissingChunks();
            for (int c = 0; c < missingChunks.Count; c++)
            {
                y += 15f;
                GUI.Label(new Rect(10f, y, w, 30f), "   -> " + missingChunks [c]);
            }
        }
        return(y);
    }
コード例 #2
0
    void TestZonesCompletedAndSeeMore(WorldChunkSettings setting)
    {
        // Loop all zones to check if completed
        for (int zone_idx = this.worldZonesRefs.Count - 1; zone_idx >= 0; zone_idx--)
        {
            if (this.worldZonesRefs [zone_idx].isMainGround)
            {
                continue;
            }
            WorldZone sideZone = this.worldZonesRefs [zone_idx];

            if (sideZone.GetMissingChunks().Count == 0)
            {
                sideZone.OnMergeCompleted();
            }
            else
            {
                // See more ?!
                if (sideZone.requireZoneState >= WorldZoneStates.Merged)
                {
                    // BY ALL MISSNIG ?
                    // Don't use by Direction because can create a missing chunk is one was already loaded (see bug-SeeMore-not-per-direction-but-missing.png)
                    List <Coord> missingCoords = sideZone.GetMissingChunks();
                    for (int missing_idx = 0; missing_idx < missingCoords.Count; missing_idx++)
                    {
                        if (!MapEndless.instance.worldChunks.ContainsKey(missingCoords [missing_idx]))
                        {
                            MapEndless.instance.CreateChunk(missingCoords [missing_idx], ChunkStates.Computed);
                        }
                        else if (MapEndless.instance.worldChunks [missingCoords [missing_idx]].state < ChunkStates.Computed)
                        {
                            MapEndless.instance.worldChunks [missingCoords [missing_idx]].UpdateState(setting, ChunkStates.Computed);
                        }
                    }
                    /**/

                    // BY CHUNK DIRECTION

                    /*
                     * for (int e = 0; e < Coord.directions.Length; e++) {
                     *      Direction seeMoreDirection = Coord.directions [e];
                     *      Coord seeMoreCoord = this.coord.GetDirection (seeMoreDirection);
                     *
                     *      if (sideZone.chunks.Contains (seeMoreCoord)) {
                     *      //	continue; // skip if already on this zone
                     *      }
                     *
                     *      // If it's not the direction we come from
                     *      // And the zone who was used to merge, is also bordered on another chunk
                     *      for (int idx = this.worldZonesRefs [zone_idx].chunkZones[this.coord].Count - 1; idx >= 0; idx--) {
                     *              if (this.worldZonesRefs [zone_idx].chunkZones[this.coord][idx].missingChunks.Contains(seeMoreCoord)) {
                     *                      // Already exist
                     *                      if (MapEndless.instance.worldChunks.ContainsKey(seeMoreCoord)) {
                     *                              continue;
                     *                      }
                     *
                     *                      MapEndless.instance.CreateChunk (seeMoreCoord, ChunkStates.Computed);
                     *              }
                     *      }
                     * }
                     * /**/
                }
            }
        }
    }