public void TestStart() { try { LightObject lightObject = new LightObject(); LightObject dummy = new LightObject(); dummy.PutInt(1, 1000); dummy.PutInt(2, 10); LightObject dummy2 = new LightObject(); dummy2.PutInt(1, 1000); dummy2.PutInt(2, 10); dummy.PutObject(1, dummy2); lightObject.PutObject(2, dummy); lightObject.PutObject(3, dummy2); byte[] data = lightObject.Serialize(); LightObject coveredObject = LightObject.Deserialize(data); coveredObject.GetInt(1); Debugs.Log(coveredObject); } catch (Exception e) { Debugs.Log(e); } }
private void FindProtocol(byte[] data) { LightObject lightObj = LightObject.Deserialize(data); lightObj.PrintDump(); E_PROTOCOL_TYPE protocolType = (E_PROTOCOL_TYPE)lightObj.GetInt(1); Protocol targetProtocol = FindProtocol(protocolType); if (targetProtocol == null) { Debugs.Log("[EmptyProtocol] 해당 프로토콜을 찾을 수 없습니다."); return; } targetProtocol.Process(lightObj); }
protected virtual void Deserialize(LightObject receiveObject) { seq = receiveObject.GetInt(0); eProtocolType = (E_PROTOCOL_TYPE)receiveObject.GetInt(1); ReadLightObject(); }