private void HandleLoginComplete(bool should) { if (!should) { return; } if (Characters.Count() == 1) { CurrentCharacter = Characters.First(); SendCharacterSelectEvent(); return; } if (!Characters.Any()) { Exceptions.ShowErrorBox( "slimCat will now exit. \nReason: No characters to connect with. \n\n" + "Please create a character to sign into f-chat.", "No characters for chat!"); Environment.Exit(-3); } RelayMessage = "Done! Now pick a character."; RegionManager.RequestNavigate(Shell.MainRegion, new Uri(CharacterSelectViewName, UriKind.Relative)); OnPropertyChanged("Characters"); Log("Requesting character select view"); }
public void AddCharacter(Guid id, String name, String className, Boolean isMain) { if (Characters .Any(_ => _.Id == id && _.Name == name && _.ClassName == className && _.IsActive)) { return; } if (Characters.Any(_ => _.Id == id && _.Name != name && _.IsActive && _.ClassName != className)) { throw new CharacterAlreadyExists(Characters.First(_ => _.Id == id)); } if (isMain) { foreach (var character in Characters) { character.UnmarkAsMain(); } } Characters.Add(new Character(id, name, className, isMain)); ConcurrencyTokens = Guid.NewGuid(); UpdateDate = DateTime.UtcNow; }
private void _AddCharacter(object parameters) { if (parameters == null) { return; } var p = parameters as object[]; var characterName = p[0].ToString(); int.TryParse(p[1].ToString(), out int initiativeModifier); // iniline declaration if (Characters.Any(x => x.InitiativeModificator == initiativeModifier && x.Name == characterName)) { return; } Random random = new Random(); Characters.Add(new Character(characterName, initiativeModifier, random.Next(1, GetInitiativeRollDiceNumber()))); Characters = new ObservableCollection <Character>(Characters .OrderByDescending(x => x.InitiativeRoll) .ThenByDescending(x => x.InitiativeModificator).ToList()); }
public void AppendCharacters(params Character[] characters) { if (characters == null) { return; } var duplicates = new List <Character>(); foreach (var newCharacter in characters) { // Don't append duplicates if (Characters.Any(c => c.IsDuplicate(newCharacter))) { duplicates.Add(newCharacter); } else { _characters.Add(newCharacter); _unchangedCharacterList.Add(newCharacter.Clone()); IsDirty = true; } } if (duplicates.Any()) { DuplicateCharactersIgnoredEvent?.Invoke(duplicates); } UpdateNumCharactersProperty(); }
public bool IsLeader(ClientSession session) { if (!Characters.Any()) { return(false); } return(Characters.OrderBy(s => s.Character.LastGroupJoin).ElementAt(0) == session); }
public bool CanGoTo(int x, int y) { return(x >= 0 && Map[0].Count > x && y >= 0 && Map.Count > y && Map[y][x] != (int)MapTypes.Wall && Map[y][x] != (int)MapTypes.Plant && !ActiveObjects.Any(t => t.X == x && t.Y == y) && !Characters.Any(t => t.X == x && t.Y == y)); }
public void AddCharacterIfNotExist(string characterName) { if (Characters.Any(c => string.Equals(c.Name, characterName, StringComparison.OrdinalIgnoreCase))) { return; } Characters.Add(new Character(characterName)); }
public static bool Exists(string name, bool includePets = false) { if (includePets) { return(Characters.Any(x => x.Name == name)); } else { return(Characters.Any(x => x.Name == name && !x.IsPet)); } }
public bool IsLeader(ClientSession session) { if (!Characters.Any()) { return(false); } ClientSession sess = Characters.OrderBy(s => s.Character.LastGroupJoin).ElementAtOrDefault(0); return(sess != null && sess == session); }
private void SelectCharacter() { var sm = new CharacterSelectingModel(); _uiVisualizerService.ShowDialog(new CharacterSelectingViewModel(sm), (sender, e) => { if (!Characters.Any(p => p.Equals(sm.SelectedCharacter, StringComparison.OrdinalIgnoreCase)) && !string.IsNullOrEmpty(sm.SelectedCharacter)) { Characters.Add(sm.SelectedCharacter); SelectedCharacter = sm.SelectedCharacter; } }); }
public IEnumerable <Token> Tokenize() { var buffer = new Characters(); foreach (var characterInfo in Scan()) { if (IsDelimiter(characterInfo.Character) && buffer.Any()) { yield return(buffer.GetTokenAndClear()); } buffer.Add(characterInfo); if (IsDelimiter(characterInfo.Character)) { yield return(buffer.GetTokenAndClear()); } } if (buffer.Any()) { yield return(buffer.GetTokenAndClear()); } }
private bool CanExecuteDropCommand(object parameter) { if (DraggedDataContext is DiagramModel) { bool isexist = Characters.Any(item => item.Index == (DraggedDataContext as DiagramModel).Index); if (isexist) { ErrorMessage = $"{(DraggedDataContext as DiagramModel).Name} is here!"; return(false); } } ErrorMessage = string.Empty; return(true); }
public Character GetOrCreateCharacter(string characterName) { if (Characters.Any(c => c.Name == characterName)) { return(Characters.First(c => c.Name == characterName)); } var newCharacter = new Character { Name = characterName }; Characters.Add(newCharacter); SaveChanges(); return(newCharacter); }
private void ExecuteDropCommand(object parameter) { if (parameter is DiagramViewModel) { if (DraggedDataContext != null && DraggedDataContext is DiagramModel) { (parameter as DiagramViewModel).Name = (DraggedDataContext as DiagramModel).Name; (parameter as DiagramViewModel).Detail = (DraggedDataContext as DiagramModel).Detail; // (parameter as DiagramViewModel).ImagePath = (DraggedDataContext as DiagramModel).ImagePath; (parameter as DiagramViewModel).Index = (DraggedDataContext as DiagramModel).Index; } var redomemo = new Action <object>((obj) => { if (!Characters.Any(item => item.Index == (parameter as DiagramViewModel).Index)) { Characters.Add(parameter as DiagramViewModel); } }); var undomemo = new Action <object>((obj) => ExecuteDeleteDiagramCommand(parameter)); if (!_isUndoHandle) { UndoStack.Push(new UndoRedoManager() { ActionComment = $"add the {(DraggedDataContext as DiagramModel)}", RedoAction = redomemo, UndoAction = undomemo, }); } else { RedoStack.Push(new UndoRedoManager() { ActionComment = $"add the {(DraggedDataContext as DiagramModel)}", RedoAction = undomemo, UndoAction = redomemo, }); _isUndoHandle = false; } redomemo(null); } }
private void ExecuteSaveAsXMLCommand(object parameter) { if (!Characters.Any()) { return; } SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.FilterIndex = 1; //Extend the image type saveFileDialog.Filter = "XML File(.xml)|*.xml|All Files (*.*)|*.*"; bool?result = saveFileDialog.ShowDialog(); if (result == true) { var path = saveFileDialog.FileName; //request the newest the layout map IsSyncLayoutRelationshipMap = true; var map = LayoutRelationshipMap; map.Header = "it is relationship map."; map.Footer = "Yuri on Ice!!!"; if (map == null) { throw new NullReferenceException("LayoutRelationshipMap is Null"); } XmlSerializer serializer = new XmlSerializer(typeof(RelationshipMap)); //ファイルを作る FileStream fs = new FileStream(path, FileMode.Create); //書き込み serializer.Serialize(fs, map); //sclsはSampleClassのインスタンス名 //ファイルを閉じる fs.Close(); // if don't set false, it will update the layoutmap by every action IsSyncLayoutRelationshipMap = false; } }
public SizeF MeasureString(string s) { if (_cacheTextSize.ContainsKey(s)) { return(_cacheTextSize[s]); } var chars = s.ToCharArray(); var size = new SizeF(0, 0); var cursor = new PointF(0, 0); foreach (var c in chars) { if (c == '\n') { cursor.X = 0; cursor.Y += Common.LineHeight; continue; } var fontChar = Characters.Any(fC => fC.Id == c) ? Characters.First(fC => fC.Id == c) : MissingCharacter; var nx = cursor.X + fontChar.OffsetX + (c == ' ' ? fontChar.AdvanceX : fontChar.Width); var ny = cursor.Y + fontChar.OffsetY + fontChar.Height; cursor.X += fontChar.AdvanceX; if (nx > size.Width) { size.Width = nx; } if (ny > size.Height) { size.Height = ny; } } _cacheTextSize.Add(s, size); return(size); }
public bool IsMemberOfGroup(ClientSession session) { return(Characters.Any(c => c.Character.CharacterId.Equals(session.Character.CharacterId))); }
public bool IsMemberOfGroup(long characterId) { return(Characters.Any(c => c.Character.CharacterId.Equals(characterId))); }
public bool IsMemberOfGroup(ClientSession session) { return(Characters != null && Characters.Any(s => s?.Character?.CharacterId == session.Character.CharacterId)); }
public bool IsTeamAlive() { return(Characters.Any(entity => entity.IsAlive())); }
public bool IsMemberOfRaid(ClientSession session) { return(session != null && Characters.Any(t => t == session)); }
public bool IsMemberOfGroup(ClientSession session) => Characters?.Any(s => s?.Character?.CharacterId == session.Character.CharacterId) == true;
public void RenderString(string s, bool cache = true) { if (_cacheTextList.ContainsKey(s) && cache) { GL.PushMatrix(); GL.CallList(_cacheTextList[s]); GL.PopMatrix(); return; } GL.PushMatrix(); if (cache) { var list = GL.GenLists(1); _cacheTextList.Add(s, list); GL.NewList(list, ListMode.CompileAndExecute); } var chars = s.ToCharArray(); var cursor = new PointF(0, 0); foreach (var c in chars) { if (c == '\n') { cursor.X = 0; cursor.Y += Common.LineHeight; continue; } var fontChar = MissingCharacter; if (Characters.Any(fc => fc.Id == c)) { fontChar = Characters.First(fc => fc.Id == c); } if (c != ' ') { GL.PushMatrix(); GL.Translate(cursor.X + fontChar.OffsetX, cursor.Y + fontChar.OffsetY, 0); GL.BindTexture(TextureTarget.Texture2D, fontChar.CharacterBitmap.Key); GL.Begin(PrimitiveType.Quads); GL.TexCoord2(0, 0); GL.Vertex2(0, 0); GL.TexCoord2(1, 0); GL.Vertex2(fontChar.Width, 0); GL.TexCoord2(1, 1); GL.Vertex2(fontChar.Width, fontChar.Height); GL.TexCoord2(0, 1); GL.Vertex2(0, fontChar.Height); GL.End(); GL.PopMatrix(); } cursor.X += fontChar.AdvanceX; } if (cache) { GL.EndList(); } GL.PopMatrix(); }
public bool IsMemberOfGroup(long characterId) { return(Characters != null && Characters.Any(s => s?.Character?.CharacterId == characterId)); }
public bool IsMemberOfGroup(long characterId) => Characters?.Any(s => s?.Character?.CharacterId == characterId) == true;
public bool IsMemberOfRaid(long characterId) { return(Characters.Any(t => t.Character.CharacterId == characterId)); }
/// <summary> /// 全てのマスのうち、部屋かつすでにキャラクターがいない場所を取得 /// </summary> /// <returns></returns> public MapCell GetCharacterFreeCell() { return(MapData.Cast <MapCell>() .Where(x => x.Terra == Enums.Terrain.Room && !Characters.Any(y => y.Position == x.Position)) .WaitedSample(x => 1)); }