// public bool Serialize(GoingOutData packet) { bool ret = true; ret &= Serialize(packet.characterId, MovingData.characterNameLength); ret &= Serialize(packet.goingOut); return(ret); }
// public bool Deserialize(ref GoingOutData element) { if (GetDataSize() == 0) { // 데이터가 설정되어 있지 않습니다. return(false); } bool ret = true; ret &= Deserialize(ref element.characterId, MovingData.characterNameLength); ret &= Deserialize(ref element.goingOut); return(ret); }
// ================================================================ // public void OnReceiveGoingOutPacket(PacketId id, byte[] data) { GoingOutPacket packet = new GoingOutPacket(data); GoingOutData go = packet.GetPacket(); Debug.Log("OnReceiveGoingOutPacket"); if (GlobalParam.get().account_name == go.characterId) { // 자신은 이미 행동이 끝났으므로 처리하지 않습니다. return; } if (GlobalParam.get().is_in_my_home) { // 자신의 정원에 있습니다.. if (go.goingOut) { // 친구가 찾아왔습니다. this.step.set_next(STEP.WELCOME); GlobalParam.get().is_remote_in_my_home = true; } else { // 친구가 돌아갑니다. this.step.set_next(STEP.BYEBYE); GlobalParam.get().is_remote_in_my_home = false; } } else { // 친구 정원에 있습니다. if (go.goingOut) { // 친구가 갑니다. this.step.set_next(STEP.BYEBYE); GlobalParam.get().is_remote_in_my_home = true; } else { // 친구가 돌아옵니다. this.step.set_next(STEP.WELCOME); GlobalParam.get().is_remote_in_my_home = false; } } }
public void NotifyFieldMoving() { GameObject go = GameObject.Find("Network"); if (go != null) { Network network = go.GetComponent <Network>(); if (network != null) { GoingOutData data = new GoingOutData(); data.characterId = GlobalParam.get().account_name; data.goingOut = GlobalParam.get().is_in_my_home; GoingOutPacket packet = new GoingOutPacket(data); network.SendReliable <GoingOutData>(packet); } } }
public void NotifyFieldMoving() { GameObject go = GameObject.Find("Network"); if (go != null) { Network network = go.GetComponent<Network>(); if (network != null) { GoingOutData data = new GoingOutData(); data.characterId = GlobalParam.get().account_name; data.goingOut = GlobalParam.get().is_in_my_home; GoingOutPacket packet = new GoingOutPacket(data); network.SendReliable<GoingOutData>(packet); } } }