mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-12 15:44:34 +01:00
help
This commit is contained in:
45
.github/workflows/dotnet.yml
vendored
45
.github/workflows/dotnet.yml
vendored
@@ -1,45 +0,0 @@
|
||||
# This workflow will build a .NET project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
|
||||
|
||||
name: .NET
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
paths-ignore:
|
||||
- '**/LICENSE'
|
||||
- '**/README.md'
|
||||
- '**/.github'
|
||||
- '**/.gitignore'
|
||||
- '**/.gitattributes'
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
- name: Download Resources
|
||||
run: "curl -o Proto.zip -A 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36' --header 'Accept-Encoding: gzip,deflate' https://rafi12.cyou/files/Proto.zip"
|
||||
- name: Unzip Resources
|
||||
run: unzip -n Proto.zip -d Common
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet publish ./PemukulPaku.csproj -c Release -o PemukulPaku_build
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: net6.0
|
||||
path: ./PemukulPaku_build
|
||||
- name: Clean up
|
||||
run: rm Proto.zip && rm -r -force ./PemukulPaku_build
|
||||
@@ -23,13 +23,11 @@ git clone https://github.com/rafi1212122/PemukulPaku.git
|
||||
|
||||
从[这里](https://github.com/rafi1212122/PemukulPaku/actions)下载最新action.
|
||||
进入PemukulPaku文件夹,将下载的action解压到该文件夹下
|
||||
下载资源文件 [resources](***REMOVED*** 并将其解压放置在 `Common\Resources`目录下
|
||||
下载资源文件 resources 并将其解压放置在 `Common\Resources`目录下
|
||||
```
|
||||
├───Common
|
||||
│ └───Resources
|
||||
│ └───ExcelOutputAsset
|
||||
│ └───Proto.cs
|
||||
|
||||
|
||||
```
|
||||
**运行服务*
|
||||
|
||||
@@ -46,7 +46,7 @@ git clone https://github.com/rafi1212122/PemukulPaku.git
|
||||
|
||||
進入PemukulPaku資料夾,將下載的action解壓到該資料夾下
|
||||
|
||||
下載資源檔[resources](***REMOVED***
|
||||
下載資源檔 resources 並將其解壓放置在`Common\Resources`目錄下
|
||||
|
||||
```
|
||||
|
||||
@@ -56,10 +56,6 @@ git clone https://github.com/rafi1212122/PemukulPaku.git
|
||||
|
||||
│└———ExcelOutputAsset
|
||||
|
||||
│└———Proto.cs
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
28
GameServer/Handlers/One/GetTeamBriefInfoReqHandler.cs
Normal file
28
GameServer/Handlers/One/GetTeamBriefInfoReqHandler.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Common.Resources.Proto;
|
||||
using PemukulPaku.GameServer.MPModule;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers.One
|
||||
{
|
||||
[PacketCmdId(CmdId.GetTeamBriefInfoReq)]
|
||||
internal class GetTeamBriefInfoReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
GetTeamBriefInfoReq Data = packet.GetDecodedBody<GetTeamBriefInfoReq>();
|
||||
Team? team = Lobby.GetInstance().Teams.Values.FirstOrDefault(x => x.LeaderUid == Data.TeamId);
|
||||
if (team is null)
|
||||
return;
|
||||
|
||||
GetTeamBriefInfoRsp Rsp = new()
|
||||
{
|
||||
retcode = GetTeamBriefInfoRsp.Retcode.Succ,
|
||||
TeamId = Data.TeamId,
|
||||
IsFriendInvitation = Data.IsFriendInvitation,
|
||||
StageId = team.StageId,
|
||||
Status = MpTeamStatus.TeamStatusInLobby
|
||||
};
|
||||
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.GetTeamBriefInfoRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Common.Resources.Proto;
|
||||
using PemukulPaku.GameServer.MPModule;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers.Three
|
||||
{
|
||||
@@ -9,6 +10,7 @@ namespace PemukulPaku.GameServer.Handlers.Three
|
||||
{
|
||||
GetTeamListReq Data = packet.GetDecodedBody<GetTeamListReq>();
|
||||
GetTeamListRsp Rsp = new() { retcode = GetTeamListRsp.Retcode.Succ };
|
||||
Rsp.TeamDataLists.AddRange(Lobby.GetInstance().Teams.Values.Where(x => Data.StageIdLists.Contains(x.StageId)).Select(x => x.GetMpTeamData()));
|
||||
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.GetTeamListRsp));
|
||||
}
|
||||
|
||||
18
GameServer/Handlers/Three/GetTeamStatusReqHandler.cs
Normal file
18
GameServer/Handlers/Three/GetTeamStatusReqHandler.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Common.Resources.Proto;
|
||||
using PemukulPaku.GameServer.MPModule;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers.Three
|
||||
{
|
||||
[PacketCmdId(CmdId.GetTeamStatusReq)]
|
||||
internal class GetTeamStatusReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
GetTeamStatusReq Data = packet.GetDecodedBody<GetTeamStatusReq>();
|
||||
GetTeamStatusRsp Rsp = new() { retcode = GetTeamStatusRsp.Retcode.Succ };
|
||||
Rsp.TeamDataLists.AddRange(Lobby.GetInstance().Teams.Values.Where(x => Data.TeamIdLists.Contains(x.LeaderUid)).Select(x => x.GetMpTeamData()));
|
||||
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.GetTeamStatusRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,21 +31,61 @@ namespace PemukulPaku.GameServer.MPModule
|
||||
|
||||
MpTeamSyncNotify teamSyncNotify = new()
|
||||
{
|
||||
TeamData = new()
|
||||
{
|
||||
LeaderUid = team.LeaderUid,
|
||||
TeamId = teamId,
|
||||
LobbyEnterType = team.LobbyEnterType,
|
||||
LobbyStatus = team.LobbyStatus,
|
||||
MinLevel = team.MinLevel,
|
||||
MaxLevel = 0,
|
||||
StageId = team.StageId,
|
||||
TeamName = team.Name,
|
||||
Status = MpTeamStatus.TeamStatusInLobby
|
||||
}
|
||||
TeamData = team.GetMpTeamData()
|
||||
};
|
||||
|
||||
teamSyncNotify.TeamData.MemberLists.AddRange(team.Members.Select(member =>
|
||||
foreach (Session? session in team.Members.Where(x => x.Session is not null).Select(x => x.Session))
|
||||
{
|
||||
session?.Send(Packet.FromProto(teamSyncNotify, CmdId.MpTeamSyncNotify));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Team
|
||||
{
|
||||
public uint StageId { get; set; }
|
||||
public uint MinLevel;
|
||||
public uint LeaderUid;
|
||||
public LobbyEnterType LobbyEnterType;
|
||||
public LobbyStatus LobbyStatus = LobbyStatus.LobbyPreparing;
|
||||
public List<TeamMember> Members;
|
||||
public string Name;
|
||||
|
||||
public Team(uint stageId, uint minLevel, LobbyEnterType lobbyEnterType, in Session leader, string name)
|
||||
{
|
||||
StageId = stageId;
|
||||
MinLevel = minLevel;
|
||||
LobbyEnterType = lobbyEnterType;
|
||||
Members = new List<TeamMember> { new(leader), new(null, 2), new(null, 3) };
|
||||
LeaderUid = leader.Player.User.Uid;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public void Join(Session session)
|
||||
{
|
||||
if (Members[1].Session is null)
|
||||
Members[1].Session = session;
|
||||
else if (Members[2].Session is null)
|
||||
Members[2].Session = session;
|
||||
|
||||
Lobby.GetInstance().SyncTeam(LeaderUid);
|
||||
}
|
||||
|
||||
public MpTeamData GetMpTeamData()
|
||||
{
|
||||
MpTeamData teamData = new()
|
||||
{
|
||||
LeaderUid = LeaderUid,
|
||||
TeamId = LeaderUid,
|
||||
LobbyEnterType = LobbyEnterType,
|
||||
LobbyStatus = LobbyStatus,
|
||||
MinLevel = MinLevel,
|
||||
MaxLevel = 0,
|
||||
StageId = StageId,
|
||||
TeamName = Name,
|
||||
Status = MpTeamStatus.TeamStatusInLobby
|
||||
};
|
||||
teamData.MemberLists.AddRange(Members.Select(member =>
|
||||
{
|
||||
if (member.Session is null)
|
||||
return new MpTeamMember() { Index = member.Index, DressId = 0 };
|
||||
@@ -75,31 +115,12 @@ namespace PemukulPaku.GameServer.MPModule
|
||||
};
|
||||
}));
|
||||
|
||||
foreach (Session? session in team.Members.Where(x => x.Session is not null).Select(x => x.Session))
|
||||
{
|
||||
session?.Send(Packet.FromProto(teamSyncNotify, CmdId.MpTeamSyncNotify));
|
||||
}
|
||||
}
|
||||
return teamData;
|
||||
}
|
||||
|
||||
public class Team
|
||||
public override string ToString()
|
||||
{
|
||||
public uint StageId { get; set; }
|
||||
public uint MinLevel;
|
||||
public uint LeaderUid;
|
||||
public LobbyEnterType LobbyEnterType;
|
||||
public LobbyStatus LobbyStatus = LobbyStatus.LobbyPreparing;
|
||||
public List<TeamMember> Members;
|
||||
public string Name;
|
||||
|
||||
public Team(uint stageId, uint minLevel, LobbyEnterType lobbyEnterType, in Session leader, string name)
|
||||
{
|
||||
StageId = stageId;
|
||||
MinLevel = minLevel;
|
||||
LobbyEnterType = lobbyEnterType;
|
||||
Members = new List<TeamMember> { new(leader), new(null, 2), new(null, 3) };
|
||||
LeaderUid = leader.Player.User.Uid;
|
||||
Name = name;
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user