示例#1
0
        public static int Export( List<string> args )
        {
            if ( args.Count < 2 ) {
                Console.WriteLine( "Usage: db src" );
                return -1;
            }

            string InDatabase = args[0];
            string OutFile = args[1];

            scr s = new scr();
            List<GraceNoteDatabaseEntry> Entries = ReadDatabase( "Data Source=" + InDatabase );

            // init loop stuff
            s.Sections = new List<scrSection>();
            scrSection sec = new scrSection();
            sec.Elements = new List<scrElement>();
            sec.Location = (uint)Entries[0].PointerRef;
            sec.PointerIndex = Entries[0].IdentifyPointerRef;
            int SectionPointerIndex = sec.PointerIndex;

            for ( int i = 0; i < Entries.Count; ++i ) {
                GraceNoteDatabaseEntry e = Entries[i];

                if ( e.IdentifyPointerRef != SectionPointerIndex ) {
                    // reached new section, write old to scr
                    s.Sections.Add( sec );
                    sec = new scrSection();
                    sec.Elements = new List<scrElement>();
                    sec.Location = (uint)e.PointerRef;
                    sec.PointerIndex = e.IdentifyPointerRef;
                    SectionPointerIndex = sec.PointerIndex;
                }

                scrElement screlem = new scrElement();

                switch ( e.IdentifyString ) {
                    case "Code":
                        screlem.Type = scrElement.scrElementType.Code;
                        screlem.Code = CodeStringToArray( e.TextEN );
                        break;
                    case "Text":
                        screlem.Type = scrElement.scrElementType.Text;
                        screlem.Text = e.TextEN;
                        break;
                    default: throw new Exception( "scrExport: Unknown IdentifyString type!" );
                }

                sec.Elements.Add( screlem );
            }
            s.Sections.Add( sec );

            s.CreateFile( OutFile );

            return 0;
        }
示例#2
0
 void hurtBox()
 {
     //Check all colliders hit
     Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, hurtSize);
     if (colliders.Length > 1)
     {
         for (int i = 0; i < colliders.Length; i++)
         {
             //Skip ownCircle
             if (colliders[i] != ownCircle)
             {
                 //Get information from objects about what is touching it
                 scr thisObject = colliders[i].gameObject.GetComponent <scr>();
                 hitState = thisObject.activeState;
             }
         }
     }
     else
     {
         hitState = (int)State.None;
     }
 }
示例#3
0
        public static int Export(List <string> args)
        {
            if (args.Count < 2)
            {
                Console.WriteLine("Usage: db src");
                return(-1);
            }

            string InDatabase = args[0];
            string OutFile    = args[1];

            scr s = new scr();
            List <GraceNoteDatabaseEntry> Entries = ReadDatabase("Data Source=" + InDatabase);

            // init loop stuff
            s.Sections = new List <scrSection>();
            scrSection sec = new scrSection();

            sec.Elements     = new List <scrElement>();
            sec.Location     = (uint)Entries[0].PointerRef;
            sec.PointerIndex = Entries[0].IdentifyPointerRef;
            int SectionPointerIndex = sec.PointerIndex;

            for (int i = 0; i < Entries.Count; ++i)
            {
                GraceNoteDatabaseEntry e = Entries[i];

                if (e.IdentifyPointerRef != SectionPointerIndex)
                {
                    // reached new section, write old to scr
                    s.Sections.Add(sec);
                    sec                 = new scrSection();
                    sec.Elements        = new List <scrElement>();
                    sec.Location        = (uint)e.PointerRef;
                    sec.PointerIndex    = e.IdentifyPointerRef;
                    SectionPointerIndex = sec.PointerIndex;
                }

                scrElement screlem = new scrElement();

                switch (e.IdentifyString)
                {
                case "Code":
                    screlem.Type = scrElement.scrElementType.Code;
                    screlem.Code = CodeStringToArray(e.TextEN);
                    break;

                case "Text":
                    screlem.Type = scrElement.scrElementType.Text;
                    screlem.Text = e.TextEN;
                    break;

                default: throw new Exception("scrExport: Unknown IdentifyString type!");
                }

                sec.Elements.Add(screlem);
            }
            s.Sections.Add(sec);

            s.CreateFile(OutFile);

            return(0);
        }