Exemplo n.º 1
0
    public static void Push(NotesPlan plan)
    {
        int  index = -1;
        long delay = 0;
        int  depth = 0;

        while (true)
        {
            for (int i = 0; i < bundleWidth; i++)
            {
                if (bundle[i].Count <= depth)
                {
                    bundle[i].Insert(depth, plan);
                    return;
                }
                if (bundle[i][depth].time > plan.time)
                {
                    if (delay < bundle[i][depth].time - plan.time)
                    {
                        index = i;
                        delay = bundle[i][depth].time - plan.time;
                    }
                }
            }
            if (index != -1)
            {
                bundle[index].Insert(depth, plan);
                return;
            }
            index = -1;
            delay = 0;
            depth++;
        }
    }
Exemplo n.º 2
0
    public static void Schedule(string type, Json json)
    {
        float notesHeight = 0.0f, notesWidth = 0.0f;
        float lane  = json.lane;
        long  time  = json.time;
        float speed = PlayMgr.defaultSpeed * json.speed;

        if (type == "Circle")
        {
            notesWidth  = PlayMgr.circleWidth;
            notesHeight = PlayMgr.circleHeight;
        }
        else if (type == "Rectangle")
        {
            notesWidth  = PlayMgr.rectangleWidth;
            notesHeight = PlayMgr.rectangleHeight;
        }

        float yi         = PlayMgr.max.y + 0.5f * notesHeight;
        float yj         = yi - PlayMgr.judgeY;
        float yf         = 2.0f * notesHeight + PlayMgr.height;
        float xi         = (lane - 1.5f) * PlayMgr.laneWidth;
        long  createTime = time - (long)(yj / speed * 1000.0f);

        Debug.Log(createTime);
        NotesPlan plan = new NotesPlan(notesType: type, x: xi, y: yi, length: json.length, speed: speed, time: createTime, id: json.id);

        QueueBundle.Push(plan);
    }
Exemplo n.º 3
0
 public static void AddCircle(NotesPlan plan)
 {
     PlayMgr.context.Post(__ => {
         Notes notes = Notes.Add(plan.x, plan.y, plan.notesType);
         notesDict.Add(plan.id, notes);
         notes.setId(plan.id);
         notes.setSpeed(plan.speed);
     }, null);
 }
Exemplo n.º 4
0
 public static void AddFoot(NotesPlan plan)
 {
     PlayMgr.context.Post(__ => {
         FootNotes notes = FootNotes.Add(plan.x, plan.y, plan.notesType);
         footNotesDict.Add(plan.id, notes);
         notes.setLength(plan.length);
         notes.setId(plan.id);
         notes.setSpeed(plan.speed);
     }, null);
 }