示例#1
0
        public override void Load()
        {
            //init
            int    selectnum        = 0;
            string initialdirectory = "songs";
            object temp;

            if (PreviousParam.TryGetValue("PPDGameUtility", out temp))
            {
                PPDGameUtility gameutility = temp as PPDGameUtility;
                initialdirectory = gameutility.SongInformation.ParentDirectory;// Directory.GetParent(gameutility.SongInformation.DirectoryPath).Name;
            }
            ssm                   = new SelectSongManager();
            ssm.SongChanged      += new EventHandler(ssm_SongChanged);
            ssm.DirectoryChanged += new EventHandler(ssm_DirectoryChanged);
            resource              = new Dictionary <string, ImageResource>();
            ImageResource ir = new ImageResource("img\\default\\num.png", Device);

            resource.Add("img\\default\\num.png", ir);
            pictureobjects = new ArrayList();
            mb             = new MovieBox(Device);
            mss            = new MenuSelectSong(Device, Sprite, this, ssm.Directory);
            sic            = new SongInfoControl(Device, Sprite);
            cc             = new ConfirmControl(Device, Sprite);
            if (PPDSetting.Setting.LightMode)
            {
                mt = new Moviethumb(Device, Sprite);
            }
            mss.DisapperFinish += new EventHandler(cc.Focus);
            //factory

            factory(selectnum);
            if (temp != null)
            {
                PPDGameUtility gameutility = temp as PPDGameUtility;
                Auto       = gameutility.Auto;
                Speedscale = gameutility.SpeedScale;
                Random     = gameutility.Random;
                changeprofiledisplay();
            }
            ssm.Directory = initialdirectory;
            if (temp != null)
            {
                PPDGameUtility  gameutility = temp as PPDGameUtility;
                SongInformation si          = gameutility.SongInformation;
                selectnum = Array.FindIndex(ssm.SongInformations, (songinfo) => si.DirectoryName == songinfo.DirectoryName);
                if (selectnum < 0)
                {
                    selectnum = 0;
                }
            }
            ssm.SelectedIndex = selectnum;
        }
示例#2
0
文件: Menu.cs 项目: KHCmaster/PPD
        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);
        }