/*******************Function For Combat Interface UI*******************/ //Register Connected Players public void RegisterPlayer(String username, int selectedHeroID) { if (username != null && username != "") { try { IDGSerControllerCallback callback = OperationContext.Current.GetCallbackChannel <IDGSerControllerCallback>(); int playerHP = heroInfo.Heroes[selectedHeroID].healthPoints; lock (playerLock) { //remove the old Player if (players.Keys.Contains(username)) { number--; players.Remove(username); selectedHeroHP.Remove(username); playerSelectedHero.Remove(username); playerSelectedAbility.Remove(username); playerSelectedTarget.Remove(username); } number++; players.Add(username, callback); selectedHeroHP.Add(username, playerHP); playerSelectedHero.Add(username, selectedHeroID); playerSelectedAbility.Add(username, -1); playerSelectedTarget.Add(username, -1); //if the number of players is five start combat if (number == 5) { startCount(); } } } catch (Exception e) { Console.WriteLine(e.Message); } } }
/*******************Function For Character Selection UI*******************/ //check connected client public void RegisterClient(String username) { if (username != null && username != "") { try { IDGSerControllerCallback callback = OperationContext.Current.GetCallbackChannel <IDGSerControllerCallback>(); lock (clientLock) { //remove the old client if (clients.Keys.Contains(username)) { clients.Remove(username); } clients.Add(username, callback); setPlayersData(); } } catch (Exception e) { Console.WriteLine(e.Message); } } }