public void ValidFresh(int friendcnt, string message) { JsonHelp jsonHelp = new JsonHelp(); string[] refresharray = jsonHelp.getRefreshnickarray(message); App.Current.Dispatcher.InvokeAsync(() => { Fcnt = friendcnt; Friendlist.Clear(); //여기서 각자 데이터를 받아만 올수 있다면, 그냥 add해주면 됨 for (int i = 0; i < refresharray.Length; i++) { Friendlist.Add(new Frienddata(refresharray[i])); } }); }
public void Validlogout() { // 여기에 현재 nickname으로 열려있는 모든 chatview, joinchatview, roomnamechangeview를 싹다 지워야함 messenger.userdata.Reset(); App.Current.Dispatcher.InvokeAsync(() => { for (int i = 0; i < chatViewModels.Count; i++) { chatViewModels[i].closeWindow(); } Fcnt = 0; Friendlist.Clear(); NICKNAME = string.Empty; MainWindow login = new MainWindow(); login.ShowDialog(); }); closeWindow(); }
public void SetFriendHud(PlayerList someConnectedPlayers) { if (!isLocalPlayer) { return; } myFriendList.Clear(); foreach (Transform child in myFriendList.gameObject.transform) { CmdUnsubscribe(child.gameObject); Destroy(child.gameObject); } for (int index = 0; index < someConnectedPlayers.Count; index++) { if (someConnectedPlayers[index].netId == myCharacter.GetComponent <NetworkIdentity>().netId) { continue; } GameObject player = ClientScene.FindLocalObject(someConnectedPlayers[index].netId); GameObject friend = Instantiate(myFriendList.myFriendlistHudPrefab, myFriendList.transform); friend.GetComponent <FriendHud>().SetCharacter(player); friend.GetComponent <FriendHud>().SetParent(myCharacter.GetComponent <PlayerCharacter>()); PlayerCharacter playerCharacter = player.GetComponent <PlayerCharacter>(); CharacterHUD hud = friend.GetComponent <CharacterHUD>(); hud.SetName(playerCharacter.Name); hud.SetHealthBarFillAmount(player.GetComponent <Health>().GetHealthPercentage()); myFriendList.AddHud(hud, someConnectedPlayers[index].netId, myCharacter.GetComponent <PlayerCharacter>().Name); CmdSubscribe(player); } }
public void Executelogout() { if (!messenger.requestLogout(NICKNAME)) { MessageBox.Show("서버와 연결이 끊겼습니당"); } else { messenger.userdata.Reset(); App.Current.Dispatcher.InvokeAsync(() => { for (int i = 0; i < chatViewModels.Count; i++) { chatViewModels[i].closeWindow(); } Fcnt = 0; Friendlist.Clear(); NICKNAME = string.Empty; MainWindow login = new MainWindow(); login.ShowDialog(); }); closeWindow(); } }