/
NetDataComponent.cs
42 lines (38 loc) · 1.25 KB
/
NetDataComponent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using GameFramework;
using GameFramework.Event;
using System.Collections.Generic;
using System.Linq;
using UnityGameFramework.Runtime;
using UnityEngine;
namespace Game.Hotfix
{
/// <summary>
/// 網路資料组件。
/// </summary>
public sealed partial class NetDataComponent : GameFrameworkComponent
{
private void Start()
{
// 註冊封包資料 新增/刪除/更新
subscribeSelfData();
}
private void subscribeSelfData()
{
GameCore.Event.Subscribe((int)client_serial_type.ENeResetBuildingS, onResetBuilding);
}
private void onResetBuilding(object sender, GameEventArgs e)
{
var msg = (e as NetworkS2CPacketEventArgs).data as NE_ResetBuildingS;
if (msg.Result != EStringId.EStrSuccess)
{
WorldSystems.MsgSys.AddPersonalMsg(Utility.Text.Format("{0}:{1}", typeof(NE_ResetBuildingS).Name, msg.Result.ToString()));
}
else
{
var eventArgs = ReferencePool.Acquire<NetDataEvent.ResetBuildingEvent>();
eventArgs.PosIndex = msg.PosIndex;
GameCore.Event.Fire(this, eventArgs);
}
}
}
}