forked from sin365/AxibugEmuOnline
Compare commits
No commits in common. "e8152500fdff0ea5245ed1b9160c90698f7319ab" and "2868c02c16c8f429c12409ef8e856e652a3f3e54" have entirely different histories.
e8152500fd
...
2868c02c16
@ -3,7 +3,6 @@ using AxibugEmuOnline.Client.Common;
|
|||||||
using AxibugEmuOnline.Client.Network;
|
using AxibugEmuOnline.Client.Network;
|
||||||
using AxibugProtobuf;
|
using AxibugProtobuf;
|
||||||
using Google.Protobuf;
|
using Google.Protobuf;
|
||||||
using MyNes.Core;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -12,20 +11,15 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
{
|
{
|
||||||
public class AppNetGame
|
public class AppNetGame
|
||||||
{
|
{
|
||||||
int CurrRoomID;
|
|
||||||
int[] _palette;
|
|
||||||
public int[] _renderbuffer { private set; get; }
|
|
||||||
public AppNetGame()
|
public AppNetGame()
|
||||||
{
|
{
|
||||||
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdScreen, OnScreen);
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdScreen, OnScreen);
|
||||||
_palette = NTSCPaletteGenerator.GeneratePalette();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Protobuf_Screnn_Frame _Protobuf_Screnn_Frame = new Protobuf_Screnn_Frame();
|
Protobuf_Screnn_Frame _Protobuf_Screnn_Frame = new Protobuf_Screnn_Frame();
|
||||||
|
|
||||||
public void SendScreen(byte[] RenderBuffer)
|
public void SendScreen(byte[] ScreenData)
|
||||||
{
|
{
|
||||||
byte[] comData = CompressByteArray(RenderBuffer);
|
byte[] comData = CompressByteArray(ScreenData);
|
||||||
_Protobuf_Screnn_Frame.FrameID = 0;
|
_Protobuf_Screnn_Frame.FrameID = 0;
|
||||||
_Protobuf_Screnn_Frame.RawBitmap = ByteString.CopyFrom(comData);
|
_Protobuf_Screnn_Frame.RawBitmap = ByteString.CopyFrom(comData);
|
||||||
AppAxibugEmuOnline.networkHelper.SendToServer((int)CommandID.CmdScreen, ProtoBufHelper.Serizlize(_Protobuf_Screnn_Frame));
|
AppAxibugEmuOnline.networkHelper.SendToServer((int)CommandID.CmdScreen, ProtoBufHelper.Serizlize(_Protobuf_Screnn_Frame));
|
||||||
@ -34,14 +28,14 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
public void OnScreen(byte[] reqData)
|
public void OnScreen(byte[] reqData)
|
||||||
{
|
{
|
||||||
Protobuf_Screnn_Frame msg = ProtoBufHelper.DeSerizlize<Protobuf_Screnn_Frame>(reqData);
|
Protobuf_Screnn_Frame msg = ProtoBufHelper.DeSerizlize<Protobuf_Screnn_Frame>(reqData);
|
||||||
lock (_renderbuffer)
|
//lock (RawBitmap)
|
||||||
{
|
//{
|
||||||
byte[] data = DecompressByteArray(msg.RawBitmap.ToArray());
|
// byte[] data = DecompressByteArray(msg.RawBitmap.ToArray());
|
||||||
for (int i = 0; i < data.Length; i++)
|
// for (int i = 0; i < data.Length; i++)
|
||||||
{
|
// {
|
||||||
_renderbuffer[i] = _palette[data[i]];
|
// RawBitmap[i] = _palette[data[i]];
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] CompressByteArray(byte[] bytesToCompress)
|
public static byte[] CompressByteArray(byte[] bytesToCompress)
|
||||||
|
|||||||
@ -8,21 +8,9 @@ enum CommandID
|
|||||||
|
|
||||||
CMD_LOGIN = 2001; //自动登录上行 | 下行 对应 Protobuf_Login | Protobuf_Login_RESP
|
CMD_LOGIN = 2001; //自动登录上行 | 下行 对应 Protobuf_Login | Protobuf_Login_RESP
|
||||||
|
|
||||||
CMD_CHATMSG = 4001; //广播聊天信息上行 | 下行 对应 Protobuf_ChatMsg | Protobuf_ChatMsg_RESP
|
CMD_CHATMSG = 4001; //广播信息上行 | 下行 对应 Protobuf_ChatMsg | Protobuf_ChatMsg_RESP
|
||||||
|
|
||||||
//房间相关
|
CMD_Screen = 5001; //画面同步 | 同步广播 对应 Protobuf_Screnn_Frame
|
||||||
CMD_Room_List = 5001; //房间列表 上行 | 下行 对应 Protobuf_Room_List | Protobuf_Room_List_RESP
|
|
||||||
|
|
||||||
CMD_Room_List_Update = 5002; //房间列表更新 对应 Protobuf_Room_Update_RESP
|
|
||||||
|
|
||||||
CMD_Room_Create = 5003; //房间列表创建 对应 Protobuf_Room_Create
|
|
||||||
|
|
||||||
CMD_Room_Leave = 5004; //房间列表离开 对应 Protobuf_Room_Leave
|
|
||||||
|
|
||||||
CMD_Room_Join = 5005; //房间列表加入 对应 Protobuf_Room_Join
|
|
||||||
|
|
||||||
//画面同步相关
|
|
||||||
CMD_Screen = 6001; //画面同步 | 同步广播 对应 Protobuf_Screnn_Frame
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ErrorCode
|
enum ErrorCode
|
||||||
@ -45,22 +33,6 @@ enum DeviceType
|
|||||||
PSV = 4;
|
PSV = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RoomPlayerState
|
|
||||||
{
|
|
||||||
None = 0;//缺省
|
|
||||||
OnlyP1 = 1; //仅P1
|
|
||||||
OnlyP2 = 2; //仅P2
|
|
||||||
BothOnline = 3; //玩家都在
|
|
||||||
}
|
|
||||||
|
|
||||||
enum RoomGameState
|
|
||||||
{
|
|
||||||
None = 0;//缺省
|
|
||||||
InGame = 1;//游戏中
|
|
||||||
Pause = 2;//暂停
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
enum LoginResultStatus
|
enum LoginResultStatus
|
||||||
{
|
{
|
||||||
LoginResultStatus_BaseDefault = 0;//缺省不使用
|
LoginResultStatus_BaseDefault = 0;//缺省不使用
|
||||||
@ -102,38 +74,8 @@ message Protobuf_Login_RESP
|
|||||||
int64 UID = 5;
|
int64 UID = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message Protobuf_Room_List
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
message Protobuf_Room_List_RESP
|
|
||||||
{
|
|
||||||
repeated Protobuf_Room_MiniInfo RoomMiniInfoList = 1;//房间列表
|
|
||||||
}
|
|
||||||
|
|
||||||
message Protobuf_Room_MiniInfo
|
|
||||||
{
|
|
||||||
int32 RoomID = 1;//房间ID
|
|
||||||
int32 GameID = 2;//游戏ID
|
|
||||||
RoomPlayerState PlayerState = 3;//玩家加入状态
|
|
||||||
RoomGameState GameState = 4;//游戏状态
|
|
||||||
int32 ObsUserCount = 5;//观战用户数量
|
|
||||||
int64 Player1_UID = 6;//玩家1 UID
|
|
||||||
string Player1_NickName = 7;//玩家1 昵称
|
|
||||||
int64 Player2_UID = 8;//玩家2 UID
|
|
||||||
string Player2_NickName = 9;//玩家2 昵称
|
|
||||||
}
|
|
||||||
|
|
||||||
message Protobuf_Room_Update_RESP
|
|
||||||
{
|
|
||||||
Protobuf_Room_MiniInfo RoomMiniInfo = 1;//房间信息
|
|
||||||
}
|
|
||||||
|
|
||||||
message Protobuf_Screnn_Frame
|
message Protobuf_Screnn_Frame
|
||||||
{
|
{
|
||||||
int32 RoomID = 1;//房间ID
|
int32 FrameID = 1;//帧编号
|
||||||
int32 FrameID = 2;//帧编号
|
bytes RawBitmap = 2;//渲染层画面
|
||||||
bytes RawBitmap = 3;//渲染层画面
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user