public static void RPC_S2C_UGCGenerateList(uLink.BitStream stream, uLink.NetworkMessageInfo info) { CreationOriginData[] creations = stream.Read <CreationOriginData[]>(); foreach (CreationOriginData iter in creations) { SteamWorkShop.AddCreation(iter); } }
void Awake() { #if SteamVersion _instance = this; #else Destroy(gameObject); #endif }
public SteamGetPreFileListProcess(GetPreListCallBackEventHandler callBackGetPreListResult, uint startIndex, string [] tags, uint days = 0, uint count = 9, EWorkshopEnumerationType orderBy = EWorkshopEnumerationType.k_EWorkshopEnumerationTypeRankedByVote) { RemoteStorageEnumerateWorkshopFilesResult = CallResult <RemoteStorageEnumerateWorkshopFilesResult_t> .Create(OnRemoteStorageEnumerateWorkshopFilesResultAllUser); CallBackGetPreListResult = callBackGetPreListResult; tags = SteamWorkShop.AddNewVersionTag(tags); GetPreFileList(startIndex, tags, days, count, orderBy); _StartIndex = startIndex; }
public SteamSearchProcess(GetPreListCallBackEventHandler callBackGetPreListResult, uint startIndex, string [] tags, uint count = 9, string searchText = "") { OnSteamUGCQueryCompletedCallResult = CallResult <SteamUGCQueryCompleted_t> .Create(CallBackSendQuery); _Page = startIndex / 50 + 1; _StartIndex = startIndex; CallBackGetPreListResult = callBackGetPreListResult; _Count = count; tags = SteamWorkShop.AddNewVersionTag(tags); Search(tags, searchText); }
public static void SendIsoDataToServer(string name, string desc, byte[] preIso, byte[] isoData, string[] tags, bool sendToServer = true, ulong fileId = 0, bool free = false) { #if PLANET_EXPLORERS //ulong hash_code = CRC64.Compute(isodata); //FileTransManager.RegisterISO(hash_code, isodata); #endif #if SteamVersion SteamWorkShop.SendFile(null, name, desc, preIso, isoData, tags, sendToServer, -1, fileId, free); #else ulong hash_code = CRC64.Compute(isoData); //FileTransManager.RegisterISO(hash_code, isoData); #endif }
void RPC_L2C_UploadIso(uLink.BitStream stream, LobbyMessageInfo info) { ulong isohashcode = stream.Read <ulong>(); bool sucessed = stream.Read <bool>(); if (sucessed) { SteamWorkShop.SendCacheIso(isohashcode); } else { SendIsoCache iso = SteamWorkShop.GetCacheIso(isohashcode); if (iso != null && iso.callBackSteamUploadResult != null) { iso.callBackSteamUploadResult(iso.id, false, isohashcode); } } }
// Read a creation from CreationMgr public static CreationData GetCreation(int id) { if (m_Creations == null) { Debug.LogError("CreationMgr haven't initialized!"); return(null); } if (m_Creations.ContainsKey(id)) { m_Creations[id].UpdateUseTime(); return(m_Creations[id]); } else { if (GameConfig.IsMultiMode) { return(SteamWorkShop.GetCreation(id)); } return(null); } }
public static void CopyCretion(ECreation type) { Pathea.PlayerPackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>(); if (null == pkg) { return; } List <int> creationInstanceid = pkg.package.GetCreationInstanceId(type); if (creationInstanceid == null || creationInstanceid.Count == 0) { return; } CreationData cd = CreationMgr.GetCreation(creationInstanceid[0]); if (Pathea.PeGameMgr.IsMulti) { ulong hash = CRC64.Compute(cd.m_Resource); ulong fileId = SteamWorkShop.GetFileHandle(hash); VCGameMediator.SendIsoDataToServer(cd.m_IsoData.m_HeadInfo.Name, cd.m_IsoData.m_HeadInfo.SteamDesc, cd.m_IsoData.m_HeadInfo.SteamPreview, cd.m_Resource, SteamWorkShop.AddNewVersionTag(cd.m_IsoData.m_HeadInfo.ScenePaths()), true, fileId, true); } else { CreationData new_creation = new CreationData(); new_creation.m_ObjectID = CreationMgr.QueryNewId(); new_creation.m_RandomSeed = UnityEngine.Random.value; new_creation.m_Resource = cd.m_Resource; new_creation.ReadRes(); // 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); ItemAsset.ItemObject item; int send_retval = new_creation.SendToPlayer(out item); Debug.Log("Make creation succeed !"); if (send_retval == 0) { return; // Error } else if (send_retval == -1) { return; // Item Package Full } else { return; // Succeed } } else { Debug.LogWarning("Save creation resource file failed !"); new_creation.Destroy(); return; } } }
public static int MakeCreation(string path) { TextAsset aseet = Resources.Load <TextAsset>(path); VCIsoData iso = new VCIsoData(); iso.Import(aseet.bytes, new VCIsoOption(false)); // Multi player if (s_MultiplayerMode) { if (!VCConfig.s_Categories.ContainsKey(iso.m_HeadInfo.Category)) { return(-1); } byte[] isodata = iso.Export(); if (isodata == null || isodata.Length <= 0) { return(-1); } ulong hash = CRC64.Compute(isodata); ulong fileId = SteamWorkShop.GetFileHandle(hash); VCGameMediator.SendIsoDataToServer(iso.m_HeadInfo.Name, iso.m_HeadInfo.SteamDesc, iso.m_HeadInfo.SteamPreview, isodata, SteamWorkShop.AddNewVersionTag(iso.m_HeadInfo.ScenePaths()), true, fileId, true); return(0); } else { CreationData new_creation = new CreationData(); new_creation.m_ObjectID = CreationMgr.QueryNewId(); new_creation.m_RandomSeed = UnityEngine.Random.value; new_creation.m_Resource = iso.Export(); new_creation.ReadRes(); // 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(-1); } // SaveRes if (new_creation.SaveRes()) { new_creation.BuildPrefab(); new_creation.Register(); CreationMgr.AddCreation(new_creation); ItemAsset.ItemObject item; int send_retval = new_creation.SendToPlayer(out item); Debug.Log("Make creation succeed !"); if (send_retval == 0) { return(-1); // Error } else if (send_retval == -1) { return(-4); // Item Package Full } else { if (OnMakeCreation != null) { OnMakeCreation(); } return(0); // Succeed } } else { Debug.LogWarning("Save creation resource file failed !"); new_creation.Destroy(); return(-3); } } }
void BtnUploadOnClick() { if (this.m_ImportIsoing) { return; } this.m_ImportIsoing = true; if (mSelectedIsoIndex == -1 || mSelectedIsoIndex >= mLocalIsoInfo.Count) { SetInfoMsg(UIMsgBoxInfo.mCZ_WorkShopUpNeedSeletedIso.GetString()); this.m_ImportIsoing = false; return; } int i = mSelectedIsoIndex % mLocalGridCtrl.mMaxGridCount; if (i < 0 || i >= mLocalGridCtrl.mMaxGridCount) { this.m_ImportIsoing = false; return; } VCEAssetMgr.IsoFileInfo fileInfo = mLocalIsoInfo[mSelectedIsoIndex]; VCIsoData iso = new VCIsoData(); try { string fullpath = fileInfo.m_Path; 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)); //VCGameMediator.SendIsoDataToServer(); if (iso.m_HeadInfo.Version < 0x02030001) { MessageBox_N.ShowOkBox(PELocalization.GetString(8000487)); this.m_ImportIsoing = false; return; } string isoPath = fullpath.Replace('\\', '/'); isoPath = isoPath.Replace(mDefoutIcoPath, "[ISO]/"); mUpLoadIndex++; //lz-2016.05.17 存储上传中Iso 的 hash ulong hash = CRC64.Compute(iso_buffer); if (null != this.m_UploadingIsoHashList && this.m_UploadingIsoHashList.Contains(hash)) { MessageBox_N.ShowOkBox(PELocalization.GetString(8000488)); this.m_ImportIsoing = false; return; } this.m_UploadingIsoHashList.Add(hash); mUpLoadMap[mUpLoadIndex] = isoPath; mUpLoadStateMap[mUpLoadMap[mUpLoadIndex]] = 0; mLocalGridCtrl.mUIItems[i].ActiveUpDown(true); mLocalGridCtrl.mUIItems[i].UpdteUpDownInfo(PELocalization.GetString(8000908)); //"Uploading" SteamWorkShop.SendFile(UpLoadFileCallBack, iso.m_HeadInfo.Name, iso.m_HeadInfo.SteamDesc, iso.m_HeadInfo.SteamPreview, iso_buffer, SteamWorkShop.AddNewVersionTag(iso.m_HeadInfo.ScenePaths()), false, mUpLoadIndex); } } catch (Exception e) { mLocalGridCtrl.mUIItems[i].ActiveUpDown(false); mLocalGridCtrl.mUIItems[i].UpdteUpDownInfo(""); Debug.Log(" WorkShop Loading ISO Error : " + e.ToString()); MessageBox_N.ShowOkBox(PELocalization.GetString(8000489)); } this.m_ImportIsoing = false; }
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; } } } }