private void ParseMessage(int index, int type, System.IO.MemoryStream stream) { switch (type) { case MessageTypes.S2C_Login: { ProtoBuf.S2C_Login msg = ProtoBuf.Serializer.Deserialize <ProtoBuf.S2C_Login> (stream); MessageHandler.HandleMsg(index, type, msg); break; } case MessageTypes.S2C_UserInit: { ProtoBuf.S2C_UserInit msg = ProtoBuf.Serializer.Deserialize <ProtoBuf.S2C_UserInit> (stream); MessageHandler.HandleMsg(index, type, msg); break; } case MessageTypes.S2C_RoleInit: { ProtoBuf.S2C_RoleInit msg = ProtoBuf.Serializer.Deserialize <ProtoBuf.S2C_RoleInit> (stream); MessageHandler.HandleMsg(index, type, msg); break; } case MessageTypes.S2C_NewHero: { ProtoBuf.S2C_NewHero msg = ProtoBuf.Serializer.Deserialize <ProtoBuf.S2C_NewHero> (stream); MessageHandler.HandleMsg(index, type, msg); break; } } }
void OnRoleInitBack(object msg) { ProtoBuf.S2C_RoleInit _msg = msg as ProtoBuf.S2C_RoleInit; if (_msg.ret != 0) { UIManager.Instance.ShowAlert("error code : " + _msg.ret.ToString()); } else { UIManager.Instance.HideWaiting(); DestroyObject(_panelRoleInit.gameObject); _panelDashBase.SetActive(true); UserDataManager.Instance.InitWithData(_msg.userData); _panelDashBase.GetComponent <PanelDashBase> ().LoadUserData(); } }