2023-04-13 20:49:00 +04:00
|
|
|
/*
|
2024-05-19 08:00:56 +03:00
|
|
|
* Copyright 2023-2024 Eduard Kargin <kargin.eduard@gmail.com>
|
2023-04-13 20:49:00 +04:00
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-04-13 20:42:05 +04:00
|
|
|
using Ragon.Server.Entity;
|
|
|
|
|
using Ragon.Server.IO;
|
|
|
|
|
using Ragon.Server.Room;
|
|
|
|
|
|
|
|
|
|
namespace Ragon.Server.Plugin;
|
|
|
|
|
|
|
|
|
|
public class BaseRoomPlugin: IRoomPlugin
|
|
|
|
|
{
|
2023-04-14 14:32:04 +04:00
|
|
|
public IRagonRoom Room { get; private set; }
|
2023-04-13 20:42:05 +04:00
|
|
|
|
2023-04-14 14:32:04 +04:00
|
|
|
public virtual void OnAttached(IRagonRoom room)
|
2023-04-13 20:42:05 +04:00
|
|
|
{
|
2023-04-14 14:32:04 +04:00
|
|
|
Room = room;
|
2023-04-13 20:42:05 +04:00
|
|
|
}
|
2024-05-19 08:00:56 +03:00
|
|
|
|
|
|
|
|
public virtual void OnDetached(IRagonRoom room)
|
2023-04-13 20:42:05 +04:00
|
|
|
{
|
2023-04-14 14:32:04 +04:00
|
|
|
|
2023-04-13 20:42:05 +04:00
|
|
|
}
|
2024-05-19 08:00:56 +03:00
|
|
|
|
2023-04-14 14:32:04 +04:00
|
|
|
#region VIRTUAL
|
|
|
|
|
|
|
|
|
|
public virtual bool OnPlayerJoined(RagonRoomPlayer player)
|
2023-04-13 20:42:05 +04:00
|
|
|
{
|
2023-04-14 14:32:04 +04:00
|
|
|
return true;
|
2023-04-13 20:42:05 +04:00
|
|
|
}
|
2023-04-14 14:32:04 +04:00
|
|
|
|
|
|
|
|
public virtual bool OnPlayerLeaved(RagonRoomPlayer player)
|
2023-04-13 20:42:05 +04:00
|
|
|
{
|
2023-04-14 14:32:04 +04:00
|
|
|
return true;
|
2023-04-13 20:42:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Tick(float dt)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 14:32:04 +04:00
|
|
|
public virtual bool OnEntityCreate(RagonRoomPlayer creator, IRagonEntity entity)
|
2023-04-13 20:42:05 +04:00
|
|
|
{
|
2023-04-14 14:32:04 +04:00
|
|
|
|
2023-04-13 20:42:05 +04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 14:32:04 +04:00
|
|
|
public virtual bool OnEntityRemove(RagonRoomPlayer remover, IRagonEntity entity)
|
2023-04-13 20:42:05 +04:00
|
|
|
{
|
2023-04-14 14:32:04 +04:00
|
|
|
|
2023-04-13 20:42:05 +04:00
|
|
|
return true;
|
|
|
|
|
}
|
2024-05-12 10:57:46 +03:00
|
|
|
|
|
|
|
|
public virtual bool OnData(RagonRoomPlayer player, byte[] data)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2023-04-13 20:42:05 +04:00
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|