Пример #1
0
        public static void Welcome(Packet _packet)
        {
            string _msg  = _packet.ReadString();
            int    _myId = _packet.ReadInt();

            Debug.Log($"Message from server: {_msg}");
            Client.instance.myId = _myId;
            ClientSend.WelcomeReceived();

            // Now that we have the client's id, connect UDP
            Client.instance.udp.Connect(((IPEndPoint)Client.instance.tcp.socket.Client.LocalEndPoint).Port);
        }
        public void SubmitForgotPasswordRequest()
        {
            if (CheckUserPattern(username.text))
            {
                RedefinePwdBtn.enabled = false;
                if (errorImageBG.gameObject.activeSelf)
                {
                    errorImageBG.gameObject.SetActive(false);
                }
                errorMessage.text = "";
                Debug.Log("ForgotPasswordRequest sent with my Data : " + username.text);

                // Ask server to redefine PWD
                ClientSend.ForgotPasswordRequest(username.text);
                //GameManager.instance.SwitchToScene(Constants.SCENE_FORGOT_PASSWORD, Constants.SCENE_FORGOT_PASSWORD_REQUEST);
            }
        }
Пример #3
0
        public void PlayerSpellBuff(string SpellID, int _TargetPosition, int UnitAttackingID) // Action onAttackComplete
        {
            CurrentUnitID = UnitAttackingID;

            GameManager.IAUnitCrew.TryGetValue(_TargetPosition, out _IAUnitGameObject);

            //Vector3 slideTargetPosition = _IAUnitGameObject.InstantiatedUnit.transform.position + (transform.parent.position - _IAUnitGameObject.InstantiatedUnit.transform.position).normalized * 1f; // Offset
            //Vector3 startingPosition = transform.parent.position;

            PlayAnimAttack(SpellID, () => {
                // Slide back completed, back to idle
                state = State.Idle;
                anim.SetBool(SpellID, false);
                Debug.Log("Send Player TurnOverPacket");
                ClientSend.TurnOverPacket(CurrentUnitID, "PLAYER_TURN_OVER");
            });
        }
Пример #4
0
        public float distFromCam = 10; //distance of the emitter from the camera

        private void Start()
        {
            UnloadMenuScene();
            DisableClickParticleSystem();
            //Send the server We are Ready on Our Scene
            state = BattleState.INIT_FIGHT;
            ClientSend.FightPackets("INIT_FIGHT");
            // => Init your player Crew and Enemy Crew
            // => Fight CountDown
            // => Fight Begin !

            // Exchange de Coups !
            // => Client Send AttackToServer
            //
            // Atq / Def / Brise G

            // HP = 0 pour un parti
            // Fight Over
            // Reward the Winner / Back Home
        }
Пример #5
0
        /// <summary>Spawns All player Crew</summary>
        /// <param name="_id">The player's ID.</param>
        /// <param name="_name">The member crew ID.</param>
        public void SpawnAllPlayerMemberCrew(Dictionary <int, Unit> _playerAllCrew)
        {
            PlayerUnitCrew = new Dictionary <int, Unit>();
            PlayerUnitCrew = _playerAllCrew;

            isSpawned_playerCrew = false;
            foreach (var _crewUnit in _playerAllCrew)
            {
                // On PlayeCollectionUnit find the MemberCrewPrefab using _memberCrewPrefab Name
                Debug.Log("Find Prefab in PlayerCollectionList");

                //GameObject unitCrewPrefab = PlayerCollectionList.Where<GameObject>(x => x.name == _crewUnit.Value.collection_prefab).SingleOrDefault();

                if (_crewUnit.Value.local_Collection_prefab != null)
                {
                    Transform Spawn = GameObject.Find("Spawn_Player_" + _crewUnit.Key.ToString()).transform;
                    // Create Player Prefab
                    Debug.Log("Instantiate Crew Prefab");
                    GameObject CrewMember = Instantiate(_crewUnit.Value.local_Collection_prefab, Spawn);
                    CrewMember.transform.parent = Spawn; // Set the Member Spawn on the Spawn_X position
                                                         //CrewMember.transform.localPosition = new Vector3(0, 0, 0);
                                                         // Initialize Player
                    CrewMember.GetComponent <CrewMembers>().Initialize(_crewUnit.Key, _crewUnit.Value.UnitName, _crewUnit.Value.UnitHP);

                    // Add player to a List of Players
                    Debug.Log("CrewMember added to PlayerCrew");
                    _crewUnit.Value.InstantiatedUnit = CrewMember;
                    //PlayerObjCrew.Add(_crewUnit.Key, CrewMember);
                }
                else
                {
                    Debug.Log("You forgot to Add the Prefab of the Unit on the GameManager Size on the UnloadScene");
                }
            }
            isSpawned_playerCrew = true;
            if (isSpawned_IACrew)
            {
                ClientSend.SendFightReady();
            }
        }
Пример #6
0
        public void SignUpToCognito()
        {
            if (CheckUserPattern(username.text))
            {
                if (CheckPasswordPattern(password.text))
                {
                    if (CheckConfirmedPasswordPattern(confirmedPassword.text))
                    {
                        if (CheckEmailPattern(email.text))
                        {
                            signUpBtn.enabled = false;
                            if (errorImageBG.gameObject.activeSelf)
                            {
                                errorImageBG.gameObject.SetActive(false);
                            }
                            errorMessage.text = "";
                            string response = ClientSend.SignUpToCognito(username.text, password.text, email.text);//.SwitchScene(Constants.SCENE_HOMEPAGE);

                            // Gestion des erreur au niveau de l'envoi du SignUp
                            switch (response)
                            {
                            case "SIGN_UP_SEND_OK":
                                SignUpFinalised();
                                break;

                            case "SIGN_UP_SEND_KO":
                                SignUpShowError(Constants.signup_failed_lbl);
                                break;

                            default:
                                SignUpShowError(Constants.technical_error_lbl);
                                break;
                            }
                        }
                    }
                }
            }
        }
Пример #7
0
 public void SubmitRedefinedPassword()
 {
     if (CheckUserPattern(username.text))
     {
         if (CheckPasswordPattern(currentPassword.text))
         {
             if (CheckPasswordPattern(newPassword.text))
             {
                 if (CheckConfirmedNewPasswordPattern(confirmedNewPassword.text))
                 {
                     RedefinePwdBtn.enabled = false;
                     if (errorImageBG.gameObject.activeSelf)
                     {
                         errorImageBG.gameObject.SetActive(false);
                     }
                     errorMessage.text = "";
                     Debug.Log("RedefinedUserPassword sent with my Data : " + username.text + " | " + currentPassword.text + " | " + newPassword.text);
                     ClientSend.RedefinedUserPassword(username.text, currentPassword.text, newPassword.text);//.SwitchScene(Constants.SCENE_HOMEPAGE);
                 }
             }
         }
     }
 }
Пример #8
0
 /// <summary>Spawns All player Crew</summary>
 /// <param name="_id">The player's ID.</param>
 /// <param name="_name">The member crew ID.</param>
 public void UpdateAllPlayerUnits(Dictionary <Unit, Dictionary <string, int> > _allPlayerUnits)
 {
     AllPlayerUnits = _allPlayerUnits;
     ClientSend.SwitchScene(Constants.SCENE_COLLECTION);
 }
Пример #9
0
 void OnUseUnitBtn(int _position)
 {
     //Debug.Log("Listener Clicked " + _position);
     ClientSend.AttackPackets(_position, 1);
 }
Пример #10
0
 public void EnterDungeon()
 {
     ClientSend.EnterDungeon("instance_01_name");
 }
Пример #11
0
 public void ShowLootPage()
 {
     ClientSend.SwitchScene(Constants.SCENE_LOOTS);
 }
Пример #12
0
 public void ShowHomePage()
 {
     ClientSend.SwitchScene(Constants.SCENE_HOMEPAGE);
 }
Пример #13
0
 public void ShowCollection()
 {
     ClientSend.UpdatePlayerCollection();
 }