public override void OnWorldStartDownload(GameControllerBase mainGame) { base.OnWorldStartDownload(mainGame); Level level = mainGame.Game.WorldData.Level; MainController.SetLoadingText(PBConstants.LOADINGBAR_LOADING); mainGame.Game.Listener.LogDebug(mainGame.Game, string.Format("Tile ({0}, {1}), Grid ({2}, {3})", level.InterestArea[0], level.InterestArea[1], level.WorldSize[0], level.WorldSize[1])); try { PBGameMaster.GameTime = DateTime.Parse(level.StartDateTime); } catch (System.Exception ex) { Debug.LogWarning("Invalid Game Time: " + level.StartDateTime + " => " + ex.ToString()); PBGameMaster.GameTime = DateTime.Now; } //loadingProgress = 0; MainController.SetLoadingProgess(0); MainController.SetLoadingText(PBConstants.LOADINGBAR_LOADING); _progress = 0; _isDownload = true; _downloadState = DownloadStateType.Level; //_statusText = PBConstants.LOADINGBAR_LOADING; // Register Gesticon Engine to the game data loader GesticonEngine.Instance.Register(); // Register the Inventory Engine into the game data loader InventoryEngine.Instance.Register(); // Register dialog engine into the game data loader DialogEngine.Instance.Register(); // Register our Quest engine into the game data loader QuestEngine.Instance.Register(); // Prepare all the data loaders GameDataLoader.Prepare(); }
public DownloadItemInfo(Clue clue, string path, ulong maxLength, uint downloadingDepth, MerkleTreeNode downloadingMerkleTreeNode, DownloadStateType stateType) { if (clue is null) { throw new ArgumentNullException("clue"); } if (path is null) { throw new ArgumentNullException("path"); } if (path.Length > 1024) { throw new ArgumentOutOfRangeException("path"); } if (downloadingMerkleTreeNode is null) { throw new ArgumentNullException("downloadingMerkleTreeNode"); } this.Clue = clue; this.Path = path; this.MaxLength = maxLength; this.DownloadingDepth = downloadingDepth; this.DownloadingMerkleTreeNode = downloadingMerkleTreeNode; this.StateType = stateType; { var hashCode = new HashCode(); if (this.Clue != default) { hashCode.Add(this.Clue.GetHashCode()); } if (this.Path != default) { hashCode.Add(this.Path.GetHashCode()); } if (this.MaxLength != default) { hashCode.Add(this.MaxLength.GetHashCode()); } if (this.DownloadingDepth != default) { hashCode.Add(this.DownloadingDepth.GetHashCode()); } if (this.DownloadingMerkleTreeNode != default) { hashCode.Add(this.DownloadingMerkleTreeNode.GetHashCode()); } if (this.StateType != default) { hashCode.Add(this.StateType.GetHashCode()); } _hashCode = hashCode.ToHashCode(); } }
public override void Update(GameControllerBase mainGame) { base.Update(mainGame); if (_isDownload) { switch (_downloadState) { case DownloadStateType.Level: { if (DownloadWorldLevel(mainGame)) { _downloadState = DownloadStateType.GameData; } } break; case DownloadStateType.GameData: { //_statusText = GameDataLoader.GetCurrentStatusText; //loadingProgress = GameDataLoader.CurrentProgress; MainController.SetLoadingText(GameDataLoader.GetCurrentStatusText); MainController.SetLoadingProgess(GameDataLoader.CurrentProgress); if (GameDataLoader.Download()) { _isDownload = false; OnWorldLoaded(mainGame); } } break; } } }
public DownloadItemInfo Deserialize(RocketPackReader r, int rank) { if (rank > 256) { throw new FormatException(); } // Read property count int propertyCount = (int)r.GetUInt64(); Clue p_clue = default; string p_path = default; ulong p_maxLength = default; uint p_downloadingDepth = default; MerkleTreeNode p_downloadingMerkleTreeNode = default; DownloadStateType p_stateType = default; for (; propertyCount > 0; propertyCount--) { int id = (int)r.GetUInt64(); switch (id) { case 0: // Clue { p_clue = Clue.Formatter.Deserialize(r, rank + 1); break; } case 1: // Path { p_path = r.GetString(1024); break; } case 2: // MaxLength { p_maxLength = (ulong)r.GetUInt64(); break; } case 3: // DownloadingDepth { p_downloadingDepth = (uint)r.GetUInt64(); break; } case 4: // DownloadingMerkleTreeNode { p_downloadingMerkleTreeNode = MerkleTreeNode.Formatter.Deserialize(r, rank + 1); break; } case 5: // StateType { p_stateType = (DownloadStateType)r.GetUInt64(); break; } } } return(new DownloadItemInfo(p_clue, p_path, p_maxLength, p_downloadingDepth, p_downloadingMerkleTreeNode, p_stateType)); }