Exemplo n.º 1
0
    public static void parse(string filepath, dbLog log)
    {
        Debug.Log("#########   " + filepath);
        if (File.Exists(filepath))
        {
            StreamReader file = new StreamReader(filepath);
            string       line = file.ReadLine();

            int lineNum = 1;

            while (line != null)
            {
                line = line.Trim();
                if (line.IndexOf("#") != 0 && line.Length > 1)
                {
                    ConfigOverrides.set_keyvalue(line, "Line: " + lineNum, log);
                }
                line = file.ReadLine();
                lineNum++;
            }
        }
    }
Exemplo n.º 2
0
    void updatePlayback()
    {
        long last_now = now;
        long tick     = DateTime.Now.Ticks;

        now = tick / TimeSpan.TicksPerMillisecond;

        if (Input.GetButtonDown("PlayPause"))
        {
            pause = !pause;
            hud.flashStatus("Playback Paused");
        }

        if (pause)
        {
            playback_offset -= now - last_now;
        }

        float seek = Input.GetAxis("Horizontal");

        //if (seek != 0.0) {
        if (Input.GetButton("Horizontal"))
        {
            playback_offset += 250;            // * Convert.ToInt64(seek);
        }
        playback_time     = now - playback_start + playback_offset;
        hud.playback_time = playback_time;

        string[] vec;
        Vector3  vec3;

        while ((!pause || (seek != 0.0)) && !done && dblog.PlaybackTime() <= playback_time)
        {
//					 Debug.Log(dblog.PlaybackTime() + " : " + playback_time);
            Debug.Log(next_action[2]);


            //try {
            if (next_action[2] == "AVATAR_HPR" || next_action[2] == "AVATAR_POS" || next_action[2] == "AVATAR_STOP")
            {
                vec  = next_action[3].Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                vec3 = new Vector3(float.Parse(vec[0]), float.Parse(vec[1]), +float.Parse(vec[2]));
                Type t = typeof(AvatarController);
                t.InvokeMember(next_action[2], BindingFlags.Default | BindingFlags.InvokeMethod, null, avatarController, new System.Object[] { vec3 });
            }
            else if (next_action[2] == "TASK_ROTATE" || next_action[2] == "TASK_POSITION" || next_action[2] == "TASK_SCALE")
            {
                vec  = next_action[5].Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                vec3 = new Vector3(float.Parse(vec[0]), float.Parse(vec[1]), +float.Parse(vec[2]));

                GameObject taskObject = GameObject.Find(next_action[3]);
                Component  script     = taskObject.GetComponent(next_action[4]) as Component;
                //Type t = typeof(AvatarController);
                this.GetType().InvokeMember(next_action[2], BindingFlags.Default | BindingFlags.InvokeMethod, null, this, new System.Object[] { taskObject, vec3 });
            }
            else if (next_action[2] == "TASK_ADD")
            {
                GameObject taskObject = GameObject.Find(next_action[3]);
                Component  script     = taskObject.GetComponent(next_action[4]) as Component;
                //Type t = typeof(AvatarController);
                GameObject secondObject = GameObject.Find(next_action[5]);
                script.GetType().InvokeMember(next_action[2], BindingFlags.Default | BindingFlags.InvokeMethod, null, script, new System.Object[] { secondObject, next_action[6] });
            }
            else if (next_action[2] == "INPUT_EVENT")
            {
                hud.flashStatus("Input: " + next_action[3] + " " + next_action[4]);
            }
            else if (next_action[2] == "SET_SCORE")
            {
                hud.setScore(int.Parse(next_action[3]));
            }
            else if (next_action[2] == "INFO")
            {
                //skip
            }
            else if (next_action[2] == "DATA")
            {
                //skip
            }
            else if (next_action[2] == "BOOKMARK")
            {
                //skip
            }
            else if (next_action[2] == "CONFIG_SET")
            {
                //Debug.Log("CONFIG_SET" );
                ConfigOverrides.set_keyvalue(next_action[3] + "=" + next_action[4], "Config: ", dblog);
            }
            else
            {
                //	Debug.Log("else" );
                GameObject taskObject = GameObject.Find(next_action[3]);
                Component  script     = taskObject.GetComponent(next_action[4]) as Component;

                //Type t = typeof(AvatarController);
                script.GetType().InvokeMember(next_action[2], BindingFlags.Default | BindingFlags.InvokeMethod, null, script, null);
            }

            //	} catch (FormatException){
            //	} catch (IndexOutOfRangeException){ }

            next_action = dblog.NextAction();
            if (next_action == null)
            {
                hud.setMessage("Playback Done");
                done = true;
            }
        }
    }