public bool LogInUser(string email, string password)
        {
            if (_authController.VerifyLoginInput(email, password))
            {
                bool loginSuccess = true;
                switch (_authController.LogInUser(email, password, _playerRepository, _trainerRepository, _adminRepository))
                {
                case "player":
                {
                    var form = _formsFactory.PlayerView();
                    _playerController.Homepage(form, this, _playerRepository.GetPlayerByEmail(email), _transactionRepository, _trainerRepository, _trainingRepository, _teamRepository);
                    break;
                }

                case "trainer":
                {
                    var form = _formsFactory.TrainerView();
                    var trainerController = new TrainerController();
                    trainerController.Homepage(form, this, _trainerRepository.GetTrainerByEmail(email), _trainerRepository, _trainingRepository, _teamRepository, _playerRepository);
                    break;
                }

                case "admin":
                {
                    var form = _formsFactory.AdminView();
                    _adminController.Homepage(form, this, _adminRepository.GetAdminByEmail(email), _playerRepository, _trainerRepository, _teamRepository, _transactionRepository);
                    break;
                }

                case "": loginSuccess = false; break;
                }
                return(loginSuccess);
            }
            return(false);
        }
Exemple #2
0
    // Start is called before the first frame update. If the player enters the trainer's view, the battle will be triggered.
    private void Start()
    {
        battleSystem.Awake();
        BattleSystem.Instance.onBattleOver += EndBattle;

        playerController.onEnterTrainersView += (Collider2D trainerCollider) =>
        {
            var trainer = trainerCollider.GetComponentInParent <TrainerController>();
            this.trainer = trainer;
            if (trainer != null)
            {
                state = GameState.Cutscene;
                StartCoroutine(trainer.TriggerTrainerBattle(playerController));
            }
        };

        DialogManager.Instance.OnShowDialog += () =>
        {
            state = GameState.Dialog;
        };

        DialogManager.Instance.OnCloseDialog += () =>
        {
            if (state == GameState.Dialog)
            {
                state = GameState.FreeRoam;
            }
        };
    }
Exemple #3
0
    public void OnEnterTrainersView(TrainerController trainer)
    {
        bool battleLost = false;

        foreach (string trainerName in GameController.Instance.DefeatedTrainerName)
        {
            if (trainer.Name == trainerName)
            {
                battleLost = true;
                break;
            }
            else
            {
                battleLost = false;
            }
        }
        if (!battleLost)
        {
            state = GameState.Cutscene;
            StartCoroutine(trainer.TriggerTrainerBattle(playerController));
        }
        else
        {
            trainer.BattleLost();
        }
    }
Exemple #4
0
    public void StartTrainerBattle(PokemonParty playerParty, PokemonParty trainerParty)
    {
        this.playerParty  = playerParty;
        this.trainerParty = trainerParty;

        isTrainerBattle = true;
        player          = playerParty.GetComponent <PlayerController>();
        trainer         = trainerParty.GetComponent <TrainerController>();

        StartCoroutine(SetupBattle());
    }
    public void StartTrainerBattle(TrainerController trainer)
    {
        state = GameState.Battle;
        battleSystem.gameObject.SetActive(true);
        worldCamera.gameObject.SetActive(false);

        this.trainer = trainer;
        var playerParty  = playerController.GetComponent <PokemonParty>();
        var trainerParty = trainer.GetComponent <PokemonParty>();

        battleSystem.StartTrainerBattle(playerParty, trainerParty);
    }
Exemple #6
0
    //Here the UI for the end of the battle (or beginning of the game) gets setup
    void EndBattle(bool won)
    {
        if (trainer != null && won == true)
        {
            trainer.BattleLost();
            trainer = null;
        }

        state = GameState.FreeRoam;
        battleSystem.gameObject.SetActive(false);
        worldCamera.gameObject.SetActive(true);
    }
Exemple #7
0
        public TrainerPage(
            TrainerController trainerCtrl,
            DataFilesStorageController dataFilesStorageCtrl,
            ModelFilesStorageController modelFilesStorageCtrl,
            PDataFilesStorageController pDataFilesStorageCtrl)
        {
            DataFilesStorageCtrl  = dataFilesStorageCtrl ?? throw new ArgumentNullException();
            ModelFilesStorageCtrl = modelFilesStorageCtrl ?? throw new ArgumentNullException();
            PDataFilesStorageCtrl = pDataFilesStorageCtrl ?? throw new ArgumentNullException();
            TrainerCtrl           = trainerCtrl ?? throw new ArgumentNullException();

            InitializeComponent();
        }
Exemple #8
0
    TrainerController trainer; //Reference the trainer

    public void StartTrainerBattle(TrainerController trainer)
    {
        state = GameState.Battle;
        battleSystem.gameObject.SetActive(true);
        worldCamera.gameObject.SetActive(false);

        this.trainer = trainer;                                            //Set THIS specific trainer as our reference

        var playerParty  = playerController.GetComponent <PokemonParty>(); //Store our party in a var
        var trainerParty = trainer.GetComponent <PokemonParty>();          //Store the trainer party in a var

        battleSystem.StartTrainerBattle(playerParty, trainerParty);        //Call our StartBattle, so every fight are not the same
    }
Exemple #9
0
    public void StartTrainerBattle(PokemonParty playerParty, PokemonParty trainerParty) //Beggin the trainer battle
    {
        this.playerParty  = playerParty;                                                //this. is to use the variable and not the parameter
        this.trainerParty = trainerParty;

        spriteRenderer = GetComponent <SpriteRenderer>();

        isTrainerBattle = true;
        player          = playerParty.GetComponent <PlayerController>();   //Set a reference the player party
        trainer         = trainerParty.GetComponent <TrainerController>(); //Same with trainer

        StartCoroutine(SetupBattle());                                     //We call our SetupBattle function
    }
    void EndBattle(bool won)
    {
        if (trainer != null && won == true)
        {
            trainer.BattleLost();
            trainer = null;
        }

        BattleMusic.Stop();
        state = GameState.FreeRoam;
        battleSystem.gameObject.SetActive(false);
        worldCamera.gameObject.SetActive(true);
        playerController.Velocity = 10;
    }
Exemple #11
0
    public void StartTrainerBattle(CreatureTeam playerteam, CreatureTeam trainerTeam)
    {
        //wierd use of the same name just to make it work in script
        this.playerteam  = playerteam;
        this.trainerteam = trainerTeam;
        ////for trainer battle, bug fix to false
        isTrainerBattle = true;

        //player = playerteam.GetComponent<PlayerController3D>();
        player  = playerteam.GetComponent <PlayerController360>();
        trainer = trainerteam.GetComponent <TrainerController>();

        StartCoroutine(SetUpBattle());
    }
Exemple #12
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        Skills = XmlParser <Skill> .ParseXmlFromText(((TextAsset)Resources.Load("Xml/" + /*JOB*/ "GNB")).text);

        foreach (var skill in Skills)
        {
            _debugText.text = _debugText.text + System.Environment.NewLine + "skill: " + skill.Name;
        }
        _gcdValueInput.onEndEdit.AddListener(delegate { GcdValueUpdate(); });
    }
Exemple #13
0
    public void StartTrainerBattle(TrainerController trainer)
    {
        if (state != GameState.Battle) //Preventing from entering a battle when already in one.
        {
            //Player.SetActive(false);

            state = GameState.Battle;
            battleSystem.gameObject.SetActive(true);
            freeroamCam.gameObject.SetActive(false);

            //used to return the player creatures
            //var playerTeam = playerController3D.GetComponent<CreatureTeam>();
            var playerTeam  = playerController360.GetComponent <CreatureTeam>();
            var trainerTeam = trainer.GetComponent <CreatureTeam>();

            battleSystem.StartTrainerBattle(playerTeam, trainerTeam);
        }
    }
Exemple #14
0
    //Change our battle state, camera active, and gameobject of the Battle System
    void EndBattle(bool won)
    {
        if (trainer != null)
        {
            if (won)                  //If it is a trainer battle, won by the player
            {
                trainer.BattleLost(); //Disable the fov, to disable the battle
                defeatedTrainerName.Add(trainer.Name);

                trainer = null;
            }
            else //If we lose the battle
            {
                playerController.LoseBattle();
            }
        }

        state = GameState.FreeRoam;
        battleSystem.gameObject.SetActive(false);
        worldCamera.gameObject.SetActive(true);
    }
Exemple #15
0
 void Awake()
 {
     Instance = this;
 }
 public void OnEnterTrainersView(TrainerController trainer)
 {
     state = GameState.Cutscene;
     StartCoroutine(trainer.TriggerTrainerBattle(playerController));
 }