void LoadMusic(MusicScore score, int difficulty)
    {
        GameManager.songManager.Stop();
        GameManager.songManager.loop = false;
        string[] str = GameManager.ReadFile(score.filePath);
        GameManager.currentSong   = new MusicScore();
        GameManager.currentcourse = new MusicScore.Course();
        GameManager.currentSong   = score;
        GameManager.currentcourse = score.courses.Find(s => s.difficulty == difficulty);
        bool inCourse = false;

        foreach (string i in str)
        {
            if (i == ("COURSE:" + difficulty.ToString()))
            {
                inCourse = true;
            }
            if (inCourse)
            {
                GameManager.currentcourse.course.Add(i);
                if (i == "#END")
                {
                    break;
                }
            }
        }
        StartCoroutine(gameManager.ChangeSong(score.wave));
    }
Ejemplo n.º 2
0
    public Item(int id, bool saveToDatabase = true)
    {
        Id = id;
        SetMetadataValues();
        Name       = ItemMetadataStorage.GetName(id);
        Level      = ItemMetadataStorage.GetLevel(id);
        ItemSlot   = ItemMetadataStorage.GetSlot(id);
        IsTemplate = ItemMetadataStorage.GetIsTemplate(id);
        if (GemSlot == GemSlot.TRANS)
        {
            TransparencyBadgeBools = new byte[10];
        }

        Rarity                = ItemMetadataStorage.GetRarity(id);
        PlayCount             = ItemMetadataStorage.GetPlayCount(id);
        Color                 = ItemMetadataStorage.GetEquipColor(id);
        CreationTime          = TimeInfo.Now();
        RemainingGlamorForges = ItemExtractionMetadataStorage.GetExtractionCount(id);
        Slot   = -1;
        Amount = 1;
        Score  = new();
        Stats  = new(id, Rarity, ItemSlot, Level);
        if (saveToDatabase)
        {
            Uid = DatabaseManager.Items.Insert(this);
        }
    }
Ejemplo n.º 3
0
 public KeyNotePlayer(MusicScore aScore, MusicPlayer aPlayer)
 {
     mBehaviour      = MyBehaviour.create <MyBehaviour>();
     mBehaviour.name = "KeyNotePlayer's CoroutineRunner";
     mScore          = aScore;
     mPlayer         = aPlayer;
 }
Ejemplo n.º 4
0
        public void LoadMusicScore(BinaryReader b)
        {
            IScoreImportProvider import = new ImportGuitarPro();

            score = import.LoadScore(b);
            SelectDefaultPart();
        }
Ejemplo n.º 5
0
    void Start()
    {
        audioSource       = GetComponent <AudioSource>();
        gameManager       = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
        movementComponent = GetComponent <EnemyMovement>();
        template          = GameObject.Find("MusicScoreTemplate").GetComponent <MusicScoreTemplate>();

        musicScore       = template.PickOne();
        audioSource.clip = musicScore.audio;
        audioSource.Play();

        switch (musicScore.musicScore.Count)
        {
        case 3:
            Debug.Log(musicScore.musicScore[0] + " " + musicScore.musicScore[1] + " " + musicScore.musicScore[2]);
            break;

        case 4:
            Debug.Log(musicScore.musicScore[0] + " " + musicScore.musicScore[1] + " " + musicScore.musicScore[2] + " " + musicScore.musicScore[3]);
            break;

        case 5:
            Debug.Log(musicScore.musicScore[0] + " " + musicScore.musicScore[1] + " " + musicScore.musicScore[2] + " " + musicScore.musicScore[3] + " " + musicScore.musicScore[4]);
            break;
        }
    }
Ejemplo n.º 6
0
        private void Load_Click(object sender, EventArgs e)
        {
            string musicPath = "";

            if (LoadFile.ShowDialog() == DialogResult.OK)
            {
                musicPath = LoadFile.FileName;
            }

            if (File.Exists(musicPath))
            {
                using (StreamReader file = File.OpenText(musicPath))
                {
                    JsonSerializer serializer  = new JsonSerializer();
                    MusicScore     loadedScore = (MusicScore)serializer.Deserialize(file, typeof(MusicScore));
                    score          = loadedScore;
                    ScoreName.Text = score.name;
                    CurrentNotes.Items.Clear();
                    foreach (MusicNote note in score.notes)
                    {
                        CurrentNotes.Items.Add(note.pitch);
                        CurrentNotes.SelectedIndex = CurrentNotes.Items.Count - 1;
                    }
                }
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog();
            dialog.Filter = "MusicXML files|*.xml";
            if (dialog.ShowDialog() == true)
            {
                //LoadDocToClasses.list.Clear();
                //LoadDocToClasses.MeasuresList.Clear();
                //LoadCharsToViewPort.x.Clear();
                XmlRead xmlReader = new XmlRead();
                //viewer.LoadFile(dialog.FileName);
                xmlReader.File_path = dialog.FileName;
                Logger.Log("Loading: " + dialog.FileName);
                Console.WriteLine("Loaded file>> " + dialog.FileName);
                //     textBlock.Text += "\n Loadind file ... Processing  ";
                XDocument Doc = XDocument.Load(dialog.FileName, LoadOptions.SetLineInfo);
                //XDocument Doc = XmlRead.GetXmlInventory(dialog.FileName);
                //LoadDocToClasses.Document = Doc;
                //Misc.LoadFile.LoadDocument(Doc);
                MusicScore mus_score = new MusicScore(Doc);

                /*
                 * LoadDocToClasses.AddMeasuresToXListV(Doc);
                 * //   textBlock.Text += "\n File imported to measures list \n Press Load button to process";
                 * List<MusicalChars> list;
                 * LoadDocToClasses.LoadCharsFromMeasures();
                 * list = LoadDocToClasses.list;
                 * Logger.Log("XML Loaded");
                 */
            }
        }
Ejemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            MusicScore musicScore = db.MusicScore.Find(id);

            db.MusicScore.Remove(musicScore);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public NoteDistanceInfo(MusicScore score, int laneIndex, int barIndex, int noteIndex, int noteDistance)
 {
     LaneIndex = laneIndex;
     BarIndex = barIndex;
     NoteIndex = noteIndex;
     NoteDistance = noteDistance;
     Score = score;
 }
Ejemplo n.º 10
0
 protected virtual void Start()
 {
     Count            = 0;
     CounterText      = gameObject.GetComponent <Text>();
     CounterText.text = "0";
     GameManager      = GameObject.Find("GameManager").GetComponent <GameManager4>();
     MusicData        = GameManager.Result.MusicData;
 }
Ejemplo n.º 11
0
        //[ValidateAntiForgeryToken]
        public ActionResult Create(MusicScore musicScore)
        {
            var sel1 = Request["sel"];
            var sel  = sel1.Trim();
            HttpPostedFileBase postimageBase = Request.Files["Image1"];

            //HttpFileCollectionBase files = Request.Files;
            //HttpPostedFileBase postimageBase = files["Image1"];//获取上传的文件
            if (ModelState.IsValid)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        if (postimageBase != null)
                        {
                            string filePath     = postimageBase.FileName;
                            string filename     = filePath.Substring(filePath.LastIndexOf("\\") + 1);
                            string serverpath   = Server.MapPath(@"/Images/FM/") + filename;
                            string relativepath = @"/Images/FM/" + filename;
                            postimageBase.SaveAs(serverpath);
                            musicScore.Ms_img = relativepath;
                        }

                        else
                        {
                            return(Content("<script>;alert('请先上传封面!');history.go(-1)</script>"));
                        }
                        musicScore.User_id = 1;/*Convert.ToInt32(Session["Users_id"].ToString());*/
                        //publish_food.Amount = 0;
                        musicScore.Ms_addtime = System.DateTime.Now;
                        musicScore.Ms_label   = sel;
                        db.MusicScore.Add(musicScore);
                        db.SaveChanges();
                        //return Content("<script>;alert('发布成功!');window.location.href='/Publish_Food/Index_PF'</script>");
                        return(Content("<script>;alert('发布成功!');history.go(-1)</script>"));
                    }
                    else
                    {
                        return(Content("<script>;alert('发布失败!');history.go(-1)</script>"));
                    }
                }
                catch (Exception ex)
                {
                    return(Content(ex.Message));
                }
                //var score = musicScore["Score"];
                //db.MusicScore.Add(musicScore);
                //db.SaveChanges();
                //return RedirectToAction("Index");
            }

            return(View());
        }
Ejemplo n.º 12
0
 // Make a copy of item
 public Item(Item other)
 {
     Id                     = other.Id;
     Name                   = other.Name;
     Level                  = other.Level;
     Gender                 = other.Gender;
     InventoryTab           = other.InventoryTab;
     ItemSlot               = other.ItemSlot;
     GemSlot                = other.GemSlot;
     Rarity                 = other.Rarity;
     StackLimit             = other.StackLimit;
     EnableBreak            = other.EnableBreak;
     IsTwoHand              = other.IsTwoHand;
     IsDress                = other.IsDress;
     IsTemplate             = other.IsTemplate;
     IsCustomScore          = other.IsCustomScore;
     PlayCount              = other.PlayCount;
     FileName               = other.FileName;
     Function               = other.Function;
     Uid                    = other.Uid;
     Slot                   = other.Slot;
     Amount                 = other.Amount;
     CreationTime           = other.CreationTime;
     ExpiryTime             = other.ExpiryTime;
     TimesAttributesChanged = other.TimesAttributesChanged;
     IsLocked               = other.IsLocked;
     UnlockTime             = other.UnlockTime;
     RemainingGlamorForges  = other.RemainingGlamorForges;
     GachaDismantleId       = other.GachaDismantleId;
     Enchants               = other.Enchants;
     EnchantExp             = other.EnchantExp;
     RepackageCount         = other.RepackageCount;
     Charges                = other.Charges;
     TransferFlag           = other.TransferFlag;
     RemainingTrades        = other.RemainingTrades;
     PairedCharacterId      = other.PairedCharacterId;
     PairedCharacterName    = other.PairedCharacterName;
     PetSkinBadgeId         = other.PetSkinBadgeId;
     RecommendJobs          = other.RecommendJobs;
     OwnerCharacterId       = other.OwnerCharacterId;
     OwnerCharacterName     = other.OwnerCharacterName;
     InventoryId            = other.InventoryId;
     BankInventoryId        = other.BankInventoryId;
     BlackMarketCategory    = other.BlackMarketCategory;
     Category               = other.Category;
     HomeId                 = other.HomeId;
     Color                  = other.Color;
     HairData               = other.HairData;
     HatData                = other.HatData;
     Score                  = new();
     Stats                  = new(other.Stats);
     UGC                    = other.UGC;
 }
 void GetAllMusicInfo()
 {
     musicList = new List <MusicScore>();
     foreach (string name in fileList)
     {
         MusicScore        score  = new MusicScore();
         MusicScore.Course course = new MusicScore.Course();
         string[]          str    = GameManager.ReadFile(name);
         score.filePath = name;
         foreach (string i in str)
         {
             if (i.StartsWith("TITLE:"))
             {
                 score.title = i.Substring(6);
             }
             else if (i.StartsWith("SUBTITLE:"))
             {
                 score.subtitle = i.Substring(9);
             }
             else if (i.StartsWith("BPM:"))
             {
                 score.bpm = float.Parse(i.Substring(4));
             }
             else if (i.StartsWith("WAVE:"))
             {
                 score.wave = i.Substring(5);
             }
             else if (i.StartsWith("OFFSET:"))
             {
                 score.offset = float.Parse(i.Substring(7));
             }
             else if (i.StartsWith("COURSE:"))
             {
                 course.difficulty = int.Parse(i.Substring(7));
             }
             else if (i.StartsWith("LEVEL:"))
             {
                 course.level = int.Parse(i.Substring(6));
             }
             else if (i == "#END" && course.level > 0)
             {
                 score.courses.Add(course);
                 course = new MusicScore.Course();
             }
         }
         if (score.title != "" && score.bpm != 0 && score.courses.Count > 0)
         {
             score.courses = score.courses.OrderBy(s => s.difficulty).ToList();
             musicList.Add(score);
         }
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// SpecialNotes専用コンストラクタです
        /// </summary>
        /// <param name="_musicscore"></param>
        /// <param name="_position"></param>
        /// <param name="_noteStyle"></param>
        /// <param name="_value"></param>
        public ShortNote(MusicScore _musicscore, Point _position, string _noteStyle, decimal _value)
        {
            musicscore   = _musicscore;
            position     = _position;
            noteStyle    = _noteStyle;
            specialValue = _value;
            noteSize     = 16;
            //destPoints = new Point[3];

            noteImage = setNoteImage();
            pos.Beat  = MusicScore.SelectedBeat;
            setRelativePosition();
        }
Ejemplo n.º 15
0
        // GET: MusicScore/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MusicScore musicScore = db.MusicScore.Find(id);

            if (musicScore == null)
            {
                return(HttpNotFound());
            }
            return(View(musicScore));
        }
Ejemplo n.º 16
0
 private void test4_Click(object sender, RoutedEventArgs e)
 {
     if (MusicScore.isLoaded)
     {
         DrawingVisual visual = new DrawingVisual();
         //...
         MusicScore.DrawBreaks(visual);
         drawingSurface.AddVisual(visual);
     }
     else
     {
         Logger.Log("Please load XML file first");
     }
 }
Ejemplo n.º 17
0
        public void test5_Click(object sender, RoutedEventArgs e)
        {
            MusicScore m = new MusicScore();

            if (m.ContentSpaceCalculated == true)
            {
                DrawingVisual visual = new DrawingVisual();
                MusicScore.DrawMusicScoreMeasuresContentSpace(visual);
                drawingSurface.AddVisual(visual);
            }
            else
            {
                Logger.Log("Please Calculate Content Space first");
            }
        }
Ejemplo n.º 18
0
    public void set(MusicScoreFileData aData, ScoreDifficult aDifficult)
    {
        //譜面
        mScore = MyBehaviour.create <MusicScore>();
        //曲情報ロード
        MusicScoreData.set(aData);
        MusicScoreData.mSelectedDifficult = aDifficult;
        //ミュージックプレイヤー
        MusicPlayer tPlayer = MyBehaviour.create <MusicPlayer>();

        tPlayer.setAudio(DataFolder.loadMusic(MusicScoreData.mMusicFileName));
        //譜面と曲を同期させるシステム
        mPlayer = new KeyNotePlayer(mScore, tPlayer);
        //背景
        resetScoreBackground();
    }
Ejemplo n.º 19
0
        public void LoadMusicScore(string filename)
        {
            if (filename.EndsWith(".xml"))
            {
                //music xml
                score = new ImportMusicXML().LoadMusicXML(filename);
            }
            if (filename.EndsWith(".gp4"))
            {
                //guitar pro
                IScoreImportProvider import = new ImportGuitarPro();
                score = import.LoadScore(filename);
            }

            SelectDefaultPart();
        }
Ejemplo n.º 20
0
 private void test1_Click(object sender, RoutedEventArgs e)
 {
     if (MusicScore.isLoaded)
     {
         //! drawing page
         DrawingVisual visual = new DrawingVisual();
         MusicScore.DrawPageRectangle(visual);
         drawingSurface.AddVisual(visual);
         //! drawing margins rectangle
         DrawingVisual visual2 = new DrawingVisual();
         MusicScore.DrawMusicScoreMargins(visual2);
         drawingSurface.AddVisual(visual2);
     }
     else
     {
         Logger.Log("Please load XML file first");
     }
 }
Ejemplo n.º 21
0
        /// <summary>
        /// 分数を指定できるショートノーツ用コンストラクタです
        /// </summary>
        /// <param name="_musicscore"></param>
        /// <param name="_position"></param>
        /// <param name="_noteSize"></param>
        /// <param name="_noteStyle"></param>
        /// <param name="_airDirection"></param>
        /// <param name="_longNoteNumber"></param>
        /// <param name="_beat"></param>
        public ShortNote(MusicScore _musicscore, Point _position, int _noteSize, string _noteStyle, string _airDirection, int _longNoteNumber, int _beat)
        {
            musicscore     = _musicscore;
            position       = _position;
            startPosition  = _position;
            endPosition    = _position;
            noteSize       = _noteSize;//1-16
            noteStyle      = _noteStyle;
            airDirection   = _airDirection;
            longNoteNumber = _longNoteNumber;
            //
            prevNote = null;
            nextNote = null;
            //destPoints = new Point[3];

            noteImage = setNoteImage();
            pos.Beat  = _beat;
            setRelativePosition();
        }
Ejemplo n.º 22
0
        /// <summary>
        /// SlideLine専用コンストラクタです
        /// </summary>
        /// <param name="_musicscore"></param>
        /// <param name="_position"></param>
        /// <param name="_startPosition"></param>
        /// <param name="_endPosition"></param>
        /// <param name="_startSize"></param>
        /// <param name="_endSize"></param>
        /// <param name="_longNoteNumber"></param>
        public ShortNote(MusicScore _musicscore, Point _position, Point _startPosition, Point _endPosition, int _startSize, int _endSize, int _longNoteNumber)
        {
            musicscore     = _musicscore;
            position       = _position;
            startPosition  = _startPosition;
            endPosition    = _endPosition;
            startSize      = _startSize; //1-16
            endSize        = _endSize;   //1-16
            noteStyle      = "SlideLine";
            airDirection   = "Center";
            longNoteNumber = _longNoteNumber;
            //this.visible = visible == 0 ? false : true;
            //
            prevNote = null;
            nextNote = null;
            //destPoints = new Point[3];

            noteImage = setNoteImage();
            pos.Beat  = MusicScore.SelectedBeat;
            setRelativePosition();
        }
Ejemplo n.º 23
0
        public ScoreRoot(Form1 _form1, int maxScore, int _longNotesNumber, bool _slideRelay)
        {
            form1           = _form1;
            longNotesNumber = _longNotesNumber;
            slideRelay      = _slideRelay;
            SuspendLayout();
            for (int i = 0; i < maxScore; i++)
            {
                musicScore       = new MusicScore();
                musicScore.sRoot = this;
                musicScore.Index = i;
                this.Controls.Add(musicScore);
                scores.Add(musicScore);
                //musicScore.update();
            }
            ResumeLayout();
            scores[0].NextScore = scores[1];
            scores[0].PrevScore = null;
            for (int i = 1; i < maxScore - 1; i++)
            {
                scores[i].NextScore = scores[i + 1];
                scores[i].PrevScore = scores[i - 1];
            }
            scores[maxScore - 1].NextScore = null;
            scores[maxScore - 1].PrevScore = scores[maxScore - 2];
            //
            this.Location      = new Point(269, 51);
            this.Size          = new Size(1103, 823);
            this.BackColor     = Color.AliceBlue;
            this.FlowDirection = FlowDirection.LeftToRight;
            this.WrapContents  = false;
            this.AutoScroll    = true;
            //System.Diagnostics.Debug.WriteLine(HorizontalScroll.Maximum);

            MouseWheel += ScoreRoot_MouseWheel;
        }
Ejemplo n.º 24
0
 //所属する譜面を設定
 public void setParentScore(MusicScore aScore)
 {
     mParentScore          = aScore;
     this.transform.parent = mParentScore.transform;
 }
Ejemplo n.º 25
0
    protected override List <ItemMetadata> Parse()
    {
        // Item breaking ingredients
        Dictionary <int, List <ItemBreakReward> > rewards = ParseItemBreakingIngredients();

        // Item rarity
        Dictionary <int, int> rarities = ParseItemRarities();

        // Items
        List <ItemMetadata> items = new();

        Filter.Load(Resources.XmlReader, "NA", "Live");
        Maple2.File.Parser.ItemParser parser = new(Resources.XmlReader);
        foreach ((int id, string name, ItemData data) in parser.Parse())
        {
            Limit            limit            = data.limit;
            Skill            skill            = data.skill;
            Fusion           fusion           = data.fusion;
            Property         property         = data.property;
            Function         function         = data.function;
            Install          install          = data.install;
            MusicScore       musicScore       = data.MusicScore;
            Life             life             = data.life;
            Housing          housing          = data.housing;
            AdditionalEffect additionalEffect = data.AdditionalEffect;
            ItemMetadata     metadata         = new()
            {
                Id   = id,
                Name = name,
                Tab  = GetTab(property.type, property.subtype, property.skin),
                Gem  = new()
                {
                    Gem = (GemSlot)data.gem.system
                },
                UGC = new()
                {
                    Mesh = data.ucc.mesh
                },
                Life = new()
                {
                    DurationPeriod         = life.usePeriod,
                    ExpirationType         = (ItemExpirationType)life.expirationType,
                    ExpirationTypeDuration = life.numberOfWeeksMonths
                },
                Pet = new()
                {
                    PetId = data.pet?.petID ?? 0,
                },
                Basic = new()
                {
                    Tag = data.basic.stringTag
                },
                Limit = new()
                {
                    JobRequirements     = limit.jobLimit.ToList(),
                    JobRecommendations  = limit.recommendJobs.ToList(),
                    LevelLimitMin       = limit.levelLimit,
                    LevelLimitMax       = limit.levelLimitMax,
                    Gender              = (Gender)limit.genderLimit,
                    TransferType        = (TransferType)limit.transferType,
                    Sellable            = limit.shopSell,
                    Breakable           = limit.enableBreak,
                    MeretMarketListable = limit.enableRegisterMeratMarket,
                    DisableEnchant      = limit.exceptEnchant,
                    TradeLimitByRarity  = limit.tradeLimitRank,
                    VipOnly             = limit.vip
                },
                Skill = new()
                {
                    SkillId    = skill.skillID,
                    SkillLevel = skill.skillLevel
                },
                Fusion = new()
                {
                    Fusionable = fusion.fusionable == 1,
                },
                Install = new()
                {
                    IsCubeSolid = install.cubeProp == 1,
                    ObjectId    = install.objCode,
                },
                Property = new()
                {
                    StackLimit                = property.slotMax,
                    SkinType                  = (ItemSkinType)property.skinType,
                    Category                  = property.category,
                    BlackMarketCategory       = property.blackMarketCategory,
                    DisableAttributeChange    = property.remakeDisable,
                    GearScoreFactor           = property.gearScore,
                    TradeableCount            = (byte)property.tradableCount,
                    RepackageCount            = (byte)property.rePackingLimitCount,
                    RepackageItemConsumeCount = (byte)property.rePackingItemConsumeCount,
                    DisableTradeWithinAccount = property.moveDisable == 1,
                    DisableDrop               = property.disableDrop,
                    SocketDataId              = property.socketDataId,
                    Sell = new()
                    {
                        SellPrice       = property.sell.price.ToList(),
                        SellPriceCustom = property.sell.priceCustom.ToList(),
                    }
                },
                Customize = new()
                {
                    ColorIndex   = data.customize.defaultColorIndex,
                    ColorPalette = data.customize.colorPalette,
                },
                Function = new()
                {
                    Name = function.name
                },
                Option = new()
                {
                    Static            = data.option.@static,
                    Random            = data.option.random,
                    Constant          = data.option.constant,
                    OptionLevelFactor = data.option.optionLevelFactor,
                    OptionId          = data.option.optionID,
                },
                Music = new()
                {
                    PlayCount       = musicScore.playCount,
                    MasteryValue    = musicScore.masteryValue,
                    MasteryValueMax = musicScore.masteryValueMax,
                    IsCustomScore   = musicScore.isCustomNote,
                    FileName        = musicScore.fileName,
                    PlayTime        = musicScore.playTime
                },
                Housing = new()
                {
                    TrophyId    = housing.trophyID,
                    TrophyLevel = housing.trophyLevel
                },
                Shop = new()
                {
                    ShopId = data.Shop?.systemShopID ?? 0
                },
                AdditionalEffect = new()
                {
                    Id    = additionalEffect.id,
                    Level = additionalEffect.level
                }
            };

            // Parse expiration time
            if (life.expirationPeriod.Length > 0)
            {
                metadata.Life.ExpirationTime = new(life.expirationPeriod[0], life.expirationPeriod[1], life.expirationPeriod[2], life.expirationPeriod[3],
                                                   life.expirationPeriod[4], life.expirationPeriod[5]);
            }

            // if globalOptionLevelFactor is present, override with these values
            if (data.option.globalOptionLevelFactor is not null)
            {
                metadata.Option.OptionLevelFactor = (float)data.option.globalOptionLevelFactor;
            }
            // if globalTransferType is present, override with these values
            if (limit.globalTransferType is not null)
            {
                metadata.Limit.TransferType = (TransferType)limit.globalTransferType;
            }

            // if globalTransferTypeNA is present, override with these values
            if (limit.globalTransferTypeNA is not null)
            {
                metadata.Limit.TransferType = (TransferType)limit.globalTransferTypeNA;
            }

            // if globalRePackingLimit is present, override repacking with these values
            if (property.globalRePackingLimitCount is not null)
            {
                metadata.Property.RepackageCount            = (byte)property.globalRePackingLimitCount;
                metadata.Property.RepackageItemConsumeCount = (byte)property.globalRePackingItemConsumeCount;
            }

            // Item functions
            ParseFunctions(function, metadata);

            Slot firstSlot  = data.slots.slot.First();
            bool slotResult = Enum.TryParse(firstSlot.name, out metadata.Slot);
            if (!slotResult && !string.IsNullOrEmpty(firstSlot.name))
            {
                Console.WriteLine($"Failed to parse item slot for {id}: {firstSlot.name}");
            }

            if (data.slots.slot.Count > 1)
            {
                switch (metadata.Slot)
                {
                case ItemSlot.CL or ItemSlot.PA:
                    metadata.IsDress = true;
                    break;

                case ItemSlot.RH or ItemSlot.LH:
                    metadata.IsTwoHand = true;
                    break;
                }
            }

            if (metadata.Slot is ItemSlot.HR)
            {
                ParseHair(firstSlot, metadata);
            }

            if (!string.IsNullOrEmpty(housing.categoryTag))
            {
                string[] tags = housing.categoryTag.Split(',');
                _ = short.TryParse(tags[0], out short category);
                metadata.Housing.HousingCategory = (ItemHousingCategory)category;
            }

            // Item breaking ingredients
            if (rewards.ContainsKey(id))
            {
                metadata.BreakRewards = rewards[id];
            }

            // Item rarities
            if (rarities.ContainsKey(id))
            {
                metadata.Rarity = rarities[id];
            }

            items.Add(metadata);
        }

        return(items);
    }
Ejemplo n.º 26
0
        /*
         * public int setLNN()
         * {
         *
         *
         *  return longNotesNumber;
         * }
         * //*/

        //*//test
        public void setLongNote(ShortNote note, MusicScore score)
        {
            Graphics g = Graphics.FromImage(score.StoreImage);

            //g.DrawImage(Properties.Resources.MusicScore, new Point(0, 0));
            switch (note.NoteStyle)
            {
            case "Hold":

                break;

            case "Slide":
            case "SlideEnd":
            case "SlideTap":
            case "SlideRelay":
                ShortNote nextNote = null, prevNote = null;
                for (MusicScore iScore = score; iScore.NextScore != null && nextNote == null; iScore = iScore.NextScore) //次の中継点ノーツを探してnextNoteに
                {
                    if (iScore == score)                                                                                 //初回
                    {
                        foreach (ShortNote iNote in score.shortNotes.Where(
                                     x => x.NotePosition.Y < note.NotePosition.Y).OrderByDescending(x => x.NotePosition.Y))
                        {
                            if (iNote.LongNoteNumber == note.LongNoteNumber && iNote.NoteStyle != "SlideCurve")
                            {
                                nextNote = iNote;
                                break;
                            }
                        }
                    }
                    else
                    {
                        foreach (ShortNote iNote in iScore.shortNotes.OrderByDescending(x => x.NotePosition.Y))
                        {
                            if (iNote.LongNoteNumber == note.LongNoteNumber && iNote.NoteStyle != "SlideCurve")
                            {
                                nextNote = iNote;
                                break;
                            }
                        }
                    }
                }
                for (MusicScore iScore = score; iScore.PrevScore != null && prevNote == null; iScore = iScore.PrevScore) //前の中継点ノーツを探してprevNoteに
                {
                    if (iScore == score)                                                                                 //初回
                    {
                        foreach (ShortNote iNote in score.shortNotes.Where(
                                     x => x.NotePosition.Y > note.NotePosition.Y && x.LongNoteNumber != -1).OrderBy(x => x.NotePosition.Y))
                        {
                            if (iNote.LongNoteNumber == note.LongNoteNumber && iNote.NoteStyle != "SlideCurve")
                            {
                                prevNote = iNote;
                                break;
                            }
                        }
                    }
                    else
                    {
                        foreach (ShortNote iNote in iScore.shortNotes.OrderBy(x => x.NotePosition.Y))
                        {
                            if (iNote.LongNoteNumber == note.LongNoteNumber && iNote.NoteStyle != "SlideCurve")
                            {
                                prevNote = iNote;
                                break;
                            }
                        }
                    }
                }
                if (nextNote == null)
                {
                    return;
                }
                int   nMeasure = nextNote.LocalPosition.Measure;
                int   cMeasure = note.LocalPosition.Measure;
                int   measureDiff = (nMeasure % 2 == 0 ? nMeasure - 1 : nMeasure) / 2 - (cMeasure % 2 == 0 ? cMeasure - 1 : cMeasure) / 2;
                Point nPnt, cPnt; int nSize, cSize;
                if (measureDiff == 0)    //2ノーツは同じ譜面レーン上
                {
                    //draw
                    nPnt = nextNote.NotePosition; nSize = nextNote.NoteSize;
                    cPnt = note.NotePosition; cSize = note.NoteSize;
                    Point[] ps = { new Point(nPnt.X + 2,              nPnt.Y), new Point(cPnt.X + 2,              cPnt.Y),
                                   new Point(cPnt.X + cSize * 10 - 2, cPnt.Y), new Point(nPnt.X + nSize * 10 - 2, nPnt.Y) };
                    g.FillPolygon(Brushes.Aqua, ps);
                }
                else    //2ノーツは異なるレーン上(境界を何度かまたぐ)
                {
                    //draw(begin)
                    for (int i = 0; i < measureDiff - 1; i++)
                    {
                    }
                    //draw(end)
                }
                break;

            case "AirBegin":
            case "AirAction":

                break;

            default:
                break;
            }
            g.Dispose();
        }
Ejemplo n.º 27
0
    protected override List <ItemMetadata> Parse()
    {
        // Item breaking ingredients
        Dictionary <int, List <ItemBreakReward> > rewards = ParseItemBreakingIngredients();

        // Item rarity
        Dictionary <int, int> rarities = ParseItemRarities();

        // Items
        List <ItemMetadata> items = new();

        Filter.Load(Resources.XmlReader, "NA", "Live");
        Maple2.File.Parser.ItemParser parser = new(Resources.XmlReader);
        foreach ((int id, string name, ItemData data) in parser.Parse())
        {
            Limit      limit      = data.limit;
            Property   property   = data.property;
            Function   function   = data.function;
            Install    install    = data.install;
            MusicScore musicScore = data.MusicScore;

            ItemMetadata metadata = new()
            {
                Id                        = id,
                Name                      = name,
                Tag                       = data.basic.stringTag,
                ColorIndex                = data.customize.defaultColorIndex,
                ColorPalette              = data.customize.colorPalette,
                Gem                       = (GemSlot)data.gem.system,
                Tab                       = GetTab(property.type, property.subtype, property.skin != 0),
                IsTemplate                = property.skinType == 99,
                TradeableCount            = (byte)property.tradableCount,
                RepackageCount            = (byte)property.rePackingLimitCount,
                RepackageItemConsumeCount = (byte)property.rePackingItemConsumeCount,
                BlackMarketCategory       = property.blackMarketCategory,
                Category                  = property.category,
                SellPrice                 = property.sell.price.ToList(),
                SellPriceCustom           = property.sell.priceCustom.ToList(),
                StackLimit                = property.slotMax,
                OptionStatic              = data.option.@static,
                OptionRandom              = data.option.random,
                OptionConstant            = data.option.constant,
                OptionLevelFactor         = data.option.optionLevelFactor,
                FunctionData              =
                {
                    Name = function.name
                },
                PlayCount     = musicScore.playCount,
                FileName      = musicScore.fileName,
                IsCustomScore = musicScore.isCustomNote,
                ShopID        = data.Shop?.systemShopID ?? 0,
                SkillID       = data.skill.skillID,
                EnableBreak   = limit.enableBreak != 0,
                Level         = limit.levelLimit,
                TransferType  = (TransferType)limit.transferType,
                Sellable      = limit.shopSell != 0,
                RecommendJobs = limit.recommendJobs.ToList(),
                Gender        = (Gender)limit.genderLimit,
                IsCubeSolid   = install.cubeProp != 0,
                ObjectId      = install.objCode
            };

            // Item boxes
            ParseBoxes(function, metadata);

            Slot firstSlot  = data.slots.slot.First();
            bool slotResult = Enum.TryParse(firstSlot.name, out metadata.Slot);
            if (!slotResult && !string.IsNullOrEmpty(firstSlot.name))
            {
                Console.WriteLine($"Failed to parse item slot for {id}: {firstSlot.name}");
            }

            if (data.slots.slot.Count > 1)
            {
                switch (metadata.Slot)
                {
                case ItemSlot.CL or ItemSlot.PA:
                    metadata.IsDress = true;
                    break;

                case ItemSlot.RH or ItemSlot.LH:
                    metadata.IsTwoHand = true;
                    break;
                }
            }

            if (metadata.Slot is ItemSlot.HR)
            {
                ParseHair(firstSlot, metadata);
            }

            if (!string.IsNullOrEmpty(data.housing.categoryTag))
            {
                string[] tags = data.housing.categoryTag.Split(',');
                _ = short.TryParse(tags[0], out short category);
                metadata.HousingCategory = (ItemHousingCategory)category;
            }

            // Item breaking ingredients
            if (rewards.ContainsKey(id))
            {
                metadata.BreakRewards = rewards[id];
            }

            // Item rarities
            if (rarities.ContainsKey(id))
            {
                metadata.Rarity = rarities[id];
            }

            items.Add(metadata);
        }

        return(items);
    }
Ejemplo n.º 28
0
 private void clearAll_Click(object sender, RoutedEventArgs e)
 {
     MusicScore.Clear();
     drawingSurface.ClearVisuals();
 }
Ejemplo n.º 29
0
    void LoadMusicScore(string path)
    {
        XmlSerializer serializer = new XmlSerializer(typeof(MusicScore));
        StreamReader  xmlreader  = new StreamReader(Path.Combine(path, "m_t0017_sumidagawa_00normal.xml"));

        var musicscore = serializer.Deserialize(xmlreader) as MusicScore;

        //start load sounds
        var wavefiles = Directory.GetFiles(path, "*.wav", SearchOption.TopDirectoryOnly);

        _audioClipDict = new Dictionary <string, AudioClip>();
        foreach (var file in wavefiles)
        {
            using (WWW www = new WWW($"file://{file}"))
            {
                while (!www.isDone)
                {
                }
                var a = www.GetAudioClip(false, false);
                //var filenamearray = Path.GetFileName(file).Split('_');
                //int number = int.Parse(filenamearray[filenamearray.Length - 1]);
                _audioClipDict.Add(Path.GetFileNameWithoutExtension(file), a);
            }
        }

        wavefiles = Directory.GetFiles(Path.Combine(path, "Generic"), "*.wav", SearchOption.AllDirectories);
        foreach (var file in wavefiles)
        {
            using (WWW www = new WWW($"file://{file}"))
            {
                while (!www.isDone)
                {
                }
                var a = www.GetAudioClip(false, false);
                //var filenamearray = Path.GetFileName(file).Split('_');
                //int number = int.Parse(filenamearray[filenamearray.Length - 1]);
                _audioClipDict.Add(Path.GetFileNameWithoutExtension(file), a);
            }
        }
        //end load sounds


        var hiddennote = musicscore.NoteData.Where(q => q.Hand == 2).ToList();

        //var hiddennote = musicscore.NoteData;

        _hiddenSubNotes = new List <MusicScoreSubNote>();

        foreach (var note in hiddennote)
        {
            foreach (var subnote in note.SubNoteData)
            {
                _hiddenSubNotes.Add(subnote);
            }
        }
        _hiddenSubNotes = _hiddenSubNotes.OrderBy(q => q.StartTimingMsec).ToList();
        //处理隐藏音符


        musicscore.NoteData.RemoveAll(q => q.Hand == 2);
        _musicScore = musicscore;
    }
Ejemplo n.º 30
0
        public ActionResult Display(int?id, int md = 1, int pageIndex = 1, int page = 1)
        {
            //const int pageSize = 5;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TempData["Ms_idd"] = id;
            ViewBag.Msid       = id;
            TempData["Ms_id2"] = id;
            MusicScore ms = db.MusicScore.Find(id);
            //MusicScoreStatistics msta = db.MusicScoreStatistics.Find(id);
            var   usid = (from m in db.MusicScore.Where(p => p.Ms_id == id) select m.User_id).FirstOrDefault();
            Users us   = db.Users.Find(usid);

            //MusicScoreStatistics msta = db.MusicScoreStatistics.Find(id);

            if (ms == null && us == null)
            {
                return(HttpNotFound());
            }

            //var us=from m in db.Users.Where(p=>p.User_id==usid) select m;
            var ms1     = (from m in db.MusicScore.Where(p => p.User_id == usid).OrderByDescending(p => p.Ms_addtime) select m).Take(5);
            var msc     = from m in db.MusicScoreComment.Where(p => p.Ms_id == id).OrderByDescending(p => p.Addtime) select m;
            var comment = from m in db.MusicScoreComment
                          join n in db.Users on m.User_id equals n.User_id
                          select new MusicScoreCommentViewModel
            {
                Ms_commentid = m.Ms_commentid,
                Ms_id        = m.Ms_id,
                content      = m.content,
                Addtime      = m.Addtime,
                User_id      = n.User_id,
                User_name    = n.User_name,
                User_img     = n.User_img,
            };
            //var comment1 = .ToPagedList(idd, pageSize);
            var msr = (from n in db.MusicScoreReply
                       join m in msc on n.Ms_commentid equals m.Ms_commentid
                       join q in db.Users on n.User_id equals q.User_id
                       select new MusicCommentReplyViewModel
            {
                Ms_replyid = n.Ms_replyid,
                Ms_commentid = m.Ms_commentid,
                content = n.content,
                Addtime = n.Addtime,
                Ms_id = m.Ms_id,
                User_id = n.User_id,
                User_name = q.User_name,
                User_img = q.User_img
            });
            int commentid = Convert.ToInt32(Request["Commentid1"]);
            var msrr      = from m in db.MusicScoreReply.Where(p => p.Ms_commentid == commentid).OrderByDescending(p => p.Addtime) select m;

            var comment1 = from m in comment.Where(p => p.Ms_id == id).OrderByDescending(p => p.Addtime) select m;
            //var msta = from m in db.MusicScoreStatistics.Where(p => p.Ms_id == id) select m;
            //var msta = from m in db.MusicScoreStatistics where m.Ms_id == id select m;
            //分页数据
            const int pageSize = 5;

            if (Request.IsAjaxRequest())
            {
                var target = Request.QueryString["target"];
                if (target == "articles")
                {
                    return(PartialView("_display1", comment1.ToPagedList(md, pageSize)));
                }
            }
            var index = new Guitar.ViewModel.MusicDetailsViewModel()
            {
                Us      = us,
                MScore  = ms,
                MScore1 = ms1,
                MSC     = msc,
                MSR     = msr,
                Msr     = msrr,
                msc11   = comment1.ToPagedList(page, pageSize),
            };

            //if (Request.IsAjaxRequest())
            //    return PartialView("_PartialPage1", comment.OrderByDescending(a => a.Addtime).ToPagedList(md, 3));
            return(View(index));
        }
Ejemplo n.º 31
0
 private void Clear_Click(object sender, EventArgs e)
 {
     score = new MusicScore();
     CurrentNotes.Items.Clear();
     ScoreName.Text = "";
 }