Exemplo n.º 1
0
        private void OnTriggerExit(Collider other)
        {
            WeatherZone weather = other.GetComponent <WeatherZone>();

            if (null == weather)
            {
                return;
            }

            weather.Exit(gameObject);
            _zones.Remove(weather);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Gets the current weather informations for the specified <paramref name="zone"/> asynchronously.
        /// </summary>
        /// <param name="zone">the zone to get the weather informations for</param>
        /// <param name="cluster">
        ///     a value indicating whether server clustering of points should be used for the
        ///     response data
        /// </param>
        /// <param name="requestOptions">
        ///     the request options (can change the behavior of requesting and controls caching,
        ///     cancellation, unit and language options of the result)
        /// </param>
        /// <returns>
        ///     a task that represents the asynchronous operation. The task result is the weather
        ///     information; or <see langword="null"/> if the city could not be found.
        /// </returns>
        public Task <WeatherList?> GetCurrentWeatherAsync(WeatherZone zone, bool cluster = false, RequestOptions?requestOptions = default)
        {
            requestOptions ??= RequestOptions.Default;
            requestOptions.CancellationToken.ThrowIfCancellationRequested();

            // send request
            var parameters = new NameValueCollection {
                { "bbox", zone.ToZoneString() }, { "cluster", cluster ? "yes" : "no" }
            };

            return(RequestAsync <WeatherList>("box/city", parameters, requestOptions));
        }
Exemplo n.º 3
0
        private void OnTriggerEnter(Collider other)
        {
            WeatherZone weather = other.GetComponent <WeatherZone>();

            if (null == weather)
            {
                return;
            }

            weather.Enter(gameObject, ParticleSystemParent);
            _zones.Add(weather);
        }
Exemplo n.º 4
0
 public void SendWeather(int ZoneID, ref WS_Network.ClientClass client)
 {
     if (WeatherZones.ContainsKey(ZoneID))
     {
         WeatherZone         Weather      = WeatherZones[ZoneID];
         Packets.PacketClass SMSG_WEATHER = new Packets.PacketClass(Opcodes.SMSG_WEATHER);
         SMSG_WEATHER.AddInt32((int)Weather.CurrentWeather);
         SMSG_WEATHER.AddSingle(Weather.Intensity);
         SMSG_WEATHER.AddInt32(Weather.GetSound());
         client.Send(ref SMSG_WEATHER);
         SMSG_WEATHER.Dispose();
     }
 }
Exemplo n.º 5
0
    public bool zone_activated(int x, int y)
    {
        WeatherZone zone = Zones.Find(zo => zo.X == x && zo.Y == y);

        if (zone == null)
        {
            zone = new WeatherZone(x, y);
            Zones.Add(zone);
        }

        if (CurrentZone != null)
        {
            CurrentZone.RainMode = cmbRain.SelectedIndex;
        }
        cmbRain.SelectedIndex = zone.RainMode;
        CurrentZone           = zone;
        return(false);
    }
Exemplo n.º 6
0
    private void Load()
    {
        if (!File.Exists(Config.PathMapsDir + "\\weather.fowm"))
        {
            return;
        }

        foreach (String line in File.ReadAllLines(Config.PathMapsDir + "\\weather.fowm"))
        {
            string[] param  = line.Split('|');
            string[] coords = param[0].Split(',');

            WeatherZone weather = new WeatherZone()
            {
                X = Int32.Parse(coords[0]), Y = Int32.Parse(coords[1]), RainMode = Int32.Parse(param[1])
            };
            Zones.Add(weather);
        }
    }
        public WeatherZoneFactory()
        {
            WeatherZones = new List<WeatherZone>();

            Uri uri = new Uri(Constants.WeatherZoneDataPath, UriKind.Relative);
            XElement applicationXml;
            StreamResourceInfo xmlStream = Application.GetResourceStream(uri);
            applicationXml = XElement.Load(xmlStream.Stream);
            var data = from wz in applicationXml.Descendants("WeatherZone")
                       select wz;

            WeatherZone weatherZone = null;
            foreach (var d in data)
            {
                weatherZone = new WeatherZone();
                weatherZone.WeatherZoneId = (Int32)d.Element("WeatherZoneId");
                weatherZone.WeatherZoneDescription = (String)d.Element("WeatherZoneDescription");
                WeatherZones.Add(weatherZone);
            }
        }
Exemplo n.º 8
0
 public PSWeather(WeatherZone weatherZone) : base(WorldOpcodes.SMSG_WEATHER)
 {
     this.Write((int)weatherZone.CurrentWeather);
     this.Write(weatherZone.Intensity);
     this.Write((int)weatherZone.CurrentSound);
 }
Exemplo n.º 9
0
    public bool zone_activated(int x, int y)
    {
        WeatherZone zone = Zones.Find(zo => zo.X == x && zo.Y == y);
        if (zone == null)
        {
            zone = new WeatherZone(x,y);
            Zones.Add(zone);
        }

        if (CurrentZone != null)
        {
            CurrentZone.RainMode = cmbRain.SelectedIndex;
        }
        cmbRain.SelectedIndex = zone.RainMode;
        CurrentZone = zone;
        return false;
    }
Exemplo n.º 10
0
    private void Load()
    {
        if (!File.Exists(Config.PathMapsDir + "\\weather.fowm"))
            return;

        foreach (String line in File.ReadAllLines(Config.PathMapsDir + "\\weather.fowm"))
        {
            string[] param = line.Split('|');
            string[] coords = param[0].Split(',');

            WeatherZone weather = new WeatherZone() { X = Int32.Parse(coords[0]), Y = Int32.Parse(coords[1]), RainMode=Int32.Parse(param[1]) };
            Zones.Add(weather);
        }
    }