// this largely just handles the onscreen districts display
    void Update()
    {
        ProduceOverlay = options.Overlay;

        if (MaxCitySpreadreq < MinCitySpreadreq)
        {
            MinCitySpreadreq = MaxCitySpreadreq;
        }

        if (LiveRendererOptions != rendererOptions)
        {
            rendererOptions = LiveRendererOptions;
        }


        WorldMultiplier = worldMultiplier;
        //   TownGlobalObject.CityTileModulo = CityTileInterstitialSpread;
        PatchCap   = MaxCitySpreadreq;
        PatchFloor = MinCitySpreadreq;

        if (RequestedDistricts != null)
        {
            if (!CurrentDistricts.SequenceEqual(RequestedDistricts))
            {
                CurrentDistricts.Clear();
                CurrentDistricts.AddRange(RequestedDistricts);

                RequestedDistricts.Clear();
                districtNameText.text = string.Join(" ", CurrentDistricts);
                CurrentDistricts.Clear();
            }
        }
    }
예제 #2
0
 public TownMeshRenderer(Town town, TownOptions options, TownMeshRendererOptions rendererOptions)
 {
     this.town            = town;
     this.options         = options;
     root                 = rendererOptions.Root;
     this.rendererOptions = rendererOptions;
 }
    void DoChecks()
    {
        WorldMultiplier = worldMultiplier;

        initCiySize   = MinCitySpreadreq;
        secondCiySize = MaxCitySpreadreq;

        //if (FindObjectOfType<MapMagic.Core.MapMagicObject>() == null)
        //{
        //    return;
        //}

        ProduceOverlay = options.Overlay;
        //  if (TownGlobalObject.bundles == null || TownGlobalObject.townsData == null)
        //  {
        //   TownGlobalObject.bundles = new Dictionary<Coord, AOTABundle>();
        //   TownGlobalObject.townsData = new Dictionary<Coord, Town.Town>();
        //
        //  Debug.LogFormat("INITITALISED TownGlobalObject.bundles and .townsdata");
        //   }



        // setup district name
        CurrentDistricts = new List <string>();

        // assign statics
        if (PatchCap != MaxCitySpreadreq)
        {
            PatchCap = MaxCitySpreadreq;
        }

        if (PatchFloor != MinCitySpreadreq)
        {
            PatchFloor = MinCitySpreadreq;
        }

        districtNameText.text = "";

        if (TownGlobalObjectService.namegenref != namegen)
        {
            TownGlobalObjectService.namegenref = namegen;
        }

        int allnames = 200;

        if (NamesQueue == null)
        {
            NamesQueue = new Queue <string>(allnames);
        }

        TownGlobalObjectService.NamesQueue.Enqueue("Hometon");

        if (NamesQueue.Count < 200)
        {
            for (int i = 0; i < allnames; i++)
            {
                var tempname = "Hometon";
                while (TownGlobalObjectService.NamesQueue.Contains(tempname))
                {
                    tempname = namegen.GeneratePlace();
                }
                TownGlobalObjectService.NamesQueue.Enqueue(tempname);
            }
        }

        //    Debug.Log(NamesQueue.Peek());

        if (MapMagicObjectRef != MapMagicObjectReference)
        {
            MapMagicObjectRef = MapMagicObjectReference;
        }

        if (LiveRendererOptions != rendererOptions)
        {
            rendererOptions = LiveRendererOptions;
        }
    }