コード例 #1
0
ファイル: ClientHandle.cs プロジェクト: JasonGras/Neoky
        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);
        }
コード例 #2
0
        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
ファイル: UnitBattle.cs プロジェクト: JasonGras/Neoky
        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
ファイル: CombatManager.cs プロジェクト: JasonGras/Neoky
        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
ファイル: GameManager.cs プロジェクト: JasonGras/Neoky
        /// <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
ファイル: SignUpScript.cs プロジェクト: JasonGras/Neoky
        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
ファイル: GameManager.cs プロジェクト: JasonGras/Neoky
 /// <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
ファイル: GameManager.cs プロジェクト: JasonGras/Neoky
 void OnUseUnitBtn(int _position)
 {
     //Debug.Log("Listener Clicked " + _position);
     ClientSend.AttackPackets(_position, 1);
 }
コード例 #10
0
ファイル: UIManager.cs プロジェクト: JasonGras/Neoky
 public void EnterDungeon()
 {
     ClientSend.EnterDungeon("instance_01_name");
 }
コード例 #11
0
ファイル: UIManager.cs プロジェクト: JasonGras/Neoky
 public void ShowLootPage()
 {
     ClientSend.SwitchScene(Constants.SCENE_LOOTS);
 }
コード例 #12
0
ファイル: UIManager.cs プロジェクト: JasonGras/Neoky
 public void ShowHomePage()
 {
     ClientSend.SwitchScene(Constants.SCENE_HOMEPAGE);
 }
コード例 #13
0
ファイル: UIManager.cs プロジェクト: JasonGras/Neoky
 public void ShowCollection()
 {
     ClientSend.UpdatePlayerCollection();
 }