예제 #1
0
        public bool AddNewUser(string _username,
                               string _password,
                               string _email,
                               string _faction,
                               string _selectedUma)
        {
            //Clones the UserInformations prefab
            UserInformations newUserInfos = Instantiate <UserInformations>(UserInfos);

            //Initializes the new user
            newUserInfos.SetUserInformations(_username,
                                             _password,
                                             _email,
                                             _faction,
                                             _selectedUma);

            //Adds the new user to the list
            if (registeredUsers.Add(newUserInfos))
            {
                //Makes the new object not destroyable through scenes switching
                DontDestroyOnLoad(newUserInfos);

                //Adds the new object to the User contaner hieararchy
                newUserInfos.transform.parent = this.transform;
            }
            else //The user already exists, destroy the last created
            {
                Destroy(newUserInfos.gameObject);
                return(false);
            }

            return(true);
        }
예제 #2
0
 protected void UpdateAvatorAttributes(DestinationController _destinationController)
 {
     DestinationControllerReference = _destinationController;
     gameObject.name            = _destinationController.gameObject.name + " avator - " + networkObject.NetworkId;
     SelectedUma                = _destinationController.SelectedUma;
     CharacterController.center = new Vector3(0, 1.0f, 0);
     CurrentUserInfo            = _destinationController.CurrentUserInformations;
     DestinationTransform       = _destinationController.gameObject.GetComponent <Transform>();
     CameraOnDestination        = _destinationController.DestinationCamera;
     _destinationController.AvatorController = this;
     GameEntityRegister = _destinationController.GameEntityRegister;
 }
예제 #3
0
        public override bool Equals(System.Object obj)
        {
            // Check for null values and compare run-time types.
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            UserInformations p = (UserInformations)obj;

            return(username.Equals(p.username) &&
                   password.Equals(p.password));
            //email.Equals(p.email) &&
            //faction.Equals(p.faction) &&
            //selectedUma.Equals(p.selectedUma);
        }
        //Sets up values for the destination controller based on isGiantMode value
        protected void UpdateDestinationAttributes(Vector3 _cameraPosition,
                                                   Quaternion _cameraRotation,
                                                   float _cursorSpeed,
                                                   Vector3 _cursorDimensions,
                                                   UserInformations _currentUserInformations,
                                                   Color _cursorColor)
        {
            //Init base attributes
            UpdateDestinationAttributes(_currentUserInformations.username,
                                        _currentUserInformations.selectedUma,
                                        _cursorColor,
                                        _cursorDimensions);

            //Sets up the camera attributes
            DestinationCamera.gameObject.GetComponent <Transform>().position = _cameraPosition;
            DestinationCamera.gameObject.GetComponent <Transform>().rotation = _cameraRotation;

            //Sets up cursor attributes
            networkObject.destCursorSpeed = _cursorSpeed;
            networkObject.destCursorDims  = _cursorDimensions;
        }
예제 #5
0
        public bool InitializePlayerEntity(AvatorController _avatorControllerReference,
                                           UserInformations _user,
                                           Camera _cameraOnDestination)
        {
            //Updates attributes of this GameObject
            UpdatePlayerEntityAttributes(_avatorControllerReference);

            //I'm sorry Demetra
            var destinationOwnerNetId = AvatorControllerReference.
                                        DestinationControllerReference.
                                        networkObject.NetworkId;

            //Updates attributes of this networkObject
            UpdatePlayerEntityNetworkAttributes(destinationOwnerNetId,
                                                _user.username,
                                                _user.password,
                                                _user.email,
                                                _user.faction,
                                                _user.selectedUma);

            //When the avator controller is destroyed, destroy also the player entity
            AvatorControllerReference.networkObject.onDestroy += NetworkObject_onDestroy;

            //Create the Game UI Controller Entity in the network
            var gameUiNetworkController = NetworkManager.Instance.InstantiateGameUINetworkEntity(0, transform.position);

            gameUiNetworkController.networkStarted += GameUiNetworkController_networkStarted;

            networkObject.SendRpc(RPC_UPDATE_PLAYER_ENTITY,
                                  Receivers.AllBuffered,
                                  _user.username,
                                  _user.password,
                                  _user.email,
                                  _user.faction,
                                  _user.selectedUma);

            return(true);
        }
예제 #6
0
        public UserInformations GetUserByUsernameAndPassword(string _username, string _password)
        {
            UserInformations isFound = registeredUsers.FirstOrDefault(x => x.username.Equals(_username) && x.password.Equals(_password));

            return(!ReferenceEquals(isFound, null) ? (UserInfos = isFound) : isFound);
        }