Esempio n. 1
0
 private void InitializeUserList(GhostInfo[] ghosts)
 {
     selfPlayState = new UserPlayState(new UserInfo
     {
         AccountId = WebManager.Instance.CurrentAccountId,
         Name      = WebManager.Instance.CurrentUserName,
         IsSelf    = true
     });
     userScoreListComponent.AddUser(selfPlayState, true, true, true);
     foreach (var t in ghosts.Select(g => new Tuple <GhostInfo, UserInfo>(g, new UserInfo
     {
         AccountId = g.AccountId,
         Name = g.AccountName
     })))
     {
         var userPlayState = new UserPlayState(t.Item2);
         userScoreListComponent.AddUser(userPlayState, t.Item1.ShowScore, t.Item1.ShowEvaluate, t.Item1.ShowLife);
     }
     userScoreListComponent.Retry();
     gr.Retryed  += gr_Retryed;
     gr.Replayed += gr_Replayed;
     mainGameComponent.Drawed          += mainGameComponent_Drawed;
     mainGameComponent.ScoreChanged    += mainGameComponent_ScoreChanged;
     mainGameComponent.LifeChanged     += mainGameComponent_LifeChanged;
     mainGameComponent.EvaluateChanged += mainGameComponent_EvaluateChanged;
     foreach (var u in userScoreListComponent.Players)
     {
         var path = Path.GetTempFileName();
         File.WriteAllBytes(path, WebManager.Instance.GetAccountImage(u.UserPlayState.User.AccountId));
         u.UserImagePath = path;
     }
 }
Esempio n. 2
0
        public void AddUser(UserPlayState userPlayState, bool showScore, bool showEvaluate, bool showLife)
        {
            var playUserIcon = new PlayUserIcon(device, resourceManager, userPlayState, showScore, showEvaluate, showLife)
            {
                Position = new SharpDX.Vector2(0, ChildrenCount * ItemHeight)
            };

            this.AddChild(playUserIcon);
            list.Add(playUserIcon);
        }
Esempio n. 3
0
        public void DeleteUser(UserPlayState userPlayState)
        {
            PlayUserIcon found = null;

            foreach (PlayUserIcon playUserIcon in Children)
            {
                if (playUserIcon.UserPlayState == userPlayState)
                {
                    found = playUserIcon;
                    break;
                }
            }

            if (found != null)
            {
                this.RemoveChild(found);
                list.Remove(found);
            }
        }
Esempio n. 4
0
 public GhostPlayInfo(UserPlayState userPlayState, GhostFrame[] ghostFrames)
 {
     this.userPlayState = userPlayState;
     this.ghostFrames   = ghostFrames;
 }
Esempio n. 5
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();
        }