public static void RPC_S2C_SendRandIsoFileIds(uLink.BitStream stream, uLink.NetworkMessageInfo info) { int dungeonId = stream.Read <int>(); ulong[] isos = stream.Read <ulong[]>(); ulong[] publishs = stream.Read <ulong[]>(); for (int i = 0; i < isos.Length; i++) { SteamProcessMgr.Instance.GetPrimaryFile(SteamWorkShop.Instance.GetPrimaryFileResultEventHandler, new UGCHandle_t(isos[i]), new PublishedFileId_t(publishs[i]), i, dungeonId); } DungeonIsos.AddIsos(dungeonId, isos, publishs); }
public static bool AddItem(int amount, int dungenoId) { foreach (var iter in DungeonIsosMgr) { if (iter._dungeonId == dungenoId) { return(false); } } DungeonIsos iso = new DungeonIsos(amount, dungenoId); DungeonIsosMgr.Add(iso); return(true); }
void GetRandomIsoListCallBackEventHandler(List <ulong> fileIDsList, List <ulong> publishIds, int dungeonId, bool bOK) { if (bOK) { if (Pathea.PeGameMgr.IsSingle) { if (DungeonIsos.AddIsos(dungeonId, fileIDsList.ToArray(), publishIds.ToArray())) { for (int i = 0; i < fileIDsList.Count; i++) { SteamProcessMgr.Instance.GetPrimaryFile(SteamWorkShop.Instance.GetPrimaryFileResultEventHandler, new UGCHandle_t(fileIDsList[i]), new PublishedFileId_t(publishIds[i]), i, dungeonId); } } } else { NetworkManager.SyncServer(EPacketType.PT_Common_SendRandIsoFileIds, dungeonId, fileIDsList.ToArray(), publishIds.ToArray()); } } }
public static void ExportRandIso(string fullpath, int dungeonId, int index) { if (fullpath == "") { return; } if (!File.Exists(fullpath)) { return; } ulong fileId = DungeonIsos.GetFileId(dungeonId, index); VCIsoData iso = new VCIsoData(); using (FileStream fs = new FileStream(fullpath, FileMode.Open, FileAccess.Read)) { byte[] iso_buffer = new byte[(int)(fs.Length)]; fs.Read(iso_buffer, 0, (int)(fs.Length)); fs.Close(); iso.Import(iso_buffer, new VCIsoOption(true)); if (Pathea.PeGameMgr.IsMulti) { ulong hash = CRC64.Compute(iso_buffer); VCGameMediator.SendIsoDataToServer(iso.m_HeadInfo.Name, iso.m_HeadInfo.SteamDesc, iso.m_HeadInfo.SteamPreview, iso_buffer, SteamWorkShop.AddNewVersionTag(iso.m_HeadInfo.ScenePaths()), true, fileId, true); NetworkManager.SyncServer(EPacketType.PT_Common_SendRandIsoHash, dungeonId, index, hash); } else { CreationData new_creation = new CreationData(); new_creation.m_ObjectID = CreationMgr.QueryNewId(); new_creation.m_RandomSeed = UnityEngine.Random.value; new_creation.m_Resource = iso_buffer; new_creation.ReadRes(); ulong hash = CRC64.Compute(iso_buffer); // Attr new_creation.GenCreationAttr(); if (new_creation.m_Attribute.m_Type == ECreation.Null) { Debug.LogWarning("Creation is not a valid type !"); new_creation.Destroy(); return; } // SaveRes if (new_creation.SaveRes()) { new_creation.BuildPrefab(); new_creation.Register(); CreationMgr.AddCreation(new_creation); ItemObject item; new_creation.SendToPlayer(out item, false); Debug.Log("Make creation succeed !"); RandomDungenMgr.Instance.ReceiveIsoObj(dungeonId, hash, item.instanceId); } else { Debug.LogWarning("Save creation resource file failed !"); new_creation.Destroy(); return; } } } }
public void GetRandIsos(int dungeonId, int amount, string tag) { DungeonIsos.AddItem(amount, dungeonId); SteamProcessMgr.Instance.RandomGetIsosFromWorkShop(GetRandomIsoListCallBackEventHandler, amount, dungeonId, tag); }