Пример #1
0
 protected override void ProcessStopDrag(Position dropGridPosition)
 {
     if (dropGridPosition != null)
     {
         AddFruitonToTeam(draggedFruiton, dropGridPosition, myTeam);
     }
     MyTeamGrid.LoadTeam(myTeam, dbFridgeMapping);
 }
Пример #2
0
        public void UpdateFruitonInMyTeam(DraftResult result)
        {
            var pos = myTeam.Positions.IndexOf(result.Position);

            if (pos == -1)
            {
                // Just add it
                myTeam.FruitonIDs.Add(result.FruitonId);
                myTeam.Positions.Add(result.Position);
                MyTeamGrid.LoadTeam(myTeam, dbFridgeMapping);
            }
            else if (myTeam.FruitonIDs[pos] != result.FruitonId)
            {
                // Update it
                myTeam.FruitonIDs[pos] = result.FruitonId;
                MyTeamGrid.LoadTeam(myTeam, dbFridgeMapping);
            }
        }
Пример #3
0
 /// <summary>
 /// Cancels drag and drop, moves fruiton to gived position or removes it from the team.
 /// </summary>
 /// <param name="dropGridPosition">position in team grid where fruiton was dropped,
 /// null if fruiton was dropped outside of the team grid</param>
 protected override void ProcessStopDrag(Position dropGridPosition)
 {
     if (isDraggingFromTeam)
     {
         if (dropGridPosition == null)
         {
             RemoveTeamMember(teamDragGridPosition);
         }
         else
         {
             SwapTeamMembers(teamDragGridPosition, dropGridPosition);
         }
     }
     else if (dropGridPosition != null)
     {
         AddFruitonToTeam(draggedFruiton, dropGridPosition);
     }
     MyTeamGrid.LoadTeam(teams[selectedTeamIndex].KernelTeam, dbFridgeMapping);
 }
Пример #4
0
        protected override void Start()
        {
            base.Start();
            myTeam    = new FruitonTeam();
            enemyTeam = new FruitonTeam();
            InitializeAllFruitons();
            MyTeamGrid.LoadTeam(myTeam, dbFridgeMapping);
            EnemyTeamGrid.LoadTeam(enemyTeam, null);

            SetupView();

            InitializeTeamGridListeners();
            InitializeFruitonDetailListeners();
            DragAndDropFruiton.gameObject.SetActive(false);

            TurnOffDrafting();
            if (!ChallengeController.Instance.IsChallengeActive)
            {
                FindGame();
            }
        }
Пример #5
0
        /// <summary>
        /// Selects and loads fruiton team to team grid.
        /// </summary>
        /// <param name="index">index of selected team</param>
        private void SelectTeam(int index)
        {
            var isValidTeamIndex = IsValidTeamIndex(index);

            ButtonPlay.interactable   = isValidTeamIndex || canPlayWithoutTeamSelected;
            ButtonEdit.interactable   = isValidTeamIndex;
            ButtonDelete.interactable = isValidTeamIndex;

            if (!isValidTeamIndex)
            {
                selectedTeamIndex  = -1;
                CurrentFruitonTeam = null;
                MyTeamGrid.ResetTeam();
                return;
            }

            if (selectedTeamIndex >= 0)
            {
                var lastSelectedTeam = teams[selectedTeamIndex];
                lastSelectedTeam.gameObject.GetComponent <Image>().color = lastSelectedTeam.Valid ? FridgeFruitonTeam.COLOR_DEFAULT : FridgeFruitonTeam.COLOR_INVALID;
            }

            teams[index].gameObject.GetComponent <Image>().color = FridgeFruitonTeam.COLOR_SELECTED;
            selectedTeamIndex = index;
            var newTeam = teams[selectedTeamIndex].KernelTeam;

            InputTeamName.text = newTeam.Name;
            CurrentFruitonTeam = newTeam;
            Dictionary <int, FridgeFruiton> passedDictionary = dbFridgeMapping;

            if (state != TeamManagementState.TEAM_MANAGEMENT)
            {
                passedDictionary = null;
            }
            MyTeamGrid.LoadTeam(newTeam, passedDictionary);
        }