/// <summary>
        /// Applies the avatar part configuration for a specific part controller
        /// </summary>
        /// <param name="partController">The part controller to which the properties should be applied</param>
        /// <param name="partName">The name of the part (used in the hastable keys)</param>
        private void ApplyCustomProperty(AvatarPartConfigurationController partController, string partName)
        {
            partController.ModelIndex    = PlayerPropertyUtilities.GetValueOrDefault <byte>(photonView.Owner.CustomProperties, partName + modelKeySuffix, 0);
            partController.MaterialIndex = PlayerPropertyUtilities.GetValueOrDefault <byte>(photonView.Owner.CustomProperties, partName + materialKeySuffix, 0);
            partController.ColorIndex    = PlayerPropertyUtilities.GetValueOrDefault <byte>(photonView.Owner.CustomProperties, partName + colorKeySuffix, 0);

            partController.ApplyConfiguration();
        }
        private void ColorItemSelected(object sender, EventArgs e)
        {
            EnsureAvatarConfigController();
            AvatarPartConfigurationController selectedPartController = GetSelectedController();

            selectedPartController.ColorIndex = colorSelector.SelectedIndex;
            selectedPartController.ApplyConfiguration();

            PlayerPropertyUtilities.SetProperty(
                avatarConfigurationController.AvatarPartControllers[categoryToggles.CurrentIndex].Name + "Color",
                (byte)colorSelector.SelectedIndex);
        }
Beispiel #3
0
 public override void OnPlayerPropertiesUpdate(Player target, ExitGames.Client.Photon.Hashtable changedProps)
 {
     if (photonView == null || !PhotonNetwork.IsConnected)
     {
         idCardController.UserRole = UserManager.Instance.UserRole;
     }
     else if (PhotonNetwork.IsConnected && target == photonView.Owner)
     {
         byte      roleIndex = PlayerPropertyUtilities.GetValueOrDefault <byte>(target.CustomProperties, roleKey, 2); // defaults to "developer" if key not found
         UserRoles role      = (UserRoles)roleIndex;
         idCardController.UserRole = role;
     }
 }
Beispiel #4
0
 private void Start()
 {
     // no photonView found => must be a local instance, e.g. in the avatar configurator
     if (photonView == null)
     {
         UserManager.Instance.UserRoleChanged += OnLocalUserRoleChanged;
         idCardController.UserRole             = UserManager.Instance.UserRole;
     }
     else
     {
         idCardController.UserRole = (UserRoles)PlayerPropertyUtilities.GetValueOrDefault <byte>(photonView.Owner.CustomProperties, roleKey, 2);
     }
 }
        private void MaterialItemSelected(object sender, EventArgs e)
        {
            EnsureAvatarConfigController();
            AvatarPartConfigurationController selectedPartController = GetSelectedController();

            selectedPartController.MaterialIndex = materialSelector.SelectedIndex;
            selectedPartController.ApplyConfiguration();

            PlayerPropertyUtilities.SetProperty(
                avatarConfigurationController.AvatarPartControllers[categoryToggles.CurrentIndex].Name + "Material",
                (byte)materialSelector.SelectedIndex);

            UpdateColorChooser(selectedPartController);
        }
        private void ModelItemSelected(object sender, EventArgs e)
        {
            EnsureAvatarConfigController();
            AvatarPartConfigurationController selectedPartController = GetSelectedController();

            selectedPartController.ModelIndex = modelSelector.SelectedIndex;
            selectedPartController.ApplyConfiguration();

            PlayerPropertyUtilities.SetProperty(
                avatarConfigurationController.AvatarPartControllers[categoryToggles.CurrentIndex].Name + AvatarAppearanceSynchronizer.modelKeySuffix,
                (byte)selectedPartController.ModelIndex);
            PlayerPropertyUtilities.SetProperty(
                avatarConfigurationController.AvatarPartControllers[categoryToggles.CurrentIndex].Name + AvatarAppearanceSynchronizer.materialKeySuffix,
                (byte)selectedPartController.MaterialIndex);
            PlayerPropertyUtilities.SetProperty(
                avatarConfigurationController.AvatarPartControllers[categoryToggles.CurrentIndex].Name + AvatarAppearanceSynchronizer.colorKeySuffix,
                (byte)selectedPartController.ColorIndex);


            UpdateMaterialChooser(selectedPartController);
        }