Exemplo n.º 1
0
        public void ReadValidArcFile(string validArcFile)
        {
            if (validArcFile == this.validArcFile)
            {
                return;
            }
            Debug.Log("New valid arc file: " + validArcFile);
            this.validArcFile = validArcFile;

            List <List <int> > rawValidArcs;
            string             actualPath = Path.Combine(Application.dataPath, "StreamingAssets", "Editor", validArcFile);

            using (StreamReader r = new StreamReader(actualPath))
            {
                string json = r.ReadToEnd();
                rawValidArcs = JsonConvert.DeserializeObject <List <List <int> > >(json);
            }

            int count = 0;
            List <ListOfFrames> items = new List <ListOfFrames>();

            foreach (List <int> item in rawValidArcs)
            {
                ListOfFrames validArcsInView = new ListOfFrames();
                validArcsInView.frames = item;
                items.Add(validArcsInView);
                count++;
            }
            validArcs = items;
        }
Exemplo n.º 2
0
        public void ReadAllArcsFile(string newAllArcsFile)
        {
            if (newAllArcsFile == this.allArcsFile)
            {
                return;
            }
            Debug.Log("New all arcs file: " + newAllArcsFile);

            List <List <int> > rawData;
            string             actualPath = Path.Combine(Application.dataPath, "StreamingAssets", "Editor", newAllArcsFile);

            using (StreamReader r = new StreamReader(actualPath))
            {
                string json = r.ReadToEnd();
                rawData = JsonConvert.DeserializeObject <List <List <int> > >(json);
            }

            int count = 0;
            List <ListOfFrames> items = new List <ListOfFrames>();

            foreach (List <int> item in rawData)
            {
                ListOfFrames cutFrame = new ListOfFrames();
                cutFrame.frames = item;
                items.Add(cutFrame);
                count++;
            }
            allArcs          = items;
            this.allArcsFile = newAllArcsFile;
        }
Exemplo n.º 3
0
        public int FindJumpToFrame(int view_num, int frame_num)
        {
            ListOfFrames cutFrames  = cut[view_num];
            int          index      = cutFrames.frames.FindIndex(x => x == frame_num);
            int          validFrame = validArcs[view_num].frames[index];

            //Debug.Log("Cut Frames in " + view_num + ": " + string.Join(",", cutFrames.frames));
            //Debug.Log("Current frame is : " + frame_num + ". Index: " + index + ". Valid frame: " + validFrame);
            return(validFrame);
        }
Exemplo n.º 4
0
        public bool PastLastCutFrame(int view_num, int frame_num)
        {
            if (cut.Count == 0)
            {
                return(false);
            }
            ListOfFrames cutFrames = cut[view_num];

            return(frame_num > cutFrames.frames.Max());
        }
Exemplo n.º 5
0
        public bool ReachedCutFrame(int view_num, int frame_num)
        {
            if (cut.Count == 0)
            {
                return(false);
            }
            ListOfFrames cutFrames = cut[view_num];

            return(cutFrames.frames.Contains(frame_num));
        }
Exemplo n.º 6
0
        public void ReadCutFile(string cutFile)
        {
            if (cutFile == this.cutFile)
            {
                return;
            }
            Debug.Log("New cut file: " + cutFile);
            this.cutFile = cutFile;

            List <List <int> > rawCut;
            string             actualPath = Path.Combine(Application.dataPath, "StreamingAssets", "Editor", cutFile);

            using (StreamReader r = new StreamReader(actualPath))
            {
                string json = r.ReadToEnd();
                rawCut = JsonConvert.DeserializeObject <List <List <int> > >(json);
            }

            int count = 0;
            List <ListOfFrames> items = new List <ListOfFrames>();

            foreach (List <int> item in rawCut)
            {
                ListOfFrames cutFrame = new ListOfFrames();
                cutFrame.frames = item;
                items.Add(cutFrame);
                count++;
            }
            cut = items;

            // Condense cut frames into blocks (for efficient rendering on timeline).
            cutFrameBlocks = new BlockFrames[items.Count];
            for (int v = 0; v < items.Count; v++)
            {
                ComputeCutTimeBlocks(v);
            }
        }
Exemplo n.º 7
0
        public int FindLastCutFrame(int face_num)
        {
            ListOfFrames cutFrames = cut[face_num];

            return(cutFrames.frames.Max());
        }