Example #1
0
        private void InnerStruct()
        {
            Hidden          = true;
            itemPictureDict = new Dictionary <ItemEffect, PictureObject>();

            this.AddChild(itemSprite = new SpriteObject(device)
            {
                Position = new SharpDX.Vector2(92, 1)
            });
            this.AddChild((userIcon = new PictureObject(device, resourceManager, PathObject.Absolute(currentUserIconPath), true)
            {
                Position = new Vector2(19, 19)
            }));
            this.AddChild((userNameString = new TextureString(device, "", 9, 75, PPDColors.White)
            {
                Position = new Vector2(35, 3)
            }));
            this.AddChild(scorePicture = new NumberPictureObject(device, resourceManager, Utility.Path.Combine("play_user_score.png"))
            {
                Position  = new Vector2(35, 24),
                Alignment = Alignment.Left,
                MaxDigit  = 7
            });

            var filenames = new string[] {
                "cool.png",
                "good.png",
                "safe.png",
                "sad.png",
                "worst.png",
                "misscool.png",
                "missgood.png"
            };

            evals = new PictureObject[filenames.Length];
            for (int i = 0; i < filenames.Length; i++)
            {
                evals[i] = new PictureObject(device, resourceManager, Utility.Path.Combine("eva", filenames[i]))
                {
                    Position = new Vector2(35, 14),
                    Hidden   = true,
                    Scale    = new SharpDX.Vector2(0.4f, 0.4f)
                };
                this.AddChild(evals[i]);
            }
            this.AddChild(lifeGage = new LifeGage(device, resourceManager)
            {
                Position = new SharpDX.Vector2(37, 32)
            });

            if (userPlayState.User.IsSelf)
            {
                this.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("play_user_back_self.png")));
            }
            else
            {
                this.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("play_user_back.png")));
            }

            AddBinding(new Binding(userPlayState.User, "Name", this, "UserName"));
            AddBinding(new Binding(userPlayState.User, "ImagePath", this, "UserImagePath"));
            AddBinding(new Binding(userPlayState, "Score", this, "Score"));
            AddBinding(new Binding(userPlayState, "Evaluate", this, "Evaluate"));
            AddBinding(new Binding(userPlayState, "LifeAsFloat", this, "LifeAsFloat"));
            AddBinding(new Binding(userPlayState, "IsStealth", this, "IsStealth"));
            AddBinding(new Binding(userPlayState, "Loaded", this, "Loaded"));

            ChangeUserIconScale();
        }
Example #2
0
        public PlayUserIcon(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, UserPlayState userPlayState,
                            bool showScore, bool showEvaluate, bool showLife) : base(device)
        {
            this.resourceManager = resourceManager;
            this.userPlayState   = userPlayState;
            this.showScore       = showScore;
            this.showEvaluate    = showEvaluate;
            this.showLife        = showLife;

            this.AddChild((userIcon = new PictureObject(device, resourceManager, PathObject.Absolute(currentUserIconPath), true)
            {
                Position = new SharpDX.Vector2(19, 19)
            }));
            this.AddChild((userNameString = new TextureString(device, "", 9, 75, PPDColors.White)
            {
                Position = new SharpDX.Vector2(35, 3)
            }));
            this.AddChild(scorePicture = new NumberPictureObject(device, resourceManager, Utility.Path.Combine("play_user_score.png"))
            {
                Position  = new SharpDX.Vector2(35, 24),
                Alignment = Alignment.Left,
                MaxDigit  = 7,
                Hidden    = !showScore
            });

            var filenames = new string[] {
                "cool.png",
                "good.png",
                "safe.png",
                "sad.png",
                "worst.png",
                "misscool.png",
                "missgood.png",
                "misssafe.png",
                "misssad.png"
            };

            evals = new PictureObject[filenames.Length];
            for (int i = 0; i < filenames.Length; i++)
            {
                evals[i] = new PictureObject(device, resourceManager, Utility.Path.Combine("eva", filenames[i]))
                {
                    Position = new SharpDX.Vector2(35, 14),
                    Hidden   = true,
                    Scale    = new SharpDX.Vector2(0.4f, 0.4f)
                };
                this.AddChild(evals[i]);
            }
            this.AddChild(lifeGage = new LifeGage(device, resourceManager)
            {
                Position = new SharpDX.Vector2(37, 32),
                Hidden   = !showLife
            });

            if (userPlayState.User.IsSelf)
            {
                this.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("play_user_back_self.png")));
            }
            else
            {
                this.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("play_user_back.png")));
            }

            AddBinding(new Binding(userPlayState.User, "Name", this, "UserName"));
            AddBinding(new Binding(userPlayState.User, "ImagePath", this, "UserImagePath"));
            AddBinding(new Binding(userPlayState, "Score", this, "Score"));
            AddBinding(new Binding(userPlayState, "Evaluate", this, "Evaluate"));
            AddBinding(new Binding(userPlayState, "IsMissPress", this, "IsMissPress"));
            AddBinding(new Binding(userPlayState, "LifeAsFloat", this, "LifeAsFloat"));

            ChangeUserIconScale();
        }