public void SelectPlayerSlot(PlayerSlot slot) { if (slot.charobj == null) { playerSlot = slot; playerSelectionPanel.gameObject.SetActive(true); menuPanel.gameObject.SetActive(false); } else { //open character window CharacterObject charobj = slot.charobj; CharacterDetailPanel.SetActive(true); characterDetails cd = CharacterDetailPanel.GetComponent <characterDetails>(); cd.Name.text = "Name: " + charobj.Name; cd.icon.sprite = charobj.icon; cd.Cost.text = "Cost: " + (100).ToString(); cd.BaseHealth.text = "Health: " + (100).ToString(); cd.Vit.text = "Vitality: " + charobj.vitality.ToString(); cd.Strength.text = "Strength: " + charobj.strength.ToString(); cd.Speed.text = "Speed: " + charobj.speed.ToString(); cd.Intelligence.text = "Intelligence: " + charobj.intelligence.ToString(); CharacterDetailPanel.SetActive(true); cd.button.onClick.RemoveAllListeners(); cd.button.gameObject.transform.Find("Text").GetComponent <Text>().text = "Unequip Character"; cd.Cost.gameObject.SetActive(false); cd.button.onClick.AddListener(delegate { UnequepCharacter(slot); }); } }
/// <summary> /// Adds a Game to this Match. (adds to Games list) /// Also updates score and finished status. /// If the Match is finished or not ready, an exception is thrown. /// If the Game has invalid data (such as negative score), an exception is thrown. /// </summary> /// <param name="_defenderScore">Playerslot 0's score</param> /// <param name="_challengerScore">Playerslot 1's score</param> /// <param name="_winnerSlot">Game winner</param> /// <returns>Model of the added Game</returns> public GameModel AddGame(int _defenderScore, int _challengerScore, PlayerSlot _winnerSlot) { // Find the lowest (positive) Game Number we can add. // Check existing games, and get the first unassigned number: List <int> gameNumbers = Games.Select(g => g.GameNumber).ToList(); int gameNum = 1; while (gameNumbers.Contains(gameNum)) { ++gameNum; } // Create a new Game with the game number and this Match's ID: IGame game = new Game(this.Id, gameNum); // Add Game's data (players and score): for (int i = 0; i < 2; ++i) { game.PlayerIDs[i] = this.Players[i]?.Id ?? -1; } game.Score[(int)PlayerSlot.Defender] = _defenderScore; game.Score[(int)PlayerSlot.Challenger] = _challengerScore; game.WinnerSlot = _winnerSlot; // Use the private helper method to do the actual work. // This method will add the game and update the Match data: return(AddGame(game)); }
public void Join_makes_slot_ready() { var playerSlot = new PlayerSlot(); Assert.False(playerSlot.Ready); playerSlot.Join(Mock<IPlayer>().Object); Assert.That(playerSlot.Ready); }
protected static Player SetupPlayer(GameObject _obj, PlayerSlot _slot) { Player player = _obj.GetComponent <Player>(); SetupPlayer(player, _slot); return(player); }
public Game(int _matchId, int _gameNumber, int[] _playerIDs, PlayerSlot _winnerSlot, int[] _score) { if (null == _playerIDs) { throw new ArgumentNullException("_playerIDs"); } if (null == _score) { throw new ArgumentNullException("_score"); } Id = -1; MatchId = _matchId; GameNumber = _gameNumber; WinnerSlot = _winnerSlot; // ID values default to -1, indicating "no player" (an error) PlayerIDs = new int[2] { -1, -1 }; Score = new int[2] { 0, 0 }; for (int i = 0; i < 2; ++i) { PlayerIDs[i] = _playerIDs[i]; Score[i] = _score[i]; } }
/// <summary> /// Remove a specified Game from a Match. /// Applies necessary affects to other, related Matches. /// Updates scores and Rankings accordingly. /// _updateInstead determines whether to notify the DB to delete the game. /// May fire events: MatchesModified, GamesDeleted. /// If Match or Game is not found, an exception is thrown. /// </summary> /// <param name="_matchNumber">Match to alter</param> /// <param name="_gameNumber">Game to remove</param> /// <param name="_updateInstead">false if removing the game, true if updating</param> /// <returns>Model of removed Game</returns> public GameModel RemoveGameNumber(int _matchNumber, int _gameNumber, bool _updateInstead = false) { Match match = GetInternalMatch(_matchNumber); MatchModel oldMatchModel = GetMatchModel(match); PlayerSlot winnerSlot = match.WinnerSlot; List <GameModel> modelList = new List <GameModel>(); // Remove the Game and update the Bracket & Rankings: modelList.Add(match.RemoveGameNumber(_gameNumber)); List <MatchModel> alteredMatches = ApplyGameRemovalEffects(_matchNumber, modelList, winnerSlot); UpdateScore(_matchNumber, modelList, false, oldMatchModel); // Fire Event with any Matches that changed: alteredMatches.Add(GetMatchModel(match)); BracketEventArgs args = null; if (_updateInstead) { args = new BracketEventArgs(alteredMatches); } else { args = new BracketEventArgs (alteredMatches, modelList.Select(g => g.GameID).ToList()); } OnMatchesModified(args); // Return a Model of the removed Game: return(modelList[0]); }
/// <summary> /// Adds a reference (MatchNumber) to a previous Match: Where this Match's Players came from. /// Each Match can hold up to two of these previous match numbers. /// If two match numbers have already been added, an exception is thrown. /// If an invalid (negative) match number is given, an exception is thrown. /// </summary> /// <param name="_number">Number of previous match</param> /// <param name="_slot">Which playerslot is coming from that Match</param> public void AddPreviousMatchNumber(int _number, PlayerSlot _slot = PlayerSlot.unspecified) { if (_number < 1) { throw new InvalidIndexException ("Match Number cannot be less than 1!"); } // Previous Match Numbers are stored in a 2-length array. // Make sure the correct slot (given as _slot) is not already assigned before doing so: if ((PlayerSlot.unspecified == _slot || PlayerSlot.Defender == _slot) && PreviousMatchNumbers[(int)PlayerSlot.Defender] < 0) { PreviousMatchNumbers[(int)PlayerSlot.Defender] = _number; } else if ((PlayerSlot.unspecified == _slot || PlayerSlot.Challenger == _slot) && PreviousMatchNumbers[(int)PlayerSlot.Challenger] < 0) { PreviousMatchNumbers[(int)PlayerSlot.Challenger] = _number; } else { throw new AlreadyAssignedException ("Previous Match Numbers are already set!"); } }
private void OnDeselected(int index, PlayerSlot player) { if (OnCharacterDeselected != null) { OnCharacterDeselected(index, player); } }
public TableSegment GetSegment(NetworkPlayer player) { for (int i = 0; i < Segments.Length; i++) { TableSegment current = Segments[i]; PlayerSlot currentSlot = current.GetSlot(); if (_slotter == null) { _slotter = PlayerSlotter.Singleton(); } NetworkPlayer currentPlayer = _slotter.GetPlayer(currentSlot); if (currentPlayer == null) { continue; } if (currentPlayer == player) { return(current); } } return(null); }
/// <summary> /// Subtracts a "win" from this Match. /// This updates the score and finished status. /// If the Match is not yet ready, an exception is thrown. /// If this subtraction would lower score under 0, an exception is thrown. /// </summary> /// <param name="_slot">Playerslot to subtract a win from</param> private void SubtractWin(PlayerSlot _slot) { if (!IsReady) { throw new InactiveMatchException ("Match is not begun; can't subtract wins!"); } if (PlayerSlot.unspecified == _slot) { // "Removing" a tie: do nothing to Score return; } if (_slot != PlayerSlot.Defender && _slot != PlayerSlot.Challenger) { throw new InvalidSlotException ("PlayerSlot must be 0 or 1!"); } if (Score[(int)_slot] <= 0) { throw new ScoreException ("Score is already 0; can't subtract wins!"); } // If the given slot is the Match winner, the Match will be reactivated. // Remove the winner and reset IsFinished: if (WinnerSlot == _slot) { IsFinished = false; WinnerSlot = PlayerSlot.unspecified; } // Now we can subtract the point: Score[(int)_slot] -= 1; }
private static void InitPlayer(PlayerSlot playerSlot) { playerSlot.PlayerConfig.PlayerRootObject.SetActive(true); playerSlot.WasInitialized = true; playerSlot.IsAlive = true; OnPlayerEnteredGame?.Invoke(playerSlot.PlayerNum); }
public void Join_makes_slot_ready() { var playerSlot = new PlayerSlot(); Assert.False(playerSlot.Ready); playerSlot.Join(Mock <IPlayer>().Object); Assert.That(playerSlot.Ready); }
private void RPCTakeSlot(int slotId, int playerId) { PlayerSlot slot = playerSlots[slotId]; // When a slot is taken, the score for that player is 1. slot.Init(); slot.SetPlayer(playerId, 1); }
public static Vector2 GetRightInput(PlayerSlot p) { Vector2 output = Vector2.zero; output.x = GetHorizontalAxis2(p); output.y = GetVerticalAxis2(p); return(output); }
void Start() { GameObject gc = GameObject.FindWithTag("GameController"); gameController = gc.GetComponent<GameController>(); controller = GetComponent<Controller>(); playerSlot = GetComponent<PlayerSlot>(); }
void UnequepCharacter(PlayerSlot slot) { slot.icon.sprite = defaultHolder; slot.charobj.Equiped = false; slot.charobj = null; Base.instance.removeCharacter(); CharacterDetailPanel.SetActive(false); }
// Track player boosts that are turned on / off // Track player achievements // Track level branches unlocked public Player(PlayerSlot slotPosition) { SlotPosition = slotPosition; //LastLevelCompleted = -1; Coins = 0; CoinCarryOver = 0; TotalScores = 0; PersistentTapStrength = 1; UnlockedSequences = new List <Sequences>(); UnlockedSequences.Add(Sequences.Linear); ChanceToRollNextSeq = 1; ChanceToRollBonus = 0; LuckyPointChance = 0; LuckyPointBonus = 1; UnlockedShopItems = new List <ShopUnlocks> (); UnlockedBranches = new List <BranchType> (); UnlockedBranches.Add(BranchType.Tutorial); ActiveBranch = BranchType.Tutorial; MedKitUpgradeLevel = 0; IsMedKitActivated = false; BranchProgression = new List <BranchProgress> (); var values = Enum.GetValues(typeof(BranchType)); foreach (BranchType branch in values) { BranchProgression.Add(new BranchProgress { BranchIsType = branch, IsLocked = true, BranchState = CompletionState.notStarted, LastLevelCompleted = -1, }); } BranchProgression.Find(x => x.BranchIsType == BranchType.Tutorial).IsLocked = false; docDir = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User) [0]; switch (SlotPosition) { case PlayerSlot.slot1: PlayerDataFile = docDir.AbsoluteUrl.RelativePath + "/player1data.xml"; Name = "Player 1"; break; case PlayerSlot.slot2: PlayerDataFile = docDir.AbsoluteUrl.RelativePath + "/player2data.xml"; Name = "Player 2"; break; case PlayerSlot.slot3: PlayerDataFile = docDir.AbsoluteUrl.RelativePath + "/player3data.xml"; Name = "Player 3"; break; } }
public static bool OutOfArea(Vector2 _position, PlayerSlot _playerSlot, float _margin) { Vector2 min = GetAreaMin(_playerSlot); Vector2 max = GetAreaMax(_playerSlot); Vector2 margin = new Vector2(_margin, _margin); return(_position.x < min.x - margin.x || _position.x > max.x + margin.x || _position.y < min.y - margin.y || _position.y > max.y + margin.y); }
/// <summary> /// Adds the game and saves to the database /// </summary> /// <param name="matchNum">Match Number</param> /// <param name="DScore">Defender Score</param> /// <param name="CScore">Challenger Score</param> /// <param name="winner">The winner of the game</param> /// <returns>True if saved; false if failed</returns> public bool AddGame(int matchNum, int DScore, int CScore, PlayerSlot winner) { GameModel game = bracket.AddGame(matchNum, DScore, CScore, winner); // Add the game to the database services.Tournament.AddGame(game); return(services.Save()); }
/////////////////////////////////////////////////////////////////////////// public PlayerController GetPlayer(PlayerSlot slot) { if (!m_Players.ContainsKey(slot)) { return(null); } return(m_Players[slot]); }
public void SelectPlayer(PlayerSlot playerSlot){ selectedSlot = playerSlot; if (ModulePrefs.User == null) { ModulePrefs.User= new User("LocalUser"); } ModulePrefs.User.player.name = playerSlot.playerName.text; ModulePrefs.User.player.level=int.Parse(System.Text.RegularExpressions.Regex.Match(playerSlot.playerLevel.text, @"\d+").Value); ModulePrefs.User.player.custom = playerSlot.playerClass.text; }
/// <summary> /// Processes the effects of adding a "game win" to a Match. /// If the Match ends, the winner and loser advance, /// so long as they have legal next matches to advance to. /// </summary> /// <param name="_matchNumber">Number of Match initially affected</param> /// <param name="_slot">Slot of game winner: Defender or Challenger</param> /// <returns>List of Models of Matches that are changed</returns> protected override List <MatchModel> ApplyWinEffects(int _matchNumber, PlayerSlot _slot) { List <MatchModel> alteredMatches = new List <MatchModel>(); int nextWinnerNumber; int nextLoserNumber; Match match = GetMatchData(_matchNumber, out nextWinnerNumber, out nextLoserNumber); // Only advance players if the Match is finished. if (match.IsFinished) { // Check if the winner has a Match to advance to: if (nextWinnerNumber > 0) { // Find the next Match: Match nextWinMatch = GetInternalMatch(nextWinnerNumber); // Find which PlayerSlot to move the winner into: for (int i = 0; i < nextWinMatch.PreviousMatchNumbers.Length; ++i) { if (_matchNumber == nextWinMatch.PreviousMatchNumbers[i]) { // Advance the winner: nextWinMatch.AddPlayer (match.Players[(int)(match.WinnerSlot)], (PlayerSlot)i); alteredMatches.Add(GetMatchModel(nextWinMatch)); break; } } } // Check if the loser has a Match to advance to: if (nextLoserNumber > 0) { // Find the next Match: Match nextLosMatch = GetInternalMatch(nextLoserNumber); // Find which PlayerSlot to move the loser into: for (int i = 0; i < nextLosMatch.PreviousMatchNumbers.Length; ++i) { if (_matchNumber == nextLosMatch.PreviousMatchNumbers[i]) { PlayerSlot loserSlot = (PlayerSlot.Defender == match.WinnerSlot) ? PlayerSlot.Challenger : PlayerSlot.Defender; // Advance the loser: nextLosMatch.AddPlayer(match.Players[(int)loserSlot], (PlayerSlot)i); alteredMatches.Add(GetMatchModel(nextLosMatch)); break; } } } } // Return a list of any MatchModels we changed: return(alteredMatches); }
public static Player Instantiate(GameObject _obj, PlayerSlot _slot) { Vector3 position = (_slot == PlayerSlot.PC1) ? new Vector3(GameManager.RECT.x / 2, GameManager.RECT.w / 2) : new Vector3(GameManager.RECT.z / 2, GameManager.RECT.w / 2); Quaternion rotation = Quaternion.Euler(0, 0, 0); GameObject obj = Instantiate(_obj, position, rotation); return(SetupPlayer(obj, _slot)); }
/// <summary> /// Sets this object's values from a related MatchModel. /// Convert's any null values into appropriate defaults. /// Note: passing an unrealistic MatchModel can cause impossible situations. /// </summary> /// <param name="_model">MatchModel with data</param> public void SetFromModel(MatchModel _model) { if (null == _model) { throw new ArgumentNullException("_model"); } this.Id = _model.MatchID; this.MaxGames = _model.MaxGames.GetValueOrDefault(1); this.WinnerSlot = PlayerSlot.unspecified; // Copy Players: this.Players = new IPlayer[2]; Players[(int)PlayerSlot.Defender] = (null == _model.Defender) ? null : new Player(_model.Defender); Players[(int)PlayerSlot.Challenger] = (null == _model.Challenger) ? null : new Player(_model.Challenger); // Match is "Ready" if both player slots are filled this.IsReady = (null != Players[0] && null != Players[1]); this.Games = new List <IGame>(); this.Score = new int[2] { 0, 0 }; this.IsManualWin = false; if (_model.IsManualWin) { // If match has a manually set winner, // call the SetWinner method. // This prevents any Games from affecting the Score. PlayerSlot winnerSlot = (_model.WinnerID == _model.DefenderID) ? PlayerSlot.Defender : PlayerSlot.Challenger; SetWinner(winnerSlot); } foreach (GameModel gameModel in _model.Games.OrderBy(m => m.GameNumber)) { // Adding Games with the AddGame method handles things for us. // Data like score and finish status will auto update. AddGame(gameModel); } this.GroupNumber = _model.GroupNumber.GetValueOrDefault(-1); this.RoundIndex = _model.RoundIndex.GetValueOrDefault(-1); this.MatchIndex = _model.MatchIndex.GetValueOrDefault(-1); this.MatchNumber = _model.MatchNumber; this.NextMatchNumber = _model.NextMatchNumber.GetValueOrDefault(-1); this.NextLoserMatchNumber = _model.NextLoserMatchNumber.GetValueOrDefault(-1); this.PreviousMatchNumbers = new int[2]; PreviousMatchNumbers[(int)PlayerSlot.Defender] = _model.PrevDefenderMatchNumber.GetValueOrDefault(-1); PreviousMatchNumbers[(int)PlayerSlot.Challenger] = _model.PrevChallengerMatchNumber.GetValueOrDefault(-1); }
private void OnPlayerDeath(PlayerSlot playerSlot) { playerSlot.IsAlive = false; var livePlayers = _playerSlots.Where(slot => slot.IsAlive).ToArray(); if (livePlayers.Length == 1) { var lastPlayerNum = livePlayers[0].PlayerNum; OnLastManStanding?.Invoke(lastPlayerNum); } }
public override void SetMatchWinner(int _matchNumber, PlayerSlot _winnerSlot) { int groupIndex; int fixedMatchNumber = _matchNumber; GetMatchData(ref fixedMatchNumber, out groupIndex); Groups[groupIndex].SetMatchWinner(fixedMatchNumber, _winnerSlot); RecalculateRankings(); ApplyWinEffects(_matchNumber, _winnerSlot); }
public void PreparePlayer(PlayerSlot slot) { transform.position = slot.transform.position; transform.forward = slot.transform.forward; RpcPositionPlayer(slot.transform.position, slot.transform.rotation); _handSync.ForceSync(slot.HandStartPoint); _headSync.ForceSync(slot.HeadStartPoint); }
void Start() { animator = GetComponent<Animator>(); character = GetComponent<Character>(); controller = GetComponent<Controller>(); playerDie = GetComponent<PlayerDie>(); playerSlot = GetComponent<PlayerSlot>(); weapon = GetComponent<Weapon>(); weapon.WeaponInfo(); }
/// <summary> /// Removes the specified Player from all Matches "after" the given Match. /// Invalidates any future results he has been part of. /// This is called upon reversing a Player's bracket advancement, /// such as resetting a Match he had won. /// If the given Match is not found, an exception is thrown. /// If the Player ID is not found, an exception is thrown. /// </summary> /// <param name="_matchNumber">Number of Match</param> /// <param name="_playerId">ID of Player to remove</param> /// <returns>List of Models of Matches that changed</returns> protected virtual List <MatchModel> RemovePlayerFromFutureMatches(int _matchNumber, int _playerId) { if (_matchNumber < 1 || _playerId == -1) { // This is the recursive break condition. return(new List <MatchModel>()); } List <MatchModel> alteredMatches = new List <MatchModel>(); int nextWinnerNumber; int nextLoserNumber; Match match = GetMatchData(_matchNumber, out nextWinnerNumber, out nextLoserNumber); // If this Match doesn't contain the given Player, we can stop. if (match.Players.Any(p => p?.Id == _playerId)) { // If this match is finished, we need to continue to the next round: if (match.IsFinished) { PlayerSlot loserSlot = (PlayerSlot.Defender == match.WinnerSlot) ? PlayerSlot.Challenger : PlayerSlot.Defender; // Remove any advanced Players from future Matches. // Again, this is called twice: for winner and loser. alteredMatches.AddRange(RemovePlayerFromFutureMatches (nextWinnerNumber, match.Players[(int)(match.WinnerSlot)].Id)); List <MatchModel> secondList = RemovePlayerFromFutureMatches (nextLoserNumber, match.Players[(int)loserSlot].Id); // If we affected the same Match twice down the line, // only save the final updated Model: List <int> dupeNumbers = alteredMatches.Select(m => m.MatchNumber).ToList() .Intersect(secondList.Select(m => m.MatchNumber).ToList()) .ToList(); alteredMatches.RemoveAll(m => dupeNumbers.Contains(m.MatchNumber)); alteredMatches.AddRange(secondList); } // Fire an event to notify we're deleting this Match's Games: OnGamesDeleted(match.Games); // Remove the Player from this Match: match.RemovePlayer(_playerId); // Save the updated Model of this Match, for event firing: alteredMatches.RemoveAll(m => m.MatchNumber == _matchNumber); alteredMatches.Add(GetMatchModel(match)); } // Return the list of Matches we're changing: return(alteredMatches); }
public void AddPlayer(NetworkPlayer player) { PlayerSlot nextSlot = GetEmptySlot(); if (nextSlot == null) { return; // Spectator mode? } _playerDictionary[nextSlot] = player; player.PreparePlayer(nextSlot); }
// f:生成時にパラメータを渡すことができるInstantiate関数 public static Player Instantiate(Player _player, PlayerSlot _slot) { Vector3 position = (_slot == PlayerSlot.PC1) ? new Vector3(GameManager.RECT.x / 2, GameManager.RECT.w / 2) : new Vector3(GameManager.RECT.z / 2, GameManager.RECT.w / 2); Quaternion rotation = Quaternion.Euler(0, 0, 0); Player player = Instantiate(_player, position, rotation) as Player; SetupPlayer(player, _slot); return(player); }
public void RemovePlayer(NetworkPlayer player) { for (int i = 0; i < _playerSlots.Length; i++) { PlayerSlot current = _playerSlots[i]; if (_playerDictionary[current] == player) { _playerDictionary[current] = null; return; } } }
public void PickDecoration(PlayerSlot ps) { if (ps.StreamerPickDecoration()) { currentPS = ps; //Cursor.visible = false; screenPosition = cam.WorldToScreenPoint(ps.decoration.transform.position); offset = ps.decoration.transform.position - cam.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPosition.z)); isHoldingDecoration = true; } }
public void SetPlayerRuntimeSaveData(PlayerRuntimeSaveData playerRuntimeSaveData) { currentHitPoints = playerRuntimeSaveData.currentHitPoints; currentStunPoints = playerRuntimeSaveData.currentStunPoints; currentDecayPoints = playerRuntimeSaveData.currentStunPoints; currentSceneCode = (SceneCode)playerRuntimeSaveData.currentSceneCode; lastLittleSunID = playerRuntimeSaveData.lastLittleSunID; string[] lastPos = playerRuntimeSaveData.lastPosition.Split(','); lastPosition = new Vector2(float.Parse(lastPos[0]), float.Parse(lastPos[1])); playerStock = playerRuntimeSaveData.playerStock; playerSlot = playerRuntimeSaveData.playerSlot; // Debug.Log(playerRuntimeSaveData.lastPosition); isLoaded = true; }
private void populateSlot(PlayerSlot slot) { if (slot.championId == 0) return; //TODO: move PlayerName label to some not so retarded place if (slot.summonerName == Client.LoginPacket.AllSummonerData.Summoner.Name) { var tbc = new TeamBuilderChoose(); tbc.PlayerName.Content = slot.summonerName; tbc.PlayerName.Visibility = Visibility.Visible; string UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", champions.GetChampion(slot.championId).iconPath); tbc.Champion.Source = Client.GetImage(UriSource); tbc.Role.Items.Add(new Item(slot.role)); tbc.Role.SelectedIndex = 0; tbc.Role.IsEnabled = false; tbc.Position.Items.Add(new Item(slot.position)); tbc.Position.SelectedIndex = 0; tbc.Position.IsEnabled = false; tbc.Position.Visibility = Visibility.Visible; UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName(slot.spell1Id)); tbc.SummonerSpell1Image.Source = Client.GetImage(UriSource); tbc.SummonerSpell1.Visibility = Visibility.Visible; UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName(slot.spell2Id)); tbc.SummonerSpell2Image.Source = Client.GetImage(UriSource); tbc.SummonerSpell2.Visibility = Visibility.Visible; if (slot.slotId == teambuilderSlotId) { tbc.MasteryPage.Visibility = Visibility.Visible; tbc.MasteryPage.SelectionChanged += MasteryPage_SelectionChanged; tbc.RunePage.Visibility = Visibility.Visible; tbc.RunePage.SelectionChanged += RunePage_SelectionChanged; tbc.EditMasteries.Click += EditMasteriesButton_Click; tbc.EditRunes.Click += EditRunesButton_Click; tbc.SummonerSpell1.Click += SummonerSpell_Click; tbc.SummonerSpell2.Click += SummonerSpell_Click; int i = 0; foreach (MasteryBookPageDTO MasteryPage in MyMasteries.BookPages) { string MasteryPageName = MasteryPage.Name; //Stop garbage mastery names if (MasteryPageName.StartsWith("@@")) { MasteryPageName = "Mastery Page " + ++i; } tbc.MasteryPage.Items.Add(MasteryPageName); if (MasteryPage.Current) tbc.MasteryPage.SelectedValue = MasteryPageName; } i = 0; foreach (SpellBookPageDTO RunePage in MyRunes.BookPages) { string RunePageName = RunePage.Name; //Stop garbage rune names if (RunePageName.StartsWith("@@")) { RunePageName = "Rune Page " + ++i; } tbc.RunePage.Items.Add(RunePageName); if (RunePage.Current) tbc.RunePage.SelectedValue = RunePageName; } TeamPlayer = tbc; } PlayerListView.Items.Insert(slot.slotId, tbc); } else { var tbc = new TeamBuilderPlayer(); tbc.Height = 50; tbc.PlayerName.Content = slot.summonerName; string UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", champions.GetChampion(slot.championId).iconPath); tbc.Champion.Source = Client.GetImage(UriSource); tbc.Role.Content = slot.role; tbc.Position.Content = slot.position; UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName(slot.spell1Id)); tbc.SummonerSpell1Image.Source = Client.GetImage(UriSource); UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName(slot.spell2Id)); tbc.SummonerSpell2Image.Source = Client.GetImage(UriSource); PlayerListView.Items.Insert(slot.slotId, tbc); } //just for now, need2know what other statuses are there if (!string.IsNullOrEmpty(slot.status) && !string.IsNullOrWhiteSpace(slot.status) && slot.status != "POPULATED" && slot.status != "CANDIDATE_FOUND") Debug.WriteLine("groupUpdatedV3 - new status found! : " + slot.status); }
void Start() { ps = GetComponent<PlayerSlot>(); weapon = GetComponent<Weapon>(); animator = GetComponent<Animator>(); }
void Start() { ps = GetComponent<PlayerSlot>(); weapon = GetComponent<Weapon>(); frameX = 1; frameNum = 1; totalframesX = 16; totalframesY = 8; }