Esempio n. 1
0
 public static void CreatePlayer(int age, PlayerGender gender, int avatarID, PlayerTint color)
 {
     Debug.Log(string.Format("Will create player of age {0}, gender {1}, avatarID {2}, color {3}", age, gender, avatarID, color));
     AppManager.I.PlayerProfileManager.CreatePlayerProfile(age, gender, avatarID, color);
     LogManager.I.LogInfo(InfoEvent.AppPlay, JsonUtility.ToJson(new DeviceInfo()));
     AppManager.I.NavigationManager.GoToNextScene();
 }
Esempio n. 2
0
        /// <summary>
        /// Charge this with PlayerProfileData.
        /// </summary>
        public PlayerProfile FromData(PlayerProfileData _data)
        {
            Uuid = _data.Uuid;

            AvatarId                       = _data.AvatarId;
            Age                            = _data.Age;
            Gender                         = _data.Gender;
            Tint                           = _data.Tint;
            IsDemoUser                     = _data.IsDemoUser;
            HasFinishedTheGame             = _data.JourneyCompleted;
            HasFinishedTheGameWithAllStars = _data.HasFinishedTheGameWithAllStars();
            ProfileCompletion              = _data.ProfileCompletion;
            TotalNumberOfBones             = _data.TotalBones;

            HasMaxStarsInCurrentPlaySessions = _data.GetAdditionalData().HasMaxStarsInCurrentPlaySessions;
            ConsecutivePlayDays = _data.GetAdditionalData().ConsecutivePlayDays;
            CurrentShopState    = AnturaSpace.ShopState.CreateFromJson(_data.GetAdditionalData().CurrentShopStateJSON);
            FirstContactState   = JsonUtility.FromJson <FirstContactState>(_data.FirstContactStateJSON);

            SetCurrentJourneyPosition(_data.GetCurrentJourneyPosition(), false);
            SetMaxJourneyPosition(_data.GetMaxJourneyPosition(), false);
            // Antura customization save only customization data
            jsonAnturaCustomizationData = _data.CurrentAnturaCustomization;

            return(this);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates the player profile.
        /// </summary>
        /// <param name="age">The age.</param>
        /// <param name="gender">The gender.</param>
        /// <param name="avatarID">The avatar identifier.</param>
        /// <param name="tint">The color.</param>
        /// <returns></returns>
        public string CreatePlayerProfile(int age, PlayerGender gender, int avatarID, PlayerTint tint, bool isDemoUser = false)
        {
            PlayerProfile returnProfile = new PlayerProfile();

            // Data
            returnProfile.Uuid              = System.Guid.NewGuid().ToString();
            returnProfile.Age               = age;
            returnProfile.Gender            = gender;
            returnProfile.AvatarId          = avatarID;
            returnProfile.Tint              = tint;
            returnProfile.IsDemoUser        = isDemoUser;
            returnProfile.ProfileCompletion =
                isDemoUser ? ProfileCompletionState.GameCompletedAndFinalShown : ProfileCompletionState.New;
            returnProfile.GiftInitialBones();

            // DB Creation
            AppManager.I.DB.CreateDatabaseForPlayer(returnProfile.ToData());
            // Added to list
            AppManager.I.AppSettings.SavedPlayers.Add(returnProfile.GetPlayerIconData());
            // Set player profile as current player
            AppManager.I.PlayerProfileManager.CurrentPlayer = returnProfile;
            // Unlock the first Antura rewards
            AppManager.I.RewardSystemManager.UnlockFirstSetOfRewards();

            // Call Event Profile creation
            if (OnNewProfileCreated != null)
            {
                OnNewProfileCreated();
            }

            AppManager.I.Services.Analytics.TrackCompletedRegistration(returnProfile);

            return(returnProfile.Uuid);
        }
Esempio n. 4
0
        /// <summary> Select female as character </summary>
        private void SelectFemale()
        {
            if (isAnimating)
            {
                return;
            }

            if (!choiceConfirmed)
            {
                //If female is already selected, confirm choice
                if (genderChoice == PlayerGender.Female)
                {
                    choiceConfirmed = true;
                    DeactivateButtons();
                    ConfirmChoice(genderChoice);
                }
                else  // Activate female && Deactivate male
                {
                    //Set sprite sizes
                    StartCoroutine(SelectFemaleAnimation());
                    //Change selection images
                    maleArrow.enabled      = true;
                    maleSelected.enabled   = false;
                    femaleArrow.enabled    = false;
                    femaleSelected.enabled = true;
                    //Change active character
                    genderChoice = PlayerGender.Female;
                }

                MusicPlayer.Instance.PlaySFXSound(SFXSound.DefaultButtonClick);
            }
        }
Esempio n. 5
0
    public async void Register(string name, string email, string password, PlayerGender gender)
    {
        try
        {
            session = await client.AuthenticateEmailAsync(email, password, username : name);

            SaveGenderSelection(gender);
            EventManager.onAccountCreation.Invoke(AccountRegisterResolution.SUCCESS);
            DebugInfo.SetToast("Registration Success", "Your account has been created. Please log in with your character name.");
        }
        catch (ApiResponseException e)
        {
            if (e.Message == "Username is already in use.")
            {
                DebugInfo.SetToast("Error", e.Message);
                EventManager.onAccountCreation.Invoke(AccountRegisterResolution.FAILED);
            }
            else if (e.Message == "Invalid credentials.")
            {
                DebugInfo.SetToast("Error", "Email already in use.");
                EventManager.onAccountCreation.Invoke(AccountRegisterResolution.FAILED);
            }
            else
            {
                DebugInfo.SetToast("Error", e.Message);
                EventManager.onAccountCreation.Invoke(AccountRegisterResolution.FAILED);
            }
        }
    }
Esempio n. 6
0
    void Awake()
    {
        charGender = PlayerGender.Unspecified;

        charClass = PlayerClass.NonSelected;
        charRace = PlayerRace.NonSelected;
    }
Esempio n. 7
0
 public string GetLocalizedText(PlayerGender playerGender)
 {
     if (playerGender == PlayerGender.F && ArabicFemale != string.Empty)
     {
         return(ArabicFemale);
     }
     return(Arabic);
 }
Esempio n. 8
0
 public string GetLocalizedAudioFileName(PlayerGender playerGender)
 {
     if (playerGender == PlayerGender.F && ArabicFemale != string.Empty && AudioFile != string.Empty)
     {
         return(AudioFile + "_F");
     }
     return(AudioFile);
 }
Esempio n. 9
0
 public Player(string name, double height, int age, PlayerGender gender)
 {
     Name        = name;
     Height      = height;
     Age         = age;
     Gender      = gender;
     PlayerItems = new List <AbstractItem>();
 }
Esempio n. 10
0
 public string GetLocalizedAudioFileName(PlayerGender playerGender)
 {
     if (playerGender == PlayerGender.F && AudioKey != string.Empty)
     {
         return(AudioKey + "_F");
     }
     return(AudioKey);
 }
Esempio n. 11
0
 public string GetLearningText(PlayerGender playerGender)
 {
     if (playerGender == PlayerGender.F && LearningText_F != string.Empty)
     {
         return(LearningText_F);
     }
     return(LearningText);
 }
Esempio n. 12
0
 public static void CreatePlayer(int avatarID, PlayerGender gender, Color skinColor, Color hairColor, Color bgColor, int age)
 {
     Debug.Log(string.Format("Will create player of with avatarID {0}, skin color {1}, hair color {2}, bg color {3}, age {4}, gender {5},", avatarID, skinColor, hairColor, bgColor, age, gender));
     AppManager.I.PlayerProfileManager.CreatePlayerProfile(true, avatarID, gender, PlayerTint.None, skinColor, hairColor, bgColor, age,
                                                           AppManager.I.SpecificEdition.Edition,
                                                           AppManager.I.ParentEdition.AppVersion);
     LogManager.I.LogInfo(InfoEvent.AppPlay, JsonUtility.ToJson(new DeviceInfo()));
     AppManager.I.NavigationManager.GoToNextScene();
 }
Esempio n. 13
0
 /// <summary>
 /// 构造玩家
 /// </summary>
 /// <param name="id">玩家Id</param>
 /// <param name="name">玩家姓名</param>
 /// <param name="gender">玩家性别</param>
 /// <param name="level">玩家等级</param>
 /// <param name="physicalStrength">玩家体力</param>
 /// <param name="endurance">玩家耐力</param>
 /// <param name="combatEffectiveness">玩家战力</param>
 public Player(int id, string name, PlayerGender gender, uint level, uint physicalStrength, uint endurance, uint combatEffectiveness)
 {
     Id                  = id;
     Name                = name;
     Gender              = gender;
     Level               = level;
     PhysicalStrength    = physicalStrength;
     Endurance           = endurance;
     CombatEffectiveness = combatEffectiveness;
     UpdateFriends();
 }
Esempio n. 14
0
 void SaveGenderSelection(PlayerGender gender)
 {
     WriteStorageObject[] obj = new WriteStorageObject[]
     {
         new WriteStorageObject {
             Collection = "character",
             Key        = "base",
             Value      = "{\"Gender\":\"" + gender.ToString() + "\"}"
         }
     };
     StoreData(obj);
 }
 protected void Clear_Click(object sender, EventArgs e)
 {
     PlayerID.Text            = "";
     FirstName.Text           = "";
     LastName.Text            = "";
     PlayerAge.Text           = "";
     TeamID.SelectedIndex     = 0;
     GuardianID.SelectedIndex = 0;
     PlayerGender.ClearSelection();
     AlbertaHealthCareNumber.Text = "";
     MedicalAlerts.Text           = "";
 }
Esempio n. 16
0
 public PlayerIconData(string _Uuid, int _AvatarId, PlayerGender _Gender, PlayerTint _Tint, bool _IsDemoUser,
                       bool _HasFinishedTheGame, bool _HasFinishedTheGameWithAllStars, bool _HasMaxStarsInCurrentPlaySessions, JourneyPosition _MaxJourneyPosition)
 {
     Uuid                             = _Uuid;
     AvatarId                         = _AvatarId;
     Gender                           = _Gender;
     Tint                             = _Tint;
     IsDemoUser                       = _IsDemoUser;
     HasFinishedTheGame               = _HasFinishedTheGame;
     HasFinishedTheGameWithAllStars   = _HasFinishedTheGameWithAllStars;
     HasMaxStarsInCurrentPlaySessions = _HasMaxStarsInCurrentPlaySessions;
     MaxJourneyPosition               = _MaxJourneyPosition;
 }
Esempio n. 17
0
        /// <summary>Updates the value of this property, only set fromSaveFile flag to true when called when called after loading it from a file</summary>
        public void UpdateGender(PlayerGender newGender, bool fromSaveFile = false)
        {
            if (gender == newGender)
            {
                return;
            }

            gender = newGender;

            if (!fromSaveFile)
            {
                SaveToFile();
            }
        }
Esempio n. 18
0
        public PlayerProfileData(
            string _Uuid,
            int _AvatarId,
            PlayerGender _Gender,
            PlayerTint _Tint,
            Color _SkinColor,
            Color _HairColor,
            Color _BgColor,
            int _Age,
            bool _IsDemoUser,
            bool _HasFinishedTheGame,
            bool _HasFinishedTheGameWithAllStars,
            bool _HasMaxStarsInCurrentPlaySessions,
            int totalBones,
            ProfileCompletionState profileCompletion,
            string currentAnturaCustomization,
            int comboPlayDays,
            AnturaSpace.ShopState currentShopState,
            FirstContactState currentFirstContactState,
            AppEditions edition,
            string appVersion
            )
        {
            Id               = UNIQUE_ID; // Only one record
            AppVersion       = appVersion;
            Edition          = edition;
            Uuid             = _Uuid;
            AvatarId         = _AvatarId;
            Gender           = _Gender;
            Tint             = _Tint;
            SkinColor        = _SkinColor.ToHex();
            HairColor        = _HairColor.ToHex();
            BgColor          = _BgColor.ToHex();
            IsDemoUser       = _IsDemoUser;
            JourneyCompleted = _HasFinishedTheGame;
            TotalScore       = (_HasFinishedTheGameWithAllStars ? 1f : 0f);

            Age = _Age;
            ProfileCompletion = profileCompletion;
            TotalBones        = totalBones;
            SetMaxJourneyPosition(JourneyPosition.InitialJourneyPosition);
            SetCurrentJourneyPosition(JourneyPosition.InitialJourneyPosition);
            Timestamp = GenericHelper.GetTimestampForNow();
            CurrentAnturaCustomization = currentAnturaCustomization;
            AdditionalData             = JsonUtility.ToJson(new PlayerProfileAdditionalData(_HasMaxStarsInCurrentPlaySessions, comboPlayDays, currentShopState.ToJson()));
            FirstContactStateJSON      = JsonUtility.ToJson(currentFirstContactState);
        }
Esempio n. 19
0
        public override void OnInput(string input)
        {
            switch (currentState)
            {
            case State.EnterForename:
                if (!PlayerLogin.ValidateUsername(input))
                {
                    Session.WriteLine("Invalid username");
                    changeStateTo(State.EnterForename);
                    break;
                }

                forename = StringHelpers.Capitalize(input);
                changeStateTo(State.EnterPassword);
                break;

            case State.EnterPassword:
                password = input;
                changeStateTo(State.SelectGender);
                break;

            case State.SelectGender:
                if (input.ToLower() == "m")
                {
                    gender = PlayerGender.Male;
                    changeStateTo(State.EnterDescription);
                }
                else if (input.ToLower() == "f")
                {
                    gender = PlayerGender.Female;
                    changeStateTo(State.EnterDescription);
                }
                else
                {
                    Session.WriteLine("Invalid Gender");
                    changeStateTo(State.SelectGender);
                }
                break;

            case State.EnterShortDescription:
                shortDescription = input;
                changeStateTo(State.Finished);
                break;
            }

            base.OnInput(input);
        }
Esempio n. 20
0
    public void OnLoginButtonClicked()
    {
        string       playerName = PlayerNameInput.text;
        PlayerGender gender     = (PlayerGender)PlayerGenderDropdown.value;

        ExperimentManager.Instance.settings.Gender = gender;

        if (!playerName.Equals(""))
        {
            PhotonNetwork.LocalPlayer.NickName = playerName;
            PhotonNetwork.ConnectUsingSettings();
        }
        else
        {
            Debug.LogError("Player Name is invalid.");
        }
    }
Esempio n. 21
0
        public static string ToIfString(this PlayerGender @this, bool underscore = false)
        {
            switch (@this)
            {
            case PlayerGender.Male:
                return(underscore
                        ? MaleUnderscore
                        : Male);

            case PlayerGender.Female:
                return(underscore
                        ? FemaleUnderscore
                        : Female);

            default:
                throw new ArgumentOutOfRangeException(nameof(@this), @this, null);
            }
        }
Esempio n. 22
0
    void SpawnLocalPlayer(Vector3 position, Quaternion rotation, PlayerGender gender)
    {
        switch (gender)
        {
        case PlayerGender.MALE:
            localPlayer      = Instantiate(localMalePlayerPrefab, position, rotation);
            localPlayer.name = nakamaDataRelay.ClientId;
            break;

        case PlayerGender.FEMALE:
            localPlayer      = Instantiate(localFemalePlayerPrefab, position, rotation);
            localPlayer.name = nakamaDataRelay.ClientId;
            break;

        default:
            break;
        }
    }
Esempio n. 23
0
 public PlayerIconData(string _Uuid, int _AvatarId, PlayerTint _Tint, PlayerGender _Gender, Color _SkinColor, Color _HairColor, Color _BgColor, bool _IsDemoUser,
                       bool _HasFinishedTheGame, bool _HasFinishedTheGameWithAllStars, bool _HasMaxStarsInCurrentPlaySessions, JourneyPosition _MaxJourneyPosition, AppEditions _Edition, string _AppVersion)
 {
     Uuid                             = _Uuid;
     AvatarId                         = _AvatarId;
     SkinColor                        = _SkinColor;
     HairColor                        = _HairColor;
     BgColor                          = _BgColor;
     Gender                           = _Gender;
     Tint                             = _Tint;
     IsDemoUser                       = _IsDemoUser;
     HasFinishedTheGame               = _HasFinishedTheGame;
     HasFinishedTheGameWithAllStars   = _HasFinishedTheGameWithAllStars;
     HasMaxStarsInCurrentPlaySessions = _HasMaxStarsInCurrentPlaySessions;
     MaxJourneyPosition               = _MaxJourneyPosition;
     Edition                          = _Edition;
     AppVersion                       = _AppVersion;
     Debug.Log("CREATE PLAYER ICON DATA > " + SkinColor + " > " + HairColor);
 }
    public PlayerDataRequest(GameObject obj)
    {
        Transform t    = obj.transform;
        Animator  anim = obj.GetComponent <Animator>();

        InputHorizontal = anim.GetFloat("InputHorizontal");
        InputVertical   = anim.GetFloat("InputVertical");
        InputMagnitude  = anim.GetFloat("InputMagnitude");
        GroundDistance  = anim.GetFloat("GroundDistance");
        IsGrounded      = anim.GetBool("IsGrounded");
        IsStrafing      = anim.GetBool("IsStrafing");
        IsSprinting     = anim.GetBool("IsSprinting");

        position = t.position;
        rotation = t.rotation;
        scale    = t.localScale;

        gender = ClientPlayerHandler.localPlayerGender;
        scene  = SceneManager.GetActiveScene().name;
    }
Esempio n. 25
0
        /// <summary> Sets chosen character gender and continious to next scene. </summary>
        private void ConfirmChoice(PlayerGender gender)
        {
            switch (gender)
            {
            //set player character display sprite for dialogue
            case PlayerGender.Male:
                playerCharacter.SetDisplaySprite(MaleSprite.sprite);
                break;

            case PlayerGender.Female:
                playerCharacter.SetDisplaySprite(FemaleSprite.sprite);
                break;
            }

            MusicPlayer.Instance.PlaySFXSound(SFXSound.ConfirmChoice);
            //Use PlayerPropertyManager to update the gender value to save it
            PlayerPropertyManager.Instance.GetProperty <PlayerGenderProperty>("Gender").UpdateGender(gender);
            //Send to next scene
            SceneTransitionSystem.Instance.Transition("Fade", sceneName, LoadSceneMode.Additive);
        }
Esempio n. 26
0
    GameObject InstantiateRemotePlayer(PlayerDataResponse response)
    {
        PlayerGender gender = (PlayerGender)System.Enum.Parse(typeof(PlayerGender), response.gender);
        GameObject   rPlayer;

        switch (gender)
        {
        case PlayerGender.MALE:
            rPlayer      = Instantiate(remoteMalePlayerPrefab, response.position, response.rotation);
            rPlayer.tag  = "init_not_synced";
            rPlayer.name = response.userId;
            return(rPlayer);

        case PlayerGender.FEMALE:
            rPlayer      = Instantiate(remoteFemalePlayerPrefab, response.position, response.rotation);
            rPlayer.tag  = "init_not_synced";
            rPlayer.name = response.userId;
            return(rPlayer);

        default:
            return(null);
        }
    }
Esempio n. 27
0
 public void SetPlayerGenderFemale()
 {
     gender    = PlayerGender.FEMALE;
     genderSet = true;
     //Debug.Log("Player gender set to female.");
 }
Esempio n. 28
0
 //Player Gender Functions
 public void MaleGender() { playerGender = PlayerGender.Male; }
Esempio n. 29
0
 public void FemaleGender() { playerGender = PlayerGender.Female; }
Esempio n. 30
0
 /// <summary>
 /// Picks the player's gender.
 /// </summary>
 /// <param name="pGender">Player Gender.</param>
 void PickGender(PlayerGender pGender)
 {
     //
 }
Esempio n. 31
0
 private void SelectGender(PlayerGender _gender)
 {
     currGender = _gender;
     AppManager.I.PlayerProfileManager.TemporaryPlayerGender = currGender;
 }
Esempio n. 32
0
 public static string GetLocalizedAudioFileName(string id, PlayerGender forcedGender)
 {
     return(GetLocalizationData(id).GetLocalizedAudioFileName(forcedGender));
 }
 public void SetGenderFemale()
 {
     girlBorder.color = Color.yellow;
     boyBorder.color  = Color.gray;
     gender           = PlayerGender.FEMALE;
 }
 public void SetGenderMale()
 {
     boyBorder.color  = Color.yellow;
     girlBorder.color = Color.gray;
     gender           = PlayerGender.MALE;
 }