コード例 #1
0
ファイル: WearableItemsShould.cs プロジェクト: yemel/explorer
        protected override IEnumerator SetUp()
        {
            yield return(SetUp_SceneController());

            yield return(SetUp_CharacterController());

            if (avatarShape == null)
            {
                avatarModel = new AvatarModel()
                {
                    name      = " test",
                    hairColor = Color.white,
                    eyeColor  = Color.white,
                    skinColor = Color.white,
                    bodyShape = WearableLiterals.BodyShapes.FEMALE,
                    wearables = new List <string>()
                    {
                    }
                };
                catalog     = AvatarTestHelpers.CreateTestCatalogLocal();
                avatarShape = AvatarTestHelpers.CreateAvatarShape(scene, avatarModel);

                yield return(new DCL.WaitUntil(() => avatarShape.everythingIsLoaded, 20));
            }
        }
コード例 #2
0
        private void OnAvatarShapeUpdated(DecentralandEntity entity, AvatarShape avatarShape)
        {
            if (rootEntity != entity)
            {
                return;
            }

            OnShapeUpdated(rootEntity);
        }
コード例 #3
0
        public static AvatarShape CreateAvatarShape(ParcelScene scene, AvatarModel model)
        {
            GLTFSceneImporter.budgetPerFrameInMilliseconds = float.MaxValue;
            DecentralandEntity entity = TestHelpers.CreateSceneEntity(scene);
            AvatarShape        shape  = TestHelpers.EntityComponentCreate <AvatarShape, AvatarModel>(scene, entity, model, CLASS_ID_COMPONENT.AVATAR_SHAPE);

            TestHelpers.SetEntityTransform(scene, entity, new Vector3(0, 0, 0), Quaternion.identity, Vector3.one);
            return(shape);
        }
コード例 #4
0
        public IEnumerator MaterialsSetCorrectly()
        {
            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            AvatarShape avatar = AvatarShapeTestHelpers.CreateAvatarShape(scene, "Joan Darteis", "TestAvatar.json");

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            AssertMaterialsAreCorrect(avatar.transform);
        }
コード例 #5
0
ファイル: DCLBuilderEntity.cs プロジェクト: useit015/explorer
        private void OnAvatarShapeUpdated(IDCLEntity entity, AvatarShape avatarShape)
        {
            if (rootEntity != entity)
            {
                return;
            }

            OnShapeUpdated(rootEntity);
        }
コード例 #6
0
    public override void ApplyModifier(GameObject avatar)
    {
        AvatarShape avatarShape = avatar.GetComponent <AvatarShape>();

        if (avatarShape != null)
        {
            avatarShape.DisablePassport();
        }
    }
コード例 #7
0
ファイル: AvatarShapeTests.cs プロジェクト: menduz/explorer
        public IEnumerator NameBackgroundHasCorrectSize()
        {
            AvatarTestHelpers.CreateTestCatalog();
            AvatarShape avatar = AvatarTestHelpers.CreateAvatarShape(scene, "Maiqel Yacson", "TestAvatar.json");

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            avatar.transform.position = new Vector3(13, 0, 4);

            RectTransform rt = avatar.avatarName.uiContainer.GetComponent <RectTransform>();

            Assert.IsTrue((int)Mathf.Abs(rt.sizeDelta.x) == 190 && (int)Mathf.Abs(rt.sizeDelta.y) == 40, $"Avatar name dimensions are incorrect!. Current: {rt.sizeDelta}");
        }
コード例 #8
0
        public IEnumerator WhenTwoAvatarsLoadAtTheSameTimeTheyHaveProperMaterials()
        {
            //NOTE(Brian): Avatars must be equal to share their meshes.
            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            AvatarShape avatar  = AvatarShapeTestHelpers.CreateAvatarShape(scene, "Naicholas Keig", "TestAvatar.json");
            AvatarShape avatar2 = AvatarShapeTestHelpers.CreateAvatarShape(scene, "Naicholas Keig", "TestAvatar2.json");

            avatar.transform.position  = new Vector3(-5, 0, 0);
            avatar2.transform.position = new Vector3(5, 0, 0);

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded && avatar2.everythingIsLoaded, 25));

            AssertMaterialsAreCorrect(avatar.transform);
            AssertMaterialsAreCorrect(avatar2.transform);
        }
コード例 #9
0
        public IEnumerator DestroyWhileLoading()
        {
            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            AvatarShape avatar = AvatarShapeTestHelpers.CreateAvatarShape(scene, "Abortit", "TestAvatar.json");

            GameObject goEntity = avatar.entity.gameObject;

            TestHelpers.RemoveSceneEntity(scene, avatar.entity);

            yield return(null);

            bool destroyedOrPooled = goEntity == null || !goEntity.activeSelf;

            Assert.IsTrue(destroyedOrPooled);
        }
コード例 #10
0
ファイル: BaseNote.cs プロジェクト: 5l1v3r1/TumblrSharp
		/// <inheritdoc/>
		public override int GetHashCode()
		{
			var hashCode = 1122491329;
			hashCode = hashCode * -1521134295 + Type.GetHashCode();
			hashCode = hashCode * -1521134295 + Timestamp.GetHashCode();
			hashCode = hashCode * -1521134295 + BlogName.GetHashCode();
			hashCode = hashCode * -1521134295 + BlogUuid.GetHashCode();
			hashCode = hashCode * -1521134295 + BlogUrl.GetHashCode();
			hashCode = hashCode * -1521134295 + Followed.GetHashCode();
			hashCode = hashCode * -1521134295 + AvatarShape.GetHashCode();
			hashCode = hashCode * -1521134295 + ReplyText.GetHashCode();
			hashCode = hashCode * -1521134295 + PostId.GetHashCode();
			hashCode = hashCode * -1521134295 + ReblogParentBlogName.GetHashCode();
			return hashCode;
		}
コード例 #11
0
        public IEnumerator AvatarShapeVisualTest2()
        {
            yield return(InitVisualTestsScene("AvatarShape_B"));

            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            AvatarShape avatar = AvatarShapeTestHelpers.CreateAvatarShape(scene, "Avatar #2", "TestAvatar2.json");

            Vector3 camPos    = new Vector3(-0.75f, 2.0f, 2.25f);
            Vector3 camTarget = avatar.transform.position + Vector3.up * 2.0f;

            VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            yield return(VisualTestHelpers.TakeSnapshot());
        }
コード例 #12
0
        public IEnumerator MouthWithMask()
        {
            yield return(InitVisualTestsScene("AvatarShapeVisualTests_MouthWithMask"));

            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            var         model  = AvatarShapeTestHelpers.GetTestAvatarModel("Avatar #1", "TestAvatar_MaskMouth.json");
            AvatarShape avatar = AvatarShapeTestHelpers.CreateAvatarShape(scene, model);

            Vector3 camPos    = new Vector3(-0.75f, 2.0f, 2.25f);
            Vector3 camTarget = avatar.transform.position + Vector3.up * 2.0f;

            VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);

            yield return(new WaitUntil(() => avatar.everythingIsLoaded, 20));

            yield return(VisualTestHelpers.TakeSnapshot());
        }
コード例 #13
0
ファイル: Avatar.cs プロジェクト: xuxudefeng/ConnectAppCN
 Avatar(
     string id,
     string avatarUrl,
     string fullName,
     float size              = 36,
     OwnerType type          = OwnerType.user,
     bool hasWhiteBorder     = false,
     float whiteBorderWidth  = DefaultWhiteBorderWidth,
     AvatarShape avatarShape = AvatarShape.circle,
     Key key = null
     ) : base(key: key)
 {
     this.id               = id ?? "";
     this.avatarUrl        = avatarUrl ?? "";
     this.fullName         = fullName ?? "";
     this.size             = size;
     this.type             = type;
     this.hasWhiteBorder   = hasWhiteBorder;
     this.whiteBorderWidth = whiteBorderWidth;
     this.avatarShape      = avatarShape;
 }
コード例 #14
0
ファイル: Avatar.cs プロジェクト: xuxudefeng/ConnectAppCN
 public static Avatar User(
     User user,
     float size,
     bool hasWhiteBorder     = false,
     float whiteBorderWidth  = DefaultWhiteBorderWidth,
     AvatarShape avatarShape = AvatarShape.circle,
     Key key = null
     )
 {
     return(new Avatar(
                id: user.id,
                avatarUrl: user.avatar,
                user.fullName ?? user.name,
                size: size,
                type: OwnerType.user,
                hasWhiteBorder: hasWhiteBorder,
                whiteBorderWidth: whiteBorderWidth,
                avatarShape: avatarShape,
                key: key
                ));
 }
コード例 #15
0
ファイル: Avatar.cs プロジェクト: xuxudefeng/ConnectAppCN
 public static Avatar Team(
     Team team,
     float size,
     bool hasWhiteBorder     = false,
     float whiteBorderWidth  = DefaultWhiteBorderWidth,
     AvatarShape avatarShape = AvatarShape.rect,
     Key key = null
     )
 {
     return(new Avatar(
                id: team.id,
                avatarUrl: team.avatar,
                fullName: team.name,
                size: size,
                type: OwnerType.team,
                hasWhiteBorder: hasWhiteBorder,
                whiteBorderWidth: whiteBorderWidth,
                avatarShape: avatarShape,
                key: key
                ));
 }
コード例 #16
0
ファイル: TrailTheme.cs プロジェクト: 5l1v3r1/TumblrSharp
        /// <summary>
        /// return a hash code
        /// </summary>
        /// <returns>hashcode as <see cref="int" /></returns>
        public override int GetHashCode()
        {
            var hashCode = -2087474320;

            hashCode = hashCode * -1521134295 + HeaderFullWidth.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderFullHeight.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderFocusWidth.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderFocusHeight.GetHashCode();
            hashCode = hashCode * -1521134295 + AvatarShape.GetHashCode();
#if NETSTANDARD2_0
            hashCode = hashCode * -1521134295 + BackgroundColor.GetHashCode();
#else
            hashCode = hashCode * -1521134295 + BackgroundColor.GetHashCode();
#endif
            hashCode = hashCode * -1521134295 + BodyFont.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderBounds.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderImage.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderImageFocused.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderImageScaled.GetHashCode();
            hashCode = hashCode * -1521134295 + HeaderStretch.GetHashCode();
#if NETSTANDARD2_0
            hashCode = hashCode * -1521134295 + LinkColor.GetHashCode();
#else
            hashCode = hashCode * -1521134295 + LinkColor.GetHashCode();
#endif
            hashCode = hashCode * -1521134295 + ShowAvatar.GetHashCode();
            hashCode = hashCode * -1521134295 + ShowDescription.GetHashCode();
            hashCode = hashCode * -1521134295 + ShowHeaderImage.GetHashCode();
            hashCode = hashCode * -1521134295 + ShowTitle.GetHashCode();
#if NETSTANDARD2_0
            hashCode = hashCode * -1521134295 + TitleColor.GetHashCode();
#else
            hashCode = hashCode * -1521134295 + TitleColor.GetHashCode();
#endif
            hashCode = hashCode * -1521134295 + TitleFont.GetHashCode();
            hashCode = hashCode * -1521134295 + TitleFontWeight.GetHashCode();
            return(hashCode);
        }
コード例 #17
0
        public IEnumerator InterpolatePosition()
        {
            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            AvatarShape avatar = AvatarShapeTestHelpers.CreateAvatarShape(scene, "Abortitus", "TestAvatar.json");

            // We must wait for the AvatarShape to finish or the OnTransformChanged event is not used
            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            Assert.AreEqual(0f, avatar.entity.gameObject.transform.position.x);
            Assert.AreEqual(0f, avatar.entity.gameObject.transform.position.z);

            // Update position to the other end of the parcel
            var transformModel = new DCLTransform.Model {
                position = new Vector3(15, 2, 15)
            };

            TestHelpers.SetEntityTransform(scene, avatar.entity, transformModel);

            yield return(null);

            Assert.AreNotEqual(15f, avatar.entity.gameObject.transform.position.x);
            Assert.AreNotEqual(15f, avatar.entity.gameObject.transform.position.z);
        }