public bool SetPlayer(PlayerMatchData player) { for (int i = 0; i < _data.playersMatchData.Count; i++) { if (_data.playersMatchData[i].playerProfile == player.playerProfile) { _data.playersMatchData[i] = player; return(true); } } return(false); }
private void InitMatchData(string levelConfigId) { _data.playersMatchData.Clear(); PlayerMatchData playerMatchData = new PlayerMatchData(); playerMatchData.itemsInUse = inventoryStateModel.GetItemsInUse(); playerMatchData.playerProfile = socialStateModel.GetState(); playerMatchData.matchStatus = MatchStatus.Playing; _data.playersMatchData.Add(playerMatchData); _data.levelMatchData = new LevelMatchData(); if (levelConfigId != "-1") { _data.levelMatchData.levelConfigId = levelConfigId; } }
public object Clone() { PlayerMatchData c = new PlayerMatchData(); c.playerProfile = playerProfile.Clone() as SocialStateData; c.playerType = playerType; c.currenciesEarned = currenciesEarned.Select(currency => currency.Clone() as GameElementData).ToList(); c.xpGained = xpGained; c.score = score; c.progress = progress.Select(p => p.Clone() as GameElementData).ToList(); c.itemsInUse = itemsInUse.Select(item => item.Clone() as ItemData).ToList(); c.properties = properties.Select(p => p.Clone() as GameElementData).ToList(); c.matchStatus = matchStatus; c.index = index; return(c); }