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

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


ElSaher
2020-03-28, 04:29 AM
انا مش هطول في الكلام سيستم الطقس كامل بدون اي ايرورات او اي حاجا

اول حاجا هتعمل كلاس جديد في Game
باسم
Weather.cs
وتمسح كل الي فيه وتضيف

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

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

public static Network.GamePackets.Weather CurrentWeatherBase = new Mr_Panda.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);
}
}
}
}
}



بعد كدا هتعمل كلاس جديد في فولدر GamePackets
باسم Weather.cs
وتمسح الي فيه كلو وتحوط دول

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

namespace Mr_Panda.Network.GamePackets
{
public class Weather : Writer, Interfaces.IPacket
{
public const uint Nothing = 1,
Rain = 2,
Snow = 3,
RainWind = 4,
AutumnLeaves = 5,
CherryBlossomPetals = 7,
CherryBlossomPetalsWind = 8,
BlowingCotten = 9,
Atoms = 10;

byte[] Buffer;

public Weather(bool Create)
{
if (Create)
{
Buffer = new byte[20 + 8];
WriteUInt16(20, 0, Buffer);
WriteUInt16(1016, 2, Buffer);
}
}

public uint WeatherType
{
get { return BitConverter.ToUInt32(Buffer, 4); }
set { WriteUInt32(value, 4, Buffer); }
}

public uint Intensity
{
get { return BitConverter.ToUInt32(Buffer, 8); }
set { WriteUInt32(value, 8, Buffer); }
}

public uint Direction
{
get { return BitConverter.ToUInt32(Buffer, 12); }
set { WriteUInt32(value, 12, Buffer); }
}

public uint Appearence
{
get { return BitConverter.ToUInt32(Buffer, 16); }
set { WriteUInt32(value, 16, Buffer); }
}

public void Send(Client.GameState client)
{
client.Send(Buffer);
}

public byte[] ToArray()
{
return Buffer;
}

public void Deserialize(byte[] buffer)
{
Buffer = buffer;
}
}
}



بعد كدا هتروح علي World هتبحث عن كود

private void ServerFunctions(int time)
{


وتحط دة تحت القوس علطول هتضيف


#region New weather
Mr_Panda.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 = Mr_Panda.Network.GamePackets.Weather.Rain;
weather = new Mr_Panda.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 = Mr_Panda.Network.GamePackets.Weather.Snow;
weather = new Mr_Panda.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 = Mr_Panda.Network.GamePackets.Weather.AutumnLeaves;
weather = new Mr_Panda.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 = Mr_Panda.Network.GamePackets.Weather.CherryBlossom Petals;
weather = new Mr_Panda.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 = Mr_Panda.Network.GamePackets.Weather.BlowingCotten ;
weather = new Mr_Panda.Network.GamePackets.Weather(true)
{
WeatherType = (uint)Program.WeatherType,
Intensity = 255,
Appearence = 255,
Direction = 255
};
state.Send(weather);
}
}
#endregion CherryBlossomPetals
#endregion New weather


هتغير Mr_Panda بي اسم البروجكت بتاعك



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

Hassan Emprator
2020-03-28, 12:13 PM
موجود هنا ييسط الاحول

ElSaher
2020-03-28, 04:19 PM
موجود هنا ييسط الاحول

عليه الطلاق مش كامل الي منزلو ميرو مش كامل الي انا منزلو كامل وبتعدل مسي كمان

ابو حمزه9
2020-03-28, 07:02 PM
عليه الطلاق مش كامل الي منزلو ميرو مش كامل الي انا منزلو كامل وبتعدل مسي كمان
واسم البروجيكت Mrpanda؟ :mad:

ElSaher
2020-03-28, 07:05 PM
واسم البروجيكت Mrpanda؟ :mad:



ما اسم البروجيكت السورس Mr_Panda

Mahmoud123
2023-09-08, 05:52 AM
مرحبا