Exemplo n.º 1
0
        public GameResultScore(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager,
                               PPDGameUtility ppdGameUtility, ISound sound, ITweetManager tweetManager, IReviewManager reviewManager, IGameHost gameHost) : base(device)
        {
            this.ppdGameUtility = ppdGameUtility;
            this.TweetManager   = tweetManager;
            this.ReviewManager  = reviewManager;
            this.Sound          = sound;
            this.gameHost       = gameHost;
            menuRanking         = new MenuRanking(device, resourceManager)
            {
                Position = new Vector2(455, 100)
            };
            td = new TweetDialog(device, resourceManager, sound, tweetManager);
            rd = new ReviewDialog(device, resourceManager, sound, reviewManager);
            this.AddChild(td);
            this.AddChild(rd);
            result = new EffectObject[6];
            for (int i = 0; i < result.Length; i++)
            {
                int x    = 220;
                int y    = 74;
                var anim = new EffectObject(device, resourceManager, Utility.Path.Combine("result", String.Format("{0}.etd", ((ResultEvaluateType)i).ToString().ToLower())))
                {
                    Position = new Vector2(x, y)
                };
                anim.PlayType = Effect2D.EffectManager.PlayType.ReverseLoop;
                anim.Play();
                result[i] = anim;
            }
            string filename = "";

            switch (ppdGameUtility.Difficulty)
            {
            case Difficulty.Easy:
                filename = "easy.png";
                break;

            case Difficulty.Normal:
                filename = "normal.png";
                break;

            case Difficulty.Hard:
                filename = "hard.png";
                break;

            case Difficulty.Extreme:
                filename = "extreme.png";
                break;

            default:
                filename = "normal.png";
                break;
            }
            difficulty = new PictureObject(device, resourceManager, Utility.Path.Combine("result", filename))
            {
                Position = new Vector2(45, 105)
            };
            high = new EffectObject(device, resourceManager, Utility.Path.Combine("result", "high.etd"))
            {
                Position = new Vector2(-25, 300)
            };
            high.PlayType = Effect2D.EffectManager.PlayType.Loop;
            high.Play();
            high.Alignment = EffectObject.EffectAlignment.TopLeft;
            scoresmalls    = new NumberPictureObject[6];
            for (int i = 0; i < scoresmalls.Length; i++)
            {
                scoresmalls[i] = new NumberPictureObject(device, resourceManager, Utility.Path.Combine("result", "scoresmall.png"))
                {
                    Position  = new Vector2(scorex, scorey[i]),
                    Alignment = Alignment.Right,
                    MaxDigit  = -1
                };
            }
            scorebig = new NumberPictureObject(device, resourceManager, Utility.Path.Combine("result", "scorebig.png"))
            {
                Position  = new Vector2(scorex, scorey[6]),
                Alignment = Alignment.Right,
                MaxDigit  = -1
            };
            scoreboard = new PictureObject(device, resourceManager, Utility.Path.Combine("result", "score.png"))
            {
                Position = new Vector2(18, 52)
            };
            scoreboard.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("eva", "cool.png"), true)
            {
                Position = new Vector2(105, 108),
                Scale    = new Vector2(0.75f, 0.75f)
            });
            scoreboard.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("eva", "good.png"), true)
            {
                Position = new Vector2(105, 138),
                Scale    = new Vector2(0.75f, 0.75f)
            });
            scoreboard.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("eva", "safe.png"), true)
            {
                Position = new Vector2(105, 168),
                Scale    = new Vector2(0.75f, 0.75f)
            });
            scoreboard.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("eva", "sad.png"), true)
            {
                Position = new Vector2(105, 198),
                Scale    = new Vector2(0.75f, 0.75f)
            });
            scoreboard.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("eva", "worst.png"), true)
            {
                Position = new Vector2(105, 228),
                Scale    = new Vector2(0.75f, 0.75f)
            });
            scoreboard.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("eva", "combo.png"), true)
            {
                Position = new Vector2(105, 258),
                Scale    = new Vector2(0.75f, 0.75f)
            });

            top = new PictureObject(device, resourceManager, Utility.Path.Combine("result", "top.png"));
            top.AddChild(new TextureString(device, Utility.Language["Result"], 20, PPDColors.White)
            {
                Position = new Vector2(70, 2)
            });
            bottom = new PictureObject(device, resourceManager, Utility.Path.Combine("result", "bottom.png"));
            bottom.AddChild(new TextureString(device, Utility.Language["Move"], 16, PPDColors.White)
            {
                Position = new Vector2(587, 21)
            });
            bottom.AddChild(new TextureString(device, Utility.Language["Decide"], 16, PPDColors.White)
            {
                Position = new Vector2(708, 21)
            });
            bottom.Position = new Vector2(0, 450 - bottom.Height + 1);
            black           = new RectangleComponent(device, resourceManager, PPDColors.Black)
            {
                RectangleHeight = 450,
                RectangleWidth  = 800
            };
            black.Alpha = 0;
            buttons     = new Button[5];
            for (int i = 0; i < buttons.Length; i++)
            {
                string text = "";
                switch (i)
                {
                case 0:
                    text = "TWEET";
                    break;

                case 1:
                    text = "REVIEW";
                    break;

                case 2:
                    text = "RETRY";
                    break;

                case 3:
                    text = "REPLAY";
                    break;

                case 4:
                    text = "RETURN";
                    break;
                }
                Vector2 pos;
                if (i >= 2)
                {
                    pos = new Vector2(500 + ((i - 2) % 3) * 100, 380);
                }
                else
                {
                    pos = new Vector2(500 + (i % 2) * 100, 340);
                }
                buttons[i] = new Button(device, resourceManager, Utility.Path, text)
                {
                    Position = pos
                };
                gridSelection.Add(pos);
                buttons[i].Selected = false;
                this.AddChild(buttons[i]);
            }
            gridSelection.Initialize();
            songname = new TextureString(device, ppdGameUtility.SongInformation.DirectoryName, 20, 500, PPDColors.White)
            {
                Position = new Vector2(35, 4)
            };
            songname.Position = new Vector2(790 - songname.JustWidth, songname.Position.Y);
            difficultstring   = new TextureString(device, ppdGameUtility.DifficultString, 24, 200, PPDColors.White)
            {
                Position    = new Vector2(35, 103),
                AllowScroll = true
            };
            difficultstring.Position = new Vector2(400 - Math.Min(200, difficultstring.Width), difficultstring.Position.Y);

            bgd = new BackGroundDisplay(device, resourceManager, "skins\\PPDSingle_BackGround.xml", "Result");

            Inputed    += GameResultScore_Inputed;
            GotFocused += GameResultScore_GotFocused;

            this.AddChild(menuRanking);
            this.AddChild(high);
            this.AddChild(difficulty);
            for (int i = 0; i < result.Length; i++)
            {
                this.AddChild(result[i]);
            }
            for (int i = 0; i < scoresmalls.Length; i++)
            {
                this.AddChild(scoresmalls[i]);
            }
            this.AddChild(scorebig);
            this.AddChild(difficultstring);
            this.AddChild(scoreboard);
            this.AddChild(songname);
            this.AddChild(top);
            this.AddChild(bottom);
            this.AddChild(bgd);

            this.InsertChild(black, 0);
        }
Exemplo n.º 2
0
        public override bool Load()
        {
            WebManager.Instance.UpdateAccountInfo();
            //init
            var         list             = SongInformation.All;
            int         selectnum        = 0;
            string      initialdirectory = PPDSetting.Setting.SongDir;
            ContestInfo contestInfo      = null;

            WebSongInformation[] activeScores = null;
            ListInfo[]           lists        = null;
            Action[]             actions      =
            {
                () => { contestInfo  = WebManager.Instance.GetContestInfo(); },
                () => { activeScores = WebManager.Instance.GetScores(true);  },
                () => { lists        = WebManager.Instance.GetListInfos();   },
                PerfectTrialCache.Instance.Update
            };
            Parallel.ForEach(actions, (action) => action());
            // 前のメニューからのパラメーターを調べる
            if (PreviousParam.TryGetValue("PPDGameUtility", out object temp))
            {
                var gameutility = temp as PPDGameUtility;
                initialdirectory = gameutility.SongInformation.ParentDirectory;
            }
            ssm                   = new SelectSongManager(contestInfo, activeScores, lists);
            ssm.SongChanged      += ssm_SongChanged;
            ssm.DirectoryChanged += ssm_DirectoryChanged;
            ssm.ModeChanged      += ssm_ModeChanged;
            ssm.Filter.Desc       = SkinSetting.Setting.Desc;
            ssm.Filter.Difficulty = SkinSetting.Setting.Difficulty;
            ssm.Filter.Field      = SkinSetting.Setting.SortField;
            ssm.Filter.Type       = SkinSetting.Setting.ScoreType;
            textBox               = new DxTextBox(device, GameHost, ResourceManager);
            mss                   = new MenuSelectSong(device, ResourceManager, this);
            mss.Inputed          += mss_Inputed;
            mss.GotFocused       += mss_GotFocused;
            sic                   = new SongInfoControl(device, ResourceManager);
            sic.Inputed          += sic_Inputed;
            cc                 = new ConfirmControl(device, ResourceManager);
            cc.Inputed        += cc_Inputed;
            oc                 = new OptionControl(device, ResourceManager, Sound);
            lm                 = new LeftMenu(device, GameHost, ResourceManager, textBox, ssm, Sound);
            lm.RandomSelected += lm_RandomSelected;
            lm.FilterChanged  += lm_FilterChanged;
            ss                 = new ScoreSearcher(device, ResourceManager, textBox, ssm.Filter);
            obd                = new OpenBrowserDialog(device, ResourceManager, Sound);
            fm                 = new FocusManager(this);
            fm.Focus(mss);

            mss.DisapperFinish += cc.Show;
            bgd   = new BackGroundDisplay(device, ResourceManager, "skins\\PPDSingle_BackGround.xml", "Menu");
            black = new RectangleComponent(device, ResourceManager, PPDColors.Black)
            {
                RectangleHeight = 450,
                RectangleWidth  = 800,
                Alpha           = 0
            };

            menuMovie = new MenuMovie(device);
            this.AddChild(black);
            this.AddChild(textBox);
            this.AddChild(obd);
            this.AddChild(cc);
            this.AddChild(oc);
            this.AddChild(ss);
            this.AddChild(lm);
            this.AddChild(sic);
            this.AddChild(mss);
            var po = new PictureObject(device, ResourceManager, Utility.Path.Combine("bottom.png"));

            po.Position = new Vector2(0, 450 - po.Height + 1);
            po.AddChild(new TextureString(device, Utility.Language["SearchScore"], 14, PPDColors.Gray)
            {
                Position = new Vector2(85, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Move"], 14, PPDColors.Gray)
            {
                Position = new Vector2(205, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Menu"], 14, PPDColors.Gray)
            {
                Position = new Vector2(325, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Option"], 14, PPDColors.Gray)
            {
                Position = new Vector2(445, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Decide"], 14, PPDColors.Gray)
            {
                Position = new Vector2(565, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Back"], 14, PPDColors.Gray)
            {
                Position = new Vector2(685, 7)
            });
            this.AddChild(po);
            this.AddChild(menuMovie);
            this.AddChild(bgd);

            oc.Connect    = SkinSetting.Setting.Connect;
            oc.RivalGhost = SkinSetting.Setting.RivalGhost;

            ssm.CurrentRoot      = SongInformation.Root;
            ssm.CurrentLogicRoot = LogicFolderInfomation.Root;

            if (PreviousParam.TryGetValue("CurrentRoot", out temp))
            {
                var root = temp as SongInformation;
                ssm.CurrentRoot = root;
            }
            if (PreviousParam.TryGetValue("CurrentLogicRoot", out temp))
            {
                var root = temp as LogicFolderInfomation;
                ssm.CurrentLogicRoot = root;
            }
            if (PreviousParam.TryGetValue("CurrentMode", out temp))
            {
                var mode = (SelectSongManager.Mode)temp;
                ssm.ChangeMode(mode);
            }
            if (PreviousParam.TryGetValue("SelectedIndex", out temp))
            {
                selectnum = (int)temp;
            }
            ssm.SelectedIndex = selectnum;

            return(true);
        }