| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // B4 31 战斗战报结果 #tagSCTurnFightRet
|
| | |
|
| | | public class DTCB431_tagSCTurnFightRet : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HB431_tagSCTurnFightRet vNetData = vNetPack as HB431_tagSCTurnFightRet;
|
| | | BattleSettlementManager.Instance.UpdateSettlementData(vNetData);
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3a9eccf6a3501c24d89018d298e2cf70 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | Register(typeof(HB119_tagSCModelInfo), typeof(DTCB119_tagSCModelInfo)); |
| | | Register(typeof(HB126_tagSCTitleInfo), typeof(DTCB126_tagSCTitleInfo)); |
| | | Register(typeof(HB127_tagSCChatBoxInfo), typeof(DTCB127_tagSCChatBoxInfo)); |
| | | Register(typeof(HB431_tagSCTurnFightRet), typeof(DTCB431_tagSCTurnFightRet)); |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | if (vInts.IsNullOrEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | if (vInts.Length != vLockLeng) |
| | | Array.Resize(ref vInts, vLockLeng); |
| | | this.WriteBytes(vInts, vType); |
| | |
| | | { |
| | | try |
| | | { |
| | | if (vInts.IsNullOrEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | if (vInts.Length != vLockLeng) |
| | | Array.Resize(ref vInts, vLockLeng); |
| | | this.WriteBytes(vInts, vType); |
| | |
| | | { |
| | | try |
| | | { |
| | | if (vInts.IsNullOrEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | if (vWriteLen == StrWriteLen.BYTE) |
| | | this.WriteBytes(new Byte[] { (byte)vInts.Length }); |
| | | else if (vWriteLen == StrWriteLen.WORD) |
| | |
| | | { |
| | | try |
| | | { |
| | | if (vInts.IsNullOrEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | int l = vInts.Length; |
| | | byte[] vRst; |
| | | int i; |
| | |
| | | { |
| | | try |
| | | { |
| | | if (vInts.IsNullOrEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | int l = vInts.Length; |
| | | byte[] vRst; |
| | | int i; |
| | |
| | | { |
| | | try |
| | | { |
| | | if (vBytes.IsNullOrEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | Array.Resize(ref _writedBytes, _writeIndex + vBytes.Length); |
| | | vBytes.CopyTo(_writedBytes, _writeIndex); |
| | | _writeIndex = _writedBytes.Length; |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B4 31 战斗战报结果 #tagSCTurnFightRet
|
| | |
|
| | | public class HB431_tagSCTurnFightRet : GameNetPackBasic {
|
| | | public uint MapID; // 自定义地图ID,可用于绑定战斗地图场景功能(如主线boss、爬塔、竞技场等)
|
| | | public uint FuncLineID; // MapID对应的扩展值,如具体某个关卡等
|
| | | public byte TagType; // 目标类型,0-NPC阵容,1-玩家
|
| | | public uint TagID; // 目标类型对应的ID,如玩家ID
|
| | | public byte ValueCount;
|
| | | public uint[] ValueList; // 附加值列表,可选,具体含义由MapID决定
|
| | | public byte IsWin; //是否获胜
|
| | | public ushort AwardLen;
|
| | | public string AwardMsg; //功能结算奖励信息,不含战斗相关统计信息
|
| | | public ushort BatLen;
|
| | | public string BatStatMsg; //战斗相关统计信息
|
| | | public string PathDate; //战报路径日期, yyyyMMdd, 为空时代表公共类的战报,不为空时为玩家个人类战报
|
| | | public string GUID; //战报guid,前端根据功能MapID判断是否跨服功能,是的话从跨服服务器下载战报,否的话从本服下载
|
| | |
|
| | | public HB431_tagSCTurnFightRet () {
|
| | | _cmd = (ushort)0xB431;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out MapID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out FuncLineID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out TagType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out TagID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out ValueCount, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out ValueList, vBytes, NetDataType.DWORD, ValueCount);
|
| | | TransBytes (out IsWin, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out AwardLen, vBytes, NetDataType.WORD);
|
| | | TransBytes (out AwardMsg, vBytes, NetDataType.Chars, AwardLen);
|
| | | TransBytes (out BatLen, vBytes, NetDataType.WORD);
|
| | | TransBytes (out BatStatMsg, vBytes, NetDataType.Chars, BatLen);
|
| | | TransBytes (out PathDate, vBytes, NetDataType.Chars, 8);
|
| | | TransBytes (out GUID, vBytes, NetDataType.Chars, 40);
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9b2fa2d798559934896c3f09781aa94b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | |
| | | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using LitJson; |
| | | using UnityEngine; |
| | | |
| | | public partial class BattleSettlementManager : GameSystemManager<BattleSettlementManager> |
| | | { |
| | |
| | | } |
| | | return battleSettlementDic[battleName]; |
| | | } |
| | | |
| | | public void UpdateSettlementData(HB431_tagSCTurnFightRet netData) |
| | | { |
| | | var guid = UIHelper.ServerStringTrim(netData.GUID); |
| | | var date = UIHelper.ServerStringTrim(netData.PathDate); |
| | | RequestTurnFightData(guid, date, (int)netData.MapID); |
| | | |
| | | } |
| | | public void RequestTurnFightData(string guid, string date, int mapID) |
| | | { |
| | | //mobile.secondworld.net.cn:53080\S9006\20251202\3042602\5b11338f-cf2c-11f0-a0a0-000c29b22418.tfr |
| | | var serverID = UIHelper.GetServerIDByAccount(PlayerDatas.Instance.baseData.AccID); |
| | | var url = "http://mobile.secondworld.net.cn:53080"; |
| | | string assetVersionUrl = string.Empty; |
| | | |
| | | if (string.IsNullOrEmpty(date)) |
| | | { |
| | | //公共战报 路径: C:\TurnFightReport\S服务器编号\功能地图ID\战报GUID |
| | | assetVersionUrl = $"{url}/S{serverID}/{mapID}//{guid}.tfr"; |
| | | } |
| | | else |
| | | { |
| | | //个人战报 路径: C:\TurnFightReport\S服务器编号\日期\玩家ID\战报GUID |
| | | assetVersionUrl = $"{url}/S{serverID}/{date}/{PlayerDatas.Instance.baseData.PlayerID}/{guid}.tfr"; |
| | | } |
| | | |
| | | HttpRequest.Instance.UnityWebRequestTurnFightGet(assetVersionUrl, guid, 3, OnGetTurnFightData); |
| | | } |
| | | |
| | | void OnGetTurnFightData(bool _ok, string guid, byte[] _result) |
| | | { |
| | | if (_ok) |
| | | { |
| | | ReadTurnFightInfo(_result); |
| | | } |
| | | } |
| | | |
| | | GameNetEncode encoder = new GameNetEncode(); |
| | | //单独 |
| | | private void ReadTurnFightInfo(byte[] vBytes) |
| | | { |
| | | try |
| | | { |
| | | byte[] vPackBytes = vBytes; |
| | | GameNetPackBasic vNetpack; |
| | | byte[] vCmdBytes = new byte[2]; |
| | | ServerType socketType = ServerType.B430; |
| | | |
| | | |
| | | // vPackBytes = encoder.BaseXorSub(vPackBytes); |
| | | Array.Copy(vPackBytes, 0, vCmdBytes, 0, 2); |
| | | var cmd = (ushort)((ushort)(vCmdBytes[0] << 8) + vCmdBytes[1]); |
| | | bool isRegist = false; // 未注册封包处理 |
| | | |
| | | // 处理主工程的封包 |
| | | if (PackageRegedit.Contain(cmd)) |
| | | { |
| | | vNetpack = PackageRegedit.TransPack(socketType, cmd, vPackBytes); |
| | | if (vNetpack != null) |
| | | { |
| | | GameNetSystem.Instance.PushPackage(vNetpack, socketType); |
| | | isRegist = true; |
| | | } |
| | | } |
| | | |
| | | // 未注册封包处理 |
| | | if (!isRegist) |
| | | { |
| | | #if UNITY_EDITOR |
| | | PackageRegedit.TransPack(socketType, cmd, vPackBytes); |
| | | #endif |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Debug.LogErrorFormat("ReadTurnFightInfo 分析战报异常:{0}", ex); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |