public bool HostGame(string matchId, GameObject player) { if (!matchIds.Contains(matchId)) { matches.Add(new Match(matchId, player)); matchIds.Add(matchId); return(true); } else { Debug.LogError(matchId + " already exist"); return(false); } }
public bool HostGame(string matchId, GameObject player) { if (!matchIds.Contains(matchId)) { matchIds.Add(matchId); matches.Add(new Match(matchId, player)); Debug.Log($"Match Generated"); return(true); } else { Debug.Log($"Match Id already exists"); return(false); } }
protected virtual void AddToChangedPropNames(string sPropertyName) { if (!m_lChangedPropNames.Contains(sPropertyName)) { m_lChangedPropNames.Add(sPropertyName); } }
public bool HostGame(string _matchID, GameObject _player, out int playerIndex) { playerIndex = -1; if (!matchIDs.Contains(_matchID)) { matchIDs.Add(_matchID); matches.Add(new Match(_matchID, _player)); Debug.Log($"Match generated"); playerIndex = 1; return(true); } else { Debug.Log($"Match ID already exists"); return(false); } }
public bool HostGame(string _matchID, GameObject _player, bool isPublic, out int playerIndex) { playerIndex = -1; if (!matchIDs.Contains(_matchID)) { matchIDs.Add(_matchID); Match match = new Match(_matchID, _player); match.isPublic = isPublic; match.isMatchInLobby = true; matches.Add(match); playerIndex = 1; return(true); } else { Debug.LogError($"Match ID {_matchID} already exists"); return(false); } }
public bool HostGame(string matchId, GameObject host, bool publicMatch, out int playerIndex, out int teamId) { playerIndex = -1; teamId = -1; if (!matchIds.Contains(matchId)) { matchIds.Add(matchId); var match = new Match(matchId, host); match.publicMatch = publicMatch; matches.Add(match); //*Debug.Log($"Match generated"); playerIndex = 1; teamId = 1; return(true); } //*Debug.Log($"Match ID already exists"); return(false); }
public bool HostGame(string _matchID, GameObject _player, bool publicMatch, out int playerIndex) { playerIndex = -1; if (!matchIDs.Contains(_matchID)) { matchIDs.Add(_matchID); Match match = new Match(_matchID, _player); match.publicMatch = publicMatch; matches.Add(match); Debug.Log($"Match generated"); _player.GetComponent <Player>().currentMatch = match; playerIndex = 1; return(true); } else { Debug.Log($"Match ID already exists"); return(false); } }
public bool MoveClientToActive(NetworkConnection conn) { bool result = Players.ContainsKey(conn.connectionId) && ConnectedClients.Contains(conn.connectionId); if (result) { ConnectedClients.Remove(conn.connectionId); JoinedPlayers.Add(conn.connectionId); } return(result); }
private static void SearchMatchImp(HashSet <IMatchVw> hsMatches, SyncList <IMatchVw> lMatchesToSync, MatchLn mtch, DelegateFilterMatches dfm) { if (dfm == null || dfm(mtch)) { hsMatches.Add(mtch.MatchView); if (!lMatchesToSync.Contains(mtch.MatchView)) { lMatchesToSync.Add(mtch.MatchView); } } }
public bool HostGame(string matchID, GameObject player, bool publicMatch, out int playerIndex) { playerIndex = -1; if (!matchIDs.Contains(matchID)) { matchIDs.Add(matchID); Match match = new Match(matchID, player); match.publicMatch = publicMatch; matches.Add(match); usernames.Add(player.GetComponent <LobbyPlayer>().username); playerIndex = 1; Debug.Log("Match Generated"); return(true); } else { Debug.Log("Match ID already exists"); return(false); } }
public bool AddItem(ItemScriptableObject item) { if (items.Contains(item)) { return(false); } if (item.IsValuableItem && this.HasValuableItem) { return(false); } this.Items.Add(item); return(true); }
public void CmdOfferItem(int inventoryIndex, int offerIndex) { // validate if (player.state == "TRADING" && state == TradingState.Free && 0 <= offerIndex && offerIndex < offerItems.Count && !offerItems.Contains(inventoryIndex) && // only one reference 0 <= inventoryIndex && inventoryIndex < inventory.slots.Count) { ItemSlot slot = inventory.slots[inventoryIndex]; if (slot.amount > 0 && slot.item.tradable && !slot.item.summoned) { offerItems[offerIndex] = inventoryIndex; } } }
public void CmdDropItem(Item item, bool placeInWorld) { if (items.Contains(item) == false) { return; } item.OnDrop(player); items.Remove(item); player.Stats.OnItemsChanged(items); if (placeInWorld) { PickableInWorld.Place(item, transform.position); } }
public bool HostGame(string matchID, GameObject host) { //Ha az id még nem foglalt if (!matchIDList.Contains(matchID)) { matchIDList.Add(matchID); matches.Add(new Match(matchID, host)); Debug.Log("Match generated"); return(true); } else { Debug.Log("Match ID already exists!"); return(false); } }
public void SearchResults(SyncList <MatchResultVw> lResultsToSync, DelegateFilterResults dfr) { CheckTime ct = new CheckTime("SearchResults() entered"); lock (m_oReadLocker) { ct.AddEvent("Inside of lock"); if (lResultsToSync != null) { HashSet <MatchResultVw> hsMatches = new HashSet <MatchResultVw>(); SyncList <MatchResultLn> lAllResults = m_diAll.MatchResults.ToSyncList(); foreach (MatchResultLn result in lAllResults) { if (dfr == null || dfr(result)) { hsMatches.Add(result.MatchResultView); if (!lResultsToSync.Contains(result.MatchResultView)) { lResultsToSync.Add(result.MatchResultView); } } } for (int i = 0; i < lResultsToSync.Count;) { MatchResultVw matchResultView = lResultsToSync[i]; if (!hsMatches.Contains(matchResultView)) { lResultsToSync.RemoveAt(i); } else { i++; } } } } ct.AddEvent("Completed"); ct.Info(m_logger); }
public void VerifySelectedOdds(SortableObservableCollection <ITipItemVw> socSelectedOdds, SyncHashSet <ITipItemVw> hsOddsToRemove = null) { CheckTime ct = new CheckTime(true, "VerifySelectedOdds(TipCount={0})", socSelectedOdds.Count); ExcpHelper.ThrowIf <ArgumentNullException>(socSelectedOdds == null, "VerifySelectedOdds(NULL) ERROR"); lock (_verifyLocker) { ct.AddEvent("Lock Entered"); if (hsOddsToRemove != null) { hsOddsToRemove.Clear(); } else { hsOddsToRemove = new SyncHashSet <ITipItemVw>(); } SyncList <ITipItemVw> lTipItems = socSelectedOdds.ToSyncList(); foreach (TipItemVw tiv in lTipItems) { // Check if selected odd is not expired if (!CheckOdd(tiv.Odd)) { hsOddsToRemove.Add(tiv); } // Check if selected odd is not yet in current collection (m_lSelectedOdds) else if (!m_lSelectedOdds.Contains(tiv.Odd)) { m_lSelectedOdds.Add(tiv.Odd); tiv.Odd.BetDomain.Match.SetSelected(tiv.Odd, true); } } ct.AddEvent("Check Completed"); // Remove from socSelectedOdds and m_lSelectedOdds for (int i = 0; i < lTipItems.Count;) { var tiv = lTipItems[i]; if (hsOddsToRemove.Contains(tiv)) { // This Odd is expired lTipItems.Remove(tiv); socSelectedOdds.Remove(tiv); m_lSelectedOdds.Remove(tiv.Odd); tiv.Odd.BetDomain.Match.SetSelected(tiv.Odd, false); } else { i++; } } ct.AddEvent("Remove from List Completed"); // Remove from m_lSelectedOdd those items were not removed in previous cycle for (int i = 0; i < m_lSelectedOdds.Count;) { IOddLn odd = m_lSelectedOdds[i]; TipItemVw tiv = new TipItemVw(odd); if (!lTipItems.Contains(tiv)) { m_lSelectedOdds.Remove(odd); tiv.Odd.BetDomain.Match.SetSelected(tiv.Odd, false); } else { i++; } } ct.AddEvent("Remove from List2 Completed"); } ct.Info(m_logger); }
/// <summary> /// Checks if this id card has the indicated access. /// </summary> /// <param name="access"></param> /// <returns></returns> public bool HasAccess(Access access) { return(accessSyncList.Contains((int)access)); }
public void Rotate() { if (ChangeTracker.LiveMonitors.Count <= 0) { return; } if (this.rotationCounter >= 1000) { rotationCounter = 0; } this.rotationCounter++; LiveMonitorViewModel lmvm = null; SyncList <IMatchVw> lMatches = Matches.ToSyncList(); for (int i = 0; i < LiveMonitorsCollectionList.Count; i++) { if (!lmViewModels[i].rotating || lmViewModels[i].LiveOddsVisibility == Visibility.Collapsed) { continue; } //check interval if (this.rotationCounter % lmViewModels[i].rotationInterval != 0 && this.rotationCounter != 0) { continue; } lmvm = ChangeTracker.LiveMonitors[i].DataContext as LiveMonitorViewModel; Debug.Assert(lmvm != null); double dblItemHeight = lmvm != null && lmvm.ItemHeight > 0.0d ? lmvm.ItemHeight : ITEM_DEFAULT_HEIGHT; double dblHeaderItemHeight = lmvm != null && lmvm.HeaderItemHeight > 0.0d ? lmvm.HeaderItemHeight : ITEM_WITH_HEADER_DEFAULT_HEIGHT; if (LiveMonitorRotationCounters[i] >= lMatches.Count) { LiveMonitorRotationCounters[i] = LiveMonitorRotationCounters[i] - lMatches.Count; } int iMatchIdx = LiveMonitorRotationCounters[i]; if (iMatchIdx >= lMatches.Count) { iMatchIdx = 0; } IMatchVw matchVw = lMatches.Count > iMatchIdx ? lMatches[iMatchIdx] : null; SyncObservableCollection <IMatchVw> socMonitor = LiveMonitorsCollectionList[i]; double dblCurrentMonitorFilledHeight = 0; SyncList <IMatchVw> lMatchesTemp = new SyncList <IMatchVw>(); string oldSport = ""; bool isPreLiveOld = false; while (matchVw != null) { if (matchVw == null || lMatchesTemp.Contains(matchVw)) { break; } string currentSport = matchVw.SportDescriptor; var isPreLive = matchVw.LiveBetStatus == eMatchStatus.NotStarted || !matchVw.IsLiveBet; if (!string.IsNullOrEmpty(currentSport)) { if (currentSport != oldSport) { matchVw.IsHeaderForRotation = true; } else if (isPreLive && !isPreLiveOld) { matchVw.IsHeaderForRotation = true; } else { matchVw.IsHeaderForRotation = false; } oldSport = currentSport; isPreLiveOld = isPreLive; } dblCurrentMonitorFilledHeight += matchVw.IsHeaderForRotation ? dblHeaderItemHeight : dblItemHeight; if (dblCurrentMonitorFilledHeight > lmViewModels[i].LiveOddsHeight) //lmViewModels[i].LiveOddsHeight) { break; } else { lMatchesTemp.Add(matchVw); } iMatchIdx++; if (iMatchIdx >= lMatches.Count) { iMatchIdx = 0; } matchVw = lMatches.Count > iMatchIdx ? lMatches[iMatchIdx] : null; LiveMonitorRotationCounters[i]++; } Dispatcher.Invoke(() => { socMonitor.ApplyChanges(lMatchesTemp); //damn thing does not applay normally changes for collections with duplicate matches with it... }); } }