المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : سستم الطقس


Mero
2019-06-01, 05:59 AM
عفواً لايمكن عرض الروابط في الإرشيف


سيستم الطقس الى هو بيخلى الجو يمطر و ينزل ثلج وكدة


هاتعمل ملف جديد باسم

Weather.cs

وتحط فيه الكود دة


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Conquer_Online_Server.Game
{
public static class Weather
{
public static DateTime NextChange = new DateTime();

public static Network.GamePackets.Weather CurrentWeatherBase = new Conquer_Online_Server.Network.GamePackets.Weather( true);

public static uint Intensity
{
get
{
return CurrentWeatherBase.Intensity;
}
set
{
CurrentWeatherBase.Intensity = value;
}
}

public static uint Appearence
{
get
{
return CurrentWeatherBase.Appearence;
}
set
{
CurrentWeatherBase.Appearence = value;
}
}

public static uint Direction
{
get
{
return CurrentWeatherBase.Direction;
}
set
{
CurrentWeatherBase.Direction = value;
}
}

public static uint CurrentWeather
{
get
{
return CurrentWeatherBase.WeatherType;
}
set
{
CurrentWeatherBase.WeatherType = value;
foreach (Client.GameState client in Program.Values)
{
CurrentWeatherBase.Send(client);
}
}
}
}
}

وبعدين تروح ملف

World.cs

وتبحث عن الكود دة


private void ServerFunctions(int time)
{

وتحط دة تحت القوص علطول


#region New weather
Conquer_Online_Server.Network.GamePackets.Weather weather;
#region Rain System
if (DateTime.Now.Minute == 10 && DateTime.Now.Second == 0 || DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
{
foreach (GameState state in Kernel.GamePool.Values)
{
Program.WeatherType = Conquer_Online_Server.Network.GamePackets.Weather. Rain;
weather = new Conquer_Online_Server.Network.GamePackets.Weather( true)
{
WeatherType = (uint)Program.WeatherType,
Intensity = 255,
Appearence = 255,
Direction = 255
};
state.Send(weather);
}
}
#endregion Rain System
#region Snow System
if (DateTime.Now.Minute == 20 && DateTime.Now.Second == 0 || DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
{
foreach (GameState state in Kernel.GamePool.Values)
{
Program.WeatherType = Conquer_Online_Server.Network.GamePackets.Weather. Snow;
weather = new Conquer_Online_Server.Network.GamePackets.Weather( true)
{
WeatherType = (uint)Program.WeatherType,
Intensity = 255,
Appearence = 255,
Direction = 255
};
state.Send(weather);
}
}
#endregion Snow System
#region AutumnLeaves
if (DateTime.Now.Minute == 30 && DateTime.Now.Second == 0 || DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
{
foreach (GameState state in Kernel.GamePool.Values)
{
Program.WeatherType = Conquer_Online_Server.Network.GamePackets.Weather. AutumnLeaves;
weather = new Conquer_Online_Server.Network.GamePackets.Weather( true)
{
WeatherType = (uint)Program.WeatherType,
Intensity = 255,
Appearence = 255,
Direction = 255
};
state.Send(weather);
}
}
#endregion AutumnLeaves
#region CherryBlossomPetals
if (DateTime.Now.Minute == 40 && DateTime.Now.Second == 0 || DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
{
foreach (GameState state in Kernel.GamePool.Values)
{
Program.WeatherType = Conquer_Online_Server.Network.GamePackets.Weather. CherryBlossomPetals;
weather = new Conquer_Online_Server.Network.GamePackets.Weather( true)
{
WeatherType = (uint)Program.WeatherType,
Intensity = 255,
Appearence = 255,
Direction = 255
};
state.Send(weather);
}
}
#endregion CherryBlossomPetals
#region BlowingCotten
if (DateTime.Now.Minute == 60 && DateTime.Now.Second == 0 || DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
{
foreach (GameState state in Kernel.GamePool.Values)
{
Program.WeatherType = Conquer_Online_Server.Network.GamePackets.Weather. BlowingCotten;
weather = new Conquer_Online_Server.Network.GamePackets.Weather( true)
{
WeatherType = (uint)Program.WeatherType,
Intensity = 255,
Appearence = 255,
Direction = 255
};
state.Send(weather);
}
}
#endregion CherryBlossomPetals
#endregion New weather



وكدة هيبقى كلوا تمام تمام انشاء الله اشوفكم بخير


عفواً لايمكن عرض الروابط في الإرشيف

محمد ياسر
2019-06-01, 12:35 PM
الله ينور شغل جامد حدا

MohamedModyAdel
2019-06-28, 11:20 PM
تسلم

midoelg
2021-12-20, 06:30 AM
شكرا جزيلا