protected override void Save(LogicJSONObject jsonObject) { this.LogicClientAvatar.Save(jsonObject); jsonObject.Put(GameDocument.JSON_ATTRIBUTE_HOME, this.LogicClientHome.Save()); jsonObject.Put(GameDocument.JSON_ATTRIBUTE_SAVE_TIME, new LogicJSONNumber(this.SaveTime)); jsonObject.Put(GameDocument.JSON_ATTRIBUTE_MAINTENANCE_TIME, new LogicJSONNumber(this.MaintenanceTime)); LogicJSONArray recentlyMatchedEnemyArray = new LogicJSONArray(this.RecentlyMatchedEnemies.Size()); for (int i = 0; i < this.RecentlyMatchedEnemies.Size(); i++) { RecentlyEnemy entry = this.RecentlyMatchedEnemies[i]; LogicJSONArray value = new LogicJSONArray(3); value.Add(new LogicJSONNumber(entry.AvatarId.GetHigherInt())); value.Add(new LogicJSONNumber(entry.AvatarId.GetLowerInt())); value.Add(new LogicJSONNumber(entry.Timestamp)); recentlyMatchedEnemyArray.Add(value); } jsonObject.Put(GameDocument.JSON_ATTRIBUTE_RECENTLY_MATCHED_ENEMIES, recentlyMatchedEnemyArray); LogicJSONArray allianceBookmarksArray = new LogicJSONArray(this.AllianceBookmarksList.Size()); for (int i = 0; i < this.AllianceBookmarksList.Size(); i++) { LogicLong id = this.AllianceBookmarksList[i]; LogicJSONArray ids = new LogicJSONArray(2); ids.Add(new LogicJSONNumber(id.GetHigherInt())); ids.Add(new LogicJSONNumber(id.GetLowerInt())); allianceBookmarksArray.Add(ids); } jsonObject.Put(GameDocument.JSON_ATTRIBUTE_ALLIANCE_BOOKMARKS_LIST, allianceBookmarksArray); LogicJSONArray avatarStreamsArray = new LogicJSONArray(this.AvatarStreamList.Size()); for (int i = 0; i < this.AvatarStreamList.Size(); i++) { LogicLong id = this.AvatarStreamList[i]; LogicJSONArray ids = new LogicJSONArray(2); ids.Add(new LogicJSONNumber(id.GetHigherInt())); ids.Add(new LogicJSONNumber(id.GetLowerInt())); avatarStreamsArray.Add(ids); } jsonObject.Put(GameDocument.JSON_ATTRIBUTE_AVATAR_STREAM_LIST, avatarStreamsArray); }
public bool HasRecentlyMatchedWithEnemy(LogicLong id) { int timestamp = TimeUtil.GetTimestamp(); for (int i = 0; i < this.RecentlyMatchedEnemies.Size(); i++) { RecentlyEnemy enemy = this.RecentlyMatchedEnemies[i]; if (LogicLong.Equals(enemy.AvatarId, id) && timestamp - enemy.Timestamp <= 60 * 15) { return(true); } } return(false); }