private void OnReq_ChargeRelics(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); ReqChargeRelics req = Serializer.Deserialize <ReqChargeRelics>(ms); AckChargeRelics ack = new AckChargeRelics(); ack.RelicsID = req.RelicsID; ack.Index = req.Index; NetworkManager.Instance.Send(MessageID.MSG_ACK_CHARGE_RELICS, ack, 0, 0); }
private void OnAck_ChargeRelics(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); AckChargeRelics ack = Serializer.Deserialize <AckChargeRelics>(ms); int index = ack.Index; int relicsID = ack.RelicsID; DRelics db = ReadCfgRelics.GetDataById(relicsID); int itemID = db.ArtificeCostID[index - 1]; DItem itemDB = ReadCfgItem.GetDataById(itemID); XRelics relics = DataDBSRelics.GetDataById(relicsID); if (relics == null) { relics = new XRelics(); relics.Id = relicsID; } switch (index) { case 1: relics.CurExp1 += itemDB.Data1; break; case 2: relics.CurExp2 += itemDB.Data1; break; case 3: relics.CurExp3 += itemDB.Data1; break; } DataDBSRelics.Update(relicsID, relics); GTDataManager.Instance.UseItemById(itemID); GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR); GTEventCenter.FireEvent(GTEventID.TYPE_RELICS_CHARGE, relicsID, index); GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE); }